loki-mode 11.141.0 → 11.141.1

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 (69) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/dashboard/__init__.py +1 -1
  4. package/docs/CLI-REFERENCE.md +1 -1
  5. package/docs/INSTALLATION.md +1 -1
  6. package/docs/dev/architecture-reference.md +1 -0
  7. package/docs/dev/release-checklist.md +2 -0
  8. package/loki-ts/dist/loki.js +1699 -1698
  9. package/mcp/__init__.py +1 -1
  10. package/package.json +2 -2
  11. package/packages/control-plane/dist/server.js +240 -101
  12. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  13. package/web-app/dist/assets/{AdminPage-Ch63nqJJ.js → AdminPage-CyrZ0lVQ.js} +1 -1
  14. package/web-app/dist/assets/{Avatar-BGzv9D9p.js → Avatar-HVsqbJDy.js} +1 -1
  15. package/web-app/dist/assets/{Badge-Dp6PH-Rw.js → Badge-Cl4d3UiW.js} +1 -1
  16. package/web-app/dist/assets/{Button-U4RqOlar.js → Button-DK96_8fz.js} +1 -1
  17. package/web-app/dist/assets/{CockpitPage-CGxfadSz.js → CockpitPage-trGqUQG8.js} +1 -1
  18. package/web-app/dist/assets/{ComparePage-ANl5ioFg.js → ComparePage-DAH2WKoS.js} +1 -1
  19. package/web-app/dist/assets/{ErrorBoundary-D_sHZ8fh.js → ErrorBoundary-YLMvxCBX.js} +1 -1
  20. package/web-app/dist/assets/{EvidenceReceiptPanel-BcMt4wR9.js → EvidenceReceiptPanel-ChbaWlfG.js} +1 -1
  21. package/web-app/dist/assets/{GitHubIssuesPanel-Cw7ijm9K.js → GitHubIssuesPanel-Cy-a21mI.js} +1 -1
  22. package/web-app/dist/assets/{GitHubPRsPanel-iAm1wnrJ.js → GitHubPRsPanel-DZxyuRJn.js} +1 -1
  23. package/web-app/dist/assets/{HomePage-Bmrnuvm2.js → HomePage-CitCe7Hp.js} +2 -2
  24. package/web-app/dist/assets/{LoginPage-BL_08imZ.js → LoginPage-D77qV6GG.js} +1 -1
  25. package/web-app/dist/assets/{MagicPage-96Omf7fs.js → MagicPage-ls3_mi0r.js} +1 -1
  26. package/web-app/dist/assets/{MetricsPage-setocK5A.js → MetricsPage-BRiWJxwM.js} +1 -1
  27. package/web-app/dist/assets/{NotFoundPage-BxZbHqCx.js → NotFoundPage-zg2L2XVX.js} +1 -1
  28. package/web-app/dist/assets/{ProjectPage-CaCNqPhA.js → ProjectPage-CZzWE-4p.js} +3 -3
  29. package/web-app/dist/assets/{ProjectsPage-BGhsKcnW.js → ProjectsPage-VUcvC0NC.js} +1 -1
  30. package/web-app/dist/assets/{SettingsPage-BaPtARmq.js → SettingsPage-CHVQJ19x.js} +1 -1
  31. package/web-app/dist/assets/{ShowcasePage-DootX_Rv.js → ShowcasePage-Bg6grTXX.js} +1 -1
  32. package/web-app/dist/assets/{SystemSettingsPage-CwDb3rVs.js → SystemSettingsPage-DsRZ0-xE.js} +1 -1
  33. package/web-app/dist/assets/{TeamsPage-BYl3e9Td.js → TeamsPage-CaTemCxx.js} +1 -1
  34. package/web-app/dist/assets/{TemplatesPage-D8de7dvp.js → TemplatesPage-BhaJA7pC.js} +1 -1
  35. package/web-app/dist/assets/{TerminalOutput-DKVZg6SO.js → TerminalOutput-BfOkrKSl.js} +1 -1
  36. package/web-app/dist/assets/{activity-DIQUumgD.js → activity-DbQIWo1H.js} +1 -1
  37. package/web-app/dist/assets/{bell-D7tbnhAM.js → bell-BIxiZZLC.js} +1 -1
  38. package/web-app/dist/assets/{bot-DO96ra4B.js → bot-B29JFAKe.js} +1 -1
  39. package/web-app/dist/assets/{check-9lM1wqXN.js → check-eFrYlRX2.js} +1 -1
  40. package/web-app/dist/assets/{chevron-left-DjmTGuYx.js → chevron-left-B8Y6dg5E.js} +1 -1
  41. package/web-app/dist/assets/{circle-alert-DNn4HgtD.js → circle-alert-DBBzGsvI.js} +1 -1
  42. package/web-app/dist/assets/{clock-DtdNA2ZI.js → clock-Dq4VdmRL.js} +1 -1
  43. package/web-app/dist/assets/{cloud-CDpRR5WU.js → cloud-By5Dz28l.js} +1 -1
  44. package/web-app/dist/assets/{code-xml-DrvYNTKD.js → code-xml-BuxW3PKD.js} +1 -1
  45. package/web-app/dist/assets/{database-ClSkFKKo.js → database-8yPYngba.js} +1 -1
  46. package/web-app/dist/assets/{dollar-sign-CJQBvVmF.js → dollar-sign-CnMURBiL.js} +1 -1
  47. package/web-app/dist/assets/{file-code-corner-Den6jX10.js → file-code-corner-DvauxYVA.js} +1 -1
  48. package/web-app/dist/assets/{file-plus-BJyVsMto.js → file-plus-BRtK7xDy.js} +1 -1
  49. package/web-app/dist/assets/{globe-BZY0lJXN.js → globe-DSzvEwzA.js} +1 -1
  50. package/web-app/dist/assets/{hammer-BJ0w6IT1.js → hammer-C-0bgkhm.js} +1 -1
  51. package/web-app/dist/assets/{index-BxSDD_tX.js → index-XQ-bFGQE.js} +3 -3
  52. package/web-app/dist/assets/{layers-Dc6o3GdS.js → layers-CHtZrk_M.js} +1 -1
  53. package/web-app/dist/assets/{loader-circle-OsOqcdhx.js → loader-circle-DDIRImbs.js} +1 -1
  54. package/web-app/dist/assets/{lock-B4xqbuIy.js → lock-DMYEb6iD.js} +1 -1
  55. package/web-app/dist/assets/{package-BNbqKwa5.js → package-Vh6ODRFi.js} +1 -1
  56. package/web-app/dist/assets/{plus-BoYko36-.js → plus-DdbM86Sk.js} +1 -1
  57. package/web-app/dist/assets/{refresh-cw-BhJav8DJ.js → refresh-cw-DN7fyy51.js} +1 -1
  58. package/web-app/dist/assets/{rotate-ccw-BH5S5eq1.js → rotate-ccw-_LiXn4f3.js} +1 -1
  59. package/web-app/dist/assets/{scroll-text-C5q727c8.js → scroll-text-iOYkzHRL.js} +1 -1
  60. package/web-app/dist/assets/{server-LNJjx00G.js → server-C4fDFqum.js} +1 -1
  61. package/web-app/dist/assets/{shield-alert-DtgIuz_o.js → shield-alert-BrlFKF10.js} +1 -1
  62. package/web-app/dist/assets/{thumbs-up-Dcfjdt3W.js → thumbs-up-CELA6jYM.js} +1 -1
  63. package/web-app/dist/assets/{trash-2-bY_78mmT.js → trash-2-BFh0_4hy.js} +1 -1
  64. package/web-app/dist/assets/{trending-down-C7FrGcbH.js → trending-down-BuhHSUh0.js} +1 -1
  65. package/web-app/dist/assets/{trending-up-Dnm4K3Su.js → trending-up-DdM35X0R.js} +1 -1
  66. package/web-app/dist/assets/{upload-D8GMaF6v.js → upload-CylWmA1t.js} +1 -1
  67. package/web-app/dist/assets/{usePolling-CTqmDKPs.js → usePolling-BS-LpZFV.js} +1 -1
  68. package/web-app/dist/assets/{user-BTGxiVtl.js → user-BqgsBztl.js} +1 -1
  69. package/web-app/dist/index.html +1 -1
@@ -29086,9 +29086,65 @@ var init_pr_body = __esm(() => {
29086
29086
 
29087
29087
  // ../../loki-ts/src/util/mutation_proof.ts
29088
29088
  import { execFileSync as execFileSync8, spawnSync as spawnSync9 } from "child_process";
29089
- import { existsSync as existsSync55, mkdirSync as mkdirSync36, mkdtempSync as mkdtempSync12, readFileSync as readFileSync76, rmSync as rmSync25, symlinkSync as symlinkSync3, writeFileSync as writeFileSync39 } from "fs";
29089
+ import { existsSync as existsSync55, mkdirSync as mkdirSync36, mkdtempSync as mkdtempSync12, readdirSync as readdirSync32, readFileSync as readFileSync76, realpathSync as realpathSync28, rmSync as rmSync25, symlinkSync as symlinkSync3, writeFileSync as writeFileSync39 } from "fs";
29090
29090
  import { tmpdir as tmpdir16 } from "os";
29091
- import { dirname as dirname36, isAbsolute as isAbsolute14, join as join88, relative as relative16 } from "path";
29091
+ import { delimiter as delimiter4, dirname as dirname36, isAbsolute as isAbsolute14, join as join88, relative as relative16 } from "path";
29092
+ function editableBaseEnv(repoDir, wt, venvs, env = process.env) {
29093
+ const roots = new Set([repoDir]);
29094
+ try {
29095
+ roots.add(realpathSync28(repoDir));
29096
+ } catch {}
29097
+ for (const r of [...roots])
29098
+ roots.add(r.startsWith("/private/") ? r.slice("/private".length) : `/private${r}`);
29099
+ const mapped = [], add3 = (p) => {
29100
+ for (const r of roots)
29101
+ if (p === r || p.startsWith(`${r}/`)) {
29102
+ const m = join88(wt, relative16(r, p));
29103
+ if (existsSync55(m) && !mapped.includes(m))
29104
+ mapped.push(m);
29105
+ return;
29106
+ }
29107
+ };
29108
+ for (const v of venvs) {
29109
+ let libs = [];
29110
+ try {
29111
+ libs = readdirSync32(join88(v, "lib")).filter((n3) => n3.startsWith("python")).map((n3) => join88(v, "lib", n3, "site-packages"));
29112
+ } catch {}
29113
+ for (const sp of [...libs, join88(v, "Lib", "site-packages")]) {
29114
+ let names = [];
29115
+ try {
29116
+ names = readdirSync32(sp);
29117
+ } catch {
29118
+ continue;
29119
+ }
29120
+ for (const n3 of names) {
29121
+ const pth = n3.endsWith(".pth"), finder = /^__editable__.*\.py$/.test(n3);
29122
+ if (!pth && !finder)
29123
+ continue;
29124
+ let text3 = "";
29125
+ try {
29126
+ text3 = readFileSync76(join88(sp, n3), "utf8");
29127
+ } catch {
29128
+ continue;
29129
+ }
29130
+ if (pth)
29131
+ for (const l of text3.split(`
29132
+ `)) {
29133
+ const t = l.trim();
29134
+ if (isAbsolute14(t))
29135
+ add3(t);
29136
+ }
29137
+ else
29138
+ for (const m of text3.matchAll(/["']((?:\/|[A-Za-z]:\\)[^"'\n]+)["']/g))
29139
+ add3(dirname36(m[1]));
29140
+ }
29141
+ }
29142
+ }
29143
+ if (!mapped.length)
29144
+ return {};
29145
+ const prev = (env["PYTHONPATH"] ?? "").trim();
29146
+ return { PYTHONPATH: [...mapped, ...prev ? [prev] : []].join(delimiter4) };
29147
+ }
29092
29148
  function proofBudgetS(tests, env = process.env, timeoutS) {
29093
29149
  const explicit = timeoutS ?? (env["LOKI_MUTATION_PROOF_TIMEOUT_S"] !== undefined ? envTimeoutS(env["LOKI_MUTATION_PROOF_TIMEOUT_S"]) : undefined);
29094
29150
  return Math.min(explicit ?? (compiledBudgetOn(env) && tests.some((t) => COMPILED_RUNNERS.has(t.runner)) ? MAX_TOTAL_S : envTimeoutS(undefined)), MAX_TOTAL_S);
@@ -29143,6 +29199,7 @@ async function mutationProof(i) {
29143
29199
  }
29144
29200
  return true;
29145
29201
  };
29202
+ const venvs = [];
29146
29203
  for (const rel of rels) {
29147
29204
  const parts = rel.split("/").slice(0, -1);
29148
29205
  for (let n3 = 0;n3 <= parts.length; n3++) {
@@ -29152,11 +29209,14 @@ async function mutationProof(i) {
29152
29209
  if (existsSync55(src) && !existsSync55(dst)) {
29153
29210
  try {
29154
29211
  symlinkSync3(src, dst);
29212
+ if (d !== "node_modules")
29213
+ venvs.push(src);
29155
29214
  } catch {}
29156
29215
  }
29157
29216
  }
29158
29217
  }
29159
29218
  }
29219
+ const baseEnv = editableBaseEnv(i.repoDir, wt, venvs, i.env ?? process.env), envd = (r) => r.withEnv && Object.keys(baseEnv).length ? r.withEnv(baseEnv) : r;
29160
29220
  if (compiled)
29161
29221
  warmGoBuild(wt, tests, remaining);
29162
29222
  let active = tests;
@@ -29166,7 +29226,7 @@ async function mutationProof(i) {
29166
29226
  if (pre.length > 0) {
29167
29227
  if (remaining() <= 0)
29168
29228
  return np("timeout");
29169
- const pr = pre.map((t) => remaining() <= 0 ? null : (typeof i.runner === "function" ? i.runner(remaining()) : i.runner).run(wt, [t]));
29229
+ const pr = pre.map((t) => remaining() <= 0 ? null : envd(typeof i.runner === "function" ? i.runner(remaining()) : i.runner).run(wt, [t]));
29170
29230
  if (pr.some((r) => !r))
29171
29231
  return np("timeout");
29172
29232
  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));
@@ -29200,7 +29260,7 @@ async function mutationProof(i) {
29200
29260
  let pass = 0, fail2 = 0, notRun = 0;
29201
29261
  if (remaining() <= 0)
29202
29262
  return np("timeout");
29203
- const mk2 = () => typeof i.runner === "function" ? i.runner(remaining()) : i.runner, jobs = envJobs((i.env ?? process.env)["LOKI_MUTATION_PROOF_JOBS"]), first = mk2();
29263
+ const mk2 = () => envd(typeof i.runner === "function" ? i.runner(remaining()) : i.runner), jobs = envJobs((i.env ?? process.env)["LOKI_MUTATION_PROOF_JOBS"]), first = mk2();
29204
29264
  const par = jobs > 1 && active.length > 1 && first.runEach !== undefined;
29205
29265
  const rs = par ? await first.runEach(wt, active, jobs, false, remaining) : active.map((t) => remaining() <= 0 ? null : mk2().run(wt, [t]));
29206
29266
  if (rs.some((r) => !r))
@@ -29551,6 +29611,60 @@ function settleItems(before, after, reply) {
29551
29611
  return s && s.verdict === "justified" && s.reason ? { item: b.item, status: "justified", detail: `${b.detail}; reviewer: ${s.reason}` } : { item: b.item, status: after ? "unresolved" : "flagged", detail: b.detail };
29552
29612
  });
29553
29613
  }
29614
+ function turnChangedPaths(pre, post) {
29615
+ const a = new Map(pre.map((e) => [e.path, e])), b = new Map(post.map((e) => [e.path, e]));
29616
+ return [...new Set([...a.keys(), ...b.keys()])].filter((p) => !sameEntry(a.get(p), b.get(p))).sort();
29617
+ }
29618
+ function restoreTurnPaths(root, base, snap, paths) {
29619
+ const by = new Map(snap.map((e) => [e.path, e])), write = [], fromBase = [];
29620
+ for (const p of paths) {
29621
+ const e = by.get(p);
29622
+ if (e)
29623
+ write.push(e);
29624
+ else {
29625
+ let inBase = false;
29626
+ try {
29627
+ safeGit(root, ["cat-file", "-e", `${base}:${p}`]);
29628
+ inBase = true;
29629
+ } catch {}
29630
+ if (inBase)
29631
+ fromBase.push(p);
29632
+ else
29633
+ write.push({ path: p, kind: "delete" });
29634
+ }
29635
+ }
29636
+ applyDiff(root, write);
29637
+ if (fromBase.length)
29638
+ safeGit(root, ["--literal-pathspecs", "checkout", base, "--", ...fromBase]);
29639
+ }
29640
+ async function guardReviewTurn(root, base, pre, pick, run2) {
29641
+ const post = snapshotDiff(root, base), paths = turnChangedPaths(pre, post);
29642
+ if (!paths.length)
29643
+ return null;
29644
+ const ran = [], failing = [];
29645
+ for (const t of pick(paths)) {
29646
+ const r = await run2(t);
29647
+ ran.push(`${t.path}=${r}`);
29648
+ if (r === "fail")
29649
+ failing.push(t);
29650
+ }
29651
+ if (!failing.length)
29652
+ return { paths, ran, broke: [], reverted: false };
29653
+ restoreTurnPaths(root, base, pre, paths);
29654
+ const broke = [];
29655
+ for (const t of failing) {
29656
+ if (!existsSync56(join89(root, t.path)))
29657
+ continue;
29658
+ const r = await run2(t);
29659
+ ran.push(`${t.path}=${r} without the turn`);
29660
+ if (r === "pass")
29661
+ broke.push(t.path);
29662
+ }
29663
+ if (broke.length)
29664
+ return { paths, ran, broke, reverted: true };
29665
+ restoreTurnPaths(root, base, post, paths);
29666
+ return { paths, ran, broke: [], reverted: false };
29667
+ }
29554
29668
  function stripInventedReleaseRefs(repoDir, baseSha, staged, task, env = process.env) {
29555
29669
  const conv2 = (() => {
29556
29670
  try {
@@ -29629,12 +29743,13 @@ var TEST_DIR3, TEST_NAME2, isTestFile3 = (f) => isTestFile(f) || TEST_DIR3.test(
29629
29743
  } catch {
29630
29744
  return 0;
29631
29745
  }
29632
- }, SIB_SKIP, S = "[[:space:]]", DEF_RE, selfReviewWanted = (items, mode) => mode === "always" || mode === "on" && items.some((i) => i.status === "flagged"), LABEL2, KEY_OF, selfReviewReceiptBlock = (implement) => implement && implement["self_review"] ? { self_review: implement["self_review"] } : {}, releaseRefsReceiptBlock = (implement) => Array.isArray(implement?.["changelog_refs_removed"]) && implement["changelog_refs_removed"].length ? { changelog_refs_removed: implement["changelog_refs_removed"] } : {};
29746
+ }, SIB_SKIP, S = "[[:space:]]", DEF_RE, selfReviewWanted = (items, mode) => mode === "always" || mode === "on" && items.some((i) => i.status === "flagged"), LABEL2, KEY_OF, selfReviewReceiptBlock = (implement) => implement && implement["self_review"] ? { self_review: implement["self_review"] } : {}, reviewTurnGuardOn = (env = process.env) => /^(1|on|true|yes)$/i.test((env["LOKI_E10_REVIEW_TURN_GUARD"] ?? "").trim()), sameEntry = (a, b) => !a || !b ? a === b : a.kind === b.kind && a.mode === b.mode && a.symlinkTarget === b.symlinkTarget && (a.content && b.content ? a.content.equals(b.content) : a.content === b.content), turnGuardNote = (g) => g?.reverted ? [`review turn reverted: ${g.broke.join(", ")} passed before the turn and failed after it; the turn's edits to ${g.paths.join(", ")} were taken back and the pre-turn diff kept`] : [], releaseRefsReceiptBlock = (implement) => Array.isArray(implement?.["changelog_refs_removed"]) && implement["changelog_refs_removed"].length ? { changelog_refs_removed: implement["changelog_refs_removed"] } : {};
29633
29747
  var init_self_review = __esm(() => {
29634
29748
  init_commit_filter();
29635
29749
  init_scope2();
29636
29750
  init_conventions();
29637
29751
  init_repo_profile();
29752
+ init_treeswap();
29638
29753
  init_safe_git();
29639
29754
  init_test_file_text();
29640
29755
  TEST_DIR3 = /(?:^|\/)(?:tests?|__tests__|specs?|testing|[a-z]*Test)\//;
@@ -30762,7 +30877,7 @@ class TestName(unittest.TestCase):
30762
30877
 
30763
30878
  // ../../loki-ts/src/util/wall_cases.ts
30764
30879
  import { spawnSync as spawnSync10 } from "child_process";
30765
- import { existsSync as existsSync57, readFileSync as readFileSync79, readdirSync as readdirSync32, renameSync as renameSync18, rmSync as rmSync26, writeFileSync as writeFileSync41 } from "fs";
30880
+ import { existsSync as existsSync57, readFileSync as readFileSync79, readdirSync as readdirSync33, renameSync as renameSync18, rmSync as rmSync26, writeFileSync as writeFileSync41 } from "fs";
30766
30881
  import { join as join91, relative as relative17, sep as sep18 } from "path";
30767
30882
  function wallCasesRunner(runners, env = process.env) {
30768
30883
  if (!wallCasesEnabled(env) || runners.length === 0 || runners.some((r) => guessRunner("x.py", [r]) !== r))
@@ -30891,7 +31006,7 @@ function isTextFile(p) {
30891
31006
  }
30892
31007
  }
30893
31008
  function hoistNestedWall(cwd, runners, dir = cwd) {
30894
- for (const e of readdirSync32(dir, { withFileTypes: true })) {
31009
+ for (const e of readdirSync33(dir, { withFileTypes: true })) {
30895
31010
  const p = join91(dir, e.name), wall = e.name.startsWith("loki_wall_");
30896
31011
  if (e.isDirectory()) {
30897
31012
  if (e.name.startsWith(".") || e.name === "__pycache__" || DEP_DIRS.includes(e.name))
@@ -30912,7 +31027,7 @@ function ingestWallCases(cwd, runners, repoDir, env = process.env) {
30912
31027
  hoistNestedWall(cwd, runners);
30913
31028
  return null;
30914
31029
  }
30915
- const stray = readdirSync32(cwd).filter((f) => f.startsWith("loki_wall_") && f !== WALL_CASES_JSON);
31030
+ const stray = readdirSync33(cwd).filter((f) => f.startsWith("loki_wall_") && f !== WALL_CASES_JSON);
30916
31031
  if (stray.length > 0)
30917
31032
  return `wall_cases_free_form_output: the author wrote ${stray.join(", ")} instead of ${WALL_CASES_JSON}`;
30918
31033
  const src = join91(cwd, WALL_CASES_JSON);
@@ -31063,7 +31178,7 @@ __export(exports_wall, {
31063
31178
  RealBaseTestRunner: () => RealBaseTestRunner,
31064
31179
  BASE_RUN_TIMEOUT_MS: () => BASE_RUN_TIMEOUT_MS
31065
31180
  });
31066
- import { existsSync as existsSync58, mkdirSync as mkdirSync38, mkdtempSync as mkdtempSync13, readFileSync as readFileSync80, readdirSync as readdirSync33, rmSync as rmSync27, writeFileSync as writeFileSync42 } from "fs";
31181
+ import { existsSync as existsSync58, mkdirSync as mkdirSync38, mkdtempSync as mkdtempSync13, readFileSync as readFileSync80, readdirSync as readdirSync34, rmSync as rmSync27, writeFileSync as writeFileSync42 } from "fs";
31067
31182
  import { tmpdir as tmpdir17 } from "os";
31068
31183
  import { basename as basename30, dirname as dirname39, join as join92, relative as relative18 } from "path";
31069
31184
 
@@ -31081,6 +31196,9 @@ class RealBaseTestRunner {
31081
31196
  this.trustSystem = trustSystem;
31082
31197
  this.reported = reported;
31083
31198
  }
31199
+ withEnv(env) {
31200
+ return new RealBaseTestRunner(this.api, this.timeoutMs, { ...this.extraEnv, ...env }, this.trustSystem, this.reported);
31201
+ }
31084
31202
  run(repoDir, files) {
31085
31203
  this.lastNotRunFiles = [];
31086
31204
  let pass = 0, fail2 = 0, not_run = 0, assertFail = 0;
@@ -31252,14 +31370,14 @@ ${retry.note}` : ""),
31252
31370
  }
31253
31371
  const planText = typeof prior.plan?.plan === "string" ? prior.plan.plan : null, repoFiles = repoMap?.files ?? [];
31254
31372
  const goPkgPath = goPackagePath(readText2, ctx.repoDir, targetDir), planned = runners.includes("go") ? plannedGoDir(ctx.repoDir, srcTexts) : null, goTested = planned?.pkg && planned.dir !== targetDir ? goPackagePath(readText2, ctx.repoDir, planned.dir) : undefined;
31255
- const oor = () => readdirSync33(cwd).filter((f) => f.startsWith(WALL_PREFIX)).flatMap((name) => {
31373
+ const oor = () => readdirSync34(cwd).filter((f) => f.startsWith(WALL_PREFIX)).flatMap((name) => {
31256
31374
  const text3 = readFileSync80(join92(cwd, name), "utf8"), why = outOfRepoTarget(text3) ?? dotenvFileRead(text3) ?? vacuousCheck(name, text3, goPkgPath, goTested) ?? phantomReason(phantomRepoPaths(text3, name, targetDir, ctx.repoDir, planText, task), repoFiles, relative18(ctx.repoDir, targetDir), pkg?.root ?? "", task);
31257
31375
  return why ? [{ name, why }] : [];
31258
31376
  });
31259
31377
  const bad1 = oor();
31260
31378
  if (bad1.length > 0 && !wallCasesRunner(runners) && !signal.aborted && !ctx.overCap?.())
31261
31379
  await ctx.sessions.run({ stage: "wall", brief: withStagePrefix(outOfRepoReask("Rewrite these Wall files in place, keeping the same names and acceptance coverage.", bad1)), tier: "development", model, iterationId: `${iterationId}-oor`, limitS: wallLimitS(sz.size), maxOutputTokens: wallOutputCap(), signal, cwd });
31262
- const oorBad = new Map(oor().map((b) => [b.name, b.why])), all = readdirSync33(cwd).filter((f) => f.startsWith(WALL_PREFIX)), held = stashHoldout({ runId: ctx.runId, repoDir: ctx.repoDir, srcDir: cwd, targetDir, names: all.filter((n3) => !oorBad.has(n3) && !reject(n3, readFileSync80(join92(cwd, n3), "utf8"))), runnerOf: (n3) => guessRunner(n3, runners) }), generated = all.filter((n3) => !held?.names.has(n3));
31380
+ const oorBad = new Map(oor().map((b) => [b.name, b.why])), all = readdirSync34(cwd).filter((f) => f.startsWith(WALL_PREFIX)), held = stashHoldout({ runId: ctx.runId, repoDir: ctx.repoDir, srcDir: cwd, targetDir, names: all.filter((n3) => !oorBad.has(n3) && !reject(n3, readFileSync80(join92(cwd, n3), "utf8"))), runnerOf: (n3) => guessRunner(n3, runners) }), generated = all.filter((n3) => !held?.names.has(n3));
31263
31381
  const sealedDir = sealStageDir(ctx.runId, ctx.repoDir);
31264
31382
  rmSync27(sealedDir, { recursive: true, force: true });
31265
31383
  if (generated.length > 0)
@@ -31463,10 +31581,10 @@ var init_wall = __esm(() => {
31463
31581
  });
31464
31582
 
31465
31583
  // ../../loki-ts/src/e10ext/discard.ts
31466
- import { chmodSync as chmodSync6, closeSync as closeSync16, lstatSync as lstatSync24, mkdirSync as mkdirSync39, openSync as openSync16, readFileSync as readFileSync81, realpathSync as realpathSync29, rmdirSync, unlinkSync as unlinkSync9, writeFileSync as writeFileSync43 } from "fs";
31584
+ import { chmodSync as chmodSync6, closeSync as closeSync16, lstatSync as lstatSync24, mkdirSync as mkdirSync39, openSync as openSync16, readFileSync as readFileSync81, realpathSync as realpathSync30, rmdirSync, unlinkSync as unlinkSync9, writeFileSync as writeFileSync43 } from "fs";
31467
31585
  import { dirname as dirname40, join as join93, relative as relative19, sep as sep19 } from "path";
31468
31586
  function safeRestore(repoDir, f, want, mode) {
31469
- const root = realpathSync29(repoDir), fp = join93(root, f), rel = relative19(root, dirname40(fp));
31587
+ const root = realpathSync30(repoDir), fp = join93(root, f), rel = relative19(root, dirname40(fp));
31470
31588
  if (rel.startsWith(".."))
31471
31589
  throw new Error("outside repo");
31472
31590
  let cur = root;
@@ -31678,7 +31796,7 @@ var init_reviewer_body = __esm(() => {
31678
31796
  // ../../loki-ts/src/features/visual_evidence.ts
31679
31797
  import { spawn as spawn9 } from "child_process";
31680
31798
  import { createHash as createHash23, randomBytes as randomBytes6 } from "crypto";
31681
- import { existsSync as existsSync59, lstatSync as lstatSync25, mkdirSync as mkdirSync40, readdirSync as readdirSync34, readFileSync as readFileSync83, writeFileSync as writeFileSync44 } from "fs";
31799
+ import { existsSync as existsSync59, lstatSync as lstatSync25, mkdirSync as mkdirSync40, readdirSync as readdirSync35, readFileSync as readFileSync83, writeFileSync as writeFileSync44 } from "fs";
31682
31800
  import { createServer } from "net";
31683
31801
  import { dirname as dirname42, isAbsolute as isAbsolute16, join as join94, normalize as normalize5, relative as relative20, sep as sep20 } from "path";
31684
31802
  function routeFor(file) {
@@ -31780,7 +31898,7 @@ async function recordE2eMedia(repoDir, runDir, relDir, base, routes, ms, signal)
31780
31898
  return { rels: [], skipped: "playwright e2e video and trace skipped: the run failed or timed out" };
31781
31899
  const rels = [];
31782
31900
  const walk = (d) => {
31783
- for (const e of readdirSync34(d, { withFileTypes: true })) {
31901
+ for (const e of readdirSync35(d, { withFileTypes: true })) {
31784
31902
  const full = join94(d, e.name);
31785
31903
  if (e.isDirectory())
31786
31904
  walk(full);
@@ -32320,7 +32438,7 @@ var init_receipt_dsse = __esm(() => {
32320
32438
 
32321
32439
  // ../../loki-ts/src/util/receipt_bundle.ts
32322
32440
  import { createPublicKey as createPublicKey4 } from "crypto";
32323
- import { cpSync as cpSync4, copyFileSync as copyFileSync5, existsSync as existsSync61, mkdirSync as mkdirSync42, readdirSync as readdirSync35, readFileSync as readFileSync85, renameSync as renameSync19, rmSync as rmSync28, writeFileSync as writeFileSync45 } from "fs";
32441
+ import { cpSync as cpSync4, copyFileSync as copyFileSync5, existsSync as existsSync61, mkdirSync as mkdirSync42, readdirSync as readdirSync36, readFileSync as readFileSync85, renameSync as renameSync19, rmSync as rmSync28, writeFileSync as writeFileSync45 } from "fs";
32324
32442
  import { homedir as homedir11 } from "os";
32325
32443
  import { basename as basename31, dirname as dirname43, join as join96, normalize as normalize6 } from "path";
32326
32444
  function publicJwk(pub) {
@@ -34633,7 +34751,7 @@ var init_contract = __esm(() => {
34633
34751
 
34634
34752
  // ../../loki-ts/src/features/speed/seal_group.ts
34635
34753
  import { createHash as createHash27 } from "crypto";
34636
- import { existsSync as existsSync66, mkdirSync as mkdirSync48, readdirSync as readdirSync36, readFileSync as readFileSync91, renameSync as renameSync21, statSync as statSync30, writeFileSync as writeFileSync50 } from "fs";
34754
+ import { existsSync as existsSync66, mkdirSync as mkdirSync48, readdirSync as readdirSync37, readFileSync as readFileSync91, renameSync as renameSync21, statSync as statSync30, writeFileSync as writeFileSync50 } from "fs";
34637
34755
  import { dirname as dirname46, join as join103 } from "path";
34638
34756
  function sealGroup(runDir, rh) {
34639
34757
  const manifestPath = join103(runDir, "group", "manifest.json");
@@ -34782,7 +34900,7 @@ var ID_RE, PASSING, sha3 = (b) => createHash27("sha256").update(b).digest("hex")
34782
34900
  }
34783
34901
  }, dirNames = (d) => {
34784
34902
  try {
34785
- return readdirSync36(d).filter((n3) => !n3.startsWith(".")).sort();
34903
+ return readdirSync37(d).filter((n3) => !n3.startsWith(".")).sort();
34786
34904
  } catch {
34787
34905
  return null;
34788
34906
  }
@@ -35038,7 +35156,7 @@ var init_supply_guard = __esm(() => {
35038
35156
  });
35039
35157
 
35040
35158
  // ../../loki-ts/src/features/patch_protocol.ts
35041
- import { existsSync as existsSync68, lstatSync as lstatSync28, mkdirSync as mkdirSync49, readFileSync as readFileSync93, realpathSync as realpathSync30, rmSync as rmSync31, writeFileSync as writeFileSync51 } from "fs";
35159
+ import { existsSync as existsSync68, lstatSync as lstatSync28, mkdirSync as mkdirSync49, readFileSync as readFileSync93, realpathSync as realpathSync31, rmSync as rmSync31, writeFileSync as writeFileSync51 } from "fs";
35042
35160
  import { basename as basename33, dirname as dirname47, join as join105, normalize as normalize7, relative as relative21, sep as sep21 } from "path";
35043
35161
  function buildPatchBrief(task, code, conventions, checkCmds) {
35044
35162
  return [
@@ -35103,7 +35221,7 @@ function refusal(rules, rel, before, after) {
35103
35221
  }
35104
35222
  function contained(repoDir, rel) {
35105
35223
  try {
35106
- const root = realpathSync30(repoDir);
35224
+ const root = realpathSync31(repoDir);
35107
35225
  let p = join105(root, rel);
35108
35226
  for (;; ) {
35109
35227
  let exists2 = false;
@@ -35112,7 +35230,7 @@ function contained(repoDir, rel) {
35112
35230
  exists2 = true;
35113
35231
  } catch {}
35114
35232
  if (exists2) {
35115
- const r = realpathSync30(p);
35233
+ const r = realpathSync31(p);
35116
35234
  return r === p && (r === root || r.startsWith(root + sep21));
35117
35235
  }
35118
35236
  const up = dirname47(p);
@@ -35471,7 +35589,7 @@ __export(exports_seal, {
35471
35589
  });
35472
35590
  import { createHash as createHash28 } from "crypto";
35473
35591
  import { execFileSync as execFileSync10 } from "child_process";
35474
- import { existsSync as existsSync69, readdirSync as readdirSync37, mkdirSync as mkdirSync50, readFileSync as readFileSync94, rmSync as rmSync32 } from "fs";
35592
+ import { existsSync as existsSync69, readdirSync as readdirSync38, mkdirSync as mkdirSync50, readFileSync as readFileSync94, rmSync as rmSync32 } from "fs";
35475
35593
  import { basename as basename34, isAbsolute as isAbsolute17, join as join106, relative as relative22 } from "path";
35476
35594
  function missingLintChecks(vraw, env = process.env) {
35477
35595
  if (/^(0|off|false|no)$/i.test((env["LOKI_E10_LINT_MISSING_DISCLOSE"] ?? "").trim()))
@@ -35966,7 +36084,7 @@ var init_seal = __esm(() => {
35966
36084
  if (wallNotRun > 0) {
35967
36085
  try {
35968
36086
  const kept = new Set((Array.isArray(o.wall?.files) ? o.wall.files : []).map((f) => basename34(String(f.path))));
35969
- for (const n3 of readdirSync37(sealedWallDir(ctx.runDir)).sort())
36087
+ for (const n3 of readdirSync38(sealedWallDir(ctx.runDir)).sort())
35970
36088
  if (!kept.has(n3))
35971
36089
  notProven2.add(`wall test discarded: ${n3} (not_run)`);
35972
36090
  } catch {}
@@ -36035,6 +36153,8 @@ var init_seal = __esm(() => {
36035
36153
  notProven2.add(EXTERNAL_DIFF_NOT_ISOLATED);
36036
36154
  for (const t of strs2(o.implement?.tests_reverted))
36037
36155
  notProven2.add(`reverted test edit: ${t}`);
36156
+ for (const n3 of turnGuardNote(o.implement?.self_review?.turn_guard))
36157
+ notProven2.add(n3);
36038
36158
  {
36039
36159
  const sc = o.implement?.scaffold;
36040
36160
  if (typeof sc?.path === "string")
@@ -36194,7 +36314,7 @@ var init_seal = __esm(() => {
36194
36314
 
36195
36315
  // ../../loki-ts/src/util/seal_drift.ts
36196
36316
  import { createHash as createHash29, createPublicKey as createPublicKey5, sign as sign3, verify as verify4 } from "crypto";
36197
- import { existsSync as existsSync70, lstatSync as lstatSync29, readFileSync as readFileSync95, realpathSync as realpathSync32 } from "fs";
36317
+ import { existsSync as existsSync70, lstatSync as lstatSync29, readFileSync as readFileSync95, realpathSync as realpathSync33 } from "fs";
36198
36318
  import { basename as basename35, dirname as dirname49, join as join107, relative as relative23 } from "path";
36199
36319
  function tornTail(raw2) {
36200
36320
  if (raw2 === "" || raw2.endsWith(`
@@ -36323,7 +36443,7 @@ function onlyWallPublish(repo, r, sealedHead, head) {
36323
36443
  try {
36324
36444
  const real3 = (x) => {
36325
36445
  try {
36326
- return realpathSync32(x);
36446
+ return realpathSync33(x);
36327
36447
  } catch {
36328
36448
  return x;
36329
36449
  }
@@ -36365,7 +36485,7 @@ function claimsWallPublish(repo, r, sealedHead, head) {
36365
36485
  function sealDrift(given, r, env = process.env) {
36366
36486
  let receiptPath = given;
36367
36487
  try {
36368
- receiptPath = join107(realpathSync32(dirname49(given)), basename35(given));
36488
+ receiptPath = join107(realpathSync33(dirname49(given)), basename35(given));
36369
36489
  } catch {}
36370
36490
  const fab = fabricatedPass(receiptPath, r);
36371
36491
  if (fab)
@@ -36511,7 +36631,7 @@ var init_seal_drift = __esm(() => {
36511
36631
  });
36512
36632
 
36513
36633
  // ../../loki-ts/src/providers/provider_guard.ts
36514
- import { copyFileSync as copyFileSync6, existsSync as existsSync71, lstatSync as lstatSync30, mkdirSync as mkdirSync51, readFileSync as readFileSync96, readdirSync as readdirSync38, readlinkSync as readlinkSync3, realpathSync as realpathSync33, rmSync as rmSync33 } from "fs";
36634
+ import { copyFileSync as copyFileSync6, existsSync as existsSync71, lstatSync as lstatSync30, mkdirSync as mkdirSync51, readFileSync as readFileSync96, readdirSync as readdirSync39, readlinkSync as readlinkSync3, realpathSync as realpathSync34, rmSync as rmSync33 } from "fs";
36515
36635
  import { dirname as dirname50, isAbsolute as isAbsolute18, join as join108, relative as relative24, resolve as resolve23 } from "path";
36516
36636
  function providerSandboxFlags(provider) {
36517
36637
  return [];
@@ -36536,7 +36656,7 @@ function escapesProject(root, linkPath) {
36536
36656
  try {
36537
36657
  const target = readlinkSync3(linkPath);
36538
36658
  const abs = isAbsolute18(target) ? target : resolve23(dirname50(linkPath), target);
36539
- const rel = relative24(realpathSync33(root), existsSync71(abs) ? realpathSync33(abs) : abs);
36659
+ const rel = relative24(realpathSync34(root), existsSync71(abs) ? realpathSync34(abs) : abs);
36540
36660
  return rel.startsWith("..") || isAbsolute18(rel);
36541
36661
  } catch {
36542
36662
  return false;
@@ -36662,7 +36782,7 @@ var isGuarded = (provider) => provider !== "claude", git8 = (cwd, args) => {
36662
36782
  return g2 || join108(cwd, ".git");
36663
36783
  }, listHooks = (gd) => {
36664
36784
  try {
36665
- return readdirSync38(join108(gd, "hooks")).filter((f) => !f.endsWith(".sample")).sort();
36785
+ return readdirSync39(join108(gd, "hooks")).filter((f) => !f.endsWith(".sample")).sort();
36666
36786
  } catch {
36667
36787
  return [];
36668
36788
  }
@@ -36685,7 +36805,7 @@ var init_provider_guard = __esm(() => {
36685
36805
  });
36686
36806
 
36687
36807
  // ../../loki-ts/src/e10ext/budget_cap.ts
36688
- import { appendFileSync as appendFileSync10, existsSync as existsSync72, mkdirSync as mkdirSync52, readdirSync as readdirSync39, readFileSync as readFileSync97, writeFileSync as writeFileSync53 } from "fs";
36808
+ import { appendFileSync as appendFileSync10, existsSync as existsSync72, mkdirSync as mkdirSync52, readdirSync as readdirSync40, readFileSync as readFileSync97, writeFileSync as writeFileSync53 } from "fs";
36689
36809
  import { join as join109, resolve as resolve24 } from "path";
36690
36810
  function hasApiKey(env) {
36691
36811
  return ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY", "LOKI_MODEL_API_KEY"].some((k) => (env[k] ?? "") !== "");
@@ -36874,7 +36994,7 @@ function lastBudgetStop(repoDir, task) {
36874
36994
  const root = join109(repoDir, ".loki", "runs");
36875
36995
  let ids = [];
36876
36996
  try {
36877
- ids = existsSync72(root) ? readdirSync39(root).sort().reverse() : [];
36997
+ ids = existsSync72(root) ? readdirSync40(root).sort().reverse() : [];
36878
36998
  } catch {
36879
36999
  return null;
36880
37000
  }
@@ -37408,6 +37528,7 @@ var exports_implement = {};
37408
37528
  __export(exports_implement, {
37409
37529
  stage: () => stage5,
37410
37530
  savedImplementBrief: () => savedImplementBrief,
37531
+ reviewTurnGuard: () => reviewTurnGuard,
37411
37532
  restoreReadOnly: () => restoreReadOnly,
37412
37533
  patchCheckRefs: () => patchCheckRefs,
37413
37534
  patchCheck: () => patchCheck,
@@ -37542,6 +37663,17 @@ ${checkExcerpt(c) || c.first_error || ""}`).join(`
37542
37663
  `).slice(0, 1500) };
37543
37664
  };
37544
37665
  }
37666
+ async function reviewTurnGuard(ctx, pre, wall, signal) {
37667
+ const quiet = Object.assign(Object.create(ctx), { emit: () => {
37668
+ return;
37669
+ } });
37670
+ return guardReviewTurn(ctx.repoDir, ctx.baseSha, pre, (paths) => patchCheckRefs(ctx, paths, impactedTests(ctx)), async (t) => {
37671
+ const tc = commandFor(t, ctx.repoDir, loadProjectApi(ctx.repoDir)), out2 = [];
37672
+ await runCheck(quiet, `turn:${t.runner}:${t.path}`, tc.cmd, tc.args, signal, out2, { ...tc.interpreter ? { interpreter: tc.interpreter } : {}, ...tc.pkgRoot !== "." ? { cwd: tc.cwd } : {}, wall: new Set(wall) });
37673
+ const res = out2[out2.length - 1]?.result;
37674
+ return res === "fail" ? "fail" : res === "pass" || res === "flaky" ? "pass" : "not_run";
37675
+ });
37676
+ }
37545
37677
  function patchBrief(ctx, task, impacted) {
37546
37678
  const bc = briefCtx(ctx, "haiku"), code = bc.packText ?? "";
37547
37679
  const refs = patchCheckRefs(ctx, bc.files.filter((f) => !isTestFile(f)), impacted);
@@ -37592,6 +37724,7 @@ var init_implement = __esm(() => {
37592
37724
  init_patch_protocol();
37593
37725
  init_test_file_text();
37594
37726
  init_self_review();
37727
+ init_treeswap();
37595
37728
  implementStage = {
37596
37729
  name: "implement",
37597
37730
  targetS: 180,
@@ -37805,7 +37938,9 @@ ${(session.summary ?? "").slice(-1500)}`, diff: currentDiff(ctx.repoDir, ctx.bas
37805
37938
  if (mode !== "off" && ctx.baseSha && !signal.aborted && !session.killed && session.exit === 0 && session.markers.done && !session.markers.specConflict && !session.markers.alreadyDone && !treeIsEmpty(ctx)) {
37806
37939
  const before = selfReviewChecks(ctx.repoDir, ctx.baseSha, treeStaged(ctx.repoDir, ctx.baseSha), task, ctx.outputs(), process.env, ctx.runDir);
37807
37940
  let after = null, reply = null, turn = null;
37941
+ let guard = null;
37808
37942
  if (selfReviewWanted(before, mode)) {
37943
+ const preTurn = reviewTurnGuardOn() ? snapshotDiff(ctx.repoDir, ctx.baseSha) : null;
37809
37944
  const r = await resumeForSelfReview(ctx, { ...unchained(), iterationId: ids[ids.length - 1] }, session, selfReviewBrief(ctx.repoDir, before), selfReviewMaxTurns());
37810
37945
  if (r) {
37811
37946
  turn = r.iterationId;
@@ -37813,7 +37948,8 @@ ${(session.summary ?? "").slice(-1500)}`, diff: currentDiff(ctx.repoDir, ctx.bas
37813
37948
  ids.push(r.iterationId);
37814
37949
  if (r.session !== session) {
37815
37950
  reply = r.session.summary ?? "";
37816
- if (!r.session.killed && r.session.exit === 0 && r.session.markers.done && !r.session.markers.specConflict && !r.session.markers.alreadyDone)
37951
+ guard = preTurn && !signal.aborted ? await reviewTurnGuard(ctx, preTurn, readOnly.map((f) => relative25(ctx.repoDir, f.path)), signal) : null;
37952
+ if (!guard?.reverted && !r.session.killed && r.session.exit === 0 && r.session.markers.done && !r.session.markers.specConflict && !r.session.markers.alreadyDone)
37817
37953
  session = r.session;
37818
37954
  else
37819
37955
  session = { ...session, durationS: r.session.durationS };
@@ -37821,7 +37957,7 @@ ${(session.summary ?? "").slice(-1500)}`, diff: currentDiff(ctx.repoDir, ctx.bas
37821
37957
  after = selfReviewChecks(ctx.repoDir, ctx.baseSha, treeStaged(ctx.repoDir, ctx.baseSha), task, ctx.outputs(), process.env, ctx.runDir);
37822
37958
  }
37823
37959
  }
37824
- selfReview = { mode, turn, items: settleItems(before, after, reply) };
37960
+ selfReview = { mode, turn, items: settleItems(before, after, guard?.reverted ? null : reply), ...guard ? { turn_guard: guard } : {} };
37825
37961
  }
37826
37962
  }
37827
37963
  const refsRemoved = ctx.baseSha && !signal.aborted && !session.killed && session.exit === 0 && session.markers.done ? stripInventedReleaseRefs(ctx.repoDir, ctx.baseSha, treeStaged(ctx.repoDir, ctx.baseSha), task) : [];
@@ -39544,7 +39680,7 @@ var init_provider = __esm(() => {
39544
39680
 
39545
39681
  // ../../loki-ts/src/util/funnel.ts
39546
39682
  import { spawn as spawn10 } from "child_process";
39547
- import { existsSync as existsSync79, readdirSync as readdirSync40, readFileSync as readFileSync104, statSync as statSync33 } from "fs";
39683
+ import { existsSync as existsSync79, readdirSync as readdirSync41, readFileSync as readFileSync104, statSync as statSync33 } from "fs";
39548
39684
  import { join as join115, resolve as resolve27 } from "path";
39549
39685
  function emitFunnel(kind, key, extra = []) {
39550
39686
  try {
@@ -40369,7 +40505,7 @@ __export(exports_doctor, {
40369
40505
  CLAUDE_LOGIN_TTL_MS: () => CLAUDE_LOGIN_TTL_MS,
40370
40506
  AUTH_PROVIDERS: () => AUTH_PROVIDERS
40371
40507
  });
40372
- import { appendFileSync as appendFileSync12, writeFileSync as writeFileSync62, mkdirSync as mkdirSync59, accessSync as accessSync3, constants as fsConstants3, existsSync as existsSync81, lstatSync as lstatSync31, readdirSync as readdirSync41, readFileSync as readFileSync106, readlinkSync as readlinkSync4, realpathSync as realpathSync34, statSync as statSync34, statfsSync } from "fs";
40508
+ import { appendFileSync as appendFileSync12, writeFileSync as writeFileSync62, mkdirSync as mkdirSync59, accessSync as accessSync3, constants as fsConstants3, existsSync as existsSync81, lstatSync as lstatSync31, readdirSync as readdirSync42, readFileSync as readFileSync106, readlinkSync as readlinkSync4, realpathSync as realpathSync35, statSync as statSync34, statfsSync } from "fs";
40373
40509
  import { spawnSync as spawnSync15 } from "child_process";
40374
40510
  import { homedir as homedir14, tmpdir as tmpdir20 } from "os";
40375
40511
  import { basename as basename36, join as join117, resolve as resolve28 } from "path";
@@ -40426,7 +40562,7 @@ function sdkBinaryPath(env, root = REPO_ROOT) {
40426
40562
  continue;
40427
40563
  let names = [];
40428
40564
  try {
40429
- names = readdirSync41(scope);
40565
+ names = readdirSync42(scope);
40430
40566
  } catch {
40431
40567
  continue;
40432
40568
  }
@@ -40543,7 +40679,7 @@ function findOrphanRuns(repoDir, ownerAlive = runOwnerAlive) {
40543
40679
  const root = join117(repoDir, ".loki", "runs");
40544
40680
  let ids = [];
40545
40681
  try {
40546
- ids = readdirSync41(root);
40682
+ ids = readdirSync42(root);
40547
40683
  } catch {
40548
40684
  return [];
40549
40685
  }
@@ -41841,7 +41977,7 @@ async function runText(deps = {}) {
41841
41977
  {
41842
41978
  const resolveReal = (p) => {
41843
41979
  try {
41844
- return realpathSync34(p);
41980
+ return realpathSync35(p);
41845
41981
  } catch {
41846
41982
  return p;
41847
41983
  }
@@ -42196,7 +42332,7 @@ __export(exports_first_run_repo, {
42196
42332
  initEmptyRepo: () => initEmptyRepo,
42197
42333
  NOT_A_REPO: () => NOT_A_REPO
42198
42334
  });
42199
- import { readdirSync as readdirSync42, statSync as statSync35 } from "fs";
42335
+ import { readdirSync as readdirSync43, statSync as statSync35 } from "fs";
42200
42336
  import { join as join118 } from "path";
42201
42337
  async function initEmptyRepo(dir, env) {
42202
42338
  if (env["LOKI_AUTO_GIT_INIT"] === "0")
@@ -42211,7 +42347,7 @@ async function initEmptyRepo(dir, env) {
42211
42347
  }
42212
42348
  };
42213
42349
  try {
42214
- const all = readdirSync42(dir);
42350
+ const all = readdirSync43(dir);
42215
42351
  written = all.filter((f) => ours.has(f) && isFile2(f));
42216
42352
  empty = all.every((f) => OS_METADATA.has(f) || written.includes(f));
42217
42353
  } catch {}
@@ -43004,7 +43140,7 @@ __export(exports_run_group, {
43004
43140
  groupCostLine: () => groupCostLine,
43005
43141
  NOT_PROVEN: () => NOT_PROVEN
43006
43142
  });
43007
- import { cpSync as cpSync5, existsSync as existsSync83, mkdirSync as mkdirSync62, readdirSync as readdirSync43, readFileSync as readFileSync108, rmSync as rmSync37, statSync as statSync36 } from "fs";
43143
+ import { cpSync as cpSync5, existsSync as existsSync83, mkdirSync as mkdirSync62, readdirSync as readdirSync44, readFileSync as readFileSync108, rmSync as rmSync37, statSync as statSync36 } from "fs";
43008
43144
  import { createHash as createHash31 } from "crypto";
43009
43145
  import { spawn as spawn11 } from "child_process";
43010
43146
  import { join as join121, resolve as resolve29 } from "path";
@@ -43074,7 +43210,7 @@ function findResumable(repoDir, specSha, unitIds) {
43074
43210
  const root = join121(repoDir, ".loki", "groups");
43075
43211
  let names = [];
43076
43212
  try {
43077
- names = readdirSync43(root);
43213
+ names = readdirSync44(root);
43078
43214
  } catch {
43079
43215
  return null;
43080
43216
  }
@@ -43514,7 +43650,7 @@ __export(exports_route, {
43514
43650
  MAX_SPEC_BYTES: () => MAX_SPEC_BYTES2,
43515
43651
  MAX_SEQ_TASK_BYTES: () => MAX_SEQ_TASK_BYTES
43516
43652
  });
43517
- import { closeSync as closeSync17, constants as constants4, fstatSync as fstatSync9, openSync as openSync17, readFileSync as readFileSync109, realpathSync as realpathSync35 } from "fs";
43653
+ import { closeSync as closeSync17, constants as constants4, fstatSync as fstatSync9, openSync as openSync17, readFileSync as readFileSync109, realpathSync as realpathSync36 } from "fs";
43518
43654
  import { isAbsolute as isAbsolute20, relative as relative27, resolve as resolve30 } from "path";
43519
43655
  function providerSlots(env, provider) {
43520
43656
  provider = (provider || env.LOKI_PROVIDER || "claude").toLowerCase();
@@ -43526,11 +43662,11 @@ function readSpec(task, repoDir, cwd) {
43526
43662
  const p = isAbsolute20(task) ? task : resolve30(cwd, task);
43527
43663
  let real3;
43528
43664
  try {
43529
- real3 = realpathSync35(p);
43665
+ real3 = realpathSync36(p);
43530
43666
  } catch {
43531
43667
  return { kind: "missing", path: p };
43532
43668
  }
43533
- const rel = relative27(realpathSync35(repoDir), real3);
43669
+ const rel = relative27(realpathSync36(repoDir), real3);
43534
43670
  if (rel === ".." || rel.startsWith("../") || isAbsolute20(rel))
43535
43671
  return { kind: "reject", reason: `spec path escapes the repo: ${task}` };
43536
43672
  let fd = -1;
@@ -43743,7 +43879,7 @@ var init_forecast = __esm(() => {
43743
43879
  });
43744
43880
 
43745
43881
  // ../../loki-ts/src/commands/queue.ts
43746
- import { existsSync as existsSync85, mkdirSync as mkdirSync64, readFileSync as readFileSync111, readdirSync as readdirSync44, renameSync as renameSync24, statSync as statSync37, writeFileSync as writeFileSync65 } from "fs";
43882
+ import { existsSync as existsSync85, mkdirSync as mkdirSync64, readFileSync as readFileSync111, readdirSync as readdirSync45, renameSync as renameSync24, statSync as statSync37, writeFileSync as writeFileSync65 } from "fs";
43747
43883
  import { join as join123, resolve as resolve31 } from "path";
43748
43884
  function normalizeRef(raw2) {
43749
43885
  const m = URL_RE.exec(raw2);
@@ -43985,7 +44121,7 @@ function newestRecord(lokiDir2, since) {
43985
44121
  const dir = join123(lokiDir2, sub2);
43986
44122
  let best = null;
43987
44123
  try {
43988
- for (const name of readdirSync44(dir)) {
44124
+ for (const name of readdirSync45(dir)) {
43989
44125
  const p = join123(dir, name, file);
43990
44126
  if (!existsSync85(p))
43991
44127
  continue;
@@ -44368,7 +44504,7 @@ __export(exports_issues_run, {
44368
44504
  REAPER_SH: () => REAPER_SH
44369
44505
  });
44370
44506
  import { spawnSync as spawnSync18 } from "child_process";
44371
- import { cpSync as cpSync6, existsSync as existsSync87, mkdirSync as mkdirSync65, mkdtempSync as mkdtempSync16, readdirSync as readdirSync45, readFileSync as readFileSync113, rmdirSync as rmdirSync2, rmSync as rmSync38, writeFileSync as writeFileSync66 } from "fs";
44507
+ import { cpSync as cpSync6, existsSync as existsSync87, mkdirSync as mkdirSync65, mkdtempSync as mkdtempSync16, readdirSync as readdirSync46, readFileSync as readFileSync113, rmdirSync as rmdirSync2, rmSync as rmSync38, writeFileSync as writeFileSync66 } from "fs";
44372
44508
  import { tmpdir as tmpdir21 } from "os";
44373
44509
  import { join as join124, resolve as resolve32 } from "path";
44374
44510
  import { createInterface as createInterface3 } from "readline";
@@ -44988,7 +45124,7 @@ var USAGE = `usage: loki issues run [owner/repo] [--label L] [--milestone M] [--
44988
45124
  }, lastLine = (s) => s.split(`
44989
45125
  `).map((l) => l.trim()).filter(Boolean).pop() ?? "", GITHUB_URL_RE, secs = (s) => s < 90 ? `${Math.round(s)}s` : `${Math.round(s / 60)}m`, slicePrintedReason = (out2) => /^Reason:\s+(.+)$/m.exec(out2)?.[1]?.trim() || undefined, PR_URL_RE2, noGovernor = async () => ({ ok: true, hold: false, reason: "not consulted" }), TRIAGE_RE, deepPids = (wt) => {
44990
45126
  try {
44991
- return readdirSync45(join124(wt, ".loki", "runs")).flatMap((id) => {
45127
+ return readdirSync46(join124(wt, ".loki", "runs")).flatMap((id) => {
44992
45128
  const pid = deepPid(join124(wt, ".loki", "runs", id));
44993
45129
  return pid ? [pid] : [];
44994
45130
  });
@@ -47761,7 +47897,7 @@ __export(exports_dashboard, {
47761
47897
  modernizeRoute: () => modernizeRoute,
47762
47898
  listModernizeIds: () => listModernizeIds
47763
47899
  });
47764
- import { existsSync as existsSync94, readdirSync as readdirSync46 } from "fs";
47900
+ import { existsSync as existsSync94, readdirSync as readdirSync47 } from "fs";
47765
47901
  import { join as join134 } from "path";
47766
47902
  function modernizeDir(repoDir) {
47767
47903
  return join134(repoDir, ".loki", "modernize");
@@ -47770,7 +47906,7 @@ function listModernizeIds(repoDir) {
47770
47906
  const dir = modernizeDir(repoDir);
47771
47907
  if (!existsSync94(dir))
47772
47908
  return [];
47773
- return readdirSync46(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort();
47909
+ return readdirSync47(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort();
47774
47910
  }
47775
47911
  function summarizeModernize(repoDir, mid) {
47776
47912
  const events2 = readModernizeEvents(repoDir, mid);
@@ -49752,7 +49888,7 @@ var init_presealed_wall = __esm(() => {
49752
49888
  // ../../loki-ts/src/engine10/modernize/unit.ts
49753
49889
  import { spawnSync as spawnSync23 } from "child_process";
49754
49890
  import { createHash as createHash35 } from "crypto";
49755
- import { lstatSync as lstatSync32, readFileSync as readFileSync128, readdirSync as readdirSync47, readlinkSync as readlinkSync5, realpathSync as realpathSync36, rmSync as rmSync42 } from "fs";
49891
+ import { lstatSync as lstatSync32, readFileSync as readFileSync128, readdirSync as readdirSync48, readlinkSync as readlinkSync5, realpathSync as realpathSync37, rmSync as rmSync42 } from "fs";
49756
49892
  import { tmpdir as tmpdir25 } from "os";
49757
49893
  import { join as join143, sep as sep22 } from "path";
49758
49894
  function isSealedName(rel) {
@@ -49762,7 +49898,7 @@ function purgePycache(dir) {
49762
49898
  const walk = (d) => {
49763
49899
  let ents;
49764
49900
  try {
49765
- ents = readdirSync47(d, { withFileTypes: true });
49901
+ ents = readdirSync48(d, { withFileTypes: true });
49766
49902
  } catch {
49767
49903
  return;
49768
49904
  }
@@ -49781,13 +49917,13 @@ function purgePycache(dir) {
49781
49917
  function outsideTargetDigest(dir, full) {
49782
49918
  let real3;
49783
49919
  try {
49784
- real3 = realpathSync36(full);
49920
+ real3 = realpathSync37(full);
49785
49921
  } catch {
49786
49922
  return "dangling";
49787
49923
  }
49788
49924
  let root;
49789
49925
  try {
49790
- root = realpathSync36(dir);
49926
+ root = realpathSync37(dir);
49791
49927
  } catch {
49792
49928
  return "noroot";
49793
49929
  }
@@ -49818,7 +49954,7 @@ function outsideTargetDigest(dir, full) {
49818
49954
  if (st.isDirectory()) {
49819
49955
  let names = [];
49820
49956
  try {
49821
- names = readdirSync47(p).sort();
49957
+ names = readdirSync48(p).sort();
49822
49958
  } catch {
49823
49959
  h.update("unreadable");
49824
49960
  }
@@ -49845,7 +49981,7 @@ function conformanceHashes(dir) {
49845
49981
  const walk = (sub2, inSkip) => {
49846
49982
  let ents;
49847
49983
  try {
49848
- ents = readdirSync47(join143(dir, sub2), { withFileTypes: true });
49984
+ ents = readdirSync48(join143(dir, sub2), { withFileTypes: true });
49849
49985
  } catch {
49850
49986
  return;
49851
49987
  }
@@ -50179,7 +50315,7 @@ var init_wave = __esm(() => {
50179
50315
 
50180
50316
  // ../../loki-ts/src/util/modernize_unit.ts
50181
50317
  import { spawnSync as spawnSync25 } from "child_process";
50182
- import { existsSync as existsSync99, lstatSync as lstatSync33, mkdtempSync as mkdtempSync20, readFileSync as readFileSync130, realpathSync as realpathSync37, rmSync as rmSync43, statSync as statSync40, writeFileSync as writeFileSync76 } from "fs";
50318
+ import { existsSync as existsSync99, lstatSync as lstatSync33, mkdtempSync as mkdtempSync20, readFileSync as readFileSync130, realpathSync as realpathSync38, rmSync as rmSync43, statSync as statSync40, writeFileSync as writeFileSync76 } from "fs";
50183
50319
  import { tmpdir as tmpdir26 } from "os";
50184
50320
  import { join as join145, sep as sep23 } from "path";
50185
50321
  function parseUnitArgs(args) {
@@ -50260,8 +50396,8 @@ function defaultUnitFile(unitId, newTreeDir) {
50260
50396
  if (!isSafeUnitId(unitId))
50261
50397
  return null;
50262
50398
  try {
50263
- const root = realpathSync37(newTreeDir);
50264
- const real3 = realpathSync37(join145(root, unitId));
50399
+ const root = realpathSync38(newTreeDir);
50400
+ const real3 = realpathSync38(join145(root, unitId));
50265
50401
  return real3.startsWith(root + sep23) ? real3 : null;
50266
50402
  } catch {
50267
50403
  return null;
@@ -51358,7 +51494,7 @@ var init_undo = __esm(() => {
51358
51494
  });
51359
51495
 
51360
51496
  // ../../loki-ts/src/commands/run_status.ts
51361
- import { existsSync as existsSync103, readdirSync as readdirSync48, readFileSync as readFileSync133, statSync as statSync42 } from "fs";
51497
+ import { existsSync as existsSync103, readdirSync as readdirSync49, readFileSync as readFileSync133, statSync as statSync42 } from "fs";
51362
51498
  import { basename as basename41, dirname as dirname61, join as join148, resolve as resolve37 } from "path";
51363
51499
  function runsRoot(env, repoDir) {
51364
51500
  return env.LOKI_DIR ? join148(resolve37(repoDir, env.LOKI_DIR), "runs") : join148(repoDir, ".loki", "runs");
@@ -51366,7 +51502,7 @@ function runsRoot(env, repoDir) {
51366
51502
  function listRunIds(root) {
51367
51503
  if (!existsSync103(root))
51368
51504
  return [];
51369
- return readdirSync48(root, { withFileTypes: true }).filter((d) => d.isDirectory() && d.name !== LEGACY_BRANCHES_DIR).map((d) => d.name).sort();
51505
+ return readdirSync49(root, { withFileTypes: true }).filter((d) => d.isDirectory() && d.name !== LEGACY_BRANCHES_DIR).map((d) => d.name).sort();
51370
51506
  }
51371
51507
  function latestRunId(root) {
51372
51508
  const ids = listRunIds(root);
@@ -51417,7 +51553,7 @@ __export(exports_base_guard, {
51417
51553
  });
51418
51554
  import { execFileSync as execFileSync12 } from "child_process";
51419
51555
  import { createHash as createHash38 } from "crypto";
51420
- import { existsSync as existsSync104, mkdirSync as mkdirSync78, mkdtempSync as mkdtempSync22, readdirSync as readdirSync49, readFileSync as readFileSync134, readlinkSync as readlinkSync6, realpathSync as realpathSync38, rmSync as rmSync45, statSync as statSync43, symlinkSync as symlinkSync5, utimesSync, writeFileSync as writeFileSync78 } from "fs";
51556
+ import { existsSync as existsSync104, mkdirSync as mkdirSync78, mkdtempSync as mkdtempSync22, readdirSync as readdirSync50, readFileSync as readFileSync134, readlinkSync as readlinkSync6, realpathSync as realpathSync39, rmSync as rmSync45, statSync as statSync43, symlinkSync as symlinkSync5, utimesSync, writeFileSync as writeFileSync78 } from "fs";
51421
51557
  import { tmpdir as tmpdir28 } from "os";
51422
51558
  import { basename as basename42, dirname as dirname62, join as join149, relative as relative30, resolve as resolve38, sep as sep24 } from "path";
51423
51559
  import { fileURLToPath as fileURLToPath5 } from "url";
@@ -51519,7 +51655,7 @@ function insideAny(p, roots) {
51519
51655
  if (under2(resolve38(p)))
51520
51656
  return true;
51521
51657
  try {
51522
- return under2(realpathSync38(p));
51658
+ return under2(realpathSync39(p));
51523
51659
  } catch {
51524
51660
  return false;
51525
51661
  }
@@ -51534,13 +51670,13 @@ function namedPaths2(file, text4) {
51534
51670
  function depsSeeHead(pkgDir, repoDir) {
51535
51671
  let roots;
51536
51672
  try {
51537
- roots = [...new Set([resolve38(repoDir), realpathSync38(repoDir)])];
51673
+ roots = [...new Set([resolve38(repoDir), realpathSync39(repoDir)])];
51538
51674
  } catch {
51539
51675
  return true;
51540
51676
  }
51541
51677
  let seen = 0;
51542
51678
  const walk = (dir, own) => {
51543
- for (const e of readdirSync49(dir, { withFileTypes: true })) {
51679
+ for (const e of readdirSync50(dir, { withFileTypes: true })) {
51544
51680
  if (++seen > WALK_BOUND)
51545
51681
  return true;
51546
51682
  const p = join149(dir, e.name);
@@ -51548,7 +51684,7 @@ function depsSeeHead(pkgDir, repoDir) {
51548
51684
  const t = resolve38(dir, readlinkSync6(p));
51549
51685
  let rt = t;
51550
51686
  try {
51551
- rt = realpathSync38(t);
51687
+ rt = realpathSync39(t);
51552
51688
  } catch {}
51553
51689
  if (insideAny(t, roots) && !own.some((r) => rt === r || rt.startsWith(r + sep24)))
51554
51690
  return true;
@@ -51567,7 +51703,7 @@ function depsSeeHead(pkgDir, repoDir) {
51567
51703
  return ["node_modules", ".venv"].some((d) => {
51568
51704
  try {
51569
51705
  const top = join149(pkgDir, d);
51570
- return walk(top, [...new Set([resolve38(top), realpathSync38(top)])]);
51706
+ return walk(top, [...new Set([resolve38(top), realpathSync39(top)])]);
51571
51707
  } catch (e) {
51572
51708
  if (e.code === "ENOENT")
51573
51709
  return false;
@@ -51598,7 +51734,7 @@ function zeroGate(rec2) {
51598
51734
  function depsListing(root) {
51599
51735
  const out2 = [], skip2 = (n3) => RUNNER_CACHE_DIRS.includes(n3) || n3 === "__pycache__";
51600
51736
  const list = (dir, prefix) => {
51601
- for (const e of readdirSync49(dir, { withFileTypes: true })) {
51737
+ for (const e of readdirSync50(dir, { withFileTypes: true })) {
51602
51738
  if (skip2(e.name))
51603
51739
  continue;
51604
51740
  if (e.name.startsWith("@") && (e.isDirectory() || e.isSymbolicLink())) {
@@ -51623,7 +51759,7 @@ function depsListing(root) {
51623
51759
  list(join149(l, "site-packages"), "py/");
51624
51760
  continue;
51625
51761
  }
51626
- for (const py of readdirSync49(l))
51762
+ for (const py of readdirSync50(l))
51627
51763
  if (/^python/.test(py) && existsSync104(join149(l, py, "site-packages")))
51628
51764
  list(join149(l, py, "site-packages"), "py/");
51629
51765
  }
@@ -51744,7 +51880,7 @@ function splitDeclaredAdvisories(notes, c) {
51744
51880
  const named2 = (f) => new RegExp(`${f.includes("/") ? `(?<![\\w./-])${escapeRegex(f)}(?![\\w-])|` : ""}[/"'\`]${escapeRegex(basename42(f))}(?=["'\`\\s);]|$)`).test(wall());
51745
51881
  const linkOk = (f) => {
51746
51882
  try {
51747
- const root = realpathSync38(c.repoDir), t = realpathSync38(join149(c.repoDir, f)), rel = relative30(root, t);
51883
+ const root = realpathSync39(c.repoDir), t = realpathSync39(join149(c.repoDir, f)), rel = relative30(root, t);
51748
51884
  return !rel.startsWith("..") && !rel.split(sep24).includes(".git") && statSync43(t).isFile() && changed.has(rel.split(sep24).join("/")) && !isTestFile(rel) && !c.wallPaths.includes(rel);
51749
51885
  } catch {
51750
51886
  return false;
@@ -51777,7 +51913,7 @@ function removeRunWorktrees(repoDir, baseSha) {
51777
51913
  return;
51778
51914
  const roots = [tmpdir28()];
51779
51915
  try {
51780
- roots.push(realpathSync38(tmpdir28()));
51916
+ roots.push(realpathSync39(tmpdir28()));
51781
51917
  } catch {}
51782
51918
  for (const t of checkedOut(repoDir).trees.slice(1)) {
51783
51919
  const named2 = RUN_TMP_WORKTREE_RE.test(basename42(t.path)) || RUN_TMP_WORKTREE_RE.test(basename42(dirname62(t.path)));
@@ -52028,7 +52164,7 @@ __export(exports_verify, {
52028
52164
  COLLATERAL_RED: () => COLLATERAL_RED,
52029
52165
  BCE_REASON: () => BCE_REASON
52030
52166
  });
52031
- import { existsSync as existsSync105, mkdtempSync as mkdtempSync23, readFileSync as readFileSync135, realpathSync as realpathSync39, rmSync as rmSync46 } from "fs";
52167
+ import { existsSync as existsSync105, mkdtempSync as mkdtempSync23, readFileSync as readFileSync135, realpathSync as realpathSync40, rmSync as rmSync46 } from "fs";
52032
52168
  import { tmpdir as tmpdir29 } from "os";
52033
52169
  import { basename as basename43, isAbsolute as isAbsolute21, join as join150, relative as relative31, resolve as resolve39 } from "path";
52034
52170
  function crashSignature(out2) {
@@ -52245,7 +52381,7 @@ async function vitestBatch(cwd, rels, signal, opts = {}) {
52245
52381
  return null;
52246
52382
  const real3 = (p) => {
52247
52383
  try {
52248
- return realpathSync39(p);
52384
+ return realpathSync40(p);
52249
52385
  } catch {
52250
52386
  return p;
52251
52387
  }
@@ -94307,8 +94443,8 @@ __export(exports_providers, {
94307
94443
  SDK_BUNDLED_CLAUDE_CODE: () => SDK_BUNDLED_CLAUDE_CODE,
94308
94444
  PROVIDER_COMMIT_HYGIENE: () => PROVIDER_COMMIT_HYGIENE
94309
94445
  });
94310
- import { mkdirSync as mkdirSync82, existsSync as existsSync108, readFileSync as readFileSync138, realpathSync as realpathSync41, appendFileSync as appendFileSync18 } from "fs";
94311
- import { delimiter as delimiter4, dirname as dirname65, isAbsolute as isAbsolute24, relative as relative33, resolve as resolve41, sep as sep26 } from "path";
94446
+ import { mkdirSync as mkdirSync82, existsSync as existsSync108, readFileSync as readFileSync138, realpathSync as realpathSync42, appendFileSync as appendFileSync18 } from "fs";
94447
+ import { delimiter as delimiter5, dirname as dirname65, isAbsolute as isAbsolute24, relative as relative33, resolve as resolve41, sep as sep26 } from "path";
94312
94448
  function mergeDisallowedTools(policy, stageCsv) {
94313
94449
  return [...new Set([...policy ?? [], ...stageCsv.split(",").filter(Boolean)])];
94314
94450
  }
@@ -94458,7 +94594,7 @@ function ensureParentDir(path) {
94458
94594
  }
94459
94595
  function physicalPath(path) {
94460
94596
  try {
94461
- return realpathSync41(path);
94597
+ return realpathSync42(path);
94462
94598
  } catch {
94463
94599
  return resolve41(path);
94464
94600
  }
@@ -94471,7 +94607,7 @@ function hostGuardRequired(cwd) {
94471
94607
  if (!target || !roots || physicalPath(target) !== physicalPath(cwd))
94472
94608
  return false;
94473
94609
  const candidate = physicalPath(cwd);
94474
- return roots.split(delimiter4).some((root) => {
94610
+ return roots.split(delimiter5).some((root) => {
94475
94611
  if (!root)
94476
94612
  return false;
94477
94613
  const fromRoot = relative33(physicalPath(root), candidate);
@@ -95314,7 +95450,10 @@ function namedFiles(task, map) {
95314
95450
  const hit2 = (map?.files ?? []).filter((f) => new RegExp(`(?<![\\w.-])${escapeRegex(basename45(f).toLowerCase())}(?![\\w-]|\\.\\w)`).test(text4));
95315
95451
  if (!namedExactOn())
95316
95452
  return hit2;
95317
- const spelled = [...text4.matchAll(/(?:\.\/)?((?:[\w@.()[\]-]+\/)+[\w@.()[\]-]+\.\w+)/g)].map((m) => m[1]);
95453
+ const spelled = text4.split(/[^\w@.()[\]\/-]+/).filter((t) => t.includes("/")).flatMap((t) => {
95454
+ const m = /^(?:\.\/)?((?:[\w@.()[\]-]+\/)+[\w@.()[\]-]+\.\w+)$/.exec(t.replace(/[.,;:)\]]+$/, ""));
95455
+ return m ? [m[1]] : [];
95456
+ });
95318
95457
  return hit2.filter((f) => {
95319
95458
  const b = basename45(f).toLowerCase();
95320
95459
  if (new RegExp(`(?<![\\w./-])${escapeRegex(b)}(?![\\w-]|\\.\\w)`).test(text4))
@@ -95838,7 +95977,7 @@ var init_python_build_check = __esm(() => {
95838
95977
  // ../../loki-ts/src/util/check_result.ts
95839
95978
  import { spawn as spawn13, spawnSync as spawnSync26 } from "child_process";
95840
95979
  import { createHash as createHash39 } from "crypto";
95841
- import { copyFileSync as copyFileSync11, existsSync as existsSync113, lstatSync as lstatSync35, mkdirSync as mkdirSync86, readlinkSync as readlinkSync8, mkdtempSync as mkdtempSync24, readdirSync as readdirSync51, readFileSync as readFileSync142, realpathSync as realpathSync42, renameSync as renameSync28, rmSync as rmSync49, statSync as statSync46, writeFileSync as writeFileSync83 } from "fs";
95980
+ import { copyFileSync as copyFileSync11, existsSync as existsSync113, lstatSync as lstatSync35, mkdirSync as mkdirSync86, readlinkSync as readlinkSync8, mkdtempSync as mkdtempSync24, readdirSync as readdirSync52, readFileSync as readFileSync142, realpathSync as realpathSync43, renameSync as renameSync28, rmSync as rmSync49, statSync as statSync46, writeFileSync as writeFileSync83 } from "fs";
95842
95981
  import { homedir as homedir16, tmpdir as tmpdir31 } from "os";
95843
95982
  import { basename as basename46, dirname as dirname67, isAbsolute as isAbsolute25, join as join159, normalize as normalize9, relative as relative34, resolve as resolve43, sep as sep27 } from "path";
95844
95983
  function plainTestEnv(base2 = process.env) {
@@ -96415,7 +96554,7 @@ function cargoProfileRustflagsManifest(root, cwd, toks2) {
96415
96554
  if (depth >= 5)
96416
96555
  continue;
96417
96556
  try {
96418
- for (const e10 of readdirSync51(d, { withFileTypes: true }))
96557
+ for (const e10 of readdirSync52(d, { withFileTypes: true }))
96419
96558
  if (e10.isDirectory() && !["target", ".git", "node_modules"].includes(e10.name))
96420
96559
  stack.push([join159(d, e10.name), depth + 1]);
96421
96560
  } catch {}
@@ -97494,7 +97633,7 @@ function pureToolCache(repoDir, dir) {
97494
97633
  return false;
97495
97634
  let seen = 0;
97496
97635
  const walk = (rel) => {
97497
- for (const e10 of readdirSync51(join159(repoDir, rel), { withFileTypes: true })) {
97636
+ for (const e10 of readdirSync52(join159(repoDir, rel), { withFileTypes: true })) {
97498
97637
  if (++seen > 5000 || e10.isSymbolicLink())
97499
97638
  return false;
97500
97639
  const r = join159(rel, e10.name);
@@ -97692,7 +97831,7 @@ function pytestCollectionIsRed(output, repoDir) {
97692
97831
  return moduleToBeCreated(output, repoDir);
97693
97832
  const real3 = (p) => {
97694
97833
  try {
97695
- return realpathSync42(isAbsolute25(p) ? p : join159(repoDir, p));
97834
+ return realpathSync43(isAbsolute25(p) ? p : join159(repoDir, p));
97696
97835
  } catch {
97697
97836
  return null;
97698
97837
  }
@@ -97733,7 +97872,7 @@ function walkPython(repoDir) {
97733
97872
  const dir = stack.pop();
97734
97873
  let ents;
97735
97874
  try {
97736
- ents = readdirSync51(join159(repoDir, dir), { withFileTypes: true });
97875
+ ents = readdirSync52(join159(repoDir, dir), { withFileTypes: true });
97737
97876
  } catch (e10) {
97738
97877
  if (!dir)
97739
97878
  throw e10;
@@ -98227,7 +98366,7 @@ function toolFallbacks(repoDir, tool, env = process.env) {
98227
98366
  function resolveTool(repoDir, bin, fallback, lastResort = fallback) {
98228
98367
  const inRepo2 = (p) => {
98229
98368
  try {
98230
- const r = relative34(realpathSync42(repoDir), realpathSync42(p));
98369
+ const r = relative34(realpathSync43(repoDir), realpathSync43(p));
98231
98370
  return r !== "" && !r.startsWith("..") && !isAbsolute25(r);
98232
98371
  } catch {
98233
98372
  return false;
@@ -98315,7 +98454,7 @@ function ownVitestSite(repoDir, path) {
98315
98454
  const abs = join159(repoDir, d);
98316
98455
  if (!existsSync113(join159(abs, "package.json")))
98317
98456
  continue;
98318
- const conf = readdirSync51(abs).find((n10) => cfg.test(n10));
98457
+ const conf = readdirSync52(abs).find((n10) => cfg.test(n10));
98319
98458
  if (!conf)
98320
98459
  continue;
98321
98460
  if (/^vitest/.test(conf) || /\btest\s*:/.test(readFileSync142(join159(abs, conf), "utf8").slice(0, 200000)))
@@ -98329,7 +98468,7 @@ function rootProjectsBreakSite(repoDir, site) {
98329
98468
  if (site.cwd === repoDir)
98330
98469
  return false;
98331
98470
  const read3 = (dir) => {
98332
- const n10 = readdirSync51(dir).find((x10) => VITEST_CFG.test(x10));
98471
+ const n10 = readdirSync52(dir).find((x10) => VITEST_CFG.test(x10));
98333
98472
  return n10 ? readFileSync142(join159(dir, n10), "utf8").slice(0, 200000) : null;
98334
98473
  };
98335
98474
  const root = read3(repoDir), own = read3(site.cwd);
@@ -98458,7 +98597,7 @@ async function publishWall(git14, runId2, repoDir, files, done) {
98458
98597
  for (const f of files) {
98459
98598
  const abs = join159(repoDir, f.rel);
98460
98599
  try {
98461
- if (!realpathSync42(dirname67(abs)).startsWith(realpathSync42(repoDir)))
98600
+ if (!realpathSync43(dirname67(abs)).startsWith(realpathSync43(repoDir)))
98462
98601
  return false;
98463
98602
  } catch {}
98464
98603
  rmSync49(abs, { force: true });
@@ -98484,7 +98623,7 @@ function firstFileLineAnchor(desc2) {
98484
98623
  }
98485
98624
  var NO_TESTS_REASON = "no tests executed", sealedWallDir = (runDir) => join159(runDir, "wall"), sealedWallCopy = (runDir, path) => join159(sealedWallDir(runDir), basename46(path)), NO_RUNNER_REASON = "no runner of this repo runs this file", harnessSkipCode = (env = process.env) => env.LOKI_WALL_HARNESS_RUNNER === "0" ? "harness_runner_disabled" : Bun.which("bun", { PATH: env.PATH ?? "" }) ? "no_toolchain" : "bun_not_on_path", GO_EXIT0_REASON = "test count could not be confirmed: go test output is produced by the code under test and cannot confirm execution (a Go exit 0 is never a pass)", UNCONFIRMED_REASON = "test count could not be confirmed", FAIL_EVIDENCE, GO_FAIL_EVIDENCE, UNMEASURED_REASON = "executed count unmeasured (Loki could not parse the runner summary, harness-owned)", pytestPrettyOn = (env = process.env) => /^(1|on|true|yes)$/i.test((env["LOKI_E10_PYTEST_PRETTY"] ?? "").trim()), stripAnsi = (s) => s.replace(/\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)/g, "").replace(/(?:\u001b\[|\u009b)[0-9;?]*[ -\/]*[@-~]/g, "").replace(/\r\n?/g, `
98486
98625
  `), tailLines = (out2) => out2.split(`
98487
- `).filter((x10) => x10.trim()).slice(-12), CARGO_NOISE, cargoMergedDoctestOn = (env = process.env) => /^(1|on|true|yes)$/i.test((env["LOKI_E10_CARGO_MERGED_DOCTEST"] ?? "").trim()), DOCTEST_NOTE, cargoNoise = (l) => CARGO_NOISE.test(l) || cargoMergedDoctestOn() && DOCTEST_NOTE.test(l), GO_PKG_RE, GO_SRC, GO_DIR, GO_PKG_AFTER, GO_MAIN_BEFORE, GO_IDENT, GO_MAJOR, GO_KEYWORDS, goRel = (r) => r.replace(/^(?:\.\/)+/, ""), GO_NON_PKG_WORD, goIgnoredPath = (rel) => rel.split("/").some((g10) => g10 === "testdata" || g10.startsWith("_") || g10.startsWith(".")), goSiblingPkg = (dir) => existsSync113(dir) ? readdirSync51(dir).filter((f) => f.endsWith(".go") && !f.endsWith("_test.go")).map((f) => /^package\s+(\w+)/m.exec(readFileSync142(join159(dir, f), "utf8"))?.[1]).find(Boolean) : undefined, goDirPackage = (dir) => goSiblingPkg(dir) ?? (existsSync113(dir) ? readdirSync51(dir).filter((f) => f.endsWith("_test.go")).map((f) => /^package\s+(\w+)/m.exec(readFileSync142(join159(dir, f), "utf8"))?.[1]?.replace(/_test$/, "")).find(Boolean) : undefined), goPackageBrief = (repoDir, targetDir, runners, texts, importPathOf) => {
98626
+ `).filter((x10) => x10.trim()).slice(-12), CARGO_NOISE, cargoMergedDoctestOn = (env = process.env) => /^(1|on|true|yes)$/i.test((env["LOKI_E10_CARGO_MERGED_DOCTEST"] ?? "").trim()), DOCTEST_NOTE, cargoNoise = (l) => CARGO_NOISE.test(l) || cargoMergedDoctestOn() && DOCTEST_NOTE.test(l), GO_PKG_RE, GO_SRC, GO_DIR, GO_PKG_AFTER, GO_MAIN_BEFORE, GO_IDENT, GO_MAJOR, GO_KEYWORDS, goRel = (r) => r.replace(/^(?:\.\/)+/, ""), GO_NON_PKG_WORD, goIgnoredPath = (rel) => rel.split("/").some((g10) => g10 === "testdata" || g10.startsWith("_") || g10.startsWith(".")), goSiblingPkg = (dir) => existsSync113(dir) ? readdirSync52(dir).filter((f) => f.endsWith(".go") && !f.endsWith("_test.go")).map((f) => /^package\s+(\w+)/m.exec(readFileSync142(join159(dir, f), "utf8"))?.[1]).find(Boolean) : undefined, goDirPackage = (dir) => goSiblingPkg(dir) ?? (existsSync113(dir) ? readdirSync52(dir).filter((f) => f.endsWith("_test.go")).map((f) => /^package\s+(\w+)/m.exec(readFileSync142(join159(dir, f), "utf8"))?.[1]?.replace(/_test$/, "")).find(Boolean) : undefined), goPackageBrief = (repoDir, targetDir, runners, texts, importPathOf) => {
98488
98627
  if (!runners.includes("go"))
98489
98628
  return "";
98490
98629
  const p = plannedGoDir(repoDir, texts);
@@ -98726,7 +98865,7 @@ var init_check_result = __esm(() => {
98726
98865
  });
98727
98866
 
98728
98867
  // ../../loki-ts/src/council/finding_schema.ts
98729
- import { existsSync as existsSync114, readdirSync as readdirSync52, readFileSync as readFileSync143, statSync as statSync47 } from "fs";
98868
+ import { existsSync as existsSync114, readdirSync as readdirSync53, readFileSync as readFileSync143, statSync as statSync47 } from "fs";
98730
98869
  import { resolve as resolvePath3, dirname as dirname68, relative as relative35, isAbsolute as isAbsolute26, join as join160, sep as sep28 } from "path";
98731
98870
  import { fileURLToPath as fileURLToPath6 } from "url";
98732
98871
  function resolveSchemaDataDir(moduleDir = _moduleDir, candidates = SCHEMA_DATA_DIR_CANDIDATES) {
@@ -98764,7 +98903,7 @@ function staticLiterals() {
98764
98903
  if (_static)
98765
98904
  return _static;
98766
98905
  const out2 = { values: new Set, patterns: new Set };
98767
- for (const f of readdirSync52(_dataDir).filter((n10) => n10.endsWith("-schema.json"))) {
98906
+ for (const f of readdirSync53(_dataDir).filter((n10) => n10.endsWith("-schema.json"))) {
98768
98907
  try {
98769
98908
  collectLiterals(JSON.parse(readFileSync143(resolvePath3(_dataDir, f), "utf8")), out2);
98770
98909
  } catch {}
@@ -122000,7 +122139,7 @@ var init_opus_consult = __esm(() => {
122000
122139
  // ../../loki-ts/src/util/conflict_resume.ts
122001
122140
  import { createHash as createHash40 } from "crypto";
122002
122141
  import { execFileSync as execFileSync14 } from "child_process";
122003
- import { chmodSync as chmodSync8, existsSync as existsSync115, mkdirSync as mkdirSync88, mkdtempSync as mkdtempSync25, readdirSync as readdirSync53, readFileSync as readFileSync146, rmSync as rmSync50, statSync as statSync48, symlinkSync as symlinkSync6, writeFileSync as writeFileSync85 } from "fs";
122142
+ import { chmodSync as chmodSync8, existsSync as existsSync115, mkdirSync as mkdirSync88, mkdtempSync as mkdtempSync25, readdirSync as readdirSync54, readFileSync as readFileSync146, rmSync as rmSync50, statSync as statSync48, symlinkSync as symlinkSync6, writeFileSync as writeFileSync85 } from "fs";
122004
122143
  import { tmpdir as tmpdir33 } from "os";
122005
122144
  import { basename as basename47, dirname as dirname70, isAbsolute as isAbsolute28, join as join163, relative as relative36 } from "path";
122006
122145
  function answerMark(events2, assumeNext = false) {
@@ -122566,7 +122705,7 @@ async function resumeForPrecedence(ctx, first, firstSession, env2 = process.env)
122566
122705
  const sameDir = (p) => {
122567
122706
  try {
122568
122707
  const d = dirname70(p);
122569
- return readdirSync53(join163(ctx.repoDir, d)).slice(0, 60).map((f) => d === "." ? f : `${d}/${f}`);
122708
+ return readdirSync54(join163(ctx.repoDir, d)).slice(0, 60).map((f) => d === "." ? f : `${d}/${f}`);
122570
122709
  } catch {
122571
122710
  return [];
122572
122711
  }
@@ -122729,7 +122868,7 @@ __export(exports_run_outputs, {
122729
122868
  });
122730
122869
  import { execFile as execFile3, spawnSync as spawnSync27 } from "child_process";
122731
122870
  import { createHash as createHash41 } from "crypto";
122732
- import { existsSync as existsSync116, lstatSync as lstatSync36, mkdirSync as mkdirSync89, readdirSync as readdirSync54, readFileSync as readFileSync147, statSync as statSync49, writeFileSync as writeFileSync86 } from "fs";
122871
+ import { existsSync as existsSync116, lstatSync as lstatSync36, mkdirSync as mkdirSync89, readdirSync as readdirSync55, readFileSync as readFileSync147, statSync as statSync49, writeFileSync as writeFileSync86 } from "fs";
122733
122872
  import { basename as basename48, join as join164, resolve as resolve45 } from "path";
122734
122873
  function intentRevisionsBlock(revs) {
122735
122874
  const r = (revs ?? []).filter((r10) => r10.unapplied !== true).map(({ rev, source, actor, sha: sha6 }) => ({ rev, source, actor, sha: sha6 }));
@@ -122907,7 +123046,7 @@ function findInterrupted(repoDir, runId2, includeCancelled = false, why) {
122907
123046
  const root = join164(repoDir, ".loki", "runs");
122908
123047
  let ids = [];
122909
123048
  try {
122910
- ids = runId2 ? [runId2] : readdirSync54(root);
123049
+ ids = runId2 ? [runId2] : readdirSync55(root);
122911
123050
  } catch {
122912
123051
  return null;
122913
123052
  }
@@ -123629,7 +123768,7 @@ function prWorkflowsSkipping(repoDir, base2) {
123629
123768
  let runs2 = false;
123630
123769
  let files = [];
123631
123770
  try {
123632
- files = readdirSync54(dir).filter((f) => /\.ya?ml$/.test(f)).sort();
123771
+ files = readdirSync55(dir).filter((f) => /\.ya?ml$/.test(f)).sort();
123633
123772
  } catch {
123634
123773
  return [];
123635
123774
  }
@@ -123669,7 +123808,7 @@ function tierSealFor(repoDir, runId2) {
123669
123808
  };
123670
123809
  let dirs = [];
123671
123810
  try {
123672
- dirs = readdirSync54(root).sort().slice(-200);
123811
+ dirs = readdirSync55(root).sort().slice(-200);
123673
123812
  } catch {}
123674
123813
  for (const d of dirs) {
123675
123814
  const own = shapeKeyForRun(repoDir, join164(root, d), true), receipt = own === null ? null : read3(d);
@@ -134947,7 +135086,7 @@ function mount20(ctx) {
134947
135086
  }
134948
135087
 
134949
135088
  // src/server/routes/verify.ts
134950
- import { readFileSync as readFileSync150, realpathSync as realpathSync43 } from "fs";
135089
+ import { readFileSync as readFileSync150, realpathSync as realpathSync44 } from "fs";
134951
135090
  import { createPublicKey as createPublicKey9 } from "crypto";
134952
135091
  import { join as join167, sep as sep29 } from "path";
134953
135092
  init_verify_cmd();
@@ -134976,11 +135115,11 @@ function mount21(ctx) {
134976
135115
  return done(404, "receipt not available", "not_found");
134977
135116
  let runDir, file;
134978
135117
  try {
134979
- const root = realpathSync43(join167(repo.p, ".loki", "runs"));
134980
- runDir = realpathSync43(join167(root, run2));
135118
+ const root = realpathSync44(join167(repo.p, ".loki", "runs"));
135119
+ runDir = realpathSync44(join167(root, run2));
134981
135120
  if (runDir !== join167(root, run2))
134982
135121
  return done(404, "receipt not found", "not_found");
134983
- file = realpathSync43(join167(runDir, "receipt.json"));
135122
+ file = realpathSync44(join167(runDir, "receipt.json"));
134984
135123
  } catch {
134985
135124
  return done(404, "receipt not found", "not_found");
134986
135125
  }