loki-mode 11.152.0 → 11.153.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 (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/loki-ts/dist/loki.js +1880 -1878
  7. package/mcp/__init__.py +1 -1
  8. package/package.json +2 -2
  9. package/packages/control-plane/dist/server.js +595 -517
  10. package/packages/control-plane/src/server/repos.ts +8 -0
  11. package/packages/control-plane/src/server/routes/start.ts +11 -1
  12. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  13. package/web-app/dist/assets/{AdminPage-PE4AZL7D.js → AdminPage-DbZu7ddP.js} +1 -1
  14. package/web-app/dist/assets/{Avatar-DSKSMtms.js → Avatar-DAUwn6hI.js} +1 -1
  15. package/web-app/dist/assets/{Badge-B7MenaNC.js → Badge-jfM-X3V8.js} +1 -1
  16. package/web-app/dist/assets/{Button-w1Dkly6r.js → Button-DPQtwxuu.js} +1 -1
  17. package/web-app/dist/assets/{CockpitPage-BDzgc_cw.js → CockpitPage-_R18YJ80.js} +1 -1
  18. package/web-app/dist/assets/{ComparePage-C1lxtIqD.js → ComparePage-B8G0ncAB.js} +1 -1
  19. package/web-app/dist/assets/{ErrorBoundary-CIUKkW3v.js → ErrorBoundary-BfsmlmUv.js} +1 -1
  20. package/web-app/dist/assets/{EvidenceReceiptPanel-3irfwXn0.js → EvidenceReceiptPanel-C2cDyG7P.js} +1 -1
  21. package/web-app/dist/assets/{GitHubIssuesPanel-8-YcImUk.js → GitHubIssuesPanel-m_epB_9T.js} +1 -1
  22. package/web-app/dist/assets/{GitHubPRsPanel-CYFJPXlS.js → GitHubPRsPanel-C3e2E4tR.js} +1 -1
  23. package/web-app/dist/assets/{HomePage-CHmilgoW.js → HomePage-DufEN9yU.js} +2 -2
  24. package/web-app/dist/assets/{LoginPage-B4iVxWhF.js → LoginPage-B9crVo53.js} +1 -1
  25. package/web-app/dist/assets/{MagicPage-Ds1hWKs_.js → MagicPage-D2CxnNve.js} +1 -1
  26. package/web-app/dist/assets/{MetricsPage-CSmj9i-9.js → MetricsPage-CB89RXmW.js} +1 -1
  27. package/web-app/dist/assets/{NotFoundPage-BwYGtThw.js → NotFoundPage-DsT1R9Nv.js} +1 -1
  28. package/web-app/dist/assets/{ProjectPage-CQcyfWrI.js → ProjectPage-DUB7qHau.js} +3 -3
  29. package/web-app/dist/assets/{ProjectsPage-BofiyP0N.js → ProjectsPage-BGXk5sdH.js} +1 -1
  30. package/web-app/dist/assets/{SettingsPage-yBZ6gtRW.js → SettingsPage-CM-HClE1.js} +1 -1
  31. package/web-app/dist/assets/{ShowcasePage-CAQ2Eyxi.js → ShowcasePage-bIdIymaJ.js} +1 -1
  32. package/web-app/dist/assets/{SystemSettingsPage-C7oyc5yv.js → SystemSettingsPage-Cepwl537.js} +1 -1
  33. package/web-app/dist/assets/{TeamsPage-CmEMd8pi.js → TeamsPage-BxtK3rw2.js} +1 -1
  34. package/web-app/dist/assets/{TemplatesPage-DHDNJt4B.js → TemplatesPage-qwpDk5T0.js} +1 -1
  35. package/web-app/dist/assets/{TerminalOutput-CvVB75WD.js → TerminalOutput-BnM3M3pB.js} +1 -1
  36. package/web-app/dist/assets/{activity-YWe5HHl1.js → activity-CawceXZd.js} +1 -1
  37. package/web-app/dist/assets/{bell-S1cFZU3e.js → bell-CsKWxejH.js} +1 -1
  38. package/web-app/dist/assets/{bot-DFLqlRci.js → bot-D3510Z28.js} +1 -1
  39. package/web-app/dist/assets/{check-CMSz_WCA.js → check-C2LOCCOY.js} +1 -1
  40. package/web-app/dist/assets/{chevron-left-D0OYlQoM.js → chevron-left-BB9kFeem.js} +1 -1
  41. package/web-app/dist/assets/{circle-alert-Cpkys85L.js → circle-alert-B2Cp1Ig9.js} +1 -1
  42. package/web-app/dist/assets/{clock-aWGlxAfo.js → clock-CMyPpDIq.js} +1 -1
  43. package/web-app/dist/assets/{cloud-BoQ1ukGN.js → cloud-PSbWAP8z.js} +1 -1
  44. package/web-app/dist/assets/{code-xml-DE1cQQY-.js → code-xml-BrxGLiE7.js} +1 -1
  45. package/web-app/dist/assets/{database-0mNn2gEZ.js → database-Dvb3EBwQ.js} +1 -1
  46. package/web-app/dist/assets/{dollar-sign-DhVHLdXn.js → dollar-sign-B04ktJSv.js} +1 -1
  47. package/web-app/dist/assets/{file-code-corner-Kdhlthsx.js → file-code-corner-CohHD1q-.js} +1 -1
  48. package/web-app/dist/assets/{file-plus-DC8Ol12M.js → file-plus-CNXxBPL0.js} +1 -1
  49. package/web-app/dist/assets/{globe-Dc20I0TQ.js → globe-VbFCeKXo.js} +1 -1
  50. package/web-app/dist/assets/{hammer-bQSO5V22.js → hammer-zDl_5fsf.js} +1 -1
  51. package/web-app/dist/assets/{index-qo4plPi9.js → index-B9FaIM3t.js} +3 -3
  52. package/web-app/dist/assets/{layers-Cpg61897.js → layers-ybdXw7tA.js} +1 -1
  53. package/web-app/dist/assets/{loader-circle-CWrV4VSZ.js → loader-circle-Df0W4piv.js} +1 -1
  54. package/web-app/dist/assets/{lock-BUAbIFbd.js → lock-BwHhoraW.js} +1 -1
  55. package/web-app/dist/assets/{package-D9crdKwa.js → package-DvX-5_gZ.js} +1 -1
  56. package/web-app/dist/assets/{plus-DQ47s2Pu.js → plus-C8BtEtIx.js} +1 -1
  57. package/web-app/dist/assets/{refresh-cw-BpPNEb-w.js → refresh-cw-DzlXJr-S.js} +1 -1
  58. package/web-app/dist/assets/{rotate-ccw-BlGqvWmT.js → rotate-ccw-CEzK4HJF.js} +1 -1
  59. package/web-app/dist/assets/{scroll-text-CdoJqUVY.js → scroll-text-c7tRHJkn.js} +1 -1
  60. package/web-app/dist/assets/{server-DAeMHIWE.js → server-kPzCaOGi.js} +1 -1
  61. package/web-app/dist/assets/{shield-alert-Nog-1UpV.js → shield-alert-5XEfb5as.js} +1 -1
  62. package/web-app/dist/assets/{thumbs-up-aKWWv11P.js → thumbs-up-ZMTB2fvb.js} +1 -1
  63. package/web-app/dist/assets/{trash-2-CdLQoGGx.js → trash-2-C_NKhJ52.js} +1 -1
  64. package/web-app/dist/assets/{trending-down-CHMgoZbL.js → trending-down-B5RqvF8F.js} +1 -1
  65. package/web-app/dist/assets/{trending-up-CE85XyXv.js → trending-up-BRi1caL4.js} +1 -1
  66. package/web-app/dist/assets/{upload-7eXHbK2F.js → upload-DVYE4Uwe.js} +1 -1
  67. package/web-app/dist/assets/{usePolling-DJo4_OMt.js → usePolling-CJhQhw27.js} +1 -1
  68. package/web-app/dist/assets/{user-DvywwLv_.js → user-DbKPy6Y-.js} +1 -1
  69. package/web-app/dist/index.html +1 -1
@@ -9824,7 +9824,7 @@ var init_retry_class = __esm(() => {
9824
9824
  // ../../loki-ts/src/runner/worker_proc.ts
9825
9825
  import { spawn as spawn7, spawnSync as spawnSync2 } from "child_process";
9826
9826
  import { createInterface } from "readline";
9827
- import { join as join32, resolve as resolve9 } from "path";
9827
+ import { join as join32, resolve as resolve10 } from "path";
9828
9828
  import { accessSync, chmodSync as chmodSync4, constants as fsConstants2, existsSync as existsSync17, mkdirSync as mkdirSync11, mkdtempSync as mkdtempSync4, readdirSync as readdirSync14, readFileSync as readFileSync24, readlinkSync, realpathSync as realpathSync14, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "fs";
9829
9829
  import { randomBytes as randomBytes3 } from "crypto";
9830
9830
  import { tmpdir as tmpdir6 } from "os";
@@ -9882,7 +9882,7 @@ function pinBashShellEnv(env, canExec = isExecutable) {
9882
9882
  env["SHELL"] = POSIX_BASH;
9883
9883
  }
9884
9884
  function envWithPwd(env, cwd) {
9885
- return cwd === undefined ? env : { ...env, PWD: resolve9(cwd) };
9885
+ return cwd === undefined ? env : { ...env, PWD: resolve10(cwd) };
9886
9886
  }
9887
9887
  function ulimitArgv(argv, env) {
9888
9888
  const set = ULIMIT_KNOBS.filter(([name]) => env[name] !== undefined && env[name] !== "");
@@ -9900,16 +9900,16 @@ function ulimitArgv(argv, env) {
9900
9900
  return [LIMIT_SHELL, "-c", script, "sh", ...values, ...argv];
9901
9901
  }
9902
9902
  function spawnWorker(argv, env, cwd, backstopMs, escalateMs, onLine, onStopped = () => {}) {
9903
- return new Promise((resolve10) => {
9903
+ return new Promise((resolve11) => {
9904
9904
  if (!argv[0])
9905
- return resolve10({ code: null, killed: false });
9905
+ return resolve11({ code: null, killed: false });
9906
9906
  let wrapped;
9907
9907
  try {
9908
9908
  wrapped = ulimitArgv(argv, env);
9909
9909
  } catch (e) {
9910
9910
  process.stderr.write(`${e.message}
9911
9911
  `);
9912
- return resolve10({ code: ULIMIT_REFUSED_EXIT, killed: false });
9912
+ return resolve11({ code: ULIMIT_REFUSED_EXIT, killed: false });
9913
9913
  }
9914
9914
  const [cmd, ...args] = wrapped;
9915
9915
  const child = spawn7(cmd, args, { cwd, env: envWithPwd(env, cwd), stdio: ["ignore", "pipe", "inherit"], detached: true });
@@ -9946,7 +9946,7 @@ function spawnWorker(argv, env, cwd, backstopMs, escalateMs, onLine, onStopped =
9946
9946
  child.stdout?.destroy();
9947
9947
  killGroup2(child.pid, "SIGKILL");
9948
9948
  onStopped(cancelled2 !== undefined);
9949
- resolve10({ code, killed, ...cancelled2 ? { cancelled: cancelled2 } : {} });
9949
+ resolve11({ code, killed, ...cancelled2 ? { cancelled: cancelled2 } : {} });
9950
9950
  };
9951
9951
  timers.push(setTimeout(() => {
9952
9952
  killed = true;
@@ -10970,7 +10970,7 @@ var init_stack_tools = __esm(() => {
10970
10970
 
10971
10971
  // ../../loki-ts/src/util/dotnet_test.ts
10972
10972
  import { existsSync as existsSync21, readFileSync as readFileSync29 } from "fs";
10973
- import { basename as basename8, join as join37 } from "path";
10973
+ import { basename as basename9, join as join37 } from "path";
10974
10974
  function dotnetSummary(text2) {
10975
10975
  const ls2 = text2.split(`
10976
10976
  `).map((l) => l.trimEnd());
@@ -11031,7 +11031,7 @@ function dotnetClasses(file) {
11031
11031
  text2 = readFileSync29(file, "utf8");
11032
11032
  } catch {}
11033
11033
  const found = [...new Set([...text2.matchAll(/\bclass\s+([A-Za-z_]\w*)/g)].map((m) => m[1]))];
11034
- return found.length ? found : [basename8(file, ".cs")];
11034
+ return found.length ? found : [basename9(file, ".cs")];
11035
11035
  }
11036
11036
  function dotnetTestCmd(repoDir, testRel) {
11037
11037
  const proj = dotnetProjectOf(repoDir, testRel) ?? dotnetTarget(repoDir), filter = dotnetClasses(join37(repoDir, testRel)).map((c) => `FullyQualifiedName~${c}`).join("|");
@@ -11066,12 +11066,12 @@ var init_wall_knobs = __esm(() => {
11066
11066
  // ../../loki-ts/src/util/producer_fingerprint.ts
11067
11067
  import { createHash as createHash7 } from "crypto";
11068
11068
  import { readdirSync as readdirSync17, readFileSync as readFileSync30 } from "fs";
11069
- import { relative as relative2, resolve as resolve10 } from "path";
11069
+ import { relative as relative2, resolve as resolve11 } from "path";
11070
11070
  function sourceFingerprint(root) {
11071
11071
  const h = createHash7("sha256");
11072
11072
  const walk = (dir) => {
11073
11073
  for (const e of readdirSync17(dir, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : 1)) {
11074
- const p = resolve10(dir, e.name);
11074
+ const p = resolve11(dir, e.name);
11075
11075
  if (e.isDirectory()) {
11076
11076
  if (e.name !== "node_modules")
11077
11077
  walk(p);
@@ -11082,7 +11082,7 @@ function sourceFingerprint(root) {
11082
11082
  walk(root);
11083
11083
  return h.digest("hex");
11084
11084
  }
11085
- function computeProducerFingerprint(root = resolve10(import.meta.dir, ".."), injected = globalThis.__LOKI_PRODUCER_FP__) {
11085
+ function computeProducerFingerprint(root = resolve11(import.meta.dir, ".."), injected = globalThis.__LOKI_PRODUCER_FP__) {
11086
11086
  if (typeof injected === "string" && /^[0-9a-f]{64}$/.test(injected))
11087
11087
  return injected;
11088
11088
  try {
@@ -11099,17 +11099,17 @@ var init_producer_fingerprint = () => {};
11099
11099
 
11100
11100
  // ../../loki-ts/src/engine10/cache.ts
11101
11101
  import { createHash as createHash8 } from "crypto";
11102
- import { chmodSync as chmodSync5, existsSync as existsSync22, mkdirSync as mkdirSync14, readdirSync as readdirSync18, readFileSync as readFileSync31, renameSync as renameSync6, statSync as statSync14, unlinkSync as unlinkSync4, writeFileSync as writeFileSync15 } from "fs";
11103
- import { basename as basename9, resolve as resolve11 } from "path";
11102
+ import { chmodSync as chmodSync5, existsSync as existsSync22, mkdirSync as mkdirSync14, readdirSync as readdirSync18, readFileSync as readFileSync31, renameSync as renameSync6, statSync as statSync15, unlinkSync as unlinkSync4, writeFileSync as writeFileSync15 } from "fs";
11103
+ import { basename as basename10, resolve as resolve12 } from "path";
11104
11104
  function repoKey(originUrl, repoDir) {
11105
- const basis = originUrl && originUrl.trim() !== "" ? originUrl : resolve11(repoDir);
11105
+ const basis = originUrl && originUrl.trim() !== "" ? originUrl : resolve12(repoDir);
11106
11106
  return createHash8("sha256").update(basis).digest("hex");
11107
11107
  }
11108
11108
  function defaultCacheRoot() {
11109
- return resolve11(homeLokiDir(), "cache", "v10");
11109
+ return resolve12(homeLokiDir(), "cache", "v10");
11110
11110
  }
11111
11111
  function repoCacheDir(key, cacheRoot = defaultCacheRoot()) {
11112
- return resolve11(cacheRoot, key);
11112
+ return resolve12(cacheRoot, key);
11113
11113
  }
11114
11114
  function readJson3(path, isValid = (_v) => true) {
11115
11115
  if (!existsSync22(path))
@@ -11145,15 +11145,15 @@ function writeJson(path, dir, data) {
11145
11145
  function pruneCache(dir, prefix, keepPath, keep = prefix === "slice-" ? 500 : 5) {
11146
11146
  const mt = (f) => {
11147
11147
  try {
11148
- return statSync14(resolve11(dir, f)).mtimeMs;
11148
+ return statSync15(resolve12(dir, f)).mtimeMs;
11149
11149
  } catch {
11150
11150
  return 0;
11151
11151
  }
11152
11152
  };
11153
11153
  try {
11154
- readdirSync18(dir).filter((f) => f.startsWith(prefix) && f.endsWith(".json") && f !== basename9(keepPath)).sort((x, y) => mt(y) - mt(x) || (x < y ? 1 : -1)).slice(keep - 1).forEach((f) => {
11154
+ readdirSync18(dir).filter((f) => f.startsWith(prefix) && f.endsWith(".json") && f !== basename10(keepPath)).sort((x, y) => mt(y) - mt(x) || (x < y ? 1 : -1)).slice(keep - 1).forEach((f) => {
11155
11155
  try {
11156
- unlinkSync4(resolve11(dir, f));
11156
+ unlinkSync4(resolve12(dir, f));
11157
11157
  } catch {}
11158
11158
  });
11159
11159
  } catch {}
@@ -11176,10 +11176,10 @@ var tmpSeq = 0, LEGACY_PREFIX, writeAndPrune = (path, dir, prefix, data) => {
11176
11176
  const old = LEGACY_PREFIX[prefix];
11177
11177
  if (old)
11178
11178
  pruneCache(dir, old, path, 1);
11179
- }, cacheFileName = (kind, tree, fp = producerFingerprint()) => `${kind}-${fp.slice(0, 16)}-${tree}.json`, readRepoMapCache = (dir, tree, fp = producerFingerprint()) => readJson3(resolve11(dir, cacheFileName("repomap", tree, fp)), isRepoMap), writeRepoMapCache = (dir, tree, map, fp = producerFingerprint()) => writeAndPrune(resolve11(dir, cacheFileName("repomap", tree, fp)), dir, "repomap-", map), readTestMapCache = (dir, tree, fp = producerFingerprint()) => readJson3(resolve11(dir, cacheFileName("testmap", tree, fp)), isTestMap), writeTestMapCache = (dir, tree, map, fp = producerFingerprint()) => writeAndPrune(resolve11(dir, cacheFileName("testmap", tree, fp)), dir, "testmap-", map), cacheStats, cachedRepoMap = (dir, tree, build, fp = producerFingerprint()) => viaCache(readRepoMapCache(dir, tree, fp), build, (m) => writeRepoMapCache(dir, tree, m, fp)), sliceKey = (card, baseSha) => createHash8("sha256").update(`${card.length}:${card}\x00${baseSha}`).digest("hex"), isJournalEntry = (v) => {
11179
+ }, cacheFileName = (kind, tree, fp = producerFingerprint()) => `${kind}-${fp.slice(0, 16)}-${tree}.json`, readRepoMapCache = (dir, tree, fp = producerFingerprint()) => readJson3(resolve12(dir, cacheFileName("repomap", tree, fp)), isRepoMap), writeRepoMapCache = (dir, tree, map, fp = producerFingerprint()) => writeAndPrune(resolve12(dir, cacheFileName("repomap", tree, fp)), dir, "repomap-", map), readTestMapCache = (dir, tree, fp = producerFingerprint()) => readJson3(resolve12(dir, cacheFileName("testmap", tree, fp)), isTestMap), writeTestMapCache = (dir, tree, map, fp = producerFingerprint()) => writeAndPrune(resolve12(dir, cacheFileName("testmap", tree, fp)), dir, "testmap-", map), cacheStats, cachedRepoMap = (dir, tree, build, fp = producerFingerprint()) => viaCache(readRepoMapCache(dir, tree, fp), build, (m) => writeRepoMapCache(dir, tree, m, fp)), sliceKey = (card, baseSha) => createHash8("sha256").update(`${card.length}:${card}\x00${baseSha}`).digest("hex"), isJournalEntry = (v) => {
11180
11180
  const e = v;
11181
11181
  return typeof e === "object" && e !== null && typeof e.gid === "string" && typeof e.id === "string" && typeof e.head === "string" && Number.isInteger(e.n);
11182
- }, readSliceJournal = (dir, key) => readJson3(resolve11(dir, `slice-${key}.json`), isJournalEntry), writeSliceJournal = (dir, key, entry) => writeAndPrune(resolve11(dir, `slice-${key}.json`), dir, "slice-", entry);
11182
+ }, readSliceJournal = (dir, key) => readJson3(resolve12(dir, `slice-${key}.json`), isJournalEntry), writeSliceJournal = (dir, key, entry) => writeAndPrune(resolve12(dir, `slice-${key}.json`), dir, "slice-", entry);
11183
11183
  var init_cache = __esm(() => {
11184
11184
  init_paths();
11185
11185
  init_producer_fingerprint();
@@ -11189,7 +11189,7 @@ var init_cache = __esm(() => {
11189
11189
 
11190
11190
  // ../../loki-ts/src/util/lock_ecosystems.ts
11191
11191
  import { existsSync as existsSync23, readdirSync as readdirSync19, readFileSync as readFileSync32 } from "fs";
11192
- import { basename as basename10, dirname as dirname11, join as join38 } from "path";
11192
+ import { basename as basename11, dirname as dirname11, join as join38 } from "path";
11193
11193
  function isYarnBerry(dir) {
11194
11194
  if (existsSync23(join38(dir, ".yarnrc.yml")))
11195
11195
  return true;
@@ -11239,7 +11239,7 @@ function declaredPythonDeps(repoDir, manifests) {
11239
11239
  } catch {
11240
11240
  continue;
11241
11241
  }
11242
- const base = basename10(f), lines = t.split(`
11242
+ const base = basename11(f), lines = t.split(`
11243
11243
  `);
11244
11244
  if (base.endsWith(".txt")) {
11245
11245
  for (const l of lines)
@@ -11427,7 +11427,7 @@ function exportsDiverge(x) {
11427
11427
  return "import" in o && "require" in o && JSON.stringify(o["import"]) !== JSON.stringify(o["require"]) || Object.values(o).some(exportsDiverge);
11428
11428
  }
11429
11429
  function addedManifestOk(f, c, wall, esc, notes) {
11430
- if (basename10(f) !== "package.json" || dirname11(f) === "." || !c.wallPassedN)
11430
+ if (basename11(f) !== "package.json" || dirname11(f) === "." || !c.wallPassedN)
11431
11431
  return false;
11432
11432
  const dir = dirname11(f), g = (a) => {
11433
11433
  try {
@@ -11476,7 +11476,7 @@ function addedManifestOk(f, c, wall, esc, notes) {
11476
11476
  if (all === null)
11477
11477
  return false;
11478
11478
  const baseManifests = all.split(`
11479
- `).filter((p) => basename10(p) === "package.json" && !p.split("/").includes("node_modules"));
11479
+ `).filter((p) => basename11(p) === "package.json" && !p.split("/").includes("node_modules"));
11480
11480
  if (baseManifests.length > MAX_BASE_MANIFESTS)
11481
11481
  return false;
11482
11482
  const baseNames = new Set, baseDeps = new Set;
@@ -11951,9 +11951,9 @@ var init_runner_boot = __esm(() => {
11951
11951
  });
11952
11952
 
11953
11953
  // ../../loki-ts/src/util/test_file_text.ts
11954
- import { basename as basename11, dirname as dirname12 } from "path";
11954
+ import { basename as basename12, dirname as dirname12 } from "path";
11955
11955
  function isTestFile(rel) {
11956
- const name = basename11(rel);
11956
+ const name = basename12(rel);
11957
11957
  return JS_TEST_RE.test(name) || PY_TEST_RE.test(name) || GO_TEST_RE.test(name) || RS_TEST_RE.test(rel) || SH_TEST_RE.test(rel) || /^test[-_].+\.(sh|bash)$/.test(name) || JAVA_TEST_RE.test(rel) || CS_TEST_RE.test(rel);
11958
11958
  }
11959
11959
  function detectFromPackageJson(text3, rel, mark) {
@@ -12007,7 +12007,7 @@ function referencedBasenames(text3) {
12007
12007
  return out2;
12008
12008
  }
12009
12009
  function coveredStem(testPath) {
12010
- const name = basename11(testPath);
12010
+ const name = basename12(testPath);
12011
12011
  if (JS_TEST_RE.test(name))
12012
12012
  return name.replace(JS_TEST_RE, "");
12013
12013
  if (/\.(?:java|cs)$/.test(name))
@@ -12017,7 +12017,7 @@ function coveredStem(testPath) {
12017
12017
  return name.replace(/_test\.(py|go)$/, "");
12018
12018
  }
12019
12019
  function scopeRunnersByPackage(files, evidence, jsText, api, order2, read, marks) {
12020
- const roots = [...new Set([".", ...api?.packages().map((p) => p.root) ?? [], ...files.filter((f) => basename11(f) === "package.json").map((f) => dirname12(f))])];
12020
+ const roots = [...new Set([".", ...api?.packages().map((p) => p.root) ?? [], ...files.filter((f) => basename12(f) === "package.json").map((f) => dirname12(f))])];
12021
12021
  const ownerRoot = (file) => api?.packageRootOf(file) ?? roots.filter((p) => p === "." || file.startsWith(`${p}/`)).sort((a, b) => b.length - a.length)[0] ?? ".";
12022
12022
  const packageRunners = new Map;
12023
12023
  for (const pkgRoot of roots) {
@@ -12098,7 +12098,7 @@ var init_test_file_text = __esm(() => {
12098
12098
  });
12099
12099
 
12100
12100
  // ../../loki-ts/src/util/context_pack.ts
12101
- import { closeSync as closeSync8, openSync as openSync8, readdirSync as readdirSync20, readFileSync as readFileSync34, readSync as readSync7, statSync as statSync15 } from "fs";
12101
+ import { closeSync as closeSync8, openSync as openSync8, readdirSync as readdirSync20, readFileSync as readFileSync34, readSync as readSync7, statSync as statSync16 } from "fs";
12102
12102
  import { join as join41 } from "path";
12103
12103
  function langOf(path) {
12104
12104
  if (/\.[cm]?[jt]sx?$/.test(path))
@@ -13174,10 +13174,10 @@ __export(exports_claude_model, {
13174
13174
  DEFAULT_SESSION_MODEL: () => DEFAULT_SESSION_MODEL
13175
13175
  });
13176
13176
  import { readFileSync as readFileSync35 } from "fs";
13177
- import { resolve as resolve12 } from "path";
13177
+ import { resolve as resolve13 } from "path";
13178
13178
  function resolveClaudeModel(want) {
13179
13179
  try {
13180
- const path = process.env["LOKI_MODEL_CATALOG"] || resolve12(REPO_ROOT, "providers/model_catalog.json");
13180
+ const path = process.env["LOKI_MODEL_CATALOG"] || resolve13(REPO_ROOT, "providers/model_catalog.json");
13181
13181
  return JSON.parse(readFileSync35(path, "utf8")).providers?.claude?.cli_aliases?.[want] ?? want;
13182
13182
  } catch {
13183
13183
  return want;
@@ -13188,7 +13188,7 @@ function isUnresolvedClaudeAlias(model) {
13188
13188
  }
13189
13189
  function claudeTierRank(model) {
13190
13190
  try {
13191
- const path = process.env["LOKI_MODEL_CATALOG"] || resolve12(REPO_ROOT, "providers/model_catalog.json");
13191
+ const path = process.env["LOKI_MODEL_CATALOG"] || resolve13(REPO_ROOT, "providers/model_catalog.json");
13192
13192
  const models = JSON.parse(readFileSync35(path, "utf8")).providers?.claude?.models;
13193
13193
  if (!Array.isArray(models))
13194
13194
  return null;
@@ -13206,7 +13206,7 @@ function claudeTierRank(model) {
13206
13206
  }
13207
13207
  function claudeEffortLevels(model) {
13208
13208
  try {
13209
- const path = process.env["LOKI_MODEL_CATALOG"] || resolve12(REPO_ROOT, "providers/model_catalog.json");
13209
+ const path = process.env["LOKI_MODEL_CATALOG"] || resolve13(REPO_ROOT, "providers/model_catalog.json");
13210
13210
  const models = JSON.parse(readFileSync35(path, "utf8")).providers?.claude?.models;
13211
13211
  if (!Array.isArray(models))
13212
13212
  return null;
@@ -13219,7 +13219,7 @@ function claudeEffortLevels(model) {
13219
13219
  }
13220
13220
  function claudeThinkingSpec(model) {
13221
13221
  try {
13222
- const path = process.env["LOKI_MODEL_CATALOG"] || resolve12(REPO_ROOT, "providers/model_catalog.json");
13222
+ const path = process.env["LOKI_MODEL_CATALOG"] || resolve13(REPO_ROOT, "providers/model_catalog.json");
13223
13223
  const models = JSON.parse(readFileSync35(path, "utf8")).providers?.claude?.models;
13224
13224
  if (!Array.isArray(models))
13225
13225
  return null;
@@ -13540,7 +13540,7 @@ var init_watchdog = __esm(() => {
13540
13540
 
13541
13541
  // ../../loki-ts/src/util/anti_loop.ts
13542
13542
  import { createHash as createHash9 } from "crypto";
13543
- import { readFileSync as readFileSync36, statSync as statSync16 } from "fs";
13543
+ import { readFileSync as readFileSync36, statSync as statSync17 } from "fs";
13544
13544
  import { join as join43 } from "path";
13545
13545
  function treeFingerprint(repoDir, baseSha) {
13546
13546
  try {
@@ -13550,7 +13550,7 @@ function treeFingerprint(repoDir, baseSha) {
13550
13550
  for (const f of fresh) {
13551
13551
  h.update(`\x00${f}\x00`);
13552
13552
  const path = join43(repoDir, f);
13553
- if (statSync16(path).size > MAX_BUFFER)
13553
+ if (statSync17(path).size > MAX_BUFFER)
13554
13554
  return null;
13555
13555
  h.update(readFileSync36(path));
13556
13556
  }
@@ -13592,7 +13592,7 @@ function diffSignature(cwd, stat, untrackedRaw = untrackedList(cwd)) {
13592
13592
  if (n3++ >= 1000)
13593
13593
  return;
13594
13594
  try {
13595
- const st = statSync16(join43(dir, f));
13595
+ const st = statSync17(join43(dir, f));
13596
13596
  bytes += st.size;
13597
13597
  if (st.mtimeMs > newest)
13598
13598
  newest = st.mtimeMs;
@@ -13614,7 +13614,7 @@ var init_anti_loop = __esm(() => {
13614
13614
 
13615
13615
  // ../../loki-ts/src/runner/session_resume.ts
13616
13616
  import { existsSync as existsSync24, mkdirSync as mkdirSync15, readdirSync as readdirSync21, readFileSync as readFileSync37, renameSync as renameSync7, rmSync as rmSync8, writeFileSync as writeFileSync16 } from "fs";
13617
- import { basename as basename12, dirname as dirname13, join as join44 } from "path";
13617
+ import { basename as basename13, dirname as dirname13, join as join44 } from "path";
13618
13618
  function readFirstTurnTokens(repoDir, iterationId) {
13619
13619
  try {
13620
13620
  const v = JSON.parse(readFileSync37(join44(repoDir, ".loki", "metrics", `result-cost-${iterationId}.json`), "utf8")).first_turn_prompt_tokens;
@@ -13660,7 +13660,7 @@ function migrateSessionFiles(repoDir, isLive = () => false) {
13660
13660
  }
13661
13661
  for (const name of names) {
13662
13662
  const iter = name.slice("e10-session-".length, -".json".length), from = legacySessionPath(repoDir, iter), dest = sessionFilePath(repoDir, iter), destDir = dirname13(dest);
13663
- if (basename12(dirname13(destDir)) === "runs" && isLive(destDir))
13663
+ if (basename13(dirname13(destDir)) === "runs" && isLive(destDir))
13664
13664
  continue;
13665
13665
  try {
13666
13666
  mkdirSync15(destDir, { recursive: true });
@@ -13795,7 +13795,7 @@ var init_session_resume = __esm(() => {
13795
13795
  });
13796
13796
 
13797
13797
  // ../../loki-ts/src/project_model/schema.ts
13798
- import { existsSync as existsSync25, lstatSync as lstatSync8, realpathSync as realpathSync15, statSync as statSync17 } from "fs";
13798
+ import { existsSync as existsSync25, lstatSync as lstatSync8, realpathSync as realpathSync15, statSync as statSync18 } from "fs";
13799
13799
  import { isAbsolute, join as join45, normalize, sep as sep10 } from "path";
13800
13800
  function safeRel(p) {
13801
13801
  const n3 = normalize(p.trim()).split(sep10).join("/").replace(/\/$/, "");
@@ -13819,7 +13819,7 @@ function checkCitation(repoDir, raw2) {
13819
13819
  if (rel === null)
13820
13820
  return `citation "${raw2}" is not a repo-relative path`;
13821
13821
  const abs = join45(repoDir, rel);
13822
- if (!existsSync25(abs) || !statSync17(abs).isFile() || !insideRepo(repoDir, rel))
13822
+ if (!existsSync25(abs) || !statSync18(abs).isFile() || !insideRepo(repoDir, rel))
13823
13823
  return `citation "${raw2}" names a file that does not exist`;
13824
13824
  return null;
13825
13825
  }
@@ -13859,7 +13859,7 @@ function checkDir(repoDir, v, where, errs) {
13859
13859
  return ".";
13860
13860
  }
13861
13861
  const abs = join45(repoDir, rel);
13862
- if (!existsSync25(abs) || !statSync17(abs).isDirectory() || !insideRepo(repoDir, rel))
13862
+ if (!existsSync25(abs) || !statSync18(abs).isDirectory() || !insideRepo(repoDir, rel))
13863
13863
  errs.push(`${where}: directory "${rel}" does not exist`);
13864
13864
  return rel;
13865
13865
  }
@@ -13988,10 +13988,10 @@ __export(exports_receipt_signer, {
13988
13988
  DEPLOY_SCHEMA: () => DEPLOY_SCHEMA
13989
13989
  });
13990
13990
  import { createHash as createHash10, randomBytes as randomBytes4, createPrivateKey, createPublicKey as createPublicKey2, generateKeyPairSync, sign, verify as verify2 } from "crypto";
13991
- import { chmodSync as chmodSync6, linkSync, mkdirSync as mkdirSync16, readdirSync as readdirSync22, readFileSync as readFileSync38, renameSync as renameSync8, statSync as statSync18, unlinkSync as unlinkSync5, writeFileSync as writeFileSync17 } from "fs";
13991
+ import { chmodSync as chmodSync6, linkSync, mkdirSync as mkdirSync16, readdirSync as readdirSync22, readFileSync as readFileSync38, renameSync as renameSync8, statSync as statSync19, unlinkSync as unlinkSync5, writeFileSync as writeFileSync17 } from "fs";
13992
13992
  import { homedir as homedir10 } from "os";
13993
13993
  import { spawnSync as spawnSync4 } from "child_process";
13994
- import { basename as basename13, dirname as dirname14, join as join46 } from "path";
13994
+ import { basename as basename14, dirname as dirname14, join as join46 } from "path";
13995
13995
  function jsonTooDeep(v) {
13996
13996
  const stack = [[v, 1]];
13997
13997
  while (stack.length > 0) {
@@ -14036,7 +14036,7 @@ function loadSigningKey(generate = true) {
14036
14036
  pem = readFileSync38(file);
14037
14037
  if (!given) {
14038
14038
  for (const [f, m] of [[file, 384], [dirname14(file), 448]])
14039
- if (statSync18(f).mode & 63)
14039
+ if (statSync19(f).mode & 63)
14040
14040
  chmodSync6(f, m);
14041
14041
  }
14042
14042
  } catch (e) {
@@ -14046,7 +14046,7 @@ function loadSigningKey(generate = true) {
14046
14046
  return null;
14047
14047
  mkdirSync16(dirname14(dirname14(file)), { recursive: true, mode: 448 });
14048
14048
  mkdirSync16(dirname14(file), { recursive: true, mode: 448 });
14049
- sweepStaleTmp(dirname14(file), new RegExp(`${escapeRegex(basename13(file))}\\.[0-9a-f]{12}\\.tmp`));
14049
+ sweepStaleTmp(dirname14(file), new RegExp(`${escapeRegex(basename14(file))}\\.[0-9a-f]{12}\\.tmp`));
14050
14050
  const tmp = `${file}.${randomBytes4(6).toString("hex")}.tmp`;
14051
14051
  writeFileSync17(tmp, generateKeyPairSync("ed25519").privateKey.export({ type: "pkcs8", format: "pem" }), { flag: "wx", mode: 384 });
14052
14052
  try {
@@ -14374,7 +14374,7 @@ async function deployAttestCmd(args, env) {
14374
14374
  return null;
14375
14375
  let rec;
14376
14376
  try {
14377
- if (statSync18(file).size > 1e6)
14377
+ if (statSync19(file).size > 1e6)
14378
14378
  return null;
14379
14379
  rec = JSON.parse(readFileSync38(file, "utf8"));
14380
14380
  } catch {
@@ -14448,7 +14448,7 @@ var init_receipt_signer = __esm(() => {
14448
14448
 
14449
14449
  // ../../loki-ts/src/runner/router/history_store.ts
14450
14450
  import { existsSync as existsSync26, mkdirSync as mkdirSync17, readFileSync as readFileSync39, renameSync as renameSync9, rmSync as rmSync9, writeFileSync as writeFileSync18 } from "fs";
14451
- import { resolve as resolve13 } from "path";
14451
+ import { resolve as resolve14 } from "path";
14452
14452
  function validRun(v) {
14453
14453
  if (typeof v !== "object" || v === null)
14454
14454
  return false;
@@ -14456,7 +14456,7 @@ function validRun(v) {
14456
14456
  return typeof r["shape"] === "string" && typeof r["executor"] === "string" && EXECUTORS2.includes(r["executor"]) && typeof r["verdict"] === "string" && VERDICTS.includes(r["verdict"]) && (r["owner"] === null || typeof r["owner"] === "string" && OWNERS.includes(r["owner"])) && typeof r["escalated"] === "boolean" && typeof r["usd"] === "number" && Number.isFinite(r["usd"]) && typeof r["wallS"] === "number" && Number.isFinite(r["wallS"]);
14457
14457
  }
14458
14458
  function historyPath(key, cacheRoot) {
14459
- return resolve13(repoCacheDir(key, cacheRoot), HISTORY_FILE);
14459
+ return resolve14(repoCacheDir(key, cacheRoot), HISTORY_FILE);
14460
14460
  }
14461
14461
  function readRunHistory(key, cacheRoot) {
14462
14462
  const path = historyPath(key, cacheRoot);
@@ -14731,7 +14731,7 @@ var init_engine_origin = __esm(() => {
14731
14731
 
14732
14732
  // ../../loki-ts/src/runner/router/history.ts
14733
14733
  import { existsSync as existsSync28, readFileSync as readFileSync42 } from "fs";
14734
- import { dirname as dirname16, join as join49, resolve as resolve14 } from "path";
14734
+ import { dirname as dirname16, join as join49, resolve as resolve15 } from "path";
14735
14735
  import { fileURLToPath as fileURLToPath2 } from "url";
14736
14736
  function shapeKey(model) {
14737
14737
  if (!model || model.status !== "ok")
@@ -14821,7 +14821,7 @@ var init_history = __esm(() => {
14821
14821
  init_cache();
14822
14822
  init_engine_origin();
14823
14823
  init_history_store();
14824
- SHAPE_DEFAULTS_FILE = resolve14(dirname16(fileURLToPath2(import.meta.url)), "..", "..", "..", "data", "router-shape-defaults.json");
14824
+ SHAPE_DEFAULTS_FILE = resolve15(dirname16(fileURLToPath2(import.meta.url)), "..", "..", "..", "data", "router-shape-defaults.json");
14825
14825
  });
14826
14826
 
14827
14827
  // ../../loki-ts/src/runner/router/unit_model.ts
@@ -14941,7 +14941,7 @@ var init_session_route = __esm(() => {
14941
14941
  });
14942
14942
 
14943
14943
  // ../../loki-ts/src/providers/mcp_config.ts
14944
- import { existsSync as existsSync29, readFileSync as readFileSync44, mkdirSync as mkdirSync18, statSync as statSync19, renameSync as renameSync10 } from "fs";
14944
+ import { existsSync as existsSync29, readFileSync as readFileSync44, mkdirSync as mkdirSync18, statSync as statSync20, renameSync as renameSync10 } from "fs";
14945
14945
  import { resolve as resolvePath, join as join50, delimiter as delimiter3 } from "path";
14946
14946
  function detectLsp() {
14947
14947
  const pathEnv = process.env["PATH"] ?? "";
@@ -14952,7 +14952,7 @@ function detectLsp() {
14952
14952
  for (const dir of dirs) {
14953
14953
  const candidate = join50(dir, bin);
14954
14954
  try {
14955
- const s = statSync19(candidate);
14955
+ const s = statSync20(candidate);
14956
14956
  if (s.isFile())
14957
14957
  return true;
14958
14958
  } catch {}
@@ -15011,7 +15011,7 @@ function userMcpConfigPath() {
15011
15011
  if (!existsSync29(p))
15012
15012
  return null;
15013
15013
  try {
15014
- const s = statSync19(p);
15014
+ const s = statSync20(p);
15015
15015
  if (!s.isFile())
15016
15016
  return null;
15017
15017
  if (s.size > 1024 * 1024) {
@@ -16797,7 +16797,7 @@ import {
16797
16797
  readFileSync as readFileSync49,
16798
16798
  readdirSync as readdirSync23,
16799
16799
  renameSync as renameSync12,
16800
- statSync as statSync20,
16800
+ statSync as statSync21,
16801
16801
  unlinkSync as unlinkSync6,
16802
16802
  writeFileSync as writeFileSync22
16803
16803
  } from "fs";
@@ -16965,7 +16965,7 @@ __export(exports_repo_profile, {
16965
16965
  import { createHash as createHash14 } from "crypto";
16966
16966
  import { spawnSync as spawnSync5 } from "child_process";
16967
16967
  import { existsSync as existsSync35, lstatSync as lstatSync12, readFileSync as readFileSync50, mkdirSync as mkdirSync22, readdirSync as readdirSync24, realpathSync as realpathSync16, renameSync as renameSync13, rmSync as rmSync11, writeFileSync as writeFileSync23 } from "fs";
16968
- import { basename as basename14, dirname as dirname19, join as join57, relative as relative3, resolve as resolve15, isAbsolute as isAbsolute2 } from "path";
16968
+ import { basename as basename15, dirname as dirname19, join as join57, relative as relative3, resolve as resolve16, isAbsolute as isAbsolute2 } from "path";
16969
16969
  function num5(env, name, fallback) {
16970
16970
  const raw2 = env[name];
16971
16971
  if (raw2 === undefined || raw2 === "")
@@ -16979,15 +16979,15 @@ function profileEnabled(env = process.env) {
16979
16979
  function redactEvidence(path, repoRoot) {
16980
16980
  if (!isAbsolute2(path))
16981
16981
  return path;
16982
- const root = resolve15(repoRoot);
16983
- const abs = resolve15(path);
16982
+ const root = resolve16(repoRoot);
16983
+ const abs = resolve16(path);
16984
16984
  if (abs.startsWith(root + "/"))
16985
16985
  return abs.slice(root.length + 1);
16986
- return basename14(abs);
16986
+ return basename15(abs);
16987
16987
  }
16988
16988
  function extractFacts(repoRoot) {
16989
16989
  const facts = [];
16990
- const pkgPath = resolve15(repoRoot, "package.json");
16990
+ const pkgPath = resolve16(repoRoot, "package.json");
16991
16991
  if (existsSync35(pkgPath)) {
16992
16992
  try {
16993
16993
  const pkg = JSON.parse(readFileSync50(pkgPath, "utf8"));
@@ -17007,31 +17007,31 @@ function extractFacts(repoRoot) {
17007
17007
  ["go.mod", "language", "go"],
17008
17008
  ["Makefile", "build.system", "make"]
17009
17009
  ]) {
17010
- if (existsSync35(resolve15(repoRoot, rel))) {
17010
+ if (existsSync35(resolve16(repoRoot, rel))) {
17011
17011
  facts.push({ key, value, evidence: rel });
17012
17012
  }
17013
17013
  }
17014
17014
  return facts;
17015
17015
  }
17016
17016
  function profilePath(lokiDirOverride) {
17017
- return resolve15(lokiDirOverride ?? lokiDir(), "profile", "repo-profile.json");
17017
+ return resolve16(lokiDirOverride ?? lokiDir(), "profile", "repo-profile.json");
17018
17018
  }
17019
17019
  function buildProfile(opts, cacheKey = null) {
17020
- const root = resolve15(opts.repoRoot);
17020
+ const root = resolve16(opts.repoRoot);
17021
17021
  const facts = extractFacts(root).map((f) => ({
17022
17022
  ...f,
17023
17023
  evidence: redactEvidence(f.evidence, root)
17024
17024
  }));
17025
17025
  const profile = {
17026
17026
  schema_version: PROFILE_SCHEMA_VERSION,
17027
- namespace: basename14(root),
17027
+ namespace: basename15(root),
17028
17028
  content_hash: manifestHash(root),
17029
17029
  generated_at: (opts.now ?? new Date).toISOString().replace(/\.\d{3}Z$/, "Z"),
17030
17030
  ...cacheKey !== null ? { cache_key: cacheKey } : {},
17031
17031
  facts
17032
17032
  };
17033
17033
  const target = profilePath(opts.lokiDirOverride);
17034
- mkdirSync22(resolve15(target, ".."), { recursive: true });
17034
+ mkdirSync22(resolve16(target, ".."), { recursive: true });
17035
17035
  atomicWriteFileSync(target, JSON.stringify(profile, null, 2) + `
17036
17036
  `);
17037
17037
  return profile;
@@ -17048,7 +17048,7 @@ function repoCacheKey(root) {
17048
17048
  }
17049
17049
  }
17050
17050
  function buildProfileCached(opts) {
17051
- const key = repoCacheKey(resolve15(opts.repoRoot));
17051
+ const key = repoCacheKey(resolve16(opts.repoRoot));
17052
17052
  if (key !== null) {
17053
17053
  const r = readProfile(opts);
17054
17054
  if (r.status === "fresh" && r.profile && r.profile.cache_key === key)
@@ -17058,7 +17058,7 @@ function buildProfileCached(opts) {
17058
17058
  }
17059
17059
  function readProfile(opts) {
17060
17060
  const env = opts.env ?? process.env;
17061
- const root = resolve15(opts.repoRoot);
17061
+ const root = resolve16(opts.repoRoot);
17062
17062
  const target = profilePath(opts.lokiDirOverride);
17063
17063
  if (!existsSync35(target))
17064
17064
  return { status: "absent", profile: null };
@@ -17235,7 +17235,7 @@ function manifestModel(repoDir) {
17235
17235
  }
17236
17236
  })();
17237
17237
  const wsPats = [...pkgWorkspaces(repoDir), ...pnpmWorkspaces(repoDir)];
17238
- const manifestDirs = [...new Set(tracked.filter((p) => PKG_MANIFESTS.includes(basename14(p))).map((p) => dirname19(p)))];
17238
+ const manifestDirs = [...new Set(tracked.filter((p) => PKG_MANIFESTS.includes(basename15(p))).map((p) => dirname19(p)))];
17239
17239
  const trackedDirs = new Set;
17240
17240
  for (const p of tracked)
17241
17241
  for (let d = dirname19(p);d !== "." && !trackedDirs.has(d); d = dirname19(d))
@@ -17271,7 +17271,7 @@ function manifestModel(repoDir) {
17271
17271
  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;
17272
17272
  const js = d === "." || isMember ? pj ? { dependsOn: [...new Set(deps.map((x) => nameToRoot.get(x)).filter((r) => r !== undefined && r !== d))] } : {} : {};
17273
17273
  return {
17274
- name: typeof pj?.["name"] === "string" && pj["name"] ? pj["name"] : d === "." ? basename14(resolve15(repoDir)) : d,
17274
+ name: typeof pj?.["name"] === "string" && pj["name"] ? pj["name"] : d === "." ? basename15(resolve16(repoDir)) : d,
17275
17275
  root: d,
17276
17276
  runner: null,
17277
17277
  cite: own.length ? own : [cmds[0] ? at(d, cmds[0].source) : at(d, "package.json")],
@@ -17552,7 +17552,7 @@ function attribute(repoDir, baseSha, failing) {
17552
17552
  const s = name ? p.suites?.find((x) => x.name === name && x.ran && x.attributable) : undefined;
17553
17553
  return s ? s.failing_ids : root;
17554
17554
  };
17555
- const rows = failing.map((f) => ({ ...f, base: new Set(own(f.suite)) })), known = new Set(rows.flatMap((r) => [...r.base]));
17555
+ const byId = baseRedByIdOn(), rows = failing.map((f) => ({ ...f, base: new Set(own(f.rerun === "same" || byId && f.rerun !== "differs" ? f.suite : undefined)) })), known = new Set(rows.flatMap((r) => [...r.base]));
17556
17556
  if (known.size === 0)
17557
17557
  return none;
17558
17558
  return split(rows, known.size);
@@ -18034,7 +18034,7 @@ var init_runner_errors = __esm(() => {
18034
18034
  import { spawnSync as spawnSync6 } from "child_process";
18035
18035
  import { mkdtempSync as mkdtempSync6, realpathSync as realpathSync17, rmSync as rmSync12 } from "fs";
18036
18036
  import { tmpdir as tmpdir9 } from "os";
18037
- import { basename as basename15, extname as extname2, join as join58 } from "path";
18037
+ import { basename as basename16, extname as extname2, join as join58 } from "path";
18038
18038
  function changedFilesNamed(out2, repoDir, changed) {
18039
18039
  return changed.filter((f) => {
18040
18040
  if (out2.includes(f) || out2.includes(join58(repoDir, f)))
@@ -18044,7 +18044,7 @@ function changedFilesNamed(out2, repoDir, changed) {
18044
18044
  return true;
18045
18045
  if (extname2(f) === ".go" && segs.length > 1 && suffixes(segs.slice(0, -1), 1).some((d) => new RegExp(`(?<=[\\w-])/${escapeRegex(d)}(?![\\w./-])`).test(out2)))
18046
18046
  return true;
18047
- const stem = basename15(f, extname2(f));
18047
+ const stem = basename16(f, extname2(f));
18048
18048
  if (stem.length < 2 || stem === "index" || stem === "__init__")
18049
18049
  return false;
18050
18050
  return new RegExp(`(?<![\\w-])${escapeRegex(stem)}(?![\\w-])`).test(out2);
@@ -18493,12 +18493,12 @@ async function groupGone(pid) {
18493
18493
  await new Promise((r) => setTimeout(r, 50));
18494
18494
  }
18495
18495
  function runDetached(cmd, cwd, env, signal, timeoutMs) {
18496
- return new Promise((resolve16) => {
18496
+ return new Promise((resolve17) => {
18497
18497
  let child;
18498
18498
  try {
18499
18499
  child = spawn8("bash", ["-c", cmd], { cwd, env, detached: true, stdio: ["ignore", "pipe", "pipe"] });
18500
18500
  } catch (e) {
18501
- resolve16({ code: null, cut: null, err: String(e), tail: "" });
18501
+ resolve17({ code: null, cut: null, err: String(e), tail: "" });
18502
18502
  return;
18503
18503
  }
18504
18504
  const pid = child.pid;
@@ -18525,7 +18525,7 @@ function runDetached(cmd, cwd, env, signal, timeoutMs) {
18525
18525
  await groupGone(pid);
18526
18526
  child.stdout?.destroy();
18527
18527
  child.stderr?.destroy();
18528
- resolve16({ ...r, tail: tail2 });
18528
+ resolve17({ ...r, tail: tail2 });
18529
18529
  };
18530
18530
  const onAbort = () => {
18531
18531
  cut = "abort";
@@ -18874,7 +18874,7 @@ var init_install = __esm(() => {
18874
18874
 
18875
18875
  // ../../loki-ts/src/e10ext/commit_filter.ts
18876
18876
  import { existsSync as existsSync38, lstatSync as lstatSync14, mkdirSync as mkdirSync23, readFileSync as readFileSync53, rmSync as rmSync13, writeFileSync as writeFileSync24 } from "fs";
18877
- import { basename as basename16, dirname as dirname21, join as join61 } from "path";
18877
+ import { basename as basename17, dirname as dirname21, join as join61 } from "path";
18878
18878
  function dropSet(repoDir, staged, preexistingDirty, env = process.env, installCreated, untrackedBlobs, baseSha, task) {
18879
18879
  const owned = installOwned(repoDir, installCreated, env), made = installCreated?.files ?? {}, tc = toolchainOutputs(repoDir, staged.filter(({ st }) => st === "A").map(({ f }) => f), baseSha);
18880
18880
  const art = buildArtifactDropEnabled(env) ? buildArtifacts(repoDir, staged.filter(({ st }) => st === "A").map(({ f }) => f), baseSha, task) : new Set;
@@ -18898,7 +18898,7 @@ function buildArtifacts(repoDir, added, baseSha, task = "") {
18898
18898
  const out2 = new Set;
18899
18899
  if (added.length === 0)
18900
18900
  return out2;
18901
- const named = (f) => task.includes(f) || new RegExp(`(?<![\\w./-])${escapeRegex(basename16(f))}(?![\\w-])`).test(task);
18901
+ const named = (f) => task.includes(f) || new RegExp(`(?<![\\w./-])${escapeRegex(basename17(f))}(?![\\w-])`).test(task);
18902
18902
  let ignored = new Set;
18903
18903
  try {
18904
18904
  const r = safeGitSpawn(repoDir, ["check-ignore", "--no-index", "--stdin", "-z"], { input: added.join("\x00") + "\x00", encoding: "utf8", timeout: 20000 });
@@ -18931,7 +18931,7 @@ function buildArtifacts(repoDir, added, baseSha, task = "") {
18931
18931
  return out2;
18932
18932
  }
18933
18933
  function runOutputs(repoDir, added, baseSha, task = "") {
18934
- const out2 = new Set, named = (f) => task.includes(f) || new RegExp(`(?<![\\w./-])${escapeRegex(basename16(f))}(?![\\w-])`).test(task);
18934
+ const out2 = new Set, named = (f) => task.includes(f) || new RegExp(`(?<![\\w./-])${escapeRegex(basename17(f))}(?![\\w-])`).test(task);
18935
18935
  const tracked = new Map, dirTracked = (d) => {
18936
18936
  if (!tracked.has(d)) {
18937
18937
  try {
@@ -19053,7 +19053,7 @@ function needDrops(staged, task, read2, scopeOutside, env = process.env) {
19053
19053
  const asksFormat = /\b(?:format(?:ting|ter)?|re-?format|prettier|black|ruff format|gofmt|rustfmt|whitespace|indent(?:ation)?)\b/i.test(task), asksLint = /\b(?:lint(?:er|ing)?|noqa|eslint|suppress(?:ion)?|warnings?|type:\s*ignore|ts-ignore)\b/i.test(task);
19054
19054
  const out2 = [];
19055
19055
  for (const { st, f } of staged) {
19056
- if (st !== "M" || f.startsWith(".loki/") || task.includes(f) || task.includes(basename16(f)))
19056
+ if (st !== "M" || f.startsWith(".loki/") || task.includes(f) || task.includes(basename17(f)))
19057
19057
  continue;
19058
19058
  const { base, head } = read2(f);
19059
19059
  if (base === null || head === null)
@@ -19147,13 +19147,13 @@ function commitUnsealedWork(intact, repoDir, workerEnv, runId, intake) {
19147
19147
  var WALL_FILE, parseStaged = (out2) => out2.split("\x00").reduce((a, t, i, all) => i % 2 === 0 && t ? [...a, { st: t, f: all[i + 1] }] : a, []), MANIFEST, manifestChanged = (staged, lock) => {
19148
19148
  const d = dirname21(lock);
19149
19149
  return staged.some(({ f: m }) => MANIFEST.test(m) && (d === "." || dirname21(m) === d || dirname21(m).startsWith(`${d}/`)));
19150
- }, taskWantsLockChange = (task, lock) => !!task && (task.includes(lock) || task.includes(basename16(lock)) || /\bCVE-\d{4}-\d+/i.test(task) || /\b(?:update|upgrade|bump)\b[^.\n]{0,60}\b(?:dependenc\w*|packages?|lockfile|lock file|version)\b/i.test(task) || /\b(?:refresh|regenerate|re-generate|sync|rebuild)\b[^.\n]{0,40}\b(?:lockfile|lock file|lock-file)\b/i.test(task) || /\b(?:bump|upgrade)\s+[@\w./-]+\s+(?:to|from)\s+v?\d/i.test(task) || /\bpin\s+[@\w./-]+\s+(?:to|at)\s+v?\d/i.test(task) || /\b(?:lock-?file|lock file)\s+(?:merge\s+)?conflicts?\b/i.test(task) || /\bconflicts?\b[^.\n]{0,20}\b(?:in|on|of)\s+(?:the\s+)?(?:lock-?file|lock file)(?![\w-])/i.test(task) || /\bre-?install\b[^.\n]{0,30}\b(?:fix|repair)\b[^.\n]{0,30}\b(?:lock-?file|lock file)(?![\w-])/i.test(task) || /\b(?:fix|repair)\s+(?:the\s+|our\s+)?(?:lock-?file|lock file)(?![\w-])/i.test(task)), buildArtifactDropEnabled = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_BUILD_ARTIFACT_DROP"] ?? "").trim()), BYTECODE, CACHE_DIR, OUT_DIR, PKG_MANIFEST, runOutputDropEnabled = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_RUN_OUTPUT_DROP"] ?? "").trim()), RUN_DIR, RUN_FILE, regenDropOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_REGEN_DROP"] ?? "").trim()), REGEN_FILE = "regenerated.json", regeneratedPaths = (runDir) => {
19150
+ }, taskWantsLockChange = (task, lock) => !!task && (task.includes(lock) || task.includes(basename17(lock)) || /\bCVE-\d{4}-\d+/i.test(task) || /\b(?:update|upgrade|bump)\b[^.\n]{0,60}\b(?:dependenc\w*|packages?|lockfile|lock file|version)\b/i.test(task) || /\b(?:refresh|regenerate|re-generate|sync|rebuild)\b[^.\n]{0,40}\b(?:lockfile|lock file|lock-file)\b/i.test(task) || /\b(?:bump|upgrade)\s+[@\w./-]+\s+(?:to|from)\s+v?\d/i.test(task) || /\bpin\s+[@\w./-]+\s+(?:to|at)\s+v?\d/i.test(task) || /\b(?:lock-?file|lock file)\s+(?:merge\s+)?conflicts?\b/i.test(task) || /\bconflicts?\b[^.\n]{0,20}\b(?:in|on|of)\s+(?:the\s+)?(?:lock-?file|lock file)(?![\w-])/i.test(task) || /\bre-?install\b[^.\n]{0,30}\b(?:fix|repair)\b[^.\n]{0,30}\b(?:lock-?file|lock file)(?![\w-])/i.test(task) || /\b(?:fix|repair)\s+(?:the\s+|our\s+)?(?:lock-?file|lock file)(?![\w-])/i.test(task)), buildArtifactDropEnabled = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_BUILD_ARTIFACT_DROP"] ?? "").trim()), BYTECODE, CACHE_DIR, OUT_DIR, PKG_MANIFEST, runOutputDropEnabled = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_RUN_OUTPUT_DROP"] ?? "").trim()), RUN_DIR, RUN_FILE, regenDropOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_REGEN_DROP"] ?? "").trim()), REGEN_FILE = "regenerated.json", regeneratedPaths = (runDir) => {
19151
19151
  try {
19152
19152
  return JSON.parse(readFileSync53(join61(runDir, REGEN_FILE), "utf8")).paths ?? [];
19153
19153
  } catch {
19154
19154
  return [];
19155
19155
  }
19156
- }, taskNamesPath = (task, f) => task.includes(f) || task.includes(basename16(f)), regenDropNote = (f) => `rewritten only by Loki's own check run, not by the change, and left out of the commit: ${f}`, regenKeptNote = (f) => `rewritten by Loki's own check run and kept: a targeted test fails without it: ${f}`, diffNeedOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_DIFF_NEED"] ?? "").trim()), WS_SIGNIFICANT, SUPPRESS, suppressionOnly = (base, head) => base !== head && base.replace(SUPPRESS, "").replace(/[ \t]+$/gm, "").replace(/\n{2,}/g, `
19156
+ }, taskNamesPath = (task, f) => task.includes(f) || task.includes(basename17(f)), regenDropNote = (f) => `rewritten only by Loki's own check run, not by the change, and left out of the commit: ${f}`, regenKeptNote = (f) => `rewritten by Loki's own check run and kept: a targeted test fails without it: ${f}`, diffNeedOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_DIFF_NEED"] ?? "").trim()), WS_SIGNIFICANT, SUPPRESS, suppressionOnly = (base, head) => base !== head && base.replace(SUPPRESS, "").replace(/[ \t]+$/gm, "").replace(/\n{2,}/g, `
19157
19157
  `) === head.replace(SUPPRESS, "").replace(/[ \t]+$/gm, "").replace(/\n{2,}/g, `
19158
19158
  `), needDropNote = (d) => `${d.why} left out of the delivered diff: ${d.f}`, buildArtifactNotes = (repoDir, droppedAdded, baseSha, task) => {
19159
19159
  const s = new Set([...buildArtifactDropEnabled() ? buildArtifacts(repoDir, droppedAdded, baseSha, task) : [], ...runOutputDropEnabled() ? runOutputs(repoDir, droppedAdded, baseSha, task) : []]);
@@ -19180,11 +19180,11 @@ var init_commit_filter = __esm(() => {
19180
19180
  });
19181
19181
 
19182
19182
  // ../../loki-ts/src/util/config_paths.ts
19183
- import { basename as basename17 } from "path";
19183
+ import { basename as basename18 } from "path";
19184
19184
  function taskNamesFenced(task, rel) {
19185
19185
  if (!task)
19186
19186
  return false;
19187
- const t = task.toLowerCase(), bn = basename17(rel).toLowerCase(), stem = bn.replace(/\.[^.]*$/, "").replace(/^\./, "");
19187
+ const t = task.toLowerCase(), bn = basename18(rel).toLowerCase(), stem = bn.replace(/\.[^.]*$/, "").replace(/^\./, "");
19188
19188
  if (LOCKFILE_RE.test(rel))
19189
19189
  return taskWantsLockChange(task, rel) || DEP_TASK.test(task);
19190
19190
  if (CONCEPTS.some(([c, w]) => c.test(rel) && w.test(task)))
@@ -19208,8 +19208,8 @@ var init_config_paths = __esm(() => {
19208
19208
  });
19209
19209
 
19210
19210
  // ../../loki-ts/src/util/config_fence.ts
19211
- import { appendFileSync as appendFileSync5, existsSync as existsSync39, mkdirSync as mkdirSync24, readdirSync as readdirSync26, readFileSync as readFileSync54, rmSync as rmSync14, statSync as statSync21, writeFileSync as writeFileSync25 } from "fs";
19212
- import { dirname as dirname22, isAbsolute as isAbsolute5, join as join62, relative as relative6, resolve as resolve16 } from "path";
19211
+ import { appendFileSync as appendFileSync5, existsSync as existsSync39, mkdirSync as mkdirSync24, readdirSync as readdirSync26, readFileSync as readFileSync54, rmSync as rmSync14, statSync as statSync22, writeFileSync as writeFileSync25 } from "fs";
19212
+ import { dirname as dirname22, isAbsolute as isAbsolute5, join as join62, relative as relative6, resolve as resolve17 } from "path";
19213
19213
  function fenceTask(env = process.env, runDir) {
19214
19214
  if (env["LOKI_E10_TASK_TEXT"])
19215
19215
  return env["LOKI_E10_TASK_TEXT"].slice(0, FENCE_TASK_MAX);
@@ -19236,8 +19236,8 @@ function harnessOutputs(cwd, env = process.env) {
19236
19236
  }
19237
19237
  if (!Array.isArray(a))
19238
19238
  return [];
19239
- const root = resolve16(cwd, ".loki");
19240
- return [...new Set(a.filter((p) => typeof p === "string" && isAbsolute5(p)).map((p) => resolve16(p)).filter((p) => {
19239
+ const root = resolve17(cwd, ".loki");
19240
+ return [...new Set(a.filter((p) => typeof p === "string" && isAbsolute5(p)).map((p) => resolve17(p)).filter((p) => {
19241
19241
  const r = relative6(root, p);
19242
19242
  return r !== "" && !r.startsWith("..") && !isAbsolute5(r) && !RUN_RECORD.test(r);
19243
19243
  }))];
@@ -19245,14 +19245,14 @@ function harnessOutputs(cwd, env = process.env) {
19245
19245
  function fenceDenied(tool, file, cwd, allow, state = false, onNewTestFile, outputs = []) {
19246
19246
  if (!/^(Edit|Write|MultiEdit)$/.test(tool) || typeof file !== "string" || !file)
19247
19247
  return null;
19248
- const abs = resolve16(cwd, file), rel = relative6(resolve16(cwd), abs);
19248
+ const abs = resolve17(cwd, file), rel = relative6(resolve17(cwd), abs);
19249
19249
  if (state && /^\.loki(\/|$)/.test(rel) && outputs.includes(abs))
19250
19250
  return null;
19251
19251
  if (state && /^\.loki(\/|$)/.test(rel))
19252
19252
  return { rel, reason: `LOKI_RUN_STATE: ${rel} is the harness's own run state (the receipt and checkpoints are built from it), so the edit was denied. Nothing in the task needs it.` };
19253
19253
  if (rel === "" || rel.startsWith("..") || isAbsolute5(rel) || !isFencedPath(rel) || allow(rel))
19254
19254
  return null;
19255
- if (TEST_DIR.test(rel) && !existsSync39(resolve16(cwd, rel))) {
19255
+ if (TEST_DIR.test(rel) && !existsSync39(resolve17(cwd, rel))) {
19256
19256
  onNewTestFile?.(rel);
19257
19257
  return null;
19258
19258
  }
@@ -19376,7 +19376,7 @@ function fenceNotes(r, provenPass = false) {
19376
19376
  };
19377
19377
  }
19378
19378
  function stateDenyRules(cwd, outputs = []) {
19379
- const root = resolve16(cwd, ".loki");
19379
+ const root = resolve17(cwd, ".loki");
19380
19380
  if (outputs.length === 0)
19381
19381
  return [`Edit(/${root}/**)`];
19382
19382
  const keep = new Set(outputs), chain = new Set([root]), rules = new Set;
@@ -19412,7 +19412,7 @@ function fencedDenyRules(cwd, env = process.env) {
19412
19412
  } catch {}
19413
19413
  const allow = allowFor(env["LOKI_E10_FENCE_TASK"] ?? fenceTask(env), allowed);
19414
19414
  try {
19415
- return scan(cwd).filter((rel) => isFencedPath(rel) && !allow(rel)).map((rel) => `Edit(/${resolve16(cwd, rel)})`);
19415
+ return scan(cwd).filter((rel) => isFencedPath(rel) && !allow(rel)).map((rel) => `Edit(/${resolve17(cwd, rel)})`);
19416
19416
  } catch {
19417
19417
  return [];
19418
19418
  }
@@ -19423,7 +19423,7 @@ var MAX_BYTES2, LIST_BUFFER, LIST_TIMEOUT_MS = 60000, FENCE_TASK_MAX = 8000, FEN
19423
19423
  return (rel) => a.has(rel) || taskNamesFenced(task, rel);
19424
19424
  }, HARNESS_OUTPUTS_ENV = "LOKI_E10_WRITE_OUTPUTS", RUN_RECORD, scan = (cwd) => safeGit(cwd, ["ls-files", "-z", "-c", "-o", "--exclude-standard"], { maxBuffer: LIST_BUFFER, timeout: LIST_TIMEOUT_MS }).split("\x00").filter((f) => f && !/(^|\/)node_modules\//.test(f)), readSmall = (p) => {
19425
19425
  try {
19426
- return statSync21(p).size <= MAX_BYTES2 ? readFileSync54(p) : null;
19426
+ return statSync22(p).size <= MAX_BYTES2 ? readFileSync54(p) : null;
19427
19427
  } catch {
19428
19428
  return null;
19429
19429
  }
@@ -19471,7 +19471,7 @@ var init_config_fence = __esm(() => {
19471
19471
 
19472
19472
  // ../../loki-ts/src/runner/host_guard.ts
19473
19473
  import { appendFileSync as appendFileSync6, mkdirSync as mkdirSync25, realpathSync as realpathSync19 } from "fs";
19474
- import { isAbsolute as isAbsolute6, join as join63, resolve as resolve17, sep as sep11 } from "path";
19474
+ import { isAbsolute as isAbsolute6, join as join63, resolve as resolve18, sep as sep11 } from "path";
19475
19475
  function hookTimeoutSeconds(env = process.env) {
19476
19476
  const raw2 = env["LOKI_HOOK_TIMEOUT"] ?? "";
19477
19477
  return /^[1-9][0-9]{0,4}$/.test(raw2) ? Number(raw2) : HOOK_TIMEOUT_DEFAULT_S;
@@ -19662,7 +19662,7 @@ var init_host_guard = __esm(() => {
19662
19662
  init_worker_proc();
19663
19663
  init_claude_flags();
19664
19664
  init_config_fence();
19665
- HOST_GUARD_SCRIPT = resolve17(REPO_ROOT, "autonomy", "hooks", "validate-bash.sh");
19665
+ HOST_GUARD_SCRIPT = resolve18(REPO_ROOT, "autonomy", "hooks", "validate-bash.sh");
19666
19666
  ALLOW = { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "allow" } };
19667
19667
  PY_BLANK = new RegExp(`^${PY_SPACE}*$`);
19668
19668
  CONTINUATION = /(?<!\\)((?:\\\\)*)\\\r?\n/g;
@@ -19774,7 +19774,7 @@ var init_scope = __esm(() => {
19774
19774
  });
19775
19775
 
19776
19776
  // ../../loki-ts/src/util/python.ts
19777
- import { accessSync as accessSync2, constants, existsSync as existsSync40, mkdtempSync as mkdtempSync7, readFileSync as readFileSync55, realpathSync as realpathSync20, rmSync as rmSync15, statSync as statSync22 } from "fs";
19777
+ import { accessSync as accessSync2, constants, existsSync as existsSync40, mkdtempSync as mkdtempSync7, readFileSync as readFileSync55, realpathSync as realpathSync20, rmSync as rmSync15, statSync as statSync23 } from "fs";
19778
19778
  import { isAbsolute as isAbsolute7, join as join64, relative as relative7 } from "path";
19779
19779
  import { spawnSync as spawnSync7 } from "child_process";
19780
19780
  import { tmpdir as tmpdir10 } from "os";
@@ -19813,7 +19813,7 @@ function resolvePython3() {
19813
19813
  const cand = `${dir}/python3`;
19814
19814
  try {
19815
19815
  accessSync2(cand, constants.X_OK);
19816
- if (statSync22(cand).isFile())
19816
+ if (statSync23(cand).isFile())
19817
19817
  return cand;
19818
19818
  } catch {}
19819
19819
  }
@@ -20214,7 +20214,7 @@ __export(exports_testmap, {
20214
20214
  });
20215
20215
  import { existsSync as existsSync41, lstatSync as lstatSync15, readdirSync as readdirSync27, readFileSync as readFileSync56 } from "fs";
20216
20216
  import { spawnSync as spawnSync8 } from "child_process";
20217
- import { basename as basename18, dirname as dirname23, extname as extname3, join as join65, sep as sep12 } from "path";
20217
+ import { basename as basename19, dirname as dirname23, extname as extname3, join as join65, sep as sep12 } from "path";
20218
20218
  function untestableReason(runners, files, env = process.env, root) {
20219
20219
  if (root && repoTestCommand(root) || harnessRunners(runners, files, env, root).length > 0)
20220
20220
  return null;
@@ -20244,7 +20244,7 @@ function buildTestMap(root) {
20244
20244
  const api = loadProjectApi(root);
20245
20245
  let pyCfg = false;
20246
20246
  for (const rel of files) {
20247
- const name = basename18(rel);
20247
+ const name = basename19(rel);
20248
20248
  const full = join65(root, rel);
20249
20249
  if (JS_TEST_RE.test(name)) {
20250
20250
  const text3 = readText(full);
@@ -20297,7 +20297,7 @@ function buildTestMap(root) {
20297
20297
  const tests = [];
20298
20298
  const testPackages = Object.create(null);
20299
20299
  for (const rel of files) {
20300
- const name = basename18(rel), pkgRoot = ownerRoot(rel);
20300
+ const name = basename19(rel), pkgRoot = ownerRoot(rel);
20301
20301
  const scope = packageRunners.get(pkgRoot) ?? packageRunners.get(".") ?? [];
20302
20302
  let jr;
20303
20303
  const jsRunner = JS_TEST_RE.test(name) ? importedRunners(jsText.get(rel) ?? "")[0] ?? ["vitest", "jest", "bun", "node"].find((r) => scope.includes(r)) : undefined;
@@ -20319,7 +20319,7 @@ function buildTestMap(root) {
20319
20319
  }
20320
20320
  }
20321
20321
  const sourceRefs = Object.create(null);
20322
- const goMods = files.filter((f) => basename18(f) === "go.mod").map((f) => ({ dir: dirname23(f), path: /^module\s+(\S+)/m.exec(readText(join65(root, f)))?.[1] })).filter((m) => !!m.path).sort((a, b) => b.path.length - a.path.length);
20322
+ const goMods = files.filter((f) => basename19(f) === "go.mod").map((f) => ({ dir: dirname23(f), path: /^module\s+(\S+)/m.exec(readText(join65(root, f)))?.[1] })).filter((m) => !!m.path).sort((a, b) => b.path.length - a.path.length);
20323
20323
  const goImportDir = (imp) => {
20324
20324
  const m = goMods.find((x) => imp === x.path || imp.startsWith(`${x.path}/`));
20325
20325
  if (!m)
@@ -20371,11 +20371,11 @@ function impactedRefs(map, changedFiles) {
20371
20371
  add3(self2);
20372
20372
  continue;
20373
20373
  }
20374
- const stem = basename18(rel, extname3(rel));
20374
+ const stem = basename19(rel, extname3(rel));
20375
20375
  const stems = [stem];
20376
20376
  const entry2 = stem === "index" || stem === "__init__" || stem === "mod" && extname3(rel) === ".rs";
20377
20377
  if (entry2 && dirname23(rel) !== ".")
20378
- stems.push(basename18(dirname23(rel)));
20378
+ stems.push(basename19(dirname23(rel)));
20379
20379
  for (const s of stems)
20380
20380
  for (const p of sourceRefs[s] ?? [])
20381
20381
  add3(map.tests.find((t) => t.path === p));
@@ -20424,7 +20424,7 @@ function avaTargets(root, changed, env = process.env) {
20424
20424
  if (!existsSync41(join65(root, dir, "package.json")) || !avaDeclared(join65(root, dir)))
20425
20425
  continue;
20426
20426
  const inPkg = dir === "." ? rel : rel.slice(dir.length + 1), at = (p) => dir === "." ? p : `${dir}/${p}`;
20427
- const stem = basename18(inPkg).replace(/\.[^.]+$/, "").replace(/\.(?:test|spec)$/, "");
20427
+ const stem = basename19(inPkg).replace(/\.[^.]+$/, "").replace(/\.(?:test|spec)$/, "");
20428
20428
  const cands = AVA_TEST_DIRS.includes(inPkg.split("/")[0]) ? [inPkg] : AVA_TEST_DIRS.flatMap((d) => AVA_EXT.map((e) => `${d}/${stem}${e}`));
20429
20429
  for (const c of cands)
20430
20430
  if (isFile(join65(root, at(c))) && !out2.includes(at(c)))
@@ -20517,7 +20517,7 @@ import {
20517
20517
  unlinkSync as unlinkSync7,
20518
20518
  writeFileSync as writeFileSync26
20519
20519
  } from "fs";
20520
- import { dirname as dirname24, isAbsolute as isAbsolute8, join as join66, relative as relative9, resolve as resolve18, sep as sep13 } from "path";
20520
+ import { dirname as dirname24, isAbsolute as isAbsolute8, join as join66, relative as relative9, resolve as resolve19, sep as sep13 } from "path";
20521
20521
  function git2(root, args) {
20522
20522
  return safeGit(root, args);
20523
20523
  }
@@ -20551,7 +20551,7 @@ function safeJoin(root, relPath) {
20551
20551
  const segments = relPath.split("/").filter((s) => s.length > 0);
20552
20552
  if (relPath.startsWith("/") || segments.includes("..") || segments.includes(".") || segments.length === 0)
20553
20553
  throw new TreeSwapUnsafePathError(`unsafe path ${relPath}`);
20554
- const rootAbs = resolve18(root);
20554
+ const rootAbs = resolve19(root);
20555
20555
  let cur = rootAbs;
20556
20556
  for (let i = 0;i < segments.length; i++) {
20557
20557
  const segment = segments[i];
@@ -20574,8 +20574,8 @@ function safeJoin(root, relPath) {
20574
20574
  function assertSymlinkWithinRoot(root, relPath, target) {
20575
20575
  if (isAbsolute8(target))
20576
20576
  throw new TreeSwapUnsafePathError(`symlink ${relPath} has an absolute target`);
20577
- const resolvedTarget = resolve18(dirname24(join66(resolve18(root), relPath)), target);
20578
- const rel = relative9(resolve18(root), resolvedTarget);
20577
+ const resolvedTarget = resolve19(dirname24(join66(resolve19(root), relPath)), target);
20578
+ const rel = relative9(resolve19(root), resolvedTarget);
20579
20579
  if (rel === ".." || rel.startsWith(`..${"/"}`) || isAbsolute8(rel)) {
20580
20580
  throw new TreeSwapUnsafePathError(`symlink ${relPath} escapes tree root`);
20581
20581
  }
@@ -20690,7 +20690,7 @@ function trackedChanges(root, excludes) {
20690
20690
  return out2;
20691
20691
  }
20692
20692
  function gitPath(root, name) {
20693
- return resolve18(root, git2(root, ["rev-parse", "--git-path", name]).trim());
20693
+ return resolve19(root, git2(root, ["rev-parse", "--git-path", name]).trim());
20694
20694
  }
20695
20695
  function swapAttemptIntoWorkingTree(opts) {
20696
20696
  const excludes = opts.excludes ?? DEFAULT_EXCLUDES;
@@ -20812,9 +20812,9 @@ import { execFileSync as execFileSync5 } from "child_process";
20812
20812
  import { mkdtempSync as mkdtempSync8, readFileSync as readFileSync58, rmSync as rmSync17 } from "fs";
20813
20813
  import { tmpdir as tmpdir11 } from "os";
20814
20814
  import { join as join67 } from "path";
20815
- import { basename as basename19 } from "path";
20815
+ import { basename as basename20 } from "path";
20816
20816
  function classifyAssertDelta(inp) {
20817
- const f = basename19(inp.path);
20817
+ const f = basename20(inp.path);
20818
20818
  if (!/^(test_.*|.*_test)\.py$/.test(f))
20819
20819
  return WEAKENED;
20820
20820
  if (inp.headCounts.run !== inp.baseCounts.run || inp.headCounts.skipped !== inp.baseCounts.skipped)
@@ -21192,6 +21192,32 @@ function excusedEdit(repoDir, baseSha, headSha, rel, base, head, task) {
21192
21192
  const stem = p.replace(/\.(?:js|mjs|cjs|jsx)$/, "");
21193
21193
  return [...new Set([p, ...["ts", "tsx", "js", "mjs", "cjs", "jsx", "mts", "cts"].map((x) => `${stem}.${x}`), ...["ts", "tsx", "js"].map((x) => `${stem}/index.${x}`)])];
21194
21194
  };
21195
+ let addedImports = null;
21196
+ const newlyImported = (spec) => {
21197
+ if (/^(0|off|false|no)$/i.test((process.env["LOKI_E10_WEAK_MOCK_PKG"] ?? "").trim()) || spec.startsWith(".") || spec.startsWith("/"))
21198
+ return false;
21199
+ if (addedImports === null) {
21200
+ try {
21201
+ let file = "";
21202
+ const keep = [];
21203
+ for (const l of safeGit(repoDir, ["diff", "-U0", baseSha, ...headSha ? [headSha] : []]).split(`
21204
+ `)) {
21205
+ if (l.startsWith("+++ "))
21206
+ file = l.slice(6);
21207
+ else if (l.startsWith("-") && !l.startsWith("---") && file && !isTestFile(file))
21208
+ keep.push(`gone ${l.slice(1)}`);
21209
+ else if (l.startsWith("+") && !l.startsWith("+++") && file && !isTestFile(file))
21210
+ keep.push(`new ${l.slice(1)}`);
21211
+ }
21212
+ addedImports = keep.join(`
21213
+ `);
21214
+ } catch {
21215
+ addedImports = "";
21216
+ }
21217
+ }
21218
+ const q = spec.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), imp = (kind) => new RegExp(`^${kind} .*(?:\\bfrom\\s*|\\brequire\\(\\s*|\\bimport\\s*\\(?\\s*)['"]${q}['"]`, "m");
21219
+ return imp("new").test(addedImports) && !imp("gone").test(addedImports);
21220
+ };
21195
21221
  let excused = 0;
21196
21222
  for (const n3 of added) {
21197
21223
  const line2 = hl[n3 - 1] ?? "";
@@ -21221,6 +21247,10 @@ function excusedEdit(repoDir, baseSha, headSha, rel, base, head, task) {
21221
21247
  excused += hits;
21222
21248
  continue;
21223
21249
  }
21250
+ if (allAdded && newlyImported(spec)) {
21251
+ excused += hits;
21252
+ continue;
21253
+ }
21224
21254
  return null;
21225
21255
  }
21226
21256
  if (HOOK_RE.test(line2)) {
@@ -21243,7 +21273,7 @@ function excusedEdit(repoDir, baseSha, headSha, rel, base, head, task) {
21243
21273
  }
21244
21274
  if (count2(SETUP_RE, head) - excused > count2(SETUP_RE, base))
21245
21275
  return null;
21246
- why.push("added setup only in describe blocks the change added, or mocks of modules new in the change");
21276
+ why.push("added setup only in describe blocks the change added, or mocks of modules new in the change or of a package its source starts importing");
21247
21277
  }
21248
21278
  return why.join("; ") || null;
21249
21279
  }
@@ -21566,7 +21596,7 @@ __export(exports_unit_mode, {
21566
21596
  });
21567
21597
  import { createHash as createHash16 } from "crypto";
21568
21598
  import { closeSync as closeSync13, constants as constants2, fstatSync as fstatSync6, lstatSync as lstatSync18, openSync as openSync13, readSync as readSync10, realpathSync as realpathSync22 } from "fs";
21569
- import { isAbsolute as isAbsolute9, relative as relative10, resolve as resolve19 } from "path";
21599
+ import { isAbsolute as isAbsolute9, relative as relative10, resolve as resolve20 } from "path";
21570
21600
  function readBounded(path) {
21571
21601
  const l = lstatSync18(path);
21572
21602
  if (l.isSymbolicLink() || !l.isFile() || l.size > MAX_SPEC_BYTES)
@@ -21668,7 +21698,7 @@ function unitIntake(env, repoDir, existingCapUsd) {
21668
21698
  const bad = (why) => ({ ok: false, note: UNIT_NOT_PROVEN(why) });
21669
21699
  let txt;
21670
21700
  try {
21671
- const real3 = realpathSync22(resolve19(path)), root = realpathSync22(repoDir), rel = relative10(root, real3);
21701
+ const real3 = realpathSync22(resolve20(path)), root = realpathSync22(repoDir), rel = relative10(root, real3);
21672
21702
  if (!(rel === ".." || rel.startsWith("../") || isAbsolute9(rel)))
21673
21703
  return bad("its spec file is inside the worktree where the agent could edit it");
21674
21704
  txt = readBounded(real3);
@@ -21690,7 +21720,7 @@ var init_unit_mode = __esm(() => {
21690
21720
  });
21691
21721
 
21692
21722
  // ../../loki-ts/src/features/exec_spec.ts
21693
- import { existsSync as existsSync43, mkdirSync as mkdirSync28, mkdtempSync as mkdtempSync9, readFileSync as readFileSync61, readdirSync as readdirSync28, rmSync as rmSync18, statSync as statSync23, writeFileSync as writeFileSync28 } from "fs";
21723
+ import { existsSync as existsSync43, mkdirSync as mkdirSync28, mkdtempSync as mkdtempSync9, readFileSync as readFileSync61, readdirSync as readdirSync28, rmSync as rmSync18, statSync as statSync24, writeFileSync as writeFileSync28 } from "fs";
21694
21724
  import { tmpdir as tmpdir12 } from "os";
21695
21725
  import { dirname as dirname25, join as join70, relative as relative11 } from "path";
21696
21726
  function sections(task) {
@@ -21765,7 +21795,7 @@ function sourceFiles(dir, root = dir, out2 = []) {
21765
21795
  const p = join70(dir, e);
21766
21796
  let st;
21767
21797
  try {
21768
- st = statSync23(p);
21798
+ st = statSync24(p);
21769
21799
  } catch {
21770
21800
  continue;
21771
21801
  }
@@ -22661,8 +22691,8 @@ var init_exec_spec = __esm(() => {
22661
22691
  });
22662
22692
 
22663
22693
  // ../../loki-ts/src/project_model/conventions.ts
22664
- import { existsSync as existsSync44, readdirSync as readdirSync29, readFileSync as readFileSync62, realpathSync as realpathSync23, renameSync as renameSync14, rmSync as rmSync19, statSync as statSync24, writeFileSync as writeFileSync29 } from "fs";
22665
- import { basename as basename20, dirname as dirname26, isAbsolute as isAbsolute10, join as join71, relative as relative12, resolve as resolve20, sep as sep14 } from "path";
22694
+ import { existsSync as existsSync44, readdirSync as readdirSync29, readFileSync as readFileSync62, realpathSync as realpathSync23, renameSync as renameSync14, rmSync as rmSync19, statSync as statSync25, writeFileSync as writeFileSync29 } from "fs";
22695
+ import { basename as basename21, dirname as dirname26, isAbsolute as isAbsolute10, join as join71, relative as relative12, resolve as resolve21, sep as sep14 } from "path";
22666
22696
  function parseJsonc(text3) {
22667
22697
  let out2 = "", i = 0;
22668
22698
  while (i < text3.length) {
@@ -22806,11 +22836,11 @@ function changelogFileConvention(repoDir) {
22806
22836
  files.push(d === "." ? n3 : `${d}/${n3}`);
22807
22837
  } catch {}
22808
22838
  }
22809
- const g = guide.toLowerCase(), rank = (f) => f.includes("/") && g.includes(f.toLowerCase()) ? 0 : g.includes(basename20(f).toLowerCase()) ? 1 : 2;
22839
+ const g = guide.toLowerCase(), rank = (f) => f.includes("/") && g.includes(f.toLowerCase()) ? 0 : g.includes(basename21(f).toLowerCase()) ? 1 : 2;
22810
22840
  for (const f of [...files].sort((a, b) => rank(a) - rank(b))) {
22811
22841
  let t = "";
22812
22842
  try {
22813
- if (!statSync24(join71(repoDir, f)).isFile())
22843
+ if (!statSync25(join71(repoDir, f)).isFile())
22814
22844
  continue;
22815
22845
  t = readFileSync62(join71(repoDir, f), "utf8");
22816
22846
  } catch {
@@ -22937,10 +22967,10 @@ function releaseNoteProblems(repoDir, conv2, added, changed, task, env = process
22937
22967
  for (const f of added.keys()) {
22938
22968
  if (!f.startsWith(`${conv2.dir}/`))
22939
22969
  continue;
22940
- const n3 = /^(\d+)\./.exec(basename20(f))?.[1];
22970
+ const n3 = /^(\d+)\./.exec(basename21(f))?.[1];
22941
22971
  if (!n3 || nums.includes(n3))
22942
22972
  continue;
22943
- out2.push(nums.length ? `${f} is numbered ${n3}, but the task gives #${nums.join(", #")}` : `${f} is numbered ${n3}, a number the task never gives${p ? `; rename it to the orphan form ${conv2.dir}/${p}<short-slug>${basename20(f).slice(n3.length)}` : ""}`);
22973
+ out2.push(nums.length ? `${f} is numbered ${n3}, but the task gives #${nums.join(", #")}` : `${f} is numbered ${n3}, a number the task never gives${p ? `; rename it to the orphan form ${conv2.dir}/${p}<short-slug>${basename21(f).slice(n3.length)}` : ""}`);
22944
22974
  }
22945
22975
  }
22946
22976
  return out2;
@@ -22988,7 +23018,7 @@ function towncrierTypes(repoDir) {
22988
23018
  function towncrierExample(repoDir, dir) {
22989
23019
  const types = towncrierTypes(repoDir);
22990
23020
  try {
22991
- const frags = readdirSync29(join71(repoDir, dir)).filter((n3) => /^\+?[\w-]+\.[a-z]+(?:\.[a-z]+)?$/.test(n3) && types.includes(n3.split(".")[1])).map((n3) => ({ n: n3, ext: n3.split(".").slice(2).join("."), t: statSync24(join71(repoDir, dir, n3)).mtimeMs }));
23021
+ const frags = readdirSync29(join71(repoDir, dir)).filter((n3) => /^\+?[\w-]+\.[a-z]+(?:\.[a-z]+)?$/.test(n3) && types.includes(n3.split(".")[1])).map((n3) => ({ n: n3, ext: n3.split(".").slice(2).join("."), t: statSync25(join71(repoDir, dir, n3)).mtimeMs }));
22992
23022
  const count3 = new Map;
22993
23023
  for (const f2 of frags)
22994
23024
  count3.set(f2.ext, (count3.get(f2.ext) ?? 0) + 1);
@@ -23032,13 +23062,13 @@ function towncrierOrphansAllowed(repoDir) {
23032
23062
  function renameInventedFragment(repoDir, conv2, f, task, env = process.env) {
23033
23063
  if (!orphanRenameOn(env) || conv2.kind !== "towncrier" || !f.startsWith(`${conv2.dir}/`) || taskNumbers(task).length)
23034
23064
  return null;
23035
- const n3 = /^(\d+)\./.exec(basename20(f))?.[1], p = towncrierOrphanPrefix(repoDir, conv2.dir);
23065
+ const n3 = /^(\d+)\./.exec(basename21(f))?.[1], p = towncrierOrphanPrefix(repoDir, conv2.dir);
23036
23066
  if (!n3 || !p)
23037
23067
  return null;
23038
23068
  const slug = fragmentTitle(task).toLowerCase().replace(/[`'"]/g, "").split(/[^a-z0-9]+/).filter(Boolean).slice(0, 6).join("-") || "change";
23039
- let to = `${conv2.dir}/${p}${slug}${basename20(f).slice(n3.length)}`;
23069
+ let to = `${conv2.dir}/${p}${slug}${basename21(f).slice(n3.length)}`;
23040
23070
  for (let i = 2;existsSync44(join71(repoDir, to)); i++)
23041
- to = `${conv2.dir}/${p}${slug}-${i}${basename20(f).slice(n3.length)}`;
23071
+ to = `${conv2.dir}/${p}${slug}-${i}${basename21(f).slice(n3.length)}`;
23042
23072
  try {
23043
23073
  renameSync14(join71(repoDir, f), join71(repoDir, to));
23044
23074
  } catch {
@@ -23478,7 +23508,7 @@ function topLevelSymbols2(src) {
23478
23508
  function misplacedNamedNotes(task, rawDiff, repoDir, head) {
23479
23509
  const named = taskNamedPaths(task), added = rawDiff.flatMap((m, i) => i % 2 === 0 && m.trim().split(" ").pop() === "A" && rawDiff[i + 1] ? [rawDiff[i + 1]] : []), changed = new Set(rawDiff.filter((_, i) => i % 2 === 1));
23480
23510
  return named.filter((x) => !x.includes("/") && !TEST_NAME.test(x)).flatMap((x) => {
23481
- const hit = added.find((f) => f.includes("/") && basename20(f) === x && TEST_DIR2.test(f.split("/")[0]));
23511
+ const hit = added.find((f) => f.includes("/") && basename21(f) === x && TEST_DIR2.test(f.split("/")[0]));
23482
23512
  if (!hit || named.some((p) => p.endsWith(`/${x}`)) || taskNamesDir(task, dirname26(hit)))
23483
23513
  return [];
23484
23514
  const root = safeGitSpawn(repoDir, ["show", `${head}:${x}`], { timeout: 5000, encoding: "utf8" });
@@ -23558,7 +23588,7 @@ function phantomRepoPaths(content, fileName, testDir, repoDir, planText, task =
23558
23588
  return join71(testDir, "__self__");
23559
23589
  const url = /^fileURLToPath\(new URL\((["'])([^"']*)\1\s*,\s*import\.meta\.url\)\)$/.exec(e);
23560
23590
  if (url)
23561
- return resolve20(testDir, url[2]);
23591
+ return resolve21(testDir, url[2]);
23562
23592
  const lit = /^(["'`])((?:\\.|(?!\1)[^\\])*)\1$/.exec(e);
23563
23593
  if (lit)
23564
23594
  return lit[2].includes("${") ? null : lit[2];
@@ -23572,7 +23602,7 @@ function phantomRepoPaths(content, fileName, testDir, repoDir, planText, task =
23572
23602
  return null;
23573
23603
  if (call[1] === "dirname")
23574
23604
  return dirname26(args[0]);
23575
- const out2 = resolve20(...args);
23605
+ const out2 = resolve21(...args);
23576
23606
  const first = parts.slice(1).map((a) => /^\s*["'`]([^"'`]*)["'`]\s*$/.exec(a)?.[1]).find((x) => x), viaWalk = !!first && walk.has(parts[0].trim()) && [pkg, repoDir].some((d) => existsSync44(join71(d, first.split("/").filter(Boolean)[0] ?? "\x00")));
23577
23607
  if (report && (viaWalk || !parts.some((a) => walk.has(a.trim()) || taint.has(a.trim())) && (relative12(testDir, out2).startsWith("..") || strayInTestDir(out2) || namedStray(out2))) && parts.some((a) => /^\s*["'`]/.test(a)))
23578
23608
  reports.set(`${ln}|${e}`, { out: out2, rel: relative12(repoDir, out2), tail: viaWalk ? join71(...args.slice(1)) : undefined });
@@ -23677,7 +23707,7 @@ function phantomReason(miss, repoFiles, testDir = "", pkgRoot = "", task = null)
23677
23707
  };
23678
23708
  const own = miss.map((m) => [m, at(m) ?? (beside(m) ? `the task names ${beside(m)} at the repo path ${beside(m)}, not beside the test file` : null)]), loc = own.filter(([, w]) => w).map(([, w]) => w), rest = own.filter(([, w]) => !w).map(([m]) => m);
23679
23709
  const hint = (m) => {
23680
- const n3 = basename20(m), near = [...new Set(repoFiles.flatMap((f) => {
23710
+ const n3 = basename21(m), near = [...new Set(repoFiles.flatMap((f) => {
23681
23711
  const s = f.split("/"), k = s.indexOf(n3);
23682
23712
  return k >= 0 && s.slice(0, k + 1).join("/") !== m ? [s.slice(0, k + 1).join("/")] : [];
23683
23713
  }))].slice(0, 3);
@@ -23695,7 +23725,7 @@ var readJson4 = (p) => {
23695
23725
  }
23696
23726
  }, newestIn = (abs, rel, pat) => {
23697
23727
  try {
23698
- const f = readdirSync29(abs).filter((n3) => pat.test(n3) && !/^readme/i.test(n3)).map((n3) => ({ n: n3, t: statSync24(join71(abs, n3)).mtimeMs })).sort((a, b) => b.t - a.t || b.n.localeCompare(a.n))[0];
23728
+ const f = readdirSync29(abs).filter((n3) => pat.test(n3) && !/^readme/i.test(n3)).map((n3) => ({ n: n3, t: statSync25(join71(abs, n3)).mtimeMs })).sort((a, b) => b.t - a.t || b.n.localeCompare(a.n))[0];
23699
23729
  return f ? `${rel}/${f.n}` : null;
23700
23730
  } catch {
23701
23731
  return null;
@@ -23764,7 +23794,7 @@ var init_conventions = __esm(() => {
23764
23794
 
23765
23795
  // ../../loki-ts/src/e10ext/scope.ts
23766
23796
  import { existsSync as existsSync45, readFileSync as readFileSync63 } from "fs";
23767
- import { basename as basename21, dirname as dirname27, join as join72 } from "path";
23797
+ import { basename as basename22, dirname as dirname27, join as join72 } from "path";
23768
23798
  function contractText(o) {
23769
23799
  const c = o.intake?.contract_snapshot?.contract;
23770
23800
  return Array.isArray(c?.criteria) ? c.criteria.map((x) => typeof x?.text === "string" ? x.text : "").join(`
@@ -23778,7 +23808,7 @@ function outsideScope(o, staged, planFiles = []) {
23778
23808
  const text3 = `${plan}
23779
23809
  ${typeof o.intake?.task === "string" ? o.intake.task : ""}
23780
23810
  ${contractText(o)}`, pre = o.intake?.preexisting_dirty ?? {};
23781
- const kept = (f) => isTestFile(f) || Object.hasOwn(pre, f) || mentions(text3, f) || mentions(text3, basename21(f));
23811
+ const kept = (f) => isTestFile(f) || Object.hasOwn(pre, f) || mentions(text3, f) || mentions(text3, basename22(f));
23782
23812
  if (planFiles.length > 0)
23783
23813
  return staged.filter(({ st, f }) => st !== "A" && !kept(f) && !planFiles.includes(f)).map(({ f }) => f);
23784
23814
  const toks = surfaceTokens(text3), plannedDirs = new Set(rel.map((r) => dirname27(r)).filter((d) => d !== "."));
@@ -23788,7 +23818,7 @@ function anchoredPlanScope(files, task, repoDir, env = process.env) {
23788
23818
  if (!files.length || !planScopeAnchorEnabled(env) || !task.trim())
23789
23819
  return files;
23790
23820
  const syms = [...new Set(extractSpecAtoms(task).filter((a) => a.kind === "site").map((a) => a.text.split(".").pop()).filter(Boolean))];
23791
- const namesFile = (f) => mentions(task, f) || mentions(task, basename21(f));
23821
+ const namesFile = (f) => mentions(task, f) || mentions(task, basename22(f));
23792
23822
  const defines = (f) => {
23793
23823
  if (!repoDir || !syms.length)
23794
23824
  return false;
@@ -23824,14 +23854,14 @@ function briefChangelog(repoDir, env = process.env) {
23824
23854
  function ownerOf(repoDir, f) {
23825
23855
  if (f.endsWith(".go")) {
23826
23856
  const d = dirname27(f);
23827
- return { dir: d, name: basename21(d) };
23857
+ return { dir: d, name: basename22(d) };
23828
23858
  }
23829
23859
  if (!JS_EXT.test(f))
23830
23860
  return null;
23831
23861
  for (let d = dirname27(f);; d = dirname27(d)) {
23832
23862
  const pj = join72(repoDir, d, "package.json");
23833
23863
  if (existsSync45(pj)) {
23834
- let name = basename21(d === "." ? repoDir : d);
23864
+ let name = basename22(d === "." ? repoDir : d);
23835
23865
  try {
23836
23866
  const n3 = JSON.parse(readFileSync63(pj, "utf8")).name;
23837
23867
  if (typeof n3 === "string")
@@ -23857,7 +23887,7 @@ function crossPackageTestEdits(repoDir, staged, task, tracked) {
23857
23887
  const o = ownerOf(repoDir, f);
23858
23888
  if (!o || srcOwners.has(o.dir))
23859
23889
  return false;
23860
- if (mentions(task, f) || mentions(task, basename21(f)) || o.dir !== "." && (mentions(task, o.dir) || mentions(task, basename21(o.dir))) || mentions(task, o.name))
23890
+ if (mentions(task, f) || mentions(task, basename22(f)) || o.dir !== "." && (mentions(task, o.dir) || mentions(task, basename22(o.dir))) || mentions(task, o.name))
23861
23891
  return false;
23862
23892
  if (testReachEnabled() && exercisesChange(repoDir, f, src.map(({ f: s }) => s)))
23863
23893
  return false;
@@ -23913,7 +23943,7 @@ var init_scope2 = __esm(() => {
23913
23943
  // ../../loki-ts/src/features/attempts.ts
23914
23944
  import { existsSync as existsSync46, lstatSync as lstatSync19, mkdtempSync as mkdtempSync10, readFileSync as readFileSync64, realpathSync as realpathSync24, rmSync as rmSync20, symlinkSync as symlinkSync2 } from "fs";
23915
23945
  import { tmpdir as tmpdir13 } from "os";
23916
- import { basename as basename22, dirname as dirname28, join as join73 } from "path";
23946
+ import { basename as basename23, dirname as dirname28, join as join73 } from "path";
23917
23947
  function attemptsTotal(model, env = process.env) {
23918
23948
  const raw2 = (env.LOKI_E10_ATTEMPTS ?? "").trim().toLowerCase() || (attemptsEarly(env) && /haiku/i.test(model ?? "") ? "on" : "");
23919
23949
  if (["on", "true", "yes"].includes(raw2))
@@ -23925,7 +23955,7 @@ function cascadeWallTail(runDir, v) {
23925
23955
  if (!wallFailedOf(v))
23926
23956
  return null;
23927
23957
  try {
23928
- const t = readFileSync64(join73(runDir, basename22(String(v.wall_failure_tail))), "utf8").trim();
23958
+ const t = readFileSync64(join73(runDir, basename23(String(v.wall_failure_tail))), "utf8").trim();
23929
23959
  return t ? t.slice(-6000) : null;
23930
23960
  } catch {
23931
23961
  return null;
@@ -24039,7 +24069,7 @@ function removeAttemptTrees(primary, root, dirs) {
24039
24069
  safeGit(primary, ["worktree", "prune"]);
24040
24070
  } catch {}
24041
24071
  try {
24042
- if (basename22(root).startsWith(ATTEMPTS_TMP_PREFIX) && dirname28(realpathSync24(root)) === realpathSync24(tmpdir13()) && !lstatSync19(root).isSymbolicLink())
24072
+ if (basename23(root).startsWith(ATTEMPTS_TMP_PREFIX) && dirname28(realpathSync24(root)) === realpathSync24(tmpdir13()) && !lstatSync19(root).isSymbolicLink())
24043
24073
  rmSync20(root, { recursive: true, force: true });
24044
24074
  } catch {}
24045
24075
  }
@@ -24294,10 +24324,10 @@ var init_attempts = __esm(() => {
24294
24324
  });
24295
24325
 
24296
24326
  // ../../loki-ts/src/util/secure_scan.ts
24297
- import { copyFileSync as copyFileSync3, existsSync as existsSync47, lstatSync as lstatSync20, mkdirSync as mkdirSync29, mkdtempSync as mkdtempSync11, readFileSync as readFileSync65, realpathSync as realpathSync25, rmSync as rmSync21, statSync as statSync25, writeFileSync as writeFileSync30 } from "fs";
24327
+ import { copyFileSync as copyFileSync3, existsSync as existsSync47, lstatSync as lstatSync20, mkdirSync as mkdirSync29, mkdtempSync as mkdtempSync11, readFileSync as readFileSync65, realpathSync as realpathSync25, rmSync as rmSync21, statSync as statSync26, writeFileSync as writeFileSync30 } from "fs";
24298
24328
  import { randomBytes as randomBytes5 } from "crypto";
24299
24329
  import { tmpdir as tmpdir14 } from "os";
24300
- import { basename as basename23, dirname as dirname29, join as join74, resolve as resolve21, sep as sep15 } from "path";
24330
+ import { basename as basename24, dirname as dirname29, join as join74, resolve as resolve22, sep as sep15 } from "path";
24301
24331
  function fail(error) {
24302
24332
  return { ok: false, findings: [], error };
24303
24333
  }
@@ -24496,7 +24526,7 @@ async function scanAddedLines(repoDir, opts = {}) {
24496
24526
  const skipped = [];
24497
24527
  for (const p of untracked3.split("\x00").filter(Boolean)) {
24498
24528
  try {
24499
- const st = statSync25(join74(repoDir, p));
24529
+ const st = statSync26(join74(repoDir, p));
24500
24530
  if (!st.isFile())
24501
24531
  continue;
24502
24532
  if (st.size > MAX_ADDED_FILE_BYTES) {
@@ -24520,14 +24550,14 @@ async function scanAddedLines(repoDir, opts = {}) {
24520
24550
  return { ok: true, findings: skipped };
24521
24551
  const mirror = mkdtempSync11(join74(tmpdir14(), "loki-secure-added-"));
24522
24552
  try {
24523
- const root = resolve21(mirror) + sep15;
24553
+ const root = resolve22(mirror) + sep15;
24524
24554
  const chunkMap = new Map;
24525
24555
  const chunkRoot = `.loki-chunks-${randomBytes5(6).toString("hex")}`;
24526
24556
  let chunkSeq = 0;
24527
24557
  for (const [p, lines] of added) {
24528
24558
  if (lines.size === 0)
24529
24559
  continue;
24530
- const dest = resolve21(mirror, p);
24560
+ const dest = resolve22(mirror, p);
24531
24561
  if (!dest.startsWith(root))
24532
24562
  continue;
24533
24563
  let max = 0;
@@ -24564,8 +24594,8 @@ async function scanAddedLines(repoDir, opts = {}) {
24564
24594
  chunks.push(cur);
24565
24595
  const whole = chunks.length === 1;
24566
24596
  for (const c of chunks) {
24567
- const rel = whole ? p : join74(chunkRoot, String(chunkSeq++), basename23(p));
24568
- const out2 = whole ? dest : resolve21(mirror, rel);
24597
+ const rel = whole ? p : join74(chunkRoot, String(chunkSeq++), basename24(p));
24598
+ const out2 = whole ? dest : resolve22(mirror, rel);
24569
24599
  if (!out2.startsWith(root))
24570
24600
  break;
24571
24601
  chunkMap.set(rel, { file: p, lines: c.orig });
@@ -25817,7 +25847,7 @@ var init_tournament = __esm(() => {
25817
25847
  import { execFileSync as execFileSync6, spawnSync as spawnSync9 } from "child_process";
25818
25848
  import { cpSync as cpSync2, lstatSync as lstatSync21, mkdirSync as mkdirSync31, mkdtempSync as mkdtempSync12, readFileSync as readFileSync67, realpathSync as realpathSync27, rmSync as rmSync23, writeFileSync as writeFileSync32 } from "fs";
25819
25849
  import { tmpdir as tmpdir15 } from "os";
25820
- import { basename as basename24, dirname as dirname31, join as join76 } from "path";
25850
+ import { basename as basename25, dirname as dirname31, join as join76 } from "path";
25821
25851
  function goStringLiterals(body) {
25822
25852
  const out2 = [];
25823
25853
  for (const m of body.matchAll(/"((?:[^"\\\n]|\\.)*)"/g)) {
@@ -26177,7 +26207,7 @@ function makeScratch(repoDir, baseSha, skip, userUntracked = [], diff) {
26177
26207
  const root = mkdtempSync12(join76(tmpdir15(), SCRATCH_PREFIX)), base = join76(root, "base"), patched = join76(root, "patched"), replay = join76(root, "replay");
26178
26208
  const dispose = () => {
26179
26209
  try {
26180
- if (basename24(root).startsWith(SCRATCH_PREFIX) && dirname31(realpathSync27(root)) === realpathSync27(tmpdir15()) && !lstatSync21(root).isSymbolicLink())
26210
+ if (basename25(root).startsWith(SCRATCH_PREFIX) && dirname31(realpathSync27(root)) === realpathSync27(tmpdir15()) && !lstatSync21(root).isSymbolicLink())
26181
26211
  rmSync23(root, { recursive: true, force: true });
26182
26212
  } catch {}
26183
26213
  };
@@ -27160,7 +27190,7 @@ var init_wall_owned = __esm(() => {
27160
27190
  import { createHash as createHash18 } from "crypto";
27161
27191
  import { appendFileSync as appendFileSync7, copyFileSync as copyFileSync4, cpSync as cpSync3, existsSync as existsSync49, mkdirSync as mkdirSync32, readFileSync as readFileSync71, rmSync as rmSync24, writeFileSync as writeFileSync33 } from "fs";
27162
27192
  import { tmpdir as tmpdir16 } from "os";
27163
- import { basename as basename25, join as join81, relative as relative14 } from "path";
27193
+ import { basename as basename26, join as join81, relative as relative14 } from "path";
27164
27194
  function wallHoldoutRatio(env = process.env) {
27165
27195
  if (env["LOKI_WALL_HOLDOUT"]?.trim() === "0")
27166
27196
  return 0;
@@ -27216,7 +27246,7 @@ function stageHoldout(dir, repoDir) {
27216
27246
  man = JSON.parse(readFileSync71(join81(dir, MANIFEST2), "utf8"));
27217
27247
  } catch {}
27218
27248
  if (!man)
27219
- return { tests, missing: [`holdout store unreadable: ${basename25(dir)}`], cleanup: () => {} };
27249
+ return { tests, missing: [`holdout store unreadable: ${basename26(dir)}`], cleanup: () => {} };
27220
27250
  mkdirSync32(man.targetDir, { recursive: true });
27221
27251
  man.files.forEach((f, i) => {
27222
27252
  const src = join81(dir, f.name);
@@ -27494,7 +27524,7 @@ var init_colors = __esm(() => {
27494
27524
  });
27495
27525
 
27496
27526
  // ../../loki-ts/src/util/run_summary.ts
27497
- import { existsSync as existsSync50, mkdirSync as mkdirSync33, readFileSync as readFileSync72, renameSync as renameSync16, statSync as statSync26, writeFileSync as writeFileSync34 } from "fs";
27527
+ import { existsSync as existsSync50, mkdirSync as mkdirSync33, readFileSync as readFileSync72, renameSync as renameSync16, statSync as statSync27, writeFileSync as writeFileSync34 } from "fs";
27498
27528
  import { join as join82 } from "path";
27499
27529
  function resultOf(outcome) {
27500
27530
  if (outcome === "VERIFIED" || outcome === "ALREADY_SATISFIED")
@@ -27596,7 +27626,7 @@ function diffStat(repoDir, base, head = "HEAD") {
27596
27626
  function readRiskRecord(repoDir, sinceMs = 0) {
27597
27627
  try {
27598
27628
  const p = join82(repoDir, ".loki", "state", "risk-tier.json");
27599
- if (statSync26(p).mtimeMs < sinceMs)
27629
+ if (statSync27(p).mtimeMs < sinceMs)
27600
27630
  return null;
27601
27631
  const r = JSON.parse(readFileSync72(p, "utf8"));
27602
27632
  return r && typeof r === "object" ? r : null;
@@ -27732,7 +27762,7 @@ function composeHandoff(f) {
27732
27762
  if (count3 === null) {
27733
27763
  try {
27734
27764
  const p = join82(f.repoDir, ".loki", "state", "interventions.json");
27735
- const r = statSync26(p).mtimeMs < (f.sinceMs ?? 0) ? null : JSON.parse(readFileSync72(p, "utf8"));
27765
+ const r = statSync27(p).mtimeMs < (f.sinceMs ?? 0) ? null : JSON.parse(readFileSync72(p, "utf8"));
27736
27766
  const nn = (v) => typeof v === "number" && Number.isInteger(v) && v >= 0 ? v : null;
27737
27767
  if (r && nn(r.count) !== null) {
27738
27768
  count3 = nn(r.count);
@@ -28477,7 +28507,7 @@ var init_fetch_issue = __esm(() => {
28477
28507
  });
28478
28508
 
28479
28509
  // ../../loki-ts/src/features/spec_ambiguity.ts
28480
- import { mkdirSync as mkdirSync35, readFileSync as readFileSync75, statSync as statSync27, writeFileSync as writeFileSync38 } from "fs";
28510
+ import { mkdirSync as mkdirSync35, readFileSync as readFileSync75, statSync as statSync28, writeFileSync as writeFileSync38 } from "fs";
28481
28511
  import { join as join86 } from "path";
28482
28512
  function scoreAmbiguity(task) {
28483
28513
  const hits = [];
@@ -28596,7 +28626,7 @@ function corpus(repoDir) {
28596
28626
  } catch {}
28597
28627
  for (const f of tracked.filter((p) => TEST_DOC.test(p)).slice(0, 600)) {
28598
28628
  try {
28599
- if (statSync27(join86(repoDir, f)).size <= 200000)
28629
+ if (statSync28(join86(repoDir, f)).size <= 200000)
28600
28630
  out2.push({ path: f, text: readFileSync75(join86(repoDir, f), "utf8").replace(/\s+/g, "") });
28601
28631
  } catch {}
28602
28632
  }
@@ -28654,7 +28684,7 @@ function precedentFor(c, repoDir) {
28654
28684
  for (const f of tracked) {
28655
28685
  let lines2;
28656
28686
  try {
28657
- if (statSync27(join86(repoDir, f)).size > 200000)
28687
+ if (statSync28(join86(repoDir, f)).size > 200000)
28658
28688
  continue;
28659
28689
  lines2 = readFileSync75(join86(repoDir, f), "utf8").split(`
28660
28690
  `);
@@ -29075,9 +29105,9 @@ var init_triage = __esm(() => {
29075
29105
  });
29076
29106
 
29077
29107
  // ../../loki-ts/src/util/steer.ts
29078
- import { appendFileSync as appendFileSync8, closeSync as closeSync14, constants as constants3, fstatSync as fstatSync7, readdirSync as readdirSync31, lstatSync as lstatSync22, mkdirSync as mkdirSync36, linkSync as linkSync2, openSync as openSync14, readFileSync as readFileSync76, readSync as readSync11, renameSync as renameSync17, statSync as statSync28, lutimesSync, rmSync as rmSync25, unlinkSync as unlinkSync8, writeFileSync as writeFileSync39, existsSync as existsSync53 } from "fs";
29108
+ import { appendFileSync as appendFileSync8, closeSync as closeSync14, constants as constants3, fstatSync as fstatSync7, readdirSync as readdirSync31, lstatSync as lstatSync22, mkdirSync as mkdirSync36, linkSync as linkSync2, openSync as openSync14, readFileSync as readFileSync76, readSync as readSync11, renameSync as renameSync17, statSync as statSync29, lutimesSync, rmSync as rmSync25, unlinkSync as unlinkSync8, writeFileSync as writeFileSync39, existsSync as existsSync53 } from "fs";
29079
29109
  import { createHash as createHash20, randomBytes as randomBytes6 } from "crypto";
29080
- import { basename as basename26, join as join87 } from "path";
29110
+ import { basename as basename27, join as join87 } from "path";
29081
29111
  function archiveTo(logs, prefix, src, link = linkSync2, onLinked) {
29082
29112
  for (let i = 0;; i++) {
29083
29113
  const name = i === 0 ? `${prefix}.md` : `${prefix}-${i}.md`;
@@ -29109,7 +29139,7 @@ function orphanAlreadyArchived(logs, claim) {
29109
29139
  if (!/^human-input-.*\.md$/.test(a))
29110
29140
  continue;
29111
29141
  try {
29112
- const s = statSync28(join87(logs, a));
29142
+ const s = statSync29(join87(logs, a));
29113
29143
  if (s.ino !== c.ino || s.dev !== c.dev)
29114
29144
  continue;
29115
29145
  if (/^human-input-(ORPHAN|REJECTED)-/.test(a) || existsSync53(appliedMarker(logs, a)))
@@ -29146,7 +29176,7 @@ function sweepOrphans(logs, stamp2, unapplied, link, nowMs = Date.now()) {
29146
29176
  if (alive2) {
29147
29177
  let ageMs = 0;
29148
29178
  try {
29149
- ageMs = nowMs - statSync28(join87(logs, n3)).mtimeMs;
29179
+ ageMs = nowMs - statSync29(join87(logs, n3)).mtimeMs;
29150
29180
  } catch {
29151
29181
  continue;
29152
29182
  }
@@ -29274,7 +29304,7 @@ function consumeSteer(repoDir, env = process.env, now2 = () => new Date, sink, h
29274
29304
  archiveTo(join87(repoDir, ".loki", "logs"), `human-input-${now2().toISOString().replace(/[-:]/g, "").replace(/\..*/, "")}`, claimed, hooks2?.link);
29275
29305
  unapplied("logs dir unwritable or file unreadable");
29276
29306
  } catch {
29277
- unapplied(`steer stranded at .loki/logs/${basename26(claimed)}`);
29307
+ unapplied(`steer stranded at .loki/logs/${basename27(claimed)}`);
29278
29308
  }
29279
29309
  } else
29280
29310
  try {
@@ -29393,7 +29423,7 @@ var init_steer = __esm(() => {
29393
29423
  });
29394
29424
 
29395
29425
  // ../../loki-ts/src/util/reviewer_brief.ts
29396
- import { closeSync as closeSync15, existsSync as existsSync54, fstatSync as fstatSync8, lstatSync as lstatSync23, openSync as openSync15, readFileSync as readFileSync77, readSync as readSync12, readdirSync as readdirSync32, realpathSync as realpathSync29, statSync as statSync29 } from "fs";
29426
+ import { closeSync as closeSync15, existsSync as existsSync54, fstatSync as fstatSync8, lstatSync as lstatSync23, openSync as openSync15, readFileSync as readFileSync77, readSync as readSync12, readdirSync as readdirSync32, realpathSync as realpathSync29, statSync as statSync30 } from "fs";
29397
29427
  import { dirname as dirname35, join as join88, normalize as normalize4, sep as sep17 } from "path";
29398
29428
  function reviewFlagLines(text3) {
29399
29429
  const out2 = [];
@@ -29550,10 +29580,10 @@ function lcovFor(repoDir, changed) {
29550
29580
  const p = LCOV_PATHS.map((r) => join88(repoDir, r)).find((x) => existsSync54(x));
29551
29581
  if (!p)
29552
29582
  return { reason: "no coverage report from an executed test run (coverage/lcov.info absent)" };
29553
- const t = statSync29(p).mtimeMs;
29583
+ const t = statSync30(p).mtimeMs;
29554
29584
  for (const f of changed) {
29555
29585
  try {
29556
- if (statSync29(join88(repoDir, f)).mtimeMs > t)
29586
+ if (statSync30(join88(repoDir, f)).mtimeMs > t)
29557
29587
  return { reason: `coverage report is older than ${f}` };
29558
29588
  } catch {}
29559
29589
  }
@@ -30086,7 +30116,7 @@ var init_mutation_proof = __esm(() => {
30086
30116
 
30087
30117
  // ../../loki-ts/src/features/self_review.ts
30088
30118
  import { existsSync as existsSync56, mkdirSync as mkdirSync38, readFileSync as readFileSync79, writeFileSync as writeFileSync41 } from "fs";
30089
- import { basename as basename28, dirname as dirname37, join as join90 } from "path";
30119
+ import { basename as basename29, dirname as dirname37, join as join90 } from "path";
30090
30120
  function pyRegex(src, flags = "") {
30091
30121
  let p = src.trim();
30092
30122
  if (p.startsWith("(?x)"))
@@ -30232,7 +30262,7 @@ function selfReviewChecks(repoDir, baseSha, staged, task, outputs, env = process
30232
30262
  }
30233
30263
  })();
30234
30264
  const fragDir = conv2 && conv2.kind !== "changelog" ? `${conv2.dir}/` : null;
30235
- const stray = trackedDirs ? added.filter((f) => !art.includes(f) && !isTestFile3(f) && !(fragDir && f.startsWith(fragDir)) && !trackedDirs.has(dirname37(f)) && !task.includes(f) && !task.includes(basename28(f))) : [];
30265
+ const stray = trackedDirs ? added.filter((f) => !art.includes(f) && !isTestFile3(f) && !(fragDir && f.startsWith(fragDir)) && !trackedDirs.has(dirname37(f)) && !task.includes(f) && !task.includes(basename29(f))) : [];
30236
30266
  items.push(stray.length ? { item: "stray_files", status: "flagged", detail: `new files outside every directory the repo tracks: ${stray.slice(0, 8).join(", ")}` } : art.length ? { item: "stray_files", status: "auto", detail: `build output the commit leaves out: ${art.slice(0, 8).join(", ")}` } : { item: "stray_files", status: "ok", detail: "no generated or stray file" });
30237
30267
  items.push(src.length === 0 ? { item: "test", status: "ok", detail: "no source change" } : tests.length ? { item: "test", status: "ok", detail: `test changes: ${tests.slice(0, 5).join(", ")}` } : { item: "test", status: "flagged", detail: `source changed (${src.slice(0, 5).join(", ")}) and the diff has no test` });
30238
30268
  const fmts = (() => {
@@ -30321,8 +30351,8 @@ function docEnumerations(repoDir, baseSha, live2) {
30321
30351
  `))].filter((t) => !baseTok.has(t));
30322
30352
  if (!added.length)
30323
30353
  continue;
30324
- const dir = dirname37(f), stems = new Set([basename28(dir), basename28(f).replace(/\.[^.]+$/, "")].filter((s) => s && s !== "." && s !== "index" && s !== "src" && s !== "lib"));
30325
- const docs = tracked.filter((d) => /\.mdx?$/i.test(d) && !touched.has(d) && (dirname37(d) === dir || /(^|\/)docs?\//.test(d) && stems.has(basename28(d).replace(/\.mdx?$/i, ""))));
30354
+ const dir = dirname37(f), stems = new Set([basename29(dir), basename29(f).replace(/\.[^.]+$/, "")].filter((s) => s && s !== "." && s !== "index" && s !== "src" && s !== "lib"));
30355
+ const docs = tracked.filter((d) => /\.mdx?$/i.test(d) && !touched.has(d) && (dirname37(d) === dir || /(^|\/)docs?\//.test(d) && stems.has(basename29(d).replace(/\.mdx?$/i, ""))));
30326
30356
  for (const d of docs) {
30327
30357
  let text3 = "";
30328
30358
  try {
@@ -31701,7 +31731,7 @@ var init_wall_manifest = __esm(() => {
31701
31731
 
31702
31732
  // ../../loki-ts/src/features/wall_manifest_wire.ts
31703
31733
  import { createHash as createHash21 } from "crypto";
31704
- import { basename as basename29, dirname as dirname38 } from "path";
31734
+ import { basename as basename30, dirname as dirname38 } from "path";
31705
31735
  function blobEntries(ls2) {
31706
31736
  const out2 = [];
31707
31737
  for (const raw2 of ls2.toString("latin1").split("\x00")) {
@@ -31731,12 +31761,12 @@ function wallManifestFor(repoDir, tree, task, env = process.env) {
31731
31761
  return null;
31732
31762
  const low = task.toLowerCase().replace(/\\/g, "/");
31733
31763
  const token = (n3) => new RegExp(`(?<![A-Za-z0-9_])${escapeRegex(n3.toLowerCase())}(?![A-Za-z0-9_])`).test(low);
31734
- const dirModule = (e) => /^(index|__init__|mod|main)\.[^.]+$/.test(basename29(e.path)) && e.path.includes("/") && token(dirname38(e.path));
31735
- const matched = all.filter((e) => SOURCE.test(e.path) && (token(basename29(e.path)) || token(e.path) || token(basename29(e.path).replace(/\.[^.]*$/, "")) || dirModule(e)));
31764
+ const dirModule = (e) => /^(index|__init__|mod|main)\.[^.]+$/.test(basename30(e.path)) && e.path.includes("/") && token(dirname38(e.path));
31765
+ const matched = all.filter((e) => SOURCE.test(e.path) && (token(basename30(e.path)) || token(e.path) || token(basename30(e.path).replace(/\.[^.]*$/, "")) || dirModule(e)));
31736
31766
  const spans = (p) => [...low.matchAll(new RegExp(`(?<![A-Za-z0-9_])${escapeRegex(p.toLowerCase())}(?![A-Za-z0-9_])`, "g"))].map((m) => [m.index, m.index + m[0].length]);
31737
31767
  const occ = new Map(matched.map((e) => [e, spans(e.path)]));
31738
31768
  const exact = (e) => occ.get(e).some(([s, t]) => !matched.some((o) => o !== e && o.path.length > e.path.length && occ.get(o).some(([s2, t2]) => s2 <= s && t <= t2)));
31739
- const byPath2 = matched.filter(exact).sort((a, b) => b.path.length - a.path.length), byBase = matched.filter((e) => !byPath2.includes(e) && token(basename29(e.path)));
31769
+ const byPath2 = matched.filter(exact).sort((a, b) => b.path.length - a.path.length), byBase = matched.filter((e) => !byPath2.includes(e) && token(basename30(e.path)));
31740
31770
  const named = [...byPath2, ...byBase, ...matched.filter((e) => !byPath2.includes(e) && !byBase.includes(e))].slice(0, MAX_NAMED);
31741
31771
  const tests = all.filter((e) => TESTISH.test(e.path)).slice(0, MAX_FILES), listed = tests.filter((e) => !SOURCE.test(e.path));
31742
31772
  const want = [...new Set([...all.filter((e) => CONFIG.test(e.path)), ...tests.filter((e) => SOURCE.test(e.path)), ...named])];
@@ -32107,7 +32137,7 @@ __export(exports_wall, {
32107
32137
  });
32108
32138
  import { existsSync as existsSync58, mkdirSync as mkdirSync39, mkdtempSync as mkdtempSync14, readFileSync as readFileSync82, readdirSync as readdirSync35, realpathSync as realpathSync31, rmSync as rmSync28, writeFileSync as writeFileSync43 } from "fs";
32109
32139
  import { tmpdir as tmpdir18 } from "os";
32110
- import { basename as basename30, dirname as dirname39, join as join93, relative as relative18 } from "path";
32140
+ import { basename as basename31, dirname as dirname39, join as join93, relative as relative18 } from "path";
32111
32141
 
32112
32142
  class RealBaseTestRunner {
32113
32143
  api;
@@ -32355,8 +32385,8 @@ async function execSpecWall(ctx, signal, task, sizeName, runners, existingTests,
32355
32385
  rmSync28(sealedDir, { recursive: true, force: true });
32356
32386
  mkdirSync39(sealedDir, { recursive: true });
32357
32387
  for (const f of sealedFiles)
32358
- writeFileSync43(join93(sealedDir, basename30(f.rel)), f.text, "utf8");
32359
- return { kind: "authored", staged: true, execSpec: summary, model: execSpecModel(), iterationId, task, sizeName, runners: [out2.runner], targetDir: join93(ctx.repoDir, dirname39(sealedFiles[0].rel)), generated: sealedFiles.map((f) => basename30(f.rel)), contents: new Map(sealedFiles.map((f) => [basename30(f.rel), f.text])), discarded: [] };
32388
+ writeFileSync43(join93(sealedDir, basename31(f.rel)), f.text, "utf8");
32389
+ return { kind: "authored", staged: true, execSpec: summary, model: execSpecModel(), iterationId, task, sizeName, runners: [out2.runner], targetDir: join93(ctx.repoDir, dirname39(sealedFiles[0].rel)), generated: sealedFiles.map((f) => basename31(f.rel)), contents: new Map(sealedFiles.map((f) => [basename31(f.rel), f.text])), discarded: [] };
32360
32390
  }
32361
32391
  function wallInstallReject(repoDir, task, runners, afterImplement) {
32362
32392
  if (!afterImplement || !runners.includes("cargo"))
@@ -32705,11 +32735,11 @@ import { spawnSync as spawnSync12 } from "child_process";
32705
32735
  import { createHash as createHash22 } from "crypto";
32706
32736
  import { chmodSync as chmodSync8, existsSync as existsSync59, mkdirSync as mkdirSync41, readFileSync as readFileSync84, realpathSync as realpathSync33, renameSync as renameSync19, writeFileSync as writeFileSync45 } from "fs";
32707
32737
  import { homedir as homedir11 } from "os";
32708
- import { dirname as dirname41, join as join95, resolve as resolve22 } from "path";
32738
+ import { dirname as dirname41, join as join95, resolve as resolve23 } from "path";
32709
32739
  function repoName(repoDir) {
32710
32740
  const u = (readOriginUrl(repoDir) ?? "").trim();
32711
32741
  if (!u)
32712
- return resolve22(repoDir);
32742
+ return resolve23(repoDir);
32713
32743
  const m = /^(?:[a-z][a-z0-9+.-]*:\/\/)?(?:[^@/]+@)?([^/:]+)[:/](.+?)(?:\.git)?\/?$/i.exec(u);
32714
32744
  return m && !u.startsWith("/") ? `${m[1].toLowerCase()}/${m[2]}` : u.replace(/\/+$/, "");
32715
32745
  }
@@ -32823,9 +32853,9 @@ function extractSetup(script, repoDir) {
32823
32853
  try {
32824
32854
  return realpathSync33(repoDir);
32825
32855
  } catch {
32826
- return resolve22(repoDir);
32856
+ return resolve23(repoDir);
32827
32857
  }
32828
- })(), names = [...new Set([real3, resolve22(repoDir), real3.replace(/^\/private\//, "/")])].filter((d) => d.length > 5).sort((a, b) => b.length - a.length);
32858
+ })(), names = [...new Set([real3, resolve23(repoDir), real3.replace(/^\/private\//, "/")])].filter((d) => d.length > 5).sort((a, b) => b.length - a.length);
32829
32859
  let swapped = false;
32830
32860
  for (const d of names)
32831
32861
  if (text3.includes(d)) {
@@ -33227,7 +33257,7 @@ var init_context = __esm(() => {
33227
33257
 
33228
33258
  // ../../loki-ts/src/engine10/proof_rerun.ts
33229
33259
  import { createHash as createHash23, randomBytes as randomBytes7 } from "crypto";
33230
- import { copyFileSync as copyFileSync5, existsSync as existsSync60, mkdirSync as mkdirSync42, readdirSync as readdirSync36, readFileSync as readFileSync85, realpathSync as realpathSync34, rmSync as rmSync29, statfsSync, statSync as statSync30, writeFileSync as writeFileSync46 } from "fs";
33260
+ import { copyFileSync as copyFileSync5, existsSync as existsSync60, mkdirSync as mkdirSync42, readdirSync as readdirSync36, readFileSync as readFileSync85, realpathSync as realpathSync34, rmSync as rmSync29, statfsSync, statSync as statSync31, writeFileSync as writeFileSync46 } from "fs";
33231
33261
  import { dirname as dirname42, join as join96, relative as relative20 } from "path";
33232
33262
  function labelAsks(provider, intake, plan, repoDir, env = process.env) {
33233
33263
  if (!issueAcceptanceCapOn(env))
@@ -33341,7 +33371,7 @@ function keepProofScript(scratchDir, runDir) {
33341
33371
  const src = join96(scratchDir, PROOF_SCRIPT);
33342
33372
  if (!existsSync60(src))
33343
33373
  return false;
33344
- const st = statSync30(src);
33374
+ const st = statSync31(src);
33345
33375
  if (!st.isFile() || st.size === 0 || st.size > MAX_SCRIPT_BYTES)
33346
33376
  return false;
33347
33377
  const real3 = (() => {
@@ -33358,7 +33388,7 @@ function keepProofScript(scratchDir, runDir) {
33358
33388
  for (const f of HANDED) {
33359
33389
  try {
33360
33390
  const su = join96(scratchDir, f);
33361
- if (existsSync60(su) && statSync30(su).size <= MAX_SCRIPT_BYTES) {
33391
+ if (existsSync60(su) && statSync31(su).size <= MAX_SCRIPT_BYTES) {
33362
33392
  let t = readFileSync85(su, "utf8");
33363
33393
  if (f === SETUP_FILE2)
33364
33394
  for (const d of names)
@@ -34177,7 +34207,7 @@ async function issueLineCheck(ctx, asks2, head, checks, reply, facts = []) {
34177
34207
  return { model, outcome: "no_diff", usd: null, calls: 0, input_chars: 0, diff_cut: [], diff_truncated: false, not_reviewed: "the diff could not be read" };
34178
34208
  const cd = lineCheckDiff(d.stdout), prompt = lineCheckPrompt(asks2, cd.text, (n3?.stdout ?? "").split(`
34179
34209
  `).filter(Boolean), checks, reply, facts);
34180
- const call = lineCheckOverride ?? consultCallFor(model, join99(ctx.repoDir, ".loki"), process.env, 120000, { maxTokens: 2500, thinking: "off" });
34210
+ const call = lineCheckOverride ?? consultCallFor(model, join99(ctx.repoDir, ".loki"), process.env, 120000, { maxTokens: 8000, thinking: "off" });
34181
34211
  let usd = null, calls = 0, outcome = "failed", parsed = null;
34182
34212
  for (let i = 0;i < 2 && !parsed; i++) {
34183
34213
  let r;
@@ -34325,7 +34355,7 @@ var init_implement_route = __esm(() => {
34325
34355
 
34326
34356
  // ../../loki-ts/src/features/patch_protocol.ts
34327
34357
  import { existsSync as existsSync63, lstatSync as lstatSync26, mkdirSync as mkdirSync45, readFileSync as readFileSync88, realpathSync as realpathSync35, rmSync as rmSync30, writeFileSync as writeFileSync49 } from "fs";
34328
- import { basename as basename31, dirname as dirname43, join as join100, normalize as normalize5, relative as relative21, sep as sep20 } from "path";
34358
+ import { basename as basename32, dirname as dirname43, join as join100, normalize as normalize5, relative as relative21, sep as sep20 } from "path";
34329
34359
  function buildPatchBrief(task, code, conventions, checkCmds) {
34330
34360
  return [
34331
34361
  PATCH_RULES,
@@ -34381,7 +34411,7 @@ function refusal(rules, rel, before, after) {
34381
34411
  return "inside .git or .loki";
34382
34412
  if (WALL_FILE.test(n3) || rules.readOnly.includes(n3))
34383
34413
  return "a read-only Wall test";
34384
- if (LOCKFILES.has(basename31(n3)) && !taskWantsLockChange(rules.task, n3))
34414
+ if (LOCKFILES.has(basename32(n3)) && !taskWantsLockChange(rules.task, n3))
34385
34415
  return "a lockfile the task does not ask to change";
34386
34416
  if (steersRunner(n3, before ?? "", after))
34387
34417
  return "a test-runner or compiler config (it steers how tests run)";
@@ -35201,6 +35231,30 @@ ${r.session.summary}` };
35201
35231
  let reviewedEarly = false, earlyReviewCost = null;
35202
35232
  let proofFails = 0, lineTurns = 0;
35203
35233
  const LINE_TURNS_MAX = 2;
35234
+ const reviewRound = async (tree) => {
35235
+ if (reviewedEarly || !reviewFixOn())
35236
+ return false;
35237
+ reviewedEarly = true;
35238
+ const xr = await crossReview(ctx, "VERIFIED", tree, signal, true);
35239
+ if (xr?.cost_iteration)
35240
+ earlyReviewCost = xr.cost_iteration;
35241
+ const found = xr && (xr.level === "block" || xr.level === "flag") ? xr.notes.filter((n3) => /^cross-review (block|flag) /.test(n3) || isUnmetNote(n3)).slice(0, 8) : [];
35242
+ ctx.emit("review.early", "implement", { level: xr?.level ?? "not_run", findings: found.length });
35243
+ if (!found.length)
35244
+ return false;
35245
+ const r3 = await resumeForProofScript(ctx, { ...unchained(), iterationId: ids[ids.length - 1] }, session, [`An independent reviewer read your whole change and found ${found.length} problem${found.length === 1 ? "" : "s"}:`, "", ...found.map((n3, i) => `${i + 1}. ${n3.replace(/^cross-review \w+ \([^)]*\):\s*/, "")}`), "", "Check each one against the code. Where the reviewer is right, fix the product (and the documentation when the two disagree), add a check for it to $LOKI_SCRATCH/loki-proof.sh under the acceptance item it belongs to, and run the proof again until it passes. Where the reviewer is wrong, say why in one line and change nothing for it. Do not remove or loosen an existing check. End with the same finish line as before."].join(`
35246
+ `));
35247
+ if (r3.iterationId !== ids[ids.length - 1])
35248
+ ids.push(r3.iterationId);
35249
+ else
35250
+ return false;
35251
+ if (r3.session.summary)
35252
+ session = { ...session, summary: `${session.summary ?? ""}
35253
+
35254
+ [after the independent review]
35255
+ ${r3.session.summary}` };
35256
+ return true;
35257
+ };
35204
35258
  for (let round2 = 0;proofFails < proofLoopMax() && scratch && proofRerunOn() && existsSync64(join101(scratch.dir, PROOF_SCRIPT)) && !signal.aborted && !session.killed && session.exit === 0 && !session.markers.specConflict && !session.markers.alreadyDone; round2++) {
35205
35259
  if (!keepProofScript(scratch.dir, ctx.runDir))
35206
35260
  break;
@@ -35217,8 +35271,14 @@ ${r.session.summary}` };
35217
35271
  }
35218
35272
  if (pr.exit === 0 && pr.failed === 0) {
35219
35273
  const la = labelAsks(ctx.provider, prior.intake, prior.plan, ctx.repoDir);
35220
- if (!la.asks.length || lineTurns >= LINE_TURNS_MAX)
35274
+ if (!la.asks.length)
35221
35275
  break;
35276
+ if (lineTurns >= LINE_TURNS_MAX) {
35277
+ const t = await worktreeTree(ctx.repoDir);
35278
+ if (t && await reviewRound(t))
35279
+ continue;
35280
+ break;
35281
+ }
35222
35282
  const tree = await worktreeTree(ctx.repoDir);
35223
35283
  if (!tree)
35224
35284
  break;
@@ -35238,28 +35298,9 @@ ${r.session.summary}` };
35238
35298
  lineRounds.push({ met: lc.marks?.met.length ?? 0, unmet: unmet.length, usd: lc.usd });
35239
35299
  ctx.emit("acceptance.round", "implement", { round: round2 + 1, met: la.asks.length - lineUnmet, unmet: lineUnmet, ...empty.size ? { pass_on_base_too: empty.size } : {}, ...unmet.length > lineUnmet ? { unused_new_files: unmet.length - lineUnmet } : {} });
35240
35300
  if (!unmet.length) {
35241
- if (reviewedEarly || !reviewFixOn())
35242
- break;
35243
- reviewedEarly = true;
35244
- const xr = await crossReview(ctx, "VERIFIED", tree, signal, true);
35245
- if (xr?.cost_iteration)
35246
- earlyReviewCost = xr.cost_iteration;
35247
- const found = xr && (xr.level === "block" || xr.notes.some(isUnmetNote)) ? xr.notes.filter((n3) => /^cross-review (block|flag) /.test(n3) || isUnmetNote(n3)).slice(0, 8) : [];
35248
- ctx.emit("review.early", "implement", { level: xr?.level ?? "not_run", findings: found.length });
35249
- if (!found.length)
35250
- break;
35251
- const r3 = await resumeForProofScript(ctx, { ...unchained(), iterationId: ids[ids.length - 1] }, session, [`An independent reviewer read your whole change and found ${found.length} problem${found.length === 1 ? "" : "s"}:`, "", ...found.map((n3, i) => `${i + 1}. ${n3.replace(/^cross-review \w+ \([^)]*\):\s*/, "")}`), "", "Check each one against the code. Where the reviewer is right, fix the product (and the documentation when the two disagree), add a check for it to $LOKI_SCRATCH/loki-proof.sh under the acceptance item it belongs to, and run the proof again until it passes. Where the reviewer is wrong, say why in one line and change nothing for it. Do not remove or loosen an existing check. End with the same finish line as before."].join(`
35252
- `));
35253
- if (r3.iterationId !== ids[ids.length - 1])
35254
- ids.push(r3.iterationId);
35255
- else
35256
- break;
35257
- if (r3.session.summary)
35258
- session = { ...session, summary: `${session.summary ?? ""}
35259
-
35260
- [after the independent review]
35261
- ${r3.session.summary}` };
35262
- continue;
35301
+ if (await reviewRound(tree))
35302
+ continue;
35303
+ break;
35263
35304
  }
35264
35305
  const stray = Object.keys(pr.lines).filter((k) => Number(k) > la.asks.length || Number(k) < 1);
35265
35306
  const r2 = await resumeForProofScript(ctx, { ...unchained(), iterationId: ids[ids.length - 1] }, session, unmetBrief(unmet, stray.length ? `Your proof script passes, but ${stray.length} of its check numbers (${stray.slice(0, 6).join(", ")}) are not acceptance item numbers, so those checks count for no item. The first argument of loki_http and loki_cmd is the item's number in $LOKI_SCRATCH/acceptance.txt (1 to ${la.asks.length}), never a line number of the script. Renumber them.` : ""));
@@ -35486,7 +35527,7 @@ var init_run_control = __esm(() => {
35486
35527
 
35487
35528
  // ../../loki-ts/src/providers/provider_guard.ts
35488
35529
  import { copyFileSync as copyFileSync6, existsSync as existsSync66, lstatSync as lstatSync27, mkdirSync as mkdirSync47, readFileSync as readFileSync91, readdirSync as readdirSync37, readlinkSync as readlinkSync4, realpathSync as realpathSync36, rmSync as rmSync32 } from "fs";
35489
- import { dirname as dirname44, isAbsolute as isAbsolute16, join as join103, relative as relative23, resolve as resolve23 } from "path";
35530
+ import { dirname as dirname44, isAbsolute as isAbsolute16, join as join103, relative as relative23, resolve as resolve24 } from "path";
35490
35531
  function providerSandboxFlags(provider) {
35491
35532
  return [];
35492
35533
  }
@@ -35509,7 +35550,7 @@ function isRepoDeletion(deleted, tracked) {
35509
35550
  function escapesProject(root, linkPath) {
35510
35551
  try {
35511
35552
  const target = readlinkSync4(linkPath);
35512
- const abs = isAbsolute16(target) ? target : resolve23(dirname44(linkPath), target);
35553
+ const abs = isAbsolute16(target) ? target : resolve24(dirname44(linkPath), target);
35513
35554
  const rel = relative23(realpathSync36(root), existsSync66(abs) ? realpathSync36(abs) : abs);
35514
35555
  return rel.startsWith("..") || isAbsolute16(rel);
35515
35556
  } catch {
@@ -35660,7 +35701,7 @@ var init_provider_guard = __esm(() => {
35660
35701
 
35661
35702
  // ../../loki-ts/src/e10ext/budget_cap.ts
35662
35703
  import { appendFileSync as appendFileSync9, existsSync as existsSync67, mkdirSync as mkdirSync48, readdirSync as readdirSync38, readFileSync as readFileSync92, writeFileSync as writeFileSync52 } from "fs";
35663
- import { join as join104, resolve as resolve24 } from "path";
35704
+ import { join as join104, resolve as resolve25 } from "path";
35664
35705
  function hasApiKey(env) {
35665
35706
  return ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY", "LOKI_MODEL_API_KEY"].some((k) => (env[k] ?? "") !== "");
35666
35707
  }
@@ -35702,11 +35743,11 @@ function groupEnv(env, capUsd, repoDir) {
35702
35743
  const out2 = { ...env, LOKI_BUDGET_LIMIT: String(capUsd) };
35703
35744
  if (repoDir && !out2.LOKI_BUDGET_LEDGER) {
35704
35745
  try {
35705
- const d = join104(resolve24(repoDir), ".loki", "runs");
35746
+ const d = join104(resolve25(repoDir), ".loki", "runs");
35706
35747
  mkdirSync48(d, { recursive: true });
35707
35748
  out2.LOKI_BUDGET_LEDGER = join104(d, `group-${process.pid}-${Date.now()}.ledger`);
35708
35749
  } catch (e) {
35709
- out2.LOKI_BUDGET_LEDGER = join104(resolve24(repoDir), ".loki", "runs", "unusable", "group.ledger");
35750
+ out2.LOKI_BUDGET_LEDGER = join104(resolve25(repoDir), ".loki", "runs", "unusable", "group.ledger");
35710
35751
  process.stderr.write(`budget: cannot create the shared ledger dir (${e instanceof Error ? e.message : String(e)}); units will stop, failing closed
35711
35752
  `);
35712
35753
  }
@@ -35716,7 +35757,7 @@ function groupEnv(env, capUsd, repoDir) {
35716
35757
  function capMeter(raw2, env, onBudget, childDelta) {
35717
35758
  const capUsd = parseCapUsd(env.LOKI_E10_MAX_COST_USD) ?? 0, seed = Number(env.LOKI_E10_SPENT_USD);
35718
35759
  const m = costMeter(capUsd, seed);
35719
- const ledger2 = env.LOKI_BUDGET_LEDGER ? resolve24(env.LOKI_BUDGET_LEDGER) : "";
35760
+ const ledger2 = env.LOKI_BUDGET_LEDGER ? resolve25(env.LOKI_BUDGET_LEDGER) : "";
35720
35761
  let broken = false;
35721
35762
  if (ledger2) {
35722
35763
  try {
@@ -37230,7 +37271,7 @@ var init_prove = __esm(() => {
37230
37271
 
37231
37272
  // ../../loki-ts/src/version.ts
37232
37273
  import { readFileSync as readFileSync94 } from "fs";
37233
- import { resolve as resolve25, dirname as dirname46 } from "path";
37274
+ import { resolve as resolve26, dirname as dirname46 } from "path";
37234
37275
  import { fileURLToPath as fileURLToPath4 } from "url";
37235
37276
  function getVersion() {
37236
37277
  if (_version !== null)
@@ -37243,7 +37284,7 @@ function getVersion() {
37243
37284
  try {
37244
37285
  const here = dirname46(fileURLToPath4(import.meta.url));
37245
37286
  const repoRoot = findRepoRootForVersion(here);
37246
- _version = readFileSync94(resolve25(repoRoot, "VERSION"), "utf-8").trim();
37287
+ _version = readFileSync94(resolve26(repoRoot, "VERSION"), "utf-8").trim();
37247
37288
  } catch {
37248
37289
  _version = "unknown";
37249
37290
  }
@@ -38020,7 +38061,7 @@ var init_receipt_dsse = __esm(() => {
38020
38061
  import { createPublicKey as createPublicKey4 } from "crypto";
38021
38062
  import { cpSync as cpSync4, copyFileSync as copyFileSync7, existsSync as existsSync72, mkdirSync as mkdirSync53, readdirSync as readdirSync41, readFileSync as readFileSync97, renameSync as renameSync21, rmSync as rmSync35, writeFileSync as writeFileSync56 } from "fs";
38022
38063
  import { homedir as homedir12 } from "os";
38023
- import { basename as basename32, dirname as dirname48, join as join109, normalize as normalize7 } from "path";
38064
+ import { basename as basename33, dirname as dirname48, join as join109, normalize as normalize7 } from "path";
38024
38065
  function publicJwk(pub) {
38025
38066
  const { kty, crv, x } = pub.export({ format: "jwk" });
38026
38067
  return JSON.stringify({ kty, crv, x, kid: kidOf2(pub), alg: "EdDSA", use: "sig" });
@@ -38047,7 +38088,7 @@ async function buildPassport(runDir, env = process.env) {
38047
38088
  return { missing: "receipt holds local paths; passport not published (run loki proof bundle)" };
38048
38089
  const envelope = JSON.stringify(signEnvelope(parsed, priv, kid)), jwk = publicJwk(pub);
38049
38090
  if (envelope.length + jwk.length > PASSPORT_MAX)
38050
- return { missing: `passport too large for a PR comment (${envelope.length + jwk.length} bytes); run loki proof bundle ${basename32(runDir)}` };
38091
+ return { missing: `passport too large for a PR comment (${envelope.length + jwk.length} bytes); run loki proof bundle ${basename33(runDir)}` };
38051
38092
  return { envelope, jwk, kid, head: String(parsed["head_sha"]) };
38052
38093
  } catch (e) {
38053
38094
  return { missing: `passport not issued: ${e instanceof Error ? e.message.split(`
@@ -38198,12 +38239,12 @@ var init_outbox = __esm(() => {
38198
38239
  // ../../loki-ts/src/util/failure_memory.ts
38199
38240
  import { createHash as createHash26 } from "crypto";
38200
38241
  import { appendFileSync as appendFileSync10, existsSync as existsSync74, mkdirSync as mkdirSync55, readFileSync as readFileSync99, renameSync as renameSync23, writeFileSync as writeFileSync57 } from "fs";
38201
- import { resolve as resolve26 } from "path";
38242
+ import { resolve as resolve27 } from "path";
38202
38243
  function failureFingerprint(cls, name) {
38203
38244
  return createHash26("sha256").update(`${cls}\x00${name}`).digest("hex").slice(0, 16);
38204
38245
  }
38205
38246
  function readFingerprints(dir) {
38206
- const p = resolve26(dir, "fingerprints.jsonl");
38247
+ const p = resolve27(dir, "fingerprints.jsonl");
38207
38248
  if (!existsSync74(p))
38208
38249
  return [];
38209
38250
  try {
@@ -38225,7 +38266,7 @@ function recordFingerprints(dir, runId, cls, names, tree = "") {
38225
38266
  if (list.length === 0)
38226
38267
  return list;
38227
38268
  try {
38228
- const p = resolve26(dir, "fingerprints.jsonl");
38269
+ const p = resolve27(dir, "fingerprints.jsonl");
38229
38270
  mkdirSync55(dir, { recursive: true });
38230
38271
  const ts = new Date().toISOString();
38231
38272
  appendFileSync10(p, `${list.map((name) => JSON.stringify({ ts, run: runId, cls, fp: failureFingerprint(cls, name), name, ...tree !== "" ? { tree } : {} })).join(`
@@ -40321,7 +40362,7 @@ var init_contract = __esm(() => {
40321
40362
 
40322
40363
  // ../../loki-ts/src/features/speed/seal_group.ts
40323
40364
  import { createHash as createHash29 } from "crypto";
40324
- import { existsSync as existsSync77, mkdirSync as mkdirSync59, readdirSync as readdirSync42, readFileSync as readFileSync103, renameSync as renameSync24, statSync as statSync32, writeFileSync as writeFileSync61 } from "fs";
40365
+ import { existsSync as existsSync77, mkdirSync as mkdirSync59, readdirSync as readdirSync42, readFileSync as readFileSync103, renameSync as renameSync24, statSync as statSync33, writeFileSync as writeFileSync61 } from "fs";
40325
40366
  import { dirname as dirname51, join as join114 } from "path";
40326
40367
  function sealGroup(runDir, rh) {
40327
40368
  const manifestPath = join114(runDir, "group", "manifest.json");
@@ -40413,7 +40454,7 @@ async function verifyGroup(receiptPath, receipt, rh, verifyOne, deps = {}) {
40413
40454
  return bad(`unit ${id} is out of order (index ${String(e["index"])} at position ${i})`);
40414
40455
  let bytes;
40415
40456
  try {
40416
- if (!statSync32(dir).isDirectory())
40457
+ if (!statSync33(dir).isDirectory())
40417
40458
  return bad(`unit ${id} is not a directory`);
40418
40459
  bytes = readFileSync103(rp);
40419
40460
  } catch {
@@ -40483,8 +40524,8 @@ var init_seal_group = __esm(() => {
40483
40524
  });
40484
40525
 
40485
40526
  // ../../loki-ts/src/supply/supply_guard.ts
40486
- import { existsSync as existsSync78, readFileSync as readFileSync104, statSync as statSync33 } from "fs";
40487
- import { basename as basename33, join as join115 } from "path";
40527
+ import { existsSync as existsSync78, readFileSync as readFileSync104, statSync as statSync34 } from "fs";
40528
+ import { basename as basename34, join as join115 } from "path";
40488
40529
  function supplyEnabled(env) {
40489
40530
  return env["LOKI_SUPPLY_GUARD"] !== "0";
40490
40531
  }
@@ -40496,14 +40537,14 @@ function supplyVerdict(verdict, r) {
40496
40537
  return r.blocked && verdict === "VERIFIED" ? "FAILED" : verdict;
40497
40538
  }
40498
40539
  function isManifestPath(path) {
40499
- return MANIFESTS3.test(basename33(path));
40540
+ return MANIFESTS3.test(basename34(path));
40500
40541
  }
40501
40542
  function readDeclared(repoDir) {
40502
40543
  const p = join115(repoDir, ".loki", DECLARED_FILE);
40503
40544
  if (!existsSync78(p))
40504
40545
  return { deps: [], problem: null };
40505
40546
  try {
40506
- if (statSync33(p).size > MAX_FILE_BYTES)
40547
+ if (statSync34(p).size > MAX_FILE_BYTES)
40507
40548
  return { deps: [], problem: "declaration file too large" };
40508
40549
  const j = JSON.parse(readFileSync104(p, "utf8"));
40509
40550
  if (!Array.isArray(j))
@@ -40712,7 +40753,7 @@ var MIN_AGE_DAYS = 7, DECLARED_FILE = "supply-declared.json", MAX_CHECKED = 50,
40712
40753
  }
40713
40754
  }, PUBLIC_HOSTS, hostOf = (u) => u.trim().toLowerCase().replace(/^[a-z][a-z0-9+.-]*:\/\//, "").replace(/^www\./, "").split(/[/?#\s]/)[0].replace(/^[^@]*@/, "").replace(/:\d+$/, ""), privateUrl = (u) => /[a-z0-9]/i.test(u) && !PUBLIC_HOSTS.has(hostOf(u)), readSmall2 = (p) => {
40714
40755
  try {
40715
- return statSync33(p).size <= MAX_FILE_BYTES ? readFileSync104(p, "utf8") : "";
40756
+ return statSync34(p).size <= MAX_FILE_BYTES ? readFileSync104(p, "utf8") : "";
40716
40757
  } catch {
40717
40758
  return "";
40718
40759
  }
@@ -40772,7 +40813,7 @@ __export(exports_seal, {
40772
40813
  import { createHash as createHash30 } from "crypto";
40773
40814
  import { execFileSync as execFileSync10 } from "child_process";
40774
40815
  import { existsSync as existsSync79, readdirSync as readdirSync43, mkdirSync as mkdirSync60, readFileSync as readFileSync105, rmSync as rmSync38 } from "fs";
40775
- import { basename as basename34, isAbsolute as isAbsolute19, join as join116, relative as relative27 } from "path";
40816
+ import { basename as basename35, isAbsolute as isAbsolute19, join as join116, relative as relative27 } from "path";
40776
40817
  function missingLintChecks(vraw, env = process.env) {
40777
40818
  if (/^(0|off|false|no)$/i.test((env["LOKI_E10_LINT_MISSING_DISCLOSE"] ?? "").trim()))
40778
40819
  return [];
@@ -41298,7 +41339,8 @@ var init_seal = __esm(() => {
41298
41339
  const issueSt = byRule ? byRule.map((r, i) => ({ ...r, ...advisory && advisory[i].status === "unmet" && r.status === "met" ? { note: `reviewer note: ${advisory[i].reason ?? ""}`.slice(0, 300) } : {} })) : advisory, issueNotes = !issueSt || verdict3a !== "VERIFIED" ? [] : !byRule && lineCheck?.not_reviewed ? [`acceptance not reviewed: ${lineCheck.not_reviewed}`] : notAddressedNotes(issueSt);
41299
41340
  const allLinesMet = !!issueSt && (byRule ? true : !!lineCheck && !lineCheck.not_reviewed) && notAddressedNotes(issueSt).length === 0, unfinished = unfinishedNotes(o.implement);
41300
41341
  const proofNotes = proofRun && proofRun.exit !== 0 ? [`Loki's own re-run of the session's proof script did not pass (exit ${proofRun.exit === null ? "none" : proofRun.exit}, ${proofRun.failed} FAILED line(s))`] : [];
41301
- const twoReaders = (xr?.notes ?? []).filter(isUnmetNote).filter((n3) => issueAsks.some((line2, i) => advisory?.[i]?.status === "unmet" && n3.toLowerCase().includes(line2.toLowerCase().slice(0, 60)))).map((n3) => `${n3} (the acceptance check also reads this line as not delivered: two readers agree, so the count does not carry it)`);
41342
+ const noSecond = !!lineCheck?.not_reviewed;
41343
+ const twoReaders = (xr?.notes ?? []).filter(isUnmetNote).filter((n3) => noSecond || issueAsks.some((line2, i) => advisory?.[i]?.status === "unmet" && n3.toLowerCase().includes(line2.toLowerCase().slice(0, 60)))).map((n3) => noSecond ? `${n3} (the acceptance check did not answer, ${lineCheck.not_reviewed}, so nothing contradicts the review and the count does not carry this line)` : `${n3} (the acceptance check also reads this line as not delivered: two readers agree, so the count does not carry it)`);
41302
41344
  const unusedNotes = issueAsks.length ? (await unusedNewFiles(ctx.repoDir, ctx.baseSha, head)).map(unusedNewFileNote) : [];
41303
41345
  const openNotes = [...issueNotes, ...proofNotes, ...neverStopNotes(o.implement), ...allLinesMet ? [] : unfinished, ...proveNotes(ctx.provider, o, process.env, ctx.runDir), ...allLinesMet && proofRun?.exit === 0 ? twoReaders : (xr?.notes ?? []).filter(isUnmetNote), ...openDecisionNotes(o), ...namedOpen.filter((s) => s.why === null).map(namedUnchangedNote)], verdict3 = openNotes.length > 0 && verdict3a === "VERIFIED" ? "PARTIAL" : verdict3a;
41304
41346
  const deepG = deepGaps(o.verify?.risk, vraw, Array.isArray(o.deep?.checks) ? o.deep.checks : [], modelReviewRan(xr)), notProven2 = new Set([...sealOnlyPass() ? [TIME_RAN_OUT_NOTE] : [], ...deepG.notProven, ...supply.notProven, ...grp.notProven, ...xr?.notes ?? [], ...reviewReceipt(ctx.provider, xr).notProven, ...openNotes]);
@@ -41348,7 +41390,7 @@ var init_seal = __esm(() => {
41348
41390
  for (const n3 of strs2(o.fix?.not_proven))
41349
41391
  notProven2.add(n3);
41350
41392
  if (typeof o.verify?.wall_failure_tail === "string" && o.verify.wall_passed === false) {
41351
- const tailFile = basename34(o.verify.wall_failure_tail), rel = relative27(ctx.repoDir, join116(ctx.runDir, tailFile));
41393
+ const tailFile = basename35(o.verify.wall_failure_tail), rel = relative27(ctx.repoDir, join116(ctx.runDir, tailFile));
41352
41394
  notProven2.add(`Wall failure output kept: ${rel.startsWith("..") || isAbsolute19(rel) ? `.loki/runs/${ctx.runId}/${tailFile}` : rel}`);
41353
41395
  }
41354
41396
  for (const x of Array.isArray(o.wall?.arbitrated) ? o.wall.arbitrated : [])
@@ -41361,7 +41403,7 @@ var init_seal = __esm(() => {
41361
41403
  notProven2.add(`Wall test not executed: ${wallNotRun} file(s), no reason recorded`);
41362
41404
  if (wallNotRun > 0) {
41363
41405
  try {
41364
- const kept = new Set((Array.isArray(o.wall?.files) ? o.wall.files : []).map((f) => basename34(String(f.path))));
41406
+ const kept = new Set((Array.isArray(o.wall?.files) ? o.wall.files : []).map((f) => basename35(String(f.path))));
41365
41407
  for (const n3 of readdirSync43(sealedWallDir(ctx.runDir)).sort())
41366
41408
  if (!kept.has(n3))
41367
41409
  notProven2.add(`wall test discarded: ${n3} (not_run)`);
@@ -41615,7 +41657,7 @@ var init_seal = __esm(() => {
41615
41657
  // ../../loki-ts/src/util/seal_drift.ts
41616
41658
  import { createHash as createHash31, createPublicKey as createPublicKey5, sign as sign3, verify as verify4 } from "crypto";
41617
41659
  import { existsSync as existsSync80, lstatSync as lstatSync30, readFileSync as readFileSync106, realpathSync as realpathSync39 } from "fs";
41618
- import { basename as basename35, dirname as dirname53, join as join117, relative as relative28 } from "path";
41660
+ import { basename as basename36, dirname as dirname53, join as join117, relative as relative28 } from "path";
41619
41661
  function tornTail(raw2) {
41620
41662
  if (raw2 === "" || raw2.endsWith(`
41621
41663
  `))
@@ -41721,7 +41763,7 @@ function currentTaskSha(runDir, source, env) {
41721
41763
  }
41722
41764
  function repoOf(receiptPath) {
41723
41765
  const runs2 = dirname53(dirname53(receiptPath));
41724
- return basename35(runs2) === "runs" && basename35(dirname53(runs2)) === ".loki" ? dirname53(dirname53(runs2)) : null;
41766
+ return basename36(runs2) === "runs" && basename36(dirname53(runs2)) === ".loki" ? dirname53(dirname53(runs2)) : null;
41725
41767
  }
41726
41768
  function overlap(repo, base2, sealedHead, head) {
41727
41769
  if (typeof base2 !== "string" || !/^[0-9a-f]{40,64}$/.test(base2) || !/^[0-9a-f]{40,64}$/.test(sealedHead))
@@ -41747,7 +41789,7 @@ function onlyWallPublish(repo, r, sealedHead, head) {
41747
41789
  } catch {
41748
41790
  return x;
41749
41791
  }
41750
- }, rr = real4(repo), want = new Map(wall.map((w) => [relative28(rr, join117(real4(dirname53(String(w.path))), basename35(String(w.path)))), String(w.sha256)]));
41792
+ }, rr = real4(repo), want = new Map(wall.map((w) => [relative28(rr, join117(real4(dirname53(String(w.path))), basename36(String(w.path)))), String(w.sha256)]));
41751
41793
  const commits = safeGit(repo, ["rev-list", "--reverse", "--topo-order", `${sealedHead}..${head}`]).split(`
41752
41794
  `).filter(Boolean);
41753
41795
  if (commits.length === 0 || safeGit(repo, ["rev-list", "--merges", "--count", `${sealedHead}..${head}`]).trim() !== "0")
@@ -41785,7 +41827,7 @@ function claimsWallPublish(repo, r, sealedHead, head) {
41785
41827
  function sealDrift(given, r, env = process.env) {
41786
41828
  let receiptPath = given;
41787
41829
  try {
41788
- receiptPath = join117(realpathSync39(dirname53(given)), basename35(given));
41830
+ receiptPath = join117(realpathSync39(dirname53(given)), basename36(given));
41789
41831
  } catch {}
41790
41832
  const fab = fabricatedPass(receiptPath, r);
41791
41833
  if (fab)
@@ -43452,11 +43494,11 @@ var init_provider = __esm(() => {
43452
43494
 
43453
43495
  // ../../loki-ts/src/util/funnel.ts
43454
43496
  import { spawn as spawn10 } from "child_process";
43455
- import { existsSync as existsSync82, readdirSync as readdirSync45, readFileSync as readFileSync109, statSync as statSync35 } from "fs";
43456
- import { join as join120, resolve as resolve27 } from "path";
43497
+ import { existsSync as existsSync82, readdirSync as readdirSync45, readFileSync as readFileSync109, statSync as statSync36 } from "fs";
43498
+ import { join as join120, resolve as resolve28 } from "path";
43457
43499
  function emitFunnel(kind, key, extra = []) {
43458
43500
  try {
43459
- const script = resolve27(REPO_ROOT, "autonomy", "telemetry.sh");
43501
+ const script = resolve28(REPO_ROOT, "autonomy", "telemetry.sh");
43460
43502
  if (!existsSync82(script))
43461
43503
  return;
43462
43504
  const fn = kind === "first_run_blocked" ? 'loki_emit_first_run_blocked "$2"' : kind === "run_started" ? "loki_emit_run_started" : kind === "run_finished" ? 'loki_emit_run_finished "$2" "${@:3}"' : 'loki_emit_build_verified_enum VERIFIED "$2"';
@@ -44277,10 +44319,10 @@ __export(exports_doctor, {
44277
44319
  CLAUDE_LOGIN_TTL_MS: () => CLAUDE_LOGIN_TTL_MS,
44278
44320
  AUTH_PROVIDERS: () => AUTH_PROVIDERS
44279
44321
  });
44280
- import { appendFileSync as appendFileSync12, writeFileSync as writeFileSync65, mkdirSync as mkdirSync62, accessSync as accessSync3, constants as fsConstants3, existsSync as existsSync84, lstatSync as lstatSync31, readdirSync as readdirSync46, readFileSync as readFileSync111, readlinkSync as readlinkSync6, realpathSync as realpathSync40, statSync as statSync36, statfsSync as statfsSync2 } from "fs";
44322
+ import { appendFileSync as appendFileSync12, writeFileSync as writeFileSync65, mkdirSync as mkdirSync62, accessSync as accessSync3, constants as fsConstants3, existsSync as existsSync84, lstatSync as lstatSync31, readdirSync as readdirSync46, readFileSync as readFileSync111, readlinkSync as readlinkSync6, realpathSync as realpathSync40, statSync as statSync37, statfsSync as statfsSync2 } from "fs";
44281
44323
  import { spawnSync as spawnSync17 } from "child_process";
44282
44324
  import { homedir as homedir15, tmpdir as tmpdir22 } from "os";
44283
- import { basename as basename36, join as join122, resolve as resolve28 } from "path";
44325
+ import { basename as basename37, join as join122, resolve as resolve29 } from "path";
44284
44326
  function loadRequirements(file = REQUIREMENTS_FILE) {
44285
44327
  if (file === REQUIREMENTS_FILE && cached)
44286
44328
  return cached;
@@ -44325,11 +44367,11 @@ function sdkSearchRoots(env, root = REPO_ROOT) {
44325
44367
  const seam = env["LOKI_SDK_NODE_MODULES"];
44326
44368
  if (seam)
44327
44369
  return [seam];
44328
- return [resolve28(root, "node_modules"), resolve28(root, "loki-ts/node_modules"), resolve28(root, ".."), resolve28(root, "../..")];
44370
+ return [resolve29(root, "node_modules"), resolve29(root, "loki-ts/node_modules"), resolve29(root, ".."), resolve29(root, "../..")];
44329
44371
  }
44330
44372
  function sdkBinaryPath(env, root = REPO_ROOT) {
44331
44373
  for (const nm of sdkSearchRoots(env, root)) {
44332
- const scope = resolve28(nm, "@anthropic-ai");
44374
+ const scope = resolve29(nm, "@anthropic-ai");
44333
44375
  if (!existsSync84(scope))
44334
44376
  continue;
44335
44377
  let names = [];
@@ -44341,7 +44383,7 @@ function sdkBinaryPath(env, root = REPO_ROOT) {
44341
44383
  for (const n3 of names) {
44342
44384
  if (!n3.startsWith("claude-agent-sdk-"))
44343
44385
  continue;
44344
- const bin = resolve28(scope, n3, "claude");
44386
+ const bin = resolve29(scope, n3, "claude");
44345
44387
  try {
44346
44388
  accessSync3(bin, fsConstants3.X_OK);
44347
44389
  return bin;
@@ -44567,7 +44609,7 @@ async function probeIntegrations(mfUrl) {
44567
44609
  }
44568
44610
  function loadClaudeCliRange(root = REPO_ROOT) {
44569
44611
  try {
44570
- const cat = JSON.parse(readFileSync111(resolve28(root, "providers/model_catalog.json"), "utf8"));
44612
+ const cat = JSON.parse(readFileSync111(resolve29(root, "providers/model_catalog.json"), "utf8"));
44571
44613
  const cli = cat?.providers?.claude?.cli;
44572
44614
  return cli && typeof cli === "object" ? cli : null;
44573
44615
  } catch {
@@ -44588,9 +44630,9 @@ function _setClaudeVersionForTest(fn) {
44588
44630
  }
44589
44631
  function bundledClaudeCodeVersion() {
44590
44632
  const rel = "node_modules/@anthropic-ai/claude-agent-sdk/manifest.json";
44591
- for (const base2 of [resolve28(REPO_ROOT, "loki-ts"), REPO_ROOT]) {
44633
+ for (const base2 of [resolve29(REPO_ROOT, "loki-ts"), REPO_ROOT]) {
44592
44634
  try {
44593
- const v = JSON.parse(readFileSync111(resolve28(base2, rel), "utf8"))?.version;
44635
+ const v = JSON.parse(readFileSync111(resolve29(base2, rel), "utf8"))?.version;
44594
44636
  if (typeof v === "string" && v !== "")
44595
44637
  return v;
44596
44638
  } catch {}
@@ -44629,9 +44671,9 @@ function checkSkills(selected) {
44629
44671
  const effective = selected === undefined ? readEffectiveProvider() : selected;
44630
44672
  const home = homedir15();
44631
44673
  return SKILL_ENTRIES.map(({ name, dir, id }) => {
44632
- const sdir = resolve28(home, dir);
44674
+ const sdir = resolve29(home, dir);
44633
44675
  const shortPath = sdir;
44634
- const skillFile = resolve28(sdir, "SKILL.md");
44676
+ const skillFile = resolve29(sdir, "SKILL.md");
44635
44677
  if (existsSync84(skillFile)) {
44636
44678
  return { name, path: shortPath, status: "pass", detail: "", dangling: false };
44637
44679
  }
@@ -44676,7 +44718,7 @@ async function runAllToolChecks() {
44676
44718
  }));
44677
44719
  }
44678
44720
  function providerOfferScript() {
44679
- const p = resolve28(REPO_ROOT, "autonomy/provider-offer.sh");
44721
+ const p = resolve29(REPO_ROOT, "autonomy/provider-offer.sh");
44680
44722
  return existsSync84(p) ? p : null;
44681
44723
  }
44682
44724
  function readProviderAvailability() {
@@ -44716,7 +44758,7 @@ async function checkSentrux() {
44716
44758
  return { found, version: version2, status, required: "optional" };
44717
44759
  }
44718
44760
  async function checkMemoryHealth() {
44719
- const { openSync: openSync17, statSync: statSync37, readSync: readSync14, closeSync: closeSync17, existsSync: existsSync85 } = await import("fs");
44761
+ const { openSync: openSync17, statSync: statSync38, readSync: readSync14, closeSync: closeSync17, existsSync: existsSync85 } = await import("fs");
44720
44762
  const { join: join123 } = await import("path");
44721
44763
  const TAIL_BYTES2 = 65536;
44722
44764
  const lokiDir2 = process.env["LOKI_DIR"] ?? ".loki";
@@ -44726,7 +44768,7 @@ async function checkMemoryHealth() {
44726
44768
  try {
44727
44769
  if (existsSync85(logPath)) {
44728
44770
  exists2 = true;
44729
- const size = statSync37(logPath).size;
44771
+ const size = statSync38(logPath).size;
44730
44772
  const offset = Math.max(0, size - TAIL_BYTES2);
44731
44773
  const len = size - offset;
44732
44774
  const buf = Buffer.alloc(len);
@@ -44756,11 +44798,11 @@ async function checkMemoryHealth() {
44756
44798
  };
44757
44799
  }
44758
44800
  function agentSdkFixText(root) {
44759
- if (existsSync84(resolve28(root, "loki-ts/bun.lock")))
44801
+ if (existsSync84(resolve29(root, "loki-ts/bun.lock")))
44760
44802
  return "cd loki-ts && bun install";
44761
- const parent = resolve28(root, "..");
44762
- if (basename36(parent) === "node_modules") {
44763
- return basename36(resolve28(parent, "..")) === "lib" ? "npm install -g loki-mode@latest" : "npm install loki-mode@latest";
44803
+ const parent = resolve29(root, "..");
44804
+ if (basename37(parent) === "node_modules") {
44805
+ return basename37(resolve29(parent, "..")) === "lib" ? "npm install -g loki-mode@latest" : "npm install loki-mode@latest";
44764
44806
  }
44765
44807
  return "reinstall loki-mode (npm install -g loki-mode@latest)";
44766
44808
  }
@@ -44773,11 +44815,11 @@ function checkAgentSdkPin(root = REPO_ROOT, env = process.env) {
44773
44815
  return null;
44774
44816
  }
44775
44817
  };
44776
- const deps = readJson7(resolve28(root, "loki-ts/package.json"))?.["dependencies"];
44818
+ const deps = readJson7(resolve29(root, "loki-ts/package.json"))?.["dependencies"];
44777
44819
  const pinned = typeof deps?.[name] === "string" ? deps[name] : null;
44778
44820
  let installed = null;
44779
44821
  for (const nm of sdkSearchRoots(env, root)) {
44780
- const v = readJson7(resolve28(nm, name, "package.json"))?.["version"];
44822
+ const v = readJson7(resolve29(nm, name, "package.json"))?.["version"];
44781
44823
  if (typeof v === "string" && v !== "") {
44782
44824
  installed = v;
44783
44825
  break;
@@ -44798,7 +44840,7 @@ function checkAgentSdkPin(root = REPO_ROOT, env = process.env) {
44798
44840
  return { status: "pass", pinned, installed, detail: `Agent SDK ${installed} matches the pin` };
44799
44841
  }
44800
44842
  function describeCatalogFreshness() {
44801
- const path = process.env["LOKI_MODEL_CATALOG"] || resolve28(REPO_ROOT, "providers/model_catalog.json");
44843
+ const path = process.env["LOKI_MODEL_CATALOG"] || resolve29(REPO_ROOT, "providers/model_catalog.json");
44802
44844
  let updated;
44803
44845
  let ageDays;
44804
44846
  try {
@@ -44873,7 +44915,7 @@ async function checkModelCapabilities(env = process.env) {
44873
44915
  return { status: "warn", detail: "Skipped: set ANTHROPIC_API_KEY to compare the catalog with models.retrieve", mismatches: [] };
44874
44916
  let models;
44875
44917
  try {
44876
- const path = env["LOKI_MODEL_CATALOG"] || resolve28(REPO_ROOT, "providers/model_catalog.json");
44918
+ const path = env["LOKI_MODEL_CATALOG"] || resolve29(REPO_ROOT, "providers/model_catalog.json");
44877
44919
  models = JSON.parse(readFileSync111(path, "utf-8")).providers?.claude?.models;
44878
44920
  if (!Array.isArray(models))
44879
44921
  throw new Error("no claude models");
@@ -45308,7 +45350,7 @@ async function runText(deps = {}) {
45308
45350
  }
45309
45351
  if (!anyProvider) {
45310
45352
  let sdkUsable = claudeSdkReady(process.env);
45311
- const sdkOfferScript = resolve28(REPO_ROOT, "autonomy/provider-offer.sh");
45353
+ const sdkOfferScript = resolve29(REPO_ROOT, "autonomy/provider-offer.sh");
45312
45354
  if (!sdkUsable && existsSync84(sdkOfferScript)) {
45313
45355
  const probe = helperSpawn("bash", [sdkOfferScript, "detect-sdk"], { stdio: "ignore" });
45314
45356
  sdkUsable = probe.status === 0;
@@ -45330,7 +45372,7 @@ async function runText(deps = {}) {
45330
45372
  bump(tally, "fail");
45331
45373
  tally.blockers.push("No AI provider CLI. Fix: npm install -g @anthropic-ai/claude-code");
45332
45374
  if (process.stdout.isTTY) {
45333
- const offerScript = resolve28(REPO_ROOT, "autonomy/provider-offer.sh");
45375
+ const offerScript = resolve29(REPO_ROOT, "autonomy/provider-offer.sh");
45334
45376
  if (existsSync84(offerScript)) {
45335
45377
  spawnSync17("bash", [offerScript, "report"], { env: tokenFreeEnv(), stdio: "inherit" });
45336
45378
  }
@@ -45727,7 +45769,7 @@ async function runText(deps = {}) {
45727
45769
  ];
45728
45770
  const missingDetectors = [];
45729
45771
  for (const det of detectors) {
45730
- if (existsSync84(resolve28(REPO_ROOT, "tests", `${det}.sh`))) {
45772
+ if (existsSync84(resolve29(REPO_ROOT, "tests", `${det}.sh`))) {
45731
45773
  bump(tally, "pass");
45732
45774
  } else {
45733
45775
  missingDetectors.push(`${det}.sh`);
@@ -45757,7 +45799,7 @@ async function runText(deps = {}) {
45757
45799
  const isExec = (p) => {
45758
45800
  try {
45759
45801
  accessSync3(p, fsConstants3.X_OK);
45760
- return statSync36(p).isFile();
45802
+ return statSync37(p).isFile();
45761
45803
  } catch {
45762
45804
  return false;
45763
45805
  }
@@ -45778,7 +45820,7 @@ async function runText(deps = {}) {
45778
45820
  seen.add(real4);
45779
45821
  if (real4 === runningReal)
45780
45822
  continue;
45781
- const pj = resolve28(real4, "..", "..", "package.json");
45823
+ const pj = resolve29(real4, "..", "..", "package.json");
45782
45824
  let ver = "";
45783
45825
  try {
45784
45826
  ver = String(JSON.parse(readFileSync111(pj, "utf8")).version ?? "");
@@ -45856,7 +45898,7 @@ async function runText(deps = {}) {
45856
45898
  `);
45857
45899
  }
45858
45900
  const id = process.env["LOKI_PROVIDER"] || readEffectiveProvider() || "claude";
45859
- const modelRun = helperSpawn("bash", ["-c", 'source "$1" >/dev/null 2>&1; printf %s "${PROVIDER_MODEL_DEVELOPMENT:-}"', "_", resolve28(REPO_ROOT, "providers", `${id}.sh`)], { encoding: "utf8" });
45901
+ const modelRun = helperSpawn("bash", ["-c", 'source "$1" >/dev/null 2>&1; printf %s "${PROVIDER_MODEL_DEVELOPMENT:-}"', "_", resolve29(REPO_ROOT, "providers", `${id}.sh`)], { encoding: "utf8" });
45860
45902
  const model = (modelRun.stdout ?? "").toString().trim() || "default";
45861
45903
  const { createPublicKey: createPublicKey6 } = await import("crypto");
45862
45904
  const signer = await Promise.resolve().then(() => (init_receipt_signer(), exports_receipt_signer));
@@ -46044,7 +46086,7 @@ var init_doctor = __esm(() => {
46044
46086
  init_model_routes();
46045
46087
  init_js_resolve();
46046
46088
  init_types();
46047
- REQUIREMENTS_FILE = resolve28(REPO_ROOT, "autonomy/lib/setup-requirements.json");
46089
+ REQUIREMENTS_FILE = resolve29(REPO_ROOT, "autonomy/lib/setup-requirements.json");
46048
46090
  VERSION_NUMBER_RE = /(\d+\.\d+(?:\.\d+)*)/;
46049
46091
  pyImpl = { fn: pythonImportOk };
46050
46092
  LSP_BINS = [
@@ -46104,7 +46146,7 @@ __export(exports_first_run_repo, {
46104
46146
  initEmptyRepo: () => initEmptyRepo,
46105
46147
  NOT_A_REPO: () => NOT_A_REPO
46106
46148
  });
46107
- import { readdirSync as readdirSync47, statSync as statSync37 } from "fs";
46149
+ import { readdirSync as readdirSync47, statSync as statSync38 } from "fs";
46108
46150
  import { join as join123 } from "path";
46109
46151
  async function initEmptyRepo(dir, env) {
46110
46152
  if (env["LOKI_AUTO_GIT_INIT"] === "0")
@@ -46113,7 +46155,7 @@ async function initEmptyRepo(dir, env) {
46113
46155
  let empty = false, written = [];
46114
46156
  const isFile2 = (f) => {
46115
46157
  try {
46116
- return statSync37(join123(dir, f)).isFile();
46158
+ return statSync38(join123(dir, f)).isFile();
46117
46159
  } catch {
46118
46160
  return false;
46119
46161
  }
@@ -46491,8 +46533,8 @@ var init_forecast = __esm(() => {
46491
46533
  });
46492
46534
 
46493
46535
  // ../../loki-ts/src/commands/queue.ts
46494
- import { existsSync as existsSync86, mkdirSync as mkdirSync65, readFileSync as readFileSync113, readdirSync as readdirSync48, renameSync as renameSync25, statSync as statSync38, writeFileSync as writeFileSync67 } from "fs";
46495
- import { join as join126, resolve as resolve29 } from "path";
46536
+ import { existsSync as existsSync86, mkdirSync as mkdirSync65, readFileSync as readFileSync113, readdirSync as readdirSync48, renameSync as renameSync25, statSync as statSync39, writeFileSync as writeFileSync67 } from "fs";
46537
+ import { join as join126, resolve as resolve30 } from "path";
46496
46538
  function normalizeRef(raw2) {
46497
46539
  const m = URL_RE.exec(raw2);
46498
46540
  if (m)
@@ -46737,7 +46779,7 @@ function newestRecord(lokiDir2, since) {
46737
46779
  const p = join126(dir, name, file);
46738
46780
  if (!existsSync86(p))
46739
46781
  continue;
46740
- const t = statSync38(p).mtimeMs;
46782
+ const t = statSync39(p).mtimeMs;
46741
46783
  if (t >= since && (!best || t > best.t))
46742
46784
  best = { t, p, name };
46743
46785
  }
@@ -46779,7 +46821,7 @@ function queueStartArgs(ref, pr) {
46779
46821
  function makeDefaultRunner(lokiDir2) {
46780
46822
  return async (ref, opts) => {
46781
46823
  const since = Date.now();
46782
- const argv = [resolve29(REPO_ROOT, "bin", "loki"), ...queueStartArgs(ref, !!opts.pr)];
46824
+ const argv = [resolve30(REPO_ROOT, "bin", "loki"), ...queueStartArgs(ref, !!opts.pr)];
46783
46825
  const runLoki = opts.cwd ? join126(opts.cwd, ".loki") : lokiDir2;
46784
46826
  const env = runnerEnv(opts, runLoki);
46785
46827
  const proc = Bun.spawn(argv, { stdout: "pipe", stderr: "pipe", stdin: "ignore", env, ...opts.cwd ? { cwd: opts.cwd } : {} });
@@ -47123,7 +47165,7 @@ var init_issues_epic = __esm(() => {
47123
47165
 
47124
47166
  // ../../loki-ts/src/util/group_integrate.ts
47125
47167
  import { existsSync as existsSync88, mkdirSync as mkdirSync66, readFileSync as readFileSync115, rmSync as rmSync39, writeFileSync as writeFileSync68 } from "fs";
47126
- import { basename as basename37, dirname as dirname55, join as join127, normalize as normalize8 } from "path";
47168
+ import { basename as basename38, dirname as dirname55, join as join127, normalize as normalize8 } from "path";
47127
47169
  function integrationOrder(dag) {
47128
47170
  const ids = dag.units.map((u) => u.id), indeg = new Map(ids.map((i) => [i, 0]));
47129
47171
  for (const e of dag.edges)
@@ -47159,7 +47201,7 @@ async function rerunWalls(runner, repoDir, merged, walls) {
47159
47201
  }
47160
47202
  try {
47161
47203
  for (const f of bad ? [] : files) {
47162
- const rel = normalize8(f.rel), abs = join127(repoDir, rel), r2 = f.runner ?? guessRunner(basename37(rel), harnessRunners([], [rel], process.env, repoDir, [rel]), rel);
47204
+ const rel = normalize8(f.rel), abs = join127(repoDir, rel), r2 = f.runner ?? guessRunner(basename38(rel), harnessRunners([], [rel], process.env, repoDir, [rel]), rel);
47163
47205
  if (bad = wallPathProblem(repoDir, rel) ?? (r2 ? undefined : `no runner for ${f.rel}`))
47164
47206
  break;
47165
47207
  written.push({ abs, prev: existsSync88(abs) ? readFileSync115(abs) : null });
@@ -48061,10 +48103,10 @@ __export(exports_run_group, {
48061
48103
  groupCostLine: () => groupCostLine,
48062
48104
  NOT_PROVEN: () => NOT_PROVEN
48063
48105
  });
48064
- import { cpSync as cpSync6, existsSync as existsSync90, mkdirSync as mkdirSync68, readdirSync as readdirSync49, readFileSync as readFileSync117, rmSync as rmSync41, statSync as statSync39 } from "fs";
48106
+ import { cpSync as cpSync6, existsSync as existsSync90, mkdirSync as mkdirSync68, readdirSync as readdirSync49, readFileSync as readFileSync117, rmSync as rmSync41, statSync as statSync40 } from "fs";
48065
48107
  import { createHash as createHash32 } from "crypto";
48066
48108
  import { spawn as spawn11 } from "child_process";
48067
- import { join as join129, resolve as resolve30 } from "path";
48109
+ import { join as join129, resolve as resolve31 } from "path";
48068
48110
  function scopedEnv(env) {
48069
48111
  const out3 = {};
48070
48112
  for (const [k, v] of Object.entries(env))
@@ -48144,7 +48186,7 @@ function findResumable(repoDir, specSha, unitIds) {
48144
48186
  continue;
48145
48187
  let at = 0;
48146
48188
  try {
48147
- at = statSync39(p).mtimeMs;
48189
+ at = statSync40(p).mtimeMs;
48148
48190
  } catch {
48149
48191
  continue;
48150
48192
  }
@@ -48342,7 +48384,7 @@ async function runGroupCore(launcher, dag, ctx) {
48342
48384
  atomicWriteJson(spec, { id: u.id, writeSet: u.writeSet, pack: u.writeSet, tokenBudget: 1e9, acceptance: u.acceptance ?? accOf.get(u.id) ?? [], items: u.items ?? [], base: u.base ?? "" });
48343
48385
  u.spec = spec;
48344
48386
  }
48345
- const jdir = repoCacheDir(repoKey(git11(repoDir, ["remote", "get-url", "origin"]) || null, repoDir), env.LOKI_CACHE_ROOT ? resolve30(env.LOKI_CACHE_ROOT) : undefined);
48387
+ const jdir = repoCacheDir(repoKey(git11(repoDir, ["remote", "get-url", "origin"]) || null, repoDir), env.LOKI_CACHE_ROOT ? resolve31(env.LOKI_CACHE_ROOT) : undefined);
48346
48388
  const keyOf = (u) => sliceKey(JSON.stringify({ id: u.id, items: u.items, writeSet: u.writeSet, acceptance: accOf.get(u.id) ?? [] }), baseRef);
48347
48389
  let doneCount = 0;
48348
48390
  for (const [i, u] of units.entries()) {
@@ -48517,7 +48559,7 @@ async function runGroupCore(launcher, dag, ctx) {
48517
48559
  `);
48518
48560
  return 0;
48519
48561
  }
48520
- var NOT_PROVEN = 4, ENV_KEEP, defaultLauncher = (argv, env, cwd, onOut) => new Promise((resolve31) => {
48562
+ var NOT_PROVEN = 4, ENV_KEEP, defaultLauncher = (argv, env, cwd, onOut) => new Promise((resolve32) => {
48521
48563
  const child = spawn11("python3", argv, { cwd, env, stdio: ["ignore", "pipe", "pipe"] });
48522
48564
  let out3 = "";
48523
48565
  child.stdout.on("data", (b) => {
@@ -48528,8 +48570,8 @@ var NOT_PROVEN = 4, ENV_KEEP, defaultLauncher = (argv, env, cwd, onOut) => new P
48528
48570
  child.stderr.on("data", (b) => {
48529
48571
  process.stderr.write(b);
48530
48572
  });
48531
- child.on("error", (e) => resolve31({ code: 127, stdout: out3 + String(e) }));
48532
- child.on("close", (c) => resolve31({ code: c ?? 1, stdout: out3 }));
48573
+ child.on("error", (e) => resolve32({ code: 127, stdout: out3 + String(e) }));
48574
+ child.on("close", (c) => resolve32({ code: c ?? 1, stdout: out3 }));
48533
48575
  }), git11 = (dir, args) => {
48534
48576
  const r = safeGitSpawn(dir, args, { encoding: "utf8" });
48535
48577
  return r.status === 0 ? String(r.stdout).trim() : "";
@@ -48572,7 +48614,7 @@ __export(exports_route, {
48572
48614
  MAX_SEQ_TASK_BYTES: () => MAX_SEQ_TASK_BYTES
48573
48615
  });
48574
48616
  import { closeSync as closeSync17, constants as constants4, fstatSync as fstatSync9, openSync as openSync17, readFileSync as readFileSync118, realpathSync as realpathSync41 } from "fs";
48575
- import { isAbsolute as isAbsolute20, relative as relative29, resolve as resolve31 } from "path";
48617
+ import { isAbsolute as isAbsolute20, relative as relative29, resolve as resolve32 } from "path";
48576
48618
  function providerSlots(env, provider) {
48577
48619
  provider = (provider || env.LOKI_PROVIDER || "claude").toLowerCase();
48578
48620
  return { provider, slots: PROVIDER_SLOTS[provider] ?? 1 };
@@ -48580,7 +48622,7 @@ function providerSlots(env, provider) {
48580
48622
  function readSpec(task, repoDir, cwd) {
48581
48623
  if (/\s/.test(task) || !SPEC_PATH_RE.test(task))
48582
48624
  return { kind: "text" };
48583
- const p = isAbsolute20(task) ? task : resolve31(cwd, task);
48625
+ const p = isAbsolute20(task) ? task : resolve32(cwd, task);
48584
48626
  let real4;
48585
48627
  try {
48586
48628
  real4 = realpathSync41(p);
@@ -48749,7 +48791,7 @@ __export(exports_issues_run, {
48749
48791
  import { spawnSync as spawnSync20 } from "child_process";
48750
48792
  import { cpSync as cpSync7, existsSync as existsSync91, mkdirSync as mkdirSync69, mkdtempSync as mkdtempSync19, readdirSync as readdirSync50, readFileSync as readFileSync119, rmdirSync as rmdirSync2, rmSync as rmSync42, writeFileSync as writeFileSync70 } from "fs";
48751
48793
  import { tmpdir as tmpdir24 } from "os";
48752
- import { join as join130, resolve as resolve32 } from "path";
48794
+ import { join as join130, resolve as resolve33 } from "path";
48753
48795
  import { createInterface as createInterface3 } from "readline";
48754
48796
  function epicParallel(env, provider) {
48755
48797
  const n3 = Number(env["LOKI_EPIC_PARALLEL"]);
@@ -49459,7 +49501,7 @@ async function startMany(o) {
49459
49501
  const env = o.env ?? process.env, { ManyStatus: ManyStatus2, consoleOn: consoleOn2 } = await Promise.resolve().then(() => (init_console(), exports_console));
49460
49502
  const userEnv = groupEnv({ ...env, ...o.provider ? { LOKI_PROVIDER: o.provider } : {} }, o.capUsd, o.repoDir);
49461
49503
  const tty = consoleOn2(env), status = new ManyStatus2({ write: (s) => void process.stdout.write(s), tty });
49462
- const d = issuesDeps(o.repoDir, env["LOKI_DIR"] ?? resolve32(o.repoDir, ".loki"), userEnv, { out: (s) => status.print(s), ...tty ? { err: (s) => status.print(s) } : {}, status, ...o.inject });
49504
+ const d = issuesDeps(o.repoDir, env["LOKI_DIR"] ?? resolve33(o.repoDir, ".loki"), userEnv, { out: (s) => status.print(s), ...tty ? { err: (s) => status.print(s) } : {}, status, ...o.inject });
49463
49505
  try {
49464
49506
  return await issuesRun({ slug: o.slug, label: o.label, milestone: null, limit: DEFAULT_LIMIT, parallel: startParallel(env), draft: false, dryRun: false, yes: false, comment: false, split: false, triage: false, json: false, fromStart: true, noPr: o.noPr, ...o.numbers ? { numbers: o.numbers } : {} }, d);
49465
49507
  } finally {
@@ -49502,7 +49544,7 @@ async function runIssues(args, inject) {
49502
49544
  return 2;
49503
49545
  }
49504
49546
  const repoDir = inject?.repoDir ?? process.cwd();
49505
- const lokiDir2 = inject?.lokiDir ?? process.env["LOKI_DIR"] ?? resolve32(repoDir, ".loki");
49547
+ const lokiDir2 = inject?.lokiDir ?? process.env["LOKI_DIR"] ?? resolve33(repoDir, ".loki");
49506
49548
  const userEnv = { ...process.env };
49507
49549
  if (!inject?.triage)
49508
49550
  (await Promise.resolve().then(() => (init_github_token(), exports_github_token))).withholdGithubTokens(process.env, () => {});
@@ -49590,7 +49632,7 @@ __export(exports_supervisor, {
49590
49632
  import { spawnSync as spawnSync21 } from "child_process";
49591
49633
  import { createHash as createHash33, createPublicKey as createPublicKey6, sign as sign4 } from "crypto";
49592
49634
  import { existsSync as existsSync92, mkdirSync as mkdirSync70, readFileSync as readFileSync120, writeFileSync as writeFileSync71 } from "fs";
49593
- import { dirname as dirname57, join as join131, relative as relative30, resolve as resolve33 } from "path";
49635
+ import { dirname as dirname57, join as join131, relative as relative30, resolve as resolve34 } from "path";
49594
49636
  async function slackEvent(...a) {
49595
49637
  try {
49596
49638
  await (await Promise.resolve().then(() => (init_slack_events(), exports_slack_events))).notifyEvent(...a);
@@ -50051,7 +50093,7 @@ async function main3(args) {
50051
50093
  noteRefusal("unsupported_flag");
50052
50094
  return 2;
50053
50095
  }
50054
- sealPatch = resolve33(v);
50096
+ sealPatch = resolve34(v);
50055
50097
  noPr = true;
50056
50098
  i++;
50057
50099
  } else if (a === "--" && !eoo)
@@ -50071,7 +50113,7 @@ usage: loki "<task>" [--no-pr] [--deep] [--json] [--verbose] [--quiet] [--max-co
50071
50113
  let spec = null;
50072
50114
  if (specFile !== null) {
50073
50115
  try {
50074
- spec = loadSpecFile(resolve33(specFile));
50116
+ spec = loadSpecFile(resolve34(specFile));
50075
50117
  } catch (e) {
50076
50118
  process.stderr.write(`engine10: ${e.message}
50077
50119
  `);
@@ -50405,8 +50447,8 @@ usage: loki "<goal>" (or: loki start <prd.md | owner/repo#N>)
50405
50447
  env,
50406
50448
  capS,
50407
50449
  capCeilingS: sized?.ceilingS,
50408
- workerArgv: [process.execPath, ...SAFE_BUN_FLAGS, resolve33(process.argv[1]), "engine10", "worker", runId2, provider, model, deep ? "deep" : "fast"],
50409
- deepArgv: noPr ? undefined : [process.execPath, ...SAFE_BUN_FLAGS, resolve33(process.argv[1]), "engine10", "deep-worker", runId2, provider, model],
50450
+ workerArgv: [process.execPath, ...SAFE_BUN_FLAGS, resolve34(process.argv[1]), "engine10", "worker", runId2, provider, model, deep ? "deep" : "fast"],
50451
+ deepArgv: noPr ? undefined : [process.execPath, ...SAFE_BUN_FLAGS, resolve34(process.argv[1]), "engine10", "deep-worker", runId2, provider, model],
50410
50452
  status: statusStep,
50411
50453
  started: {
50412
50454
  task_source: isIssue ? "issue" : "text",
@@ -50589,7 +50631,7 @@ var init_supervisor = __esm(() => {
50589
50631
 
50590
50632
  // ../../loki-ts/src/e10ext/compound_match.ts
50591
50633
  import { readFileSync as readFileSync121 } from "fs";
50592
- import { basename as basename38, join as join132 } from "path";
50634
+ import { basename as basename39, join as join132 } from "path";
50593
50635
  function parts(s) {
50594
50636
  return s.replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().match(/[a-z0-9]+/g) ?? [];
50595
50637
  }
@@ -50610,9 +50652,9 @@ function fuzzyHit(word2, ps) {
50610
50652
  }
50611
50653
  function linkedHits(word2, repoMap, testMap, repoDir) {
50612
50654
  const out3 = [];
50613
- const srcs = repoMap.entries.filter((e) => !vendored(e.path) && e.symbols.some((s) => fuzzyHit(word2, parts(s))) && fuzzyHit(word2, parts(basename38(e.path))));
50655
+ const srcs = repoMap.entries.filter((e) => !vendored(e.path) && e.symbols.some((s) => fuzzyHit(word2, parts(s))) && fuzzyHit(word2, parts(basename39(e.path))));
50614
50656
  for (const t of testMap.tests) {
50615
- if (vendored(t.path) || !fuzzyHit(word2, parts(basename38(t.path))))
50657
+ if (vendored(t.path) || !fuzzyHit(word2, parts(basename39(t.path))))
50616
50658
  continue;
50617
50659
  let body;
50618
50660
  try {
@@ -50630,7 +50672,7 @@ function linkedHits(word2, repoMap, testMap, repoDir) {
50630
50672
  }
50631
50673
  return out3;
50632
50674
  }
50633
- var MIN_PREFIX = 5, SUFFIX, VENDORED, vendored = (p) => p.split("/").some((s) => VENDORED.has(s)), stemOf2 = (p) => parts(basename38(p)).slice(0, -1).filter((x) => x !== "test" && x !== "spec").join("-");
50675
+ var MIN_PREFIX = 5, SUFFIX, VENDORED, vendored = (p) => p.split("/").some((s) => VENDORED.has(s)), stemOf2 = (p) => parts(basename39(p)).slice(0, -1).filter((x) => x !== "test" && x !== "spec").join("-");
50634
50676
  var init_compound_match = __esm(() => {
50635
50677
  SUFFIX = /^(ation|ization|isation|ity|ivity|ments?|ives?|als?|ures?|ness|ism|ist|ize|ise|able|ible|ous|ics?|ings?|ed|ers?|ions?|ly|less|es|s|(ful|hood|ship|dom|ance|ence|ancy|ency|ator|ant|ent|ary|ery|ory|ward|wise|like|ish)s?)$/;
50636
50678
  VENDORED = new Set(["vendor", "third_party", "build", ".venv", "__generated__", "coverage", "node_modules", "dist"]);
@@ -50638,7 +50680,7 @@ var init_compound_match = __esm(() => {
50638
50680
 
50639
50681
  // ../../loki-ts/src/util/already_done_evidence.ts
50640
50682
  import { existsSync as existsSync93, readFileSync as readFileSync122 } from "fs";
50641
- import { basename as basename39, join as join133 } from "path";
50683
+ import { basename as basename40, join as join133 } from "path";
50642
50684
  function keywords2(task) {
50643
50685
  const words3 = task.toLowerCase().match(/[a-z0-9_]+/g) ?? [];
50644
50686
  return Array.from(new Set(words3.filter((w) => w.length > 2 && !STOP_WORDS.has(w))));
@@ -50659,7 +50701,7 @@ function codeEvidence(words3, repoMap) {
50659
50701
  function testEvidence(words3, testMap) {
50660
50702
  const hits = [];
50661
50703
  for (const t of testMap.tests) {
50662
- const toks2 = tokenSet(basename39(t.path));
50704
+ const toks2 = tokenSet(basename40(t.path));
50663
50705
  if (words3.some((w) => toks2.has(w)))
50664
50706
  hits.push({ source: "test", path: t.path, line: t.path });
50665
50707
  }
@@ -50732,7 +50774,7 @@ function citesToken(text4, token) {
50732
50774
  function citesRealHit(text4, hit2, repoDir) {
50733
50775
  if (hit2.source === "changelog")
50734
50776
  return false;
50735
- return (citesToken(text4, hit2.path) || citesToken(text4, basename39(hit2.path))) && existsSync93(join133(repoDir, hit2.path));
50777
+ return (citesToken(text4, hit2.path) || citesToken(text4, basename40(hit2.path))) && existsSync93(join133(repoDir, hit2.path));
50736
50778
  }
50737
50779
  function renderAlreadyDoneComment(evidence) {
50738
50780
  return ["Loki 10: no change needed. This already appears to be implemented.", "", "Evidence:", ...evidence.map((e) => `- ${e}`), ""].join(`
@@ -50934,15 +50976,15 @@ __export(exports_warm, {
50934
50976
  WarmEngine: () => WarmEngine
50935
50977
  });
50936
50978
  import { createHash as createHash34 } from "crypto";
50937
- import { existsSync as existsSync94, mkdirSync as mkdirSync71, readFileSync as readFileSync123, statSync as statSync40, unlinkSync as unlinkSync11 } from "fs";
50979
+ import { existsSync as existsSync94, mkdirSync as mkdirSync71, readFileSync as readFileSync123, statSync as statSync41, unlinkSync as unlinkSync11 } from "fs";
50938
50980
  import { createServer as createServer2 } from "net";
50939
- import { dirname as dirname58, resolve as resolve34 } from "path";
50981
+ import { dirname as dirname58, resolve as resolve35 } from "path";
50940
50982
  function speedEnabled() {
50941
50983
  return process.env["LOKI_SPEED"] !== "0";
50942
50984
  }
50943
50985
  function warmSocketPath() {
50944
50986
  const o = process.env["LOKI_WARM_SOCK"];
50945
- return o && o.trim() ? o.trim() : resolve34(homeLokiDir(), "run", "engine.sock");
50987
+ return o && o.trim() ? o.trim() : resolve35(homeLokiDir(), "run", "engine.sock");
50946
50988
  }
50947
50989
  function git12(repoDir, args) {
50948
50990
  try {
@@ -50962,8 +51004,8 @@ function dirtyHash(repoDir) {
50962
51004
  `);
50963
51005
  const rel = line2.slice(3).split(" -> ").pop().replace(/^"|"$/g, "");
50964
51006
  try {
50965
- const p = resolve34(repoDir, rel);
50966
- if (existsSync94(p) && statSync40(p).isFile() && statSync40(p).size <= MAX_HASHED_BYTES)
51007
+ const p = resolve35(repoDir, rel);
51008
+ if (existsSync94(p) && statSync41(p).isFile() && statSync41(p).size <= MAX_HASHED_BYTES)
50967
51009
  h.update(readFileSync123(p));
50968
51010
  } catch {}
50969
51011
  }
@@ -50973,7 +51015,7 @@ function warmKey(repoDir) {
50973
51015
  const tree = git12(repoDir, ["rev-parse", "HEAD^{tree}"]);
50974
51016
  if (tree === null)
50975
51017
  return null;
50976
- return `${resolve34(repoDir)}|${tree.trim()}|${dirtyHash(repoDir)}`;
51018
+ return `${resolve35(repoDir)}|${tree.trim()}|${dirtyHash(repoDir)}`;
50977
51019
  }
50978
51020
 
50979
51021
  class WarmEngine {
@@ -51216,7 +51258,7 @@ __export(exports_intake, {
51216
51258
  alreadyDoneCheckOn: () => alreadyDoneCheckOn
51217
51259
  });
51218
51260
  import { appendFileSync as appendFileSync14, existsSync as existsSync95, mkdirSync as mkdirSync73, readFileSync as readFileSync124, writeFileSync as writeFileSync72 } from "fs";
51219
- import { dirname as dirname59, join as join135, resolve as resolve35 } from "path";
51261
+ import { dirname as dirname59, join as join135, resolve as resolve36 } from "path";
51220
51262
  function issueRefOf(raw2) {
51221
51263
  return typeof raw2.repo === "string" && raw2.repo && typeof raw2.number === "number" ? `${raw2.repo}#${raw2.number}` : null;
51222
51264
  }
@@ -51238,7 +51280,7 @@ function ensureBranch(repoDir, branch, from) {
51238
51280
  function excludeLokiDir(repoDir) {
51239
51281
  let path = join135(repoDir, ".git", "info", "exclude");
51240
51282
  try {
51241
- path = resolve35(repoDir, git13(repoDir, ["rev-parse", "--git-path", "info/exclude"]));
51283
+ path = resolve36(repoDir, git13(repoDir, ["rev-parse", "--git-path", "info/exclude"]));
51242
51284
  } catch {}
51243
51285
  const existing = existsSync95(path) ? readFileSync124(path, "utf8") : "";
51244
51286
  if (existing.split(`
@@ -51487,7 +51529,7 @@ __export(exports_fix, {
51487
51529
  fixStage: () => fixStage,
51488
51530
  buildFixBrief: () => buildFixBrief
51489
51531
  });
51490
- import { relative as relative31, resolve as resolve36 } from "path";
51532
+ import { relative as relative31, resolve as resolve37 } from "path";
51491
51533
  function isTestFailure(g2) {
51492
51534
  return !g2.signature.startsWith("lint:") && g2.signature !== "select-tests";
51493
51535
  }
@@ -51578,7 +51620,7 @@ ${g2.sample}`)].join(`
51578
51620
 
51579
51621
  `) || null;
51580
51622
  const fullBrief = buildFixBrief(task, groups, diffStat2, repeated ? { priorDiagnosis: prevDiag } : undefined, holdoutFailed, hintsPlus);
51581
- let r = await runFixSession(ctx, sessionBase, `${ctx.runId}-fix${round2}`, prior.fix?.iteration_ids ?? [], chain, actualModel, fullBrief, buildFixResumeBrief(groups, diffStat2, prevDiag, holdoutFailed, [...prior.implement?.tests_reverted ?? [], ...prior.fix?.tests_reverted ?? []].map((f) => relative31(ctx.repoDir, resolve36(ctx.repoDir, f))), hintsPlus));
51623
+ let r = await runFixSession(ctx, sessionBase, `${ctx.runId}-fix${round2}`, prior.fix?.iteration_ids ?? [], chain, actualModel, fullBrief, buildFixResumeBrief(groups, diffStat2, prevDiag, holdoutFailed, [...prior.implement?.tests_reverted ?? [], ...prior.fix?.tests_reverted ?? []].map((f) => relative31(ctx.repoDir, resolve37(ctx.repoDir, f))), hintsPlus));
51582
51624
  const ro = prior.wall?.readOnlyFiles ?? [], wd = r.session.markers.specConflict && !r.session.killed ? await adjudicateWallConflict(ctx, { ...sessionBase, iterationId: r.ids[r.ids.length - 1], brief: fullBrief }, r.session, ro) : null;
51583
51625
  if (wd)
51584
51626
  r = { ...r, session: wd.session, ids: [...r.ids, ...wd.ids] };
@@ -53305,7 +53347,7 @@ var init_seal2 = __esm(() => {
53305
53347
  import { spawnSync as spawnSync24 } from "child_process";
53306
53348
  import { copyFileSync as copyFileSync10, existsSync as existsSync100, linkSync as linkSync4, mkdirSync as mkdirSync77, mkdtempSync as mkdtempSync22, readFileSync as readFileSync130, renameSync as renameSync27, rmSync as rmSync45, rmdirSync as rmdirSync3, writeFileSync as writeFileSync76 } from "fs";
53307
53349
  import { tmpdir as tmpdir27 } from "os";
53308
- import { basename as basename40, dirname as dirname62, join as join143 } from "path";
53350
+ import { basename as basename41, dirname as dirname62, join as join143 } from "path";
53309
53351
  function search(unitSource, seedCases, propose, runCapture, opts = {}) {
53310
53352
  const maxRounds = opts.maxRounds ?? 10;
53311
53353
  const plateauLimit = opts.plateauRounds ?? 2;
@@ -53415,7 +53457,7 @@ function makeProposeInputs(session, cap = 20) {
53415
53457
  return (unitPath, missing, round2) => {
53416
53458
  const cwd = mkdtempSync22(join143(tmpdir27(), "m27-propose-"));
53417
53459
  try {
53418
- const unitFile = join143(cwd, basename40(unitPath));
53460
+ const unitFile = join143(cwd, basename41(unitPath));
53419
53461
  copyFileSync10(unitPath, unitFile);
53420
53462
  session({ cwd, env: tokenFreeEnv(), unitFile, missing, round: round2 });
53421
53463
  const out3 = [];
@@ -54820,7 +54862,7 @@ var init_unit = __esm(() => {
54820
54862
 
54821
54863
  // ../../loki-ts/src/engine10/modernize/wave.ts
54822
54864
  import { spawnSync as spawnSync26 } from "child_process";
54823
- import { readFileSync as readFileSync136, statSync as statSync41 } from "fs";
54865
+ import { readFileSync as readFileSync136, statSync as statSync42 } from "fs";
54824
54866
  import { join as join149 } from "path";
54825
54867
  function clampTimeout(ms) {
54826
54868
  if (ms === undefined || !Number.isFinite(ms) || ms <= 0)
@@ -54902,7 +54944,7 @@ function detectWaveCommands(inv, target) {
54902
54944
  if (system === "gradle") {
54903
54945
  let gw = "gradle";
54904
54946
  try {
54905
- if (inv.files.includes("gradlew") && (statSync41(join149(target, "gradlew")).mode & 73) !== 0)
54947
+ if (inv.files.includes("gradlew") && (statSync42(join149(target, "gradlew")).mode & 73) !== 0)
54906
54948
  gw = "./gradlew";
54907
54949
  } catch {}
54908
54950
  return { build: { argv: [gw, "assemble"] }, integration: text4().includes("integrationTest") ? { argv: [gw, "integrationTest"] } : null, original_suite: { argv: [gw, "test"] } };
@@ -54946,7 +54988,7 @@ var init_wave = __esm(() => {
54946
54988
 
54947
54989
  // ../../loki-ts/src/util/modernize_unit.ts
54948
54990
  import { spawnSync as spawnSync27 } from "child_process";
54949
- import { existsSync as existsSync103, lstatSync as lstatSync33, mkdtempSync as mkdtempSync23, readFileSync as readFileSync137, realpathSync as realpathSync43, rmSync as rmSync47, statSync as statSync42, writeFileSync as writeFileSync80 } from "fs";
54991
+ import { existsSync as existsSync103, lstatSync as lstatSync33, mkdtempSync as mkdtempSync23, readFileSync as readFileSync137, realpathSync as realpathSync43, rmSync as rmSync47, statSync as statSync43, writeFileSync as writeFileSync80 } from "fs";
54950
54992
  import { tmpdir as tmpdir29 } from "os";
54951
54993
  import { join as join150, sep as sep23 } from "path";
54952
54994
  function parseUnitArgs(args) {
@@ -55171,7 +55213,7 @@ var UNIT_USAGE = "loki modernize unit --repo <owner/name> --ref <ref> --unit <id
55171
55213
  return s.size === 1 ? [...s][0] : null;
55172
55214
  }, isRealDir = (p) => {
55173
55215
  try {
55174
- return !lstatSync33(p).isSymbolicLink() && statSync42(p).isDirectory();
55216
+ return !lstatSync33(p).isSymbolicLink() && statSync43(p).isDirectory();
55175
55217
  } catch {
55176
55218
  return false;
55177
55219
  }
@@ -55485,7 +55527,7 @@ __export(exports_cli, {
55485
55527
  main: () => main6,
55486
55528
  USAGE: () => USAGE2
55487
55529
  });
55488
- import { existsSync as existsSync105, statSync as statSync43 } from "fs";
55530
+ import { existsSync as existsSync105, statSync as statSync44 } from "fs";
55489
55531
  function parseArgs2(args) {
55490
55532
  let repoDir = null;
55491
55533
  let target = null;
@@ -55622,7 +55664,7 @@ ${USAGE2}`);
55622
55664
  return 2;
55623
55665
  }
55624
55666
  const opts = parsed.opts;
55625
- if (!existsSync105(opts.repoDir) || !statSync43(opts.repoDir).isDirectory()) {
55667
+ if (!existsSync105(opts.repoDir) || !statSync44(opts.repoDir).isDirectory()) {
55626
55668
  process.stderr.write(`modernize: not a directory: ${opts.repoDir}
55627
55669
  `);
55628
55670
  return 2;
@@ -56131,10 +56173,10 @@ var init_undo = __esm(() => {
56131
56173
  });
56132
56174
 
56133
56175
  // ../../loki-ts/src/commands/run_status.ts
56134
- import { existsSync as existsSync107, readdirSync as readdirSync53, readFileSync as readFileSync140, statSync as statSync44 } from "fs";
56135
- import { basename as basename41, dirname as dirname64, join as join153, resolve as resolve37 } from "path";
56176
+ import { existsSync as existsSync107, readdirSync as readdirSync53, readFileSync as readFileSync140, statSync as statSync45 } from "fs";
56177
+ import { basename as basename42, dirname as dirname64, join as join153, resolve as resolve38 } from "path";
56136
56178
  function runsRoot(env, repoDir) {
56137
- return env.LOKI_DIR ? join153(resolve37(repoDir, env.LOKI_DIR), "runs") : join153(repoDir, ".loki", "runs");
56179
+ return env.LOKI_DIR ? join153(resolve38(repoDir, env.LOKI_DIR), "runs") : join153(repoDir, ".loki", "runs");
56138
56180
  }
56139
56181
  function listRunIds(root) {
56140
56182
  if (!existsSync107(root))
@@ -56190,9 +56232,9 @@ __export(exports_base_guard, {
56190
56232
  });
56191
56233
  import { execFileSync as execFileSync12 } from "child_process";
56192
56234
  import { createHash as createHash39 } from "crypto";
56193
- import { existsSync as existsSync108, mkdirSync as mkdirSync81, mkdtempSync as mkdtempSync25, readdirSync as readdirSync54, readFileSync as readFileSync141, readlinkSync as readlinkSync8, realpathSync as realpathSync44, rmSync as rmSync49, statSync as statSync45, symlinkSync as symlinkSync6, utimesSync, writeFileSync as writeFileSync82 } from "fs";
56235
+ import { existsSync as existsSync108, mkdirSync as mkdirSync81, mkdtempSync as mkdtempSync25, readdirSync as readdirSync54, readFileSync as readFileSync141, readlinkSync as readlinkSync8, realpathSync as realpathSync44, rmSync as rmSync49, statSync as statSync46, symlinkSync as symlinkSync6, utimesSync, writeFileSync as writeFileSync82 } from "fs";
56194
56236
  import { tmpdir as tmpdir31 } from "os";
56195
- import { basename as basename42, dirname as dirname65, join as join154, relative as relative32, resolve as resolve38, sep as sep24 } from "path";
56237
+ import { basename as basename43, dirname as dirname65, join as join154, relative as relative32, resolve as resolve39, sep as sep24 } from "path";
56196
56238
  import { fileURLToPath as fileURLToPath5 } from "url";
56197
56239
  function git14(repoDir, args, timeout = 20000, extraEnv = {}) {
56198
56240
  try {
@@ -56289,7 +56331,7 @@ function noteOf(intake) {
56289
56331
  }
56290
56332
  function insideAny(p, roots) {
56291
56333
  const under3 = (q) => roots.some((r) => q === r || q.startsWith(r + sep24));
56292
- if (under3(resolve38(p)))
56334
+ if (under3(resolve39(p)))
56293
56335
  return true;
56294
56336
  try {
56295
56337
  return under3(realpathSync44(p));
@@ -56299,7 +56341,7 @@ function insideAny(p, roots) {
56299
56341
  }
56300
56342
  function namedPaths2(file, text4) {
56301
56343
  const out3 = text4.split(/\r?\n/).map((l) => l.trim()).filter((l) => l !== "");
56302
- if (basename42(file) !== "direct_url.json")
56344
+ if (basename43(file) !== "direct_url.json")
56303
56345
  return out3;
56304
56346
  const url = JSON.parse(text4).url;
56305
56347
  return typeof url === "string" && url.startsWith("file:") ? [...out3, fileURLToPath5(url)] : out3;
@@ -56307,7 +56349,7 @@ function namedPaths2(file, text4) {
56307
56349
  function depsSeeHead(pkgDir, repoDir) {
56308
56350
  let roots;
56309
56351
  try {
56310
- roots = [...new Set([resolve38(repoDir), realpathSync44(repoDir)])];
56352
+ roots = [...new Set([resolve39(repoDir), realpathSync44(repoDir)])];
56311
56353
  } catch {
56312
56354
  return true;
56313
56355
  }
@@ -56318,7 +56360,7 @@ function depsSeeHead(pkgDir, repoDir) {
56318
56360
  return true;
56319
56361
  const p = join154(dir, e.name);
56320
56362
  if (e.isSymbolicLink()) {
56321
- const t = resolve38(dir, readlinkSync8(p));
56363
+ const t = resolve39(dir, readlinkSync8(p));
56322
56364
  let rt = t;
56323
56365
  try {
56324
56366
  rt = realpathSync44(t);
@@ -56340,7 +56382,7 @@ function depsSeeHead(pkgDir, repoDir) {
56340
56382
  return ["node_modules", ".venv"].some((d) => {
56341
56383
  try {
56342
56384
  const top = join154(pkgDir, d);
56343
- return walk(top, [...new Set([resolve38(top), realpathSync44(top)])]);
56385
+ return walk(top, [...new Set([resolve39(top), realpathSync44(top)])]);
56344
56386
  } catch (e) {
56345
56387
  if (e.code === "ENOENT")
56346
56388
  return false;
@@ -56412,7 +56454,7 @@ function envChangedSince(repoDir, pkgDir, sinceMs, ignored, deps) {
56412
56454
  try {
56413
56455
  const roots = [];
56414
56456
  for (const rel of ignored) {
56415
- const st = statSync45(join154(repoDir, rel), { throwIfNoEntry: false });
56457
+ const st = statSync46(join154(repoDir, rel), { throwIfNoEntry: false });
56416
56458
  if (!st)
56417
56459
  return true;
56418
56460
  if (!st.isDirectory() && !TOOL_OUTPUT_FILE.test(rel))
@@ -56514,11 +56556,11 @@ function splitDeclaredAdvisories(notes, c) {
56514
56556
  return "";
56515
56557
  }).join(`
56516
56558
  `);
56517
- const named2 = (f) => new RegExp(`${f.includes("/") ? `(?<![\\w./-])${escapeRegex(f)}(?![\\w-])|` : ""}[/"'\`]${escapeRegex(basename42(f))}(?=["'\`\\s);]|$)`).test(wall());
56559
+ const named2 = (f) => new RegExp(`${f.includes("/") ? `(?<![\\w./-])${escapeRegex(f)}(?![\\w-])|` : ""}[/"'\`]${escapeRegex(basename43(f))}(?=["'\`\\s);]|$)`).test(wall());
56518
56560
  const linkOk = (f) => {
56519
56561
  try {
56520
56562
  const root = realpathSync44(c.repoDir), t = realpathSync44(join154(c.repoDir, f)), rel = relative32(root, t);
56521
- return !rel.startsWith("..") && !rel.split(sep24).includes(".git") && statSync45(t).isFile() && changed.has(rel.split(sep24).join("/")) && !isTestFile(rel) && !c.wallPaths.includes(rel);
56563
+ return !rel.startsWith("..") && !rel.split(sep24).includes(".git") && statSync46(t).isFile() && changed.has(rel.split(sep24).join("/")) && !isTestFile(rel) && !c.wallPaths.includes(rel);
56522
56564
  } catch {
56523
56565
  return false;
56524
56566
  }
@@ -56553,7 +56595,7 @@ function removeRunWorktrees(repoDir, baseSha) {
56553
56595
  roots.push(realpathSync44(tmpdir31()));
56554
56596
  } catch {}
56555
56597
  for (const t of checkedOut(repoDir).trees.slice(1)) {
56556
- const named2 = RUN_TMP_WORKTREE_RE.test(basename42(t.path)) || RUN_TMP_WORKTREE_RE.test(basename42(dirname65(t.path)));
56598
+ const named2 = RUN_TMP_WORKTREE_RE.test(basename43(t.path)) || RUN_TMP_WORKTREE_RE.test(basename43(dirname65(t.path)));
56557
56599
  if (t.detached && t.head === baseSha && named2 && roots.some((r) => t.path.startsWith(r + sep24)))
56558
56600
  git14(repoDir, ["worktree", "remove", "--force", "--force", t.path]);
56559
56601
  }
@@ -56617,8 +56659,8 @@ function removeOwnWallFiles(repoDir, runId2) {
56617
56659
  for (const f of files) {
56618
56660
  if (typeof f.path !== "string" || typeof f.sha256 !== "string")
56619
56661
  continue;
56620
- const abs = resolve38(repoDir, f.path), rel = relative32(repoDir, abs);
56621
- if (rel.startsWith("..") || rel.startsWith(".loki/") || !basename42(rel).startsWith("loki_wall_"))
56662
+ const abs = resolve39(repoDir, f.path), rel = relative32(repoDir, abs);
56663
+ if (rel.startsWith("..") || rel.startsWith(".loki/") || !basename43(rel).startsWith("loki_wall_"))
56622
56664
  continue;
56623
56665
  if (git14(repoDir, ["ls-files", "--error-unmatch", "--", rel]) !== null)
56624
56666
  continue;
@@ -56744,7 +56786,7 @@ var init_base_guard = __esm(() => {
56744
56786
  init_stop_restore();
56745
56787
  REPO_LINK_FILE = /\.pth$|\.egg-link$|^direct_url\.json$|^__editable___.*_finder\.py$/;
56746
56788
  RUNNER_CACHE_DIRS = [".vite", ".vite-temp", ".vitest", ".vitest-cache", ".cache", "__pycache__", ".pytest_cache"];
56747
- TOOL_OUTPUT_FILE = /(?:^|\/)(?:[^/]*\.tsbuildinfo|\.eslintcache|\.stylelintcache|\.DS_Store)$/;
56789
+ TOOL_OUTPUT_FILE = /(?:^|\/)(?:[^/]*\.tsbuildinfo|\.eslintcache|\.stylelintcache|\.DS_Store|next-env\.d\.ts)$/;
56748
56790
  ADVISORY_PATH = /^(?:test configuration changed|runner config changed): (.+?)(?: \(.*\))?$|^symlink added by the change .*?\): (.+)$/;
56749
56791
  E10_BRANCH_RE = /^loki\/(e10-[A-Za-z0-9-]+)$/;
56750
56792
  RUN_TMP_WORKTREE_RE = /^(?:e10-base-|e10-loadown-|loki-mutproof-)/;
@@ -56810,9 +56852,9 @@ __export(exports_verify, {
56810
56852
  COLLATERAL_RED: () => COLLATERAL_RED,
56811
56853
  BCE_REASON: () => BCE_REASON
56812
56854
  });
56813
- import { existsSync as existsSync109, mkdtempSync as mkdtempSync26, readFileSync as readFileSync142, realpathSync as realpathSync45, rmSync as rmSync50, statSync as statSync46 } from "fs";
56855
+ import { existsSync as existsSync109, mkdtempSync as mkdtempSync26, readFileSync as readFileSync142, realpathSync as realpathSync45, rmSync as rmSync50, statSync as statSync47 } from "fs";
56814
56856
  import { tmpdir as tmpdir32 } from "os";
56815
- import { basename as basename43, dirname as dirname66, isAbsolute as isAbsolute21, join as join155, relative as relative33, resolve as resolve39 } from "path";
56857
+ import { basename as basename44, dirname as dirname66, isAbsolute as isAbsolute21, join as join155, relative as relative33, resolve as resolve40 } from "path";
56816
56858
  function carriedTimeouts(prev, tests, changed, keep, env = process.env) {
56817
56859
  if (!timeoutCarryOn(env))
56818
56860
  return [];
@@ -56851,15 +56893,15 @@ ${tail2(f.out)}
56851
56893
  }
56852
56894
  function collateralTests(relevant2, named2) {
56853
56895
  const stems = new Set(named2.flatMap((f) => {
56854
- const s = basename43(f).replace(/\.[^.]+$/, "");
56855
- return /^(index|__init__|mod)$/.test(s) && f.includes("/") ? [s, basename43(f.slice(0, f.lastIndexOf("/")))] : [s];
56896
+ const s = basename44(f).replace(/\.[^.]+$/, "");
56897
+ return /^(index|__init__|mod)$/.test(s) && f.includes("/") ? [s, basename44(f.slice(0, f.lastIndexOf("/")))] : [s];
56856
56898
  }));
56857
56899
  return relevant2.filter((t) => !named2.includes(t.path) && !stems.has(coveredStem(t.path)));
56858
56900
  }
56859
56901
  function ownTests(relevant2, named2, changed) {
56860
56902
  const src = named2.filter((f) => !isTestFile(f) && changed.includes(f)).map((f) => {
56861
56903
  const d = f.includes("/") ? f.slice(0, f.lastIndexOf("/")) : ".";
56862
- const s = basename43(f).replace(/\.[^.]+$/, "");
56904
+ const s = basename44(f).replace(/\.[^.]+$/, "");
56863
56905
  return { d, s };
56864
56906
  });
56865
56907
  const inDir = (t, d) => {
@@ -57059,7 +57101,7 @@ async function vitestBatch(cwd, rels, signal, opts = {}) {
57059
57101
  }
57060
57102
  }, byAbs = new Map;
57061
57103
  for (const rel of rels)
57062
- for (const p of [resolve39(cwd, rel), real4(resolve39(cwd, rel))])
57104
+ for (const p of [resolve40(cwd, rel), real4(resolve40(cwd, rel))])
57063
57105
  byAbs.set(p, rel);
57064
57106
  const out3 = new Map;
57065
57107
  for (const tr of tests) {
@@ -57198,7 +57240,7 @@ function changedSymbolsFirst(ctx, tests, changed) {
57198
57240
  return [...hits, ...tests.filter((t) => !hits.includes(t))];
57199
57241
  }
57200
57242
  function uncausedRed(c, changed, symbols, excerpt2) {
57201
- const names = (t) => changed.some((f) => t.includes(f) || t.includes(basename43(f)));
57243
+ const names = (t) => changed.some((f) => t.includes(f) || t.includes(basename44(f)));
57202
57244
  if ((c.ids ?? []).some(names) || names(c.name))
57203
57245
  return false;
57204
57246
  if (c.name.startsWith("lint:")) {
@@ -57296,7 +57338,7 @@ function baseMemo(runDir, baseSha, on = baseMemoOn()) {
57296
57338
  };
57297
57339
  }
57298
57340
  async function subtractBase(ctx, api, checks, tests, changed, wall, rel, signal, zeroOk = true, zeroIntake = zeroGate(null), dep = new Set, own = rel, symbols = []) {
57299
- const out3 = { ids: [], names: [], knownRed: [], sameError: [], quiet: [], shapeDiffers: [], weak: [], zero: [], cnt: {}, envCrash: [] };
57341
+ const out3 = { ids: [], names: [], knownRed: [], sameError: [], quiet: [], shapeDiffers: [], compared: [], weak: [], zero: [], cnt: {}, envCrash: [] };
57300
57342
  const pairs = checks.flatMap((c) => {
57301
57343
  const t = tests.find((x) => testCheckName(x) === c.name);
57302
57344
  return t ? [{ c, t }] : [];
@@ -57325,7 +57367,8 @@ async function subtractBase(ctx, api, checks, tests, changed, wall, rel, signal,
57325
57367
  git15(["-c", "core.hooksPath=/dev/null", "worktree", "add", "--detach", dir, ctx.baseSha]);
57326
57368
  const base2 = new Map;
57327
57369
  const record = (c, b) => {
57328
- base2.set(c, { red: !b.ok && !b.cut ? failIds(b.out) : [], n: ran(b.out) ?? summaryPassFailCount(b.out), sk: skipped2(b.out), out: b.cut ? "" : b.out });
57370
+ const red2 = !b.ok && !b.cut ? failIds(b.out) : [];
57371
+ base2.set(c, { red: red2, n: ran(b.out) ?? summaryPassFailCount(b.out), sk: skipped2(b.out), out: b.cut ? "" : b.out, live: b.ok && !b.cut || red2.length > 0 });
57329
57372
  };
57330
57373
  await baseGoBatch(sus.map(({ c, t }) => ({ c, t, bc: commandFor(t, dir, api) })), signal, record);
57331
57374
  for (const { c, t } of sus) {
@@ -57386,6 +57429,8 @@ async function subtractBase(ctx, api, checks, tests, changed, wall, rel, signal,
57386
57429
  const progress = checks.some((c) => wall.has(c.name) && c.result === "pass") || sus.some(({ c }) => !out3.weak.includes(c.name) && base2.get(c).red.length > 0 && (c.n ?? 0) >= base2.get(c).n);
57387
57430
  {
57388
57431
  for (const { c } of un) {
57432
+ if (c.result === "fail" && c.ids?.length && base2.get(c)?.live)
57433
+ out3.compared.push(c.name);
57389
57434
  if (own.has(c.name) || c.result !== "fail" || !c.ids?.length || !comparableIds(c.ids).every((i) => base2.get(c)?.red.includes(i)))
57390
57435
  continue;
57391
57436
  out3.knownRed.push(c.name);
@@ -57455,7 +57500,7 @@ function tscOnlyIgnored(repoDir, cwd, out3) {
57455
57500
  const target = join155(dirname66(file), mod).replace(/\.(js|mjs|cjs|jsx)$/, "");
57456
57501
  return ![target, ...[".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".d.ts"].map((e) => target + e), ...["index.ts", "index.tsx", "index.js"].map((e) => join155(target, e))].some((t) => {
57457
57502
  try {
57458
- return statSync46(t).isFile();
57503
+ return statSync47(t).isFile();
57459
57504
  } catch {
57460
57505
  return false;
57461
57506
  }
@@ -57667,7 +57712,7 @@ var init_verify = __esm(() => {
57667
57712
  const rec2 = recorded.get(p), found = map.tests.find((t) => t.path === p && (!rec2 || t.runner === rec2));
57668
57713
  if (found)
57669
57714
  return [found];
57670
- const runner = rec2 ?? guessRunner(basename43(p), map.runners, p);
57715
+ const runner = rec2 ?? guessRunner(basename44(p), map.runners, p);
57671
57716
  return runner && (runner !== "bun" || map.runners.includes("bun") || /[._](?:test|spec)\.[cm]?[jt]sx?$/.test(p)) ? [{ runner, path: p }] : [];
57672
57717
  });
57673
57718
  const dep = dependentTests(ctx.repoDir, map, changed, [...impacted, ...changedTestFiles, ...wallTests, ...relevant2]), depNames = new Set(dep.tests.map(testCheckName));
@@ -57735,6 +57780,15 @@ var init_verify = __esm(() => {
57735
57780
  const root = api?.packageRootOf(rel) ?? ".";
57736
57781
  return [...new Set([root, "."])].every((d) => !envChangedSince(ctx.repoDir, d === "." ? ctx.repoDir : join155(ctx.repoDir, d), zgEnv.sinceMs, zgEnv.ignored ?? null, zgEnv.deps));
57737
57782
  };
57783
+ const depsSeen = new Map, depsAsIntake = (rel) => {
57784
+ if (zgEnv.sinceMs === undefined)
57785
+ return false;
57786
+ return [...new Set([api?.packageRootOf(rel) ?? ".", "."])].every((d) => {
57787
+ if (!depsSeen.has(d))
57788
+ depsSeen.set(d, !envChangedSince(ctx.repoDir, d === "." ? ctx.repoDir : join155(ctx.repoDir, d), zgEnv.sinceMs, [], zgEnv.deps));
57789
+ return depsSeen.get(d);
57790
+ });
57791
+ };
57738
57792
  const touchedRed = new Set(checks.filter((c) => {
57739
57793
  const rel = c.name.slice(c.name.indexOf(":") + 1);
57740
57794
  return c.result === "fail" && changed.includes(rel) && !wallNames0.has(c.name) && !isHold(c) && envAsIntake(rel) && touchedRedOnBase(ctx.repoDir, ctx.baseSha, { ids: c.ids, errors: headErrors.get(c) }, editedTestTitles(ctx.repoDir, ctx.baseSha, rel));
@@ -57798,7 +57852,7 @@ var init_verify = __esm(() => {
57798
57852
  const t = tests.find((x) => testCheckName(x) === name), pkg = t ? api?.packageOf(t.path) : null;
57799
57853
  return pkg?.commands.test ? `full suite: ${pkg.name}` : undefined;
57800
57854
  };
57801
- const attr = attribute(ctx.repoDir, ctx.baseSha, checks.filter((c) => c.result === "fail" && !preRed.names.includes(c.name)).map((c) => ({ name: c.name, ids: c.ids, eligible: !targetNames.has(c.name) && !changed.includes(c.name.slice(c.name.indexOf(":") + 1)), ...suiteOf(c.name) && preRed.sameError.includes(c.name) ? { suite: suiteOf(c.name) } : {} })));
57855
+ const attr = attribute(ctx.repoDir, ctx.baseSha, checks.filter((c) => c.result === "fail" && !preRed.names.includes(c.name)).map((c) => ({ name: c.name, ids: c.ids, eligible: !targetNames.has(c.name) && !changed.includes(c.name.slice(c.name.indexOf(":") + 1)), ...suiteOf(c.name) && (preRed.compared.includes(c.name) || depsAsIntake(c.name.slice(c.name.indexOf(":") + 1))) ? { suite: suiteOf(c.name), ...preRed.sameError.includes(c.name) ? { rerun: "same" } : preRed.compared.includes(c.name) ? { rerun: "differs" } : {} } : {} })));
57802
57856
  attr.introducedChecks = [...new Set(attr.introducedChecks.map((n3) => isHoldoutCheck(n3) ? "holdout" : n3))];
57803
57857
  preRed.names.push(...attr.preExistingChecks);
57804
57858
  preRed.ids.push(...attr.preExistingIds);
@@ -57916,8 +57970,8 @@ var init_verify = __esm(() => {
57916
57970
  });
57917
57971
 
57918
57972
  // ../../loki-ts/src/runner/stop_checks.ts
57919
- import { appendFileSync as appendFileSync15, existsSync as existsSync110, mkdirSync as mkdirSync82, readFileSync as readFileSync143, statSync as statSync47 } from "fs";
57920
- import { basename as basename44, isAbsolute as isAbsolute22, join as join156, relative as relative34 } from "path";
57973
+ import { appendFileSync as appendFileSync15, existsSync as existsSync110, mkdirSync as mkdirSync82, readFileSync as readFileSync143, statSync as statSync48 } from "fs";
57974
+ import { basename as basename45, isAbsolute as isAbsolute22, join as join156, relative as relative34 } from "path";
57921
57975
  function redOnBase(repoDir) {
57922
57976
  try {
57923
57977
  const b = JSON.parse(readFileSync143(join156(repoDir, ".loki", "state", "repo-profile.json"), "utf8")).baseline;
@@ -57936,7 +57990,7 @@ function planStopChecks(repoDir, outputs, impacted, stageLimitS, baseSha, env =
57936
57990
  const p = rel(f.path), found = map.tests.find((t) => t.path === p && (!f.runner || t.runner === f.runner));
57937
57991
  if (found)
57938
57992
  return [found];
57939
- const runner = f.runner ?? guessRunner(basename44(p), map.runners, p);
57993
+ const runner = f.runner ?? guessRunner(basename45(p), map.runners, p);
57940
57994
  return runner && (runner !== "bun" || map.runners.includes("bun") || /[._](?:test|spec)\.[cm]?[jt]sx?$/.test(p)) ? [{ runner, path: p }] : [];
57941
57995
  });
57942
57996
  const red = redOnBase(repoDir), api = loadProjectApi(repoDir), seen = new Set;
@@ -57970,7 +58024,7 @@ function recordStopBlock(repoDir, name, err, env = process.env) {
57970
58024
  return;
57971
58025
  try {
57972
58026
  const p = stopBlocksPath(repoDir);
57973
- if (existsSync110(p) && statSync47(p).size >= STOP_BLOCKS_MAX_BYTES)
58027
+ if (existsSync110(p) && statSync48(p).size >= STOP_BLOCKS_MAX_BYTES)
57974
58028
  return;
57975
58029
  mkdirSync82(join156(repoDir, ".loki", "state"), { recursive: true });
57976
58030
  appendFileSync15(p, JSON.stringify({ at: new Date().toISOString(), run_id: runId2.slice(0, 128), name: redactSecrets(name).slice(0, 200), first_error: redactSecrets(err).slice(0, 300) }) + `
@@ -99231,7 +99285,7 @@ __export(exports_providers, {
99231
99285
  PROVIDER_COMMIT_HYGIENE: () => PROVIDER_COMMIT_HYGIENE
99232
99286
  });
99233
99287
  import { mkdirSync as mkdirSync85, existsSync as existsSync112, readFileSync as readFileSync145, realpathSync as realpathSync47, appendFileSync as appendFileSync17 } from "fs";
99234
- import { delimiter as delimiter5, dirname as dirname69, isAbsolute as isAbsolute24, relative as relative35, resolve as resolve41, sep as sep26 } from "path";
99288
+ import { delimiter as delimiter5, dirname as dirname69, isAbsolute as isAbsolute24, relative as relative35, resolve as resolve42, sep as sep26 } from "path";
99235
99289
  function mergeDisallowedTools(policy, stageCsv) {
99236
99290
  return [...new Set([...policy ?? [], ...stageCsv.split(",").filter(Boolean)])];
99237
99291
  }
@@ -99383,7 +99437,7 @@ function physicalPath(path) {
99383
99437
  try {
99384
99438
  return realpathSync47(path);
99385
99439
  } catch {
99386
- return resolve41(path);
99440
+ return resolve42(path);
99387
99441
  }
99388
99442
  }
99389
99443
  function hostGuardRequired(cwd) {
@@ -99496,7 +99550,7 @@ function claudeProvider() {
99496
99550
  const baseModel = claudeModelFor(call);
99497
99551
  const routed = sessionPlanEnabled() ? planRouterSession({
99498
99552
  model: baseModel,
99499
- runDir: process.env["LOKI_DIR"] ?? resolve41(call.cwd, ".loki"),
99553
+ runDir: process.env["LOKI_DIR"] ?? resolve42(call.cwd, ".loki"),
99500
99554
  claudeCodeVersion: await installedClaudeCodeVersion(cli)
99501
99555
  }) : null;
99502
99556
  const model = routed ? routed.model : baseModel;
@@ -99570,7 +99624,7 @@ function providerCallTimeoutMs(env) {
99570
99624
  }
99571
99625
  function emitSdkDegradationEvent(cwd, payload) {
99572
99626
  try {
99573
- const lokiRoot = process.env["LOKI_DIR"] ?? resolve41(cwd, ".loki");
99627
+ const lokiRoot = process.env["LOKI_DIR"] ?? resolve42(cwd, ".loki");
99574
99628
  mkdirSync85(lokiRoot, { recursive: true });
99575
99629
  const record = {
99576
99630
  type: "capability_degraded",
@@ -99578,7 +99632,7 @@ function emitSdkDegradationEvent(cwd, payload) {
99578
99632
  timestamp: new Date().toISOString(),
99579
99633
  payload: { capability: "sdk_query", fail_closed: true, ...payload }
99580
99634
  };
99581
- appendFileSync17(resolve41(lokiRoot, "events.jsonl"), `${JSON.stringify(record)}
99635
+ appendFileSync17(resolve42(lokiRoot, "events.jsonl"), `${JSON.stringify(record)}
99582
99636
  `);
99583
99637
  } catch {}
99584
99638
  }
@@ -99592,7 +99646,7 @@ function buildSdkLoopOptions(args) {
99592
99646
  const out3 = {};
99593
99647
  const router = sessionPlanEnabled() ? planRouterSession({
99594
99648
  model: args.model,
99595
- runDir: args.runDir ?? process.env["LOKI_DIR"] ?? resolve41(args.cwd, ".loki"),
99649
+ runDir: args.runDir ?? process.env["LOKI_DIR"] ?? resolve42(args.cwd, ".loki"),
99596
99650
  claudeCodeVersion: args.claudeCodeVersion ?? bundledClaudeCodeVersion2()
99597
99651
  }) : null;
99598
99652
  if (router) {
@@ -99845,7 +99899,7 @@ __export(exports_session, {
99845
99899
  });
99846
99900
  import { spawn as spawn12 } from "child_process";
99847
99901
  import { copyFileSync as copyFileSync11, existsSync as existsSync113, mkdirSync as mkdirSync86, readFileSync as readFileSync146, writeFileSync as writeFileSync84, writeSync as writeSync4 } from "fs";
99848
- import { dirname as dirname70, join as join159, resolve as resolve42 } from "path";
99902
+ import { dirname as dirname70, join as join159, resolve as resolve43 } from "path";
99849
99903
  import { tmpdir as tmpdir33 } from "os";
99850
99904
  import { randomUUID as randomUUID2 } from "crypto";
99851
99905
  function capStopOf(summary) {
@@ -99914,7 +99968,7 @@ function childEnv2(opts, cfg) {
99914
99968
  else
99915
99969
  delete env["LOKI_E10_DISALLOWED_TOOLS"];
99916
99970
  if (opts.outputs?.length)
99917
- env[HARNESS_OUTPUTS_ENV] = JSON.stringify(opts.outputs.map((p) => resolve42(opts.cwd ?? process.cwd(), p)));
99971
+ env[HARNESS_OUTPUTS_ENV] = JSON.stringify(opts.outputs.map((p) => resolve43(opts.cwd ?? process.cwd(), p)));
99918
99972
  else
99919
99973
  delete env[HARNESS_OUTPUTS_ENV];
99920
99974
  if (opts.suiteCmds?.length)
@@ -100120,7 +100174,7 @@ function createSessionRunner(cfg) {
100120
100174
  }, cfg.heartbeatMs ?? HEARTBEAT_MS_DEFAULT);
100121
100175
  opts.signal.addEventListener("abort", onAbort, { once: true });
100122
100176
  const untrack = trackSession(() => kill("aborted"));
100123
- return new Promise((resolve43) => {
100177
+ return new Promise((resolve44) => {
100124
100178
  child.on("exit", () => reapLiveGroup(pgid, () => cfg.emit?.("session.group_reaped", opts.stage, { session_id: sessionId, pgid })));
100125
100179
  child.on("close", (code) => {
100126
100180
  clearTimeout(limitTimer);
@@ -100182,7 +100236,7 @@ function createSessionRunner(cfg) {
100182
100236
  rememberSessionEffort(psid, ran2);
100183
100237
  recordCost(cfg, opts, killed ? "killed" : code === 0 ? "completed" : "failed", durationS, stdout + logText);
100184
100238
  untrack();
100185
- resolve43({ exit: guard.ok ? code : 1, markers, durationS, killed, summary: (stdout + logText).trim().slice(-4096), stderrTail: (guard.ok ? "" : `guard violation: ${guard.violations.map((v10) => v10.detail).join("; ")}
100239
+ resolve44({ exit: guard.ok ? code : 1, markers, durationS, killed, summary: (stdout + logText).trim().slice(-4096), stderrTail: (guard.ok ? "" : `guard violation: ${guard.violations.map((v10) => v10.detail).join("; ")}
100186
100240
  `) + stderrTail.toString("utf8") + (logText.match(/^\[sdk-loop error: .*\]$/gm) ?? []).join(`
100187
100241
  `) });
100188
100242
  });
@@ -100270,10 +100324,10 @@ var init_model_rank = __esm(() => {
100270
100324
 
100271
100325
  // ../../loki-ts/src/engine10/sizing.ts
100272
100326
  import { existsSync as existsSync114, readFileSync as readFileSync147 } from "fs";
100273
- import { basename as basename45 } from "path";
100327
+ import { basename as basename46 } from "path";
100274
100328
  function namedFiles(task, map) {
100275
100329
  const text4 = task.toLowerCase();
100276
- const hit2 = (map?.files ?? []).filter((f) => new RegExp(`(?<![\\w.-])${escapeRegex(basename45(f).toLowerCase())}(?![\\w-]|\\.\\w)`).test(text4));
100330
+ const hit2 = (map?.files ?? []).filter((f) => new RegExp(`(?<![\\w.-])${escapeRegex(basename46(f).toLowerCase())}(?![\\w-]|\\.\\w)`).test(text4));
100277
100331
  if (!namedExactOn())
100278
100332
  return hit2;
100279
100333
  const spelled = text4.split(/[^\w@.()[\]\/-]+/).filter((t) => t.includes("/")).flatMap((t) => {
@@ -100281,11 +100335,11 @@ function namedFiles(task, map) {
100281
100335
  return m ? [m[1]] : [];
100282
100336
  });
100283
100337
  return hit2.filter((f) => {
100284
- const b = basename45(f).toLowerCase();
100338
+ const b = basename46(f).toLowerCase();
100285
100339
  if (new RegExp(`(?<![\\w./-])${escapeRegex(b)}(?![\\w-]|\\.\\w)`).test(text4))
100286
100340
  return true;
100287
100341
  const lf2 = f.toLowerCase();
100288
- return spelled.some((t) => basename45(t) === b && (lf2 === t || lf2.endsWith(`/${t}`) || t.endsWith(`/${lf2}`)));
100342
+ return spelled.some((t) => basename46(t) === b && (lf2 === t || lf2.endsWith(`/${t}`) || t.endsWith(`/${lf2}`)));
100289
100343
  });
100290
100344
  }
100291
100345
  function sizeTask(task, map, tests) {
@@ -100309,8 +100363,8 @@ function sizeTask(task, map, tests) {
100309
100363
  function namedDistinct(task, map) {
100310
100364
  const text4 = task.toLowerCase(), named2 = namedFiles(task, map).filter((f) => !isTestFile(f)).map((f) => f.toLowerCase());
100311
100365
  const spelled = new Set(named2.filter((f) => f.includes("/") && new RegExp(`(?<![\\w./-])(?:\\./)?${escapeRegex(f)}(?![\\w-]|\\.\\w)`).test(text4)));
100312
- const spelledBase = new Set([...spelled].map((f) => basename45(f)));
100313
- return spelled.size + new Set(named2.map((f) => basename45(f)).filter((b) => !spelledBase.has(b))).size;
100366
+ const spelledBase = new Set([...spelled].map((f) => basename46(f)));
100367
+ return spelled.size + new Set(named2.map((f) => basename46(f)).filter((b) => !spelledBase.has(b))).size;
100314
100368
  }
100315
100369
  function hardReason(size, map, task) {
100316
100370
  if (size === "large")
@@ -100803,9 +100857,9 @@ var init_python_build_check = __esm(() => {
100803
100857
  // ../../loki-ts/src/util/check_result.ts
100804
100858
  import { spawn as spawn13, spawnSync as spawnSync28 } from "child_process";
100805
100859
  import { createHash as createHash40 } from "crypto";
100806
- import { copyFileSync as copyFileSync12, existsSync as existsSync117, lstatSync as lstatSync35, mkdirSync as mkdirSync89, readlinkSync as readlinkSync10, mkdtempSync as mkdtempSync27, readdirSync as readdirSync56, readFileSync as readFileSync149, realpathSync as realpathSync48, renameSync as renameSync29, rmSync as rmSync53, statSync as statSync49, writeFileSync as writeFileSync87 } from "fs";
100860
+ import { copyFileSync as copyFileSync12, existsSync as existsSync117, lstatSync as lstatSync35, mkdirSync as mkdirSync89, readlinkSync as readlinkSync10, mkdtempSync as mkdtempSync27, readdirSync as readdirSync56, readFileSync as readFileSync149, realpathSync as realpathSync48, renameSync as renameSync29, rmSync as rmSync53, statSync as statSync50, writeFileSync as writeFileSync87 } from "fs";
100807
100861
  import { homedir as homedir16, tmpdir as tmpdir34 } from "os";
100808
- import { basename as basename46, dirname as dirname71, isAbsolute as isAbsolute25, join as join164, normalize as normalize9, relative as relative36, resolve as resolve43, sep as sep27 } from "path";
100862
+ import { basename as basename47, dirname as dirname71, isAbsolute as isAbsolute25, join as join164, normalize as normalize9, relative as relative36, resolve as resolve44, sep as sep27 } from "path";
100809
100863
  function plainTestEnv(base2 = process.env) {
100810
100864
  const e10 = {};
100811
100865
  for (const [k10, v10] of Object.entries(tokenFreeEnv(base2)))
@@ -100824,7 +100878,7 @@ function ran(raw2, path, ok2) {
100824
100878
  if (blk) {
100825
100879
  const c = n10(blk, /(?:#|\u2139) pass (\d+)/) + n10(blk, /(?:#|\u2139) fail (\d+)/);
100826
100880
  const nm2 = out3.match(/^(?:ok \d+ - |\u2714 )(\S+\.[cm]?[jt]s)(?: \(|$)/m)?.[1];
100827
- return c === 1 && nm2 && (!path || basename46(nm2) === basename46(path)) ? 0 : c;
100881
+ return c === 1 && nm2 && (!path || basename47(nm2) === basename47(path)) ? 0 : c;
100828
100882
  }
100829
100883
  const cg2 = cargoTrailer(out3);
100830
100884
  if (cg2.length)
@@ -101079,7 +101133,7 @@ function runsTool(tool, words3, depth) {
101079
101133
  return NO2;
101080
101134
  if (w.includes("$"))
101081
101135
  return varIsTool(tool, w) ? YES : UNKNOWN;
101082
- const name = basename46(w);
101136
+ const name = basename47(w);
101083
101137
  if (wordIsTool(tool, w))
101084
101138
  return YES;
101085
101139
  if (SHELL_WORDS.has(name)) {
@@ -101133,7 +101187,7 @@ function goRunner(cmd2, args) {
101133
101187
  return mentionsTool("go", cmd2, args) ? { runner: "go" } : {};
101134
101188
  }
101135
101189
  function parseCargo(toks2) {
101136
- if (basename46(toks2[0] ?? "") !== "cargo" || toks2.some((t) => /[&|;$`"'<>()\\]/.test(t)))
101190
+ if (basename47(toks2[0] ?? "") !== "cargo" || toks2.some((t) => /[&|;$`"'<>()\\]/.test(t)))
101137
101191
  return null;
101138
101192
  let k10 = 1;
101139
101193
  for (;k10 < toks2.length; k10++) {
@@ -101214,12 +101268,12 @@ function cargoRunnerConfigured(cwd, env, toks2) {
101214
101268
  for (const v10 of vals) {
101215
101269
  if (CARGO_REDIRECT_TEXT(v10))
101216
101270
  return true;
101217
- const f = resolve43(cwd, v10);
101271
+ const f = resolve44(cwd, v10);
101218
101272
  if (existsSync117(f) && lstatSync35(f).isFile() && doubtful(f))
101219
101273
  return true;
101220
101274
  }
101221
101275
  const dirs = [env["CARGO_HOME"] ?? join164(env["HOME"] ?? homedir16(), ".cargo"), join164(homedir16(), ".cargo")];
101222
- for (let d = resolve43(cwd), prev = "";d !== prev; prev = d, d = dirname71(d))
101276
+ for (let d = resolve44(cwd), prev = "";d !== prev; prev = d, d = dirname71(d))
101223
101277
  dirs.push(join164(d, ".cargo"));
101224
101278
  return dirs.some((dir) => ["config", "config.toml"].some((f) => existsSync117(join164(dir, f)) && doubtful(join164(dir, f))));
101225
101279
  }
@@ -101238,7 +101292,7 @@ function cargoToolchainRedirected(cwd, env) {
101238
101292
  return true;
101239
101293
  }
101240
101294
  };
101241
- for (let d = resolve43(cwd), prev = "";d !== prev; prev = d, d = dirname71(d))
101295
+ for (let d = resolve44(cwd), prev = "";d !== prev; prev = d, d = dirname71(d))
101242
101296
  if (["rust-toolchain", "rust-toolchain.toml"].some((f) => lstatOk(join164(d, f)) && doubtful(join164(d, f))))
101243
101297
  return true;
101244
101298
  return false;
@@ -101307,13 +101361,13 @@ function compilerSettingIn(raw2) {
101307
101361
  }
101308
101362
  function cargoRepoRoot(cwd) {
101309
101363
  let top = null;
101310
- for (let d = resolve43(cwd), prev = "";d !== prev; prev = d, d = dirname71(d)) {
101364
+ for (let d = resolve44(cwd), prev = "";d !== prev; prev = d, d = dirname71(d)) {
101311
101365
  if (existsSync117(join164(d, ".git")))
101312
101366
  return d;
101313
101367
  if (existsSync117(join164(d, "Cargo.toml")))
101314
101368
  top = d;
101315
101369
  }
101316
- return top ?? resolve43(cwd);
101370
+ return top ?? resolve44(cwd);
101317
101371
  }
101318
101372
  function topLevelDoubt(t) {
101319
101373
  let q = "", depth = 0, lineStart = true;
@@ -101362,16 +101416,16 @@ function cargoProfileRustflagsManifest(root, cwd, toks2) {
101362
101416
  }
101363
101417
  };
101364
101418
  const seen = new Set, files = [];
101365
- for (let d = resolve43(cwd), prev = "";d !== prev; prev = d, d = dirname71(d)) {
101419
+ for (let d = resolve44(cwd), prev = "";d !== prev; prev = d, d = dirname71(d)) {
101366
101420
  files.push(join164(d, "Cargo.toml"));
101367
101421
  if (d === root)
101368
101422
  break;
101369
101423
  }
101370
101424
  toks2.forEach((t, i) => {
101371
101425
  if (t === "--manifest-path")
101372
- files.push(resolve43(cwd, toks2[i + 1] ?? ""));
101426
+ files.push(resolve44(cwd, toks2[i + 1] ?? ""));
101373
101427
  else if (t.startsWith("--manifest-path="))
101374
- files.push(resolve43(cwd, t.slice(16)));
101428
+ files.push(resolve44(cwd, t.slice(16)));
101375
101429
  });
101376
101430
  for (let stack = [[root, 0]], seenDirs = 0;stack.length && seenDirs < 500; ) {
101377
101431
  const [d, depth] = stack.pop();
@@ -101411,19 +101465,19 @@ function cargoRepoCompilerRedirected(cwd, env, toks2) {
101411
101465
  const inline = compilerSettingIn(v10);
101412
101466
  if (inline)
101413
101467
  return cargoCompilerReason(inline, "--config");
101414
- const f = resolve43(cwd, v10);
101468
+ const f = resolve44(cwd, v10);
101415
101469
  if (existsSync117(f) && lstatSync35(f).isFile()) {
101416
101470
  const w = inFile(f);
101417
101471
  if (w)
101418
101472
  return cargoCompilerReason(w, v10);
101419
101473
  }
101420
101474
  }
101421
- const home = new Set([resolve43(env["CARGO_HOME"] || join164(env["HOME"] || homedir16(), ".cargo")), resolve43(homedir16(), ".cargo")]);
101475
+ const home = new Set([resolve44(env["CARGO_HOME"] || join164(env["HOME"] || homedir16(), ".cargo")), resolve44(homedir16(), ".cargo")]);
101422
101476
  const aboveRoot = (dir) => {
101423
101477
  const r = relative36(dirname71(dir), root);
101424
101478
  return r !== "" && !r.startsWith("..") && !isAbsolute25(r);
101425
101479
  };
101426
- for (let d = resolve43(cwd), prev = "";d !== prev; prev = d, d = dirname71(d)) {
101480
+ for (let d = resolve44(cwd), prev = "";d !== prev; prev = d, d = dirname71(d)) {
101427
101481
  const dir = join164(d, ".cargo");
101428
101482
  if (home.has(dir) && aboveRoot(dir))
101429
101483
  continue;
@@ -101516,7 +101570,7 @@ function* corroborateGoSteps(c, out3, cmdOrLine, args, toks2, o) {
101516
101570
  const first = goJson(stripAnsi(out3));
101517
101571
  const names = first?.passedNames ?? [];
101518
101572
  const shellish = (t, i) => /[&|;$`"'<>()\\]/.test(t) && !(args !== undefined && toks2[i - 1] === "-run" && /^\^\([A-Za-z0-9_|]+\)\$$/.test(t));
101519
- if (!names.length || toks2.some(shellish) || basename46(toks2[0] ?? "") !== "go" || toks2[1] !== "test")
101573
+ if (!names.length || toks2.some(shellish) || basename47(toks2[0] ?? "") !== "go" || toks2[1] !== "test")
101520
101574
  return refuse;
101521
101575
  const pkgs = [], run2 = [];
101522
101576
  for (let k10 = 2;k10 < toks2.length; k10++) {
@@ -101686,7 +101740,7 @@ function javaSummary(raw2) {
101686
101740
  return null;
101687
101741
  }
101688
101742
  function javaTestClass(path) {
101689
- const m = /^(.*?)\/?src\/test\/java\/(.+)\.java$/.exec(path), cls = (m ? m[2] : basename46(path, ".java")).split("/").join(".");
101743
+ const m = /^(.*?)\/?src\/test\/java\/(.+)\.java$/.exec(path), cls = (m ? m[2] : basename47(path, ".java")).split("/").join(".");
101690
101744
  return { root: m?.[1] || ".", cls, rel: m ? `src/test/java/${m[2]}.java` : path };
101691
101745
  }
101692
101746
  function testCount(raw2, path, ok2) {
@@ -102222,7 +102276,7 @@ function publishableWall(repoDir, runDir, o, env = process.env, task) {
102222
102276
  const listed = arr5(o.wall?.["files"]);
102223
102277
  for (const w of listed) {
102224
102278
  const rel = relative36(repoDir, String(w["path"])), hit2 = arr5(o.verify?.["checks"]).find((c) => tgt.has(String(c["name"])) && String(c["name"]).slice(String(c["name"]).indexOf(":") + 1) === rel && hasExecutedProof([c]));
102225
- if (!hit2 || rel.startsWith("..") || isAbsolute25(rel) || rel.startsWith(".loki/") || !basename46(rel).startsWith("loki_wall_"))
102279
+ if (!hit2 || rel.startsWith("..") || isAbsolute25(rel) || rel.startsWith(".loki/") || !basename47(rel).startsWith("loki_wall_"))
102226
102280
  continue;
102227
102281
  try {
102228
102282
  const bytes = readFileSync149(sealedWallCopy(runDir, rel));
@@ -102280,12 +102334,12 @@ function loadSealedWall(runDir, unitRepoDir) {
102280
102334
  continue;
102281
102335
  }
102282
102336
  try {
102283
- const bytes = readFileSync149(join164(runDir, "wall", basename46(rel)));
102337
+ const bytes = readFileSync149(join164(runDir, "wall", basename47(rel)));
102284
102338
  if (createHash40("sha256").update(bytes).digest("hex") !== w.sha256)
102285
102339
  throw new Error("hash");
102286
102340
  files.push({ rel, bytes, ...typeof w.runner === "string" ? { runner: w.runner } : {} });
102287
102341
  } catch {
102288
- problems.push(`sealed Wall copy ${basename46(rel)} missing or not the sealed bytes`);
102342
+ problems.push(`sealed Wall copy ${basename47(rel)} missing or not the sealed bytes`);
102289
102343
  }
102290
102344
  }
102291
102345
  return { files, problems };
@@ -102351,7 +102405,7 @@ function hiddenEdits(repoDir) {
102351
102405
  try {
102352
102406
  const idxRel = safeGit(repoDir, ["rev-parse", "--git-path", "index"]).trim(), idx = isAbsolute25(idxRel) ? idxRel : join164(repoDir, idxRel);
102353
102407
  const flags = new Map;
102354
- for (const l of safeGit(repoDir, ["-c", "core.quotePath=false", "ls-files", "-v", "-z"], { maxBuffer: Math.max(64 << 20, statSync49(idx).size * 32) }).split("\x00")) {
102408
+ for (const l of safeGit(repoDir, ["-c", "core.quotePath=false", "ls-files", "-v", "-z"], { maxBuffer: Math.max(64 << 20, statSync50(idx).size * 32) }).split("\x00")) {
102355
102409
  const m = /^([a-zS]) ([\s\S]+)$/.exec(l);
102356
102410
  if (m)
102357
102411
  flags.set(m[2], m[1]);
@@ -102396,16 +102450,16 @@ function execFiles(repoDir) {
102396
102450
  } catch {
102397
102451
  return null;
102398
102452
  }
102399
- const roots = new Set([".venv", "venv", ...all.filter((f) => basename46(f) === "pyvenv.cfg").map((f) => dirname71(f))]);
102453
+ const roots = new Set([".venv", "venv", ...all.filter((f) => basename47(f) === "pyvenv.cfg").map((f) => dirname71(f))]);
102400
102454
  const inVenvBin = (f) => {
102401
102455
  for (let d = dirname71(f);d !== "." && d !== "/"; d = dirname71(d))
102402
- if ((basename46(d) === "bin" || basename46(d) === "Scripts") && roots.has(dirname71(d)))
102456
+ if ((basename47(d) === "bin" || basename47(d) === "Scripts") && roots.has(dirname71(d)))
102403
102457
  return true;
102404
102458
  return false;
102405
102459
  };
102406
102460
  const out3 = {};
102407
102461
  for (const f of all) {
102408
- if (!(EXEC_NAMES.has(basename46(f)) || VENV_TOOL.test(basename46(f)) && inVenvBin(f)))
102462
+ if (!(EXEC_NAMES.has(basename47(f)) || VENV_TOOL.test(basename47(f)) && inVenvBin(f)))
102409
102463
  continue;
102410
102464
  const abs = join164(repoDir, f);
102411
102465
  try {
@@ -102427,7 +102481,7 @@ function ignoreSnapshot(repoDir) {
102427
102481
  const resolved = (args, dflt) => {
102428
102482
  try {
102429
102483
  const v10 = safeGit(repoDir, args).trim();
102430
- return v10 ? resolve43(repoDir, v10) : dflt;
102484
+ return v10 ? resolve44(repoDir, v10) : dflt;
102431
102485
  } catch {
102432
102486
  return dflt;
102433
102487
  }
@@ -102448,10 +102502,10 @@ function noteLabel(repoDir, p) {
102448
102502
  const h10 = home ? inside2(home) : null;
102449
102503
  if (h10)
102450
102504
  return `~/${h10}`;
102451
- return basename46(p);
102505
+ return basename47(p);
102452
102506
  }
102453
102507
  function pureToolCache(repoDir, dir) {
102454
- const text4 = TOOL_CACHE_GITIGNORE[basename46(dir)];
102508
+ const text4 = TOOL_CACHE_GITIGNORE[basename47(dir)];
102455
102509
  if (text4 === undefined)
102456
102510
  return false;
102457
102511
  try {
@@ -102468,7 +102522,7 @@ function pureToolCache(repoDir, dir) {
102468
102522
  return false;
102469
102523
  continue;
102470
102524
  }
102471
- if (!e10.isFile() || CACHE_CODE_EXT.test(e10.name) || (EXEC_NAMES.has(e10.name) || /^(conftest|sitecustomize|usercustomize)\./.test(e10.name)) && e10.name !== ".gitignore" || /^python/i.test(e10.name) || (statSync49(join164(repoDir, r)).mode & 73) !== 0)
102525
+ if (!e10.isFile() || CACHE_CODE_EXT.test(e10.name) || (EXEC_NAMES.has(e10.name) || /^(conftest|sitecustomize|usercustomize)\./.test(e10.name)) && e10.name !== ".gitignore" || /^python/i.test(e10.name) || (statSync50(join164(repoDir, r)).mode & 73) !== 0)
102472
102526
  return false;
102473
102527
  }
102474
102528
  return true;
@@ -102496,14 +102550,14 @@ function ignoreRuleChanges(repoDir, snap, baseSha) {
102496
102550
  const prior = s.exec_files, cur = execFiles(repoDir);
102497
102551
  if (!prior || !cur)
102498
102552
  return ["ignore rules could not be compared with the intake snapshot: the ignored files that can change what verify runs were not recorded or could not be listed"];
102499
- const gi2 = new Set(changedFiles(repoDir, baseSha ?? "HEAD").filter((f) => basename46(f) === ".gitignore"));
102553
+ const gi2 = new Set(changedFiles(repoDir, baseSha ?? "HEAD").filter((f) => basename47(f) === ".gitignore"));
102500
102554
  const hidden = [];
102501
102555
  for (const [f, h10] of Object.entries(cur)) {
102502
102556
  if (prior[f] === h10)
102503
102557
  continue;
102504
- if (basename46(f) === ".gitignore" && pureToolCache(repoDir, dirname71(f)))
102558
+ if (basename47(f) === ".gitignore" && pureToolCache(repoDir, dirname71(f)))
102505
102559
  continue;
102506
- if (basename46(f) === ".gitignore")
102560
+ if (basename47(f) === ".gitignore")
102507
102561
  gi2.add(f);
102508
102562
  else
102509
102563
  hidden.push(f);
@@ -102516,7 +102570,7 @@ function ignoreRuleChanges(repoDir, snap, baseSha) {
102516
102570
  return [];
102517
102571
  const made = listIgnoredFiles(repoDir).filter((f) => {
102518
102572
  try {
102519
- const st2 = statSync49(join164(repoDir, f));
102573
+ const st2 = statSync50(join164(repoDir, f));
102520
102574
  return Math.max(st2.birthtimeMs, st2.mtimeMs) >= s.at;
102521
102575
  } catch {
102522
102576
  return false;
@@ -102848,15 +102902,15 @@ function missingRelativeImportIsRed(f, raw2, repoDir) {
102848
102902
  hits.push({ spec: m[1], importer: m[2] });
102849
102903
  if (hits.length === 0)
102850
102904
  return false;
102851
- const abs = resolve43(repoDir, f.path);
102905
+ const abs = resolve44(repoDir, f.path);
102852
102906
  return hits.every(({ spec, importer }) => {
102853
102907
  if (!/^\.\.?(?:\/|$)/.test(spec) || !(abs === importer || abs.endsWith("/" + importer.replace(/^\.\//, "")) || importer.endsWith("/" + f.path) || importer === f.path))
102854
102908
  return false;
102855
- const target = resolve43(dirname71(abs), spec.replace(/[?#].*$/, ""));
102909
+ const target = resolve44(dirname71(abs), spec.replace(/[?#].*$/, ""));
102856
102910
  const stem2 = target.replace(/\.(?:jsx?|mjs|cjs)$/, "");
102857
- if (existsSync117(target) && statSync49(target).isDirectory())
102911
+ if (existsSync117(target) && statSync50(target).isDirectory())
102858
102912
  return false;
102859
- return ![target, stem2].some((t) => ["", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".json"].some((x10) => existsSync117(t + x10) && statSync49(t + x10).isFile())) && !["ts", "tsx", "js", "jsx", "mjs", "cjs"].some((x10) => existsSync117(join164(target, `index.${x10}`)));
102913
+ return ![target, stem2].some((t) => ["", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".json"].some((x10) => existsSync117(t + x10) && statSync50(t + x10).isFile())) && !["ts", "tsx", "js", "jsx", "mjs", "cjs"].some((x10) => existsSync117(join164(target, `index.${x10}`)));
102860
102914
  });
102861
102915
  }
102862
102916
  function classify(f, status, output, repoDir, interpreter) {
@@ -103108,7 +103162,7 @@ ${r.stderr ?? ""}` };
103108
103162
  }
103109
103163
  }
103110
103164
  function spawnCollect(cmd2, args, o) {
103111
- return new Promise((resolve44) => {
103165
+ return new Promise((resolve45) => {
103112
103166
  let out3 = "", err = "", error = false, done = false;
103113
103167
  const MAX = o.maxBytes ?? 1024 * 1024;
103114
103168
  const timers = [];
@@ -103119,7 +103173,7 @@ function spawnCollect(cmd2, args, o) {
103119
103173
  o.signal?.removeEventListener("abort", abort);
103120
103174
  killGroup2(c.pid, "SIGKILL");
103121
103175
  wd2?.kill("SIGKILL");
103122
- resolve44({ status: error ? null : status, output: `${out3}
103176
+ resolve45({ status: error ? null : status, output: `${out3}
103123
103177
  ${err}` });
103124
103178
  }
103125
103179
  };
@@ -103255,7 +103309,7 @@ function runnerCmd(t, repoDir) {
103255
103309
  case "dotnet":
103256
103310
  return dotnetTestCmd(repoDir, t.path);
103257
103311
  case "cargo":
103258
- return CARGO_TEST_FILE_RE.test(t.path) ? ["cargo", ["test", "--test", basename46(t.path, ".rs")]] : ["cargo", ["test"]];
103312
+ return CARGO_TEST_FILE_RE.test(t.path) ? ["cargo", ["test", "--test", basename47(t.path, ".rs")]] : ["cargo", ["test"]];
103259
103313
  }
103260
103314
  }
103261
103315
  function fullSuiteCmd(runner, repoDir) {
@@ -103473,7 +103527,7 @@ function firstFileLineAnchor(desc2) {
103473
103527
  }
103474
103528
  return null;
103475
103529
  }
103476
- var NO_TESTS_REASON = "no tests executed", sealedWallDir = (runDir) => join164(runDir, "wall"), sealedWallCopy = (runDir, path) => join164(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) => !/^(0|off|false|no)$/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, `
103530
+ var NO_TESTS_REASON = "no tests executed", sealedWallDir = (runDir) => join164(runDir, "wall"), sealedWallCopy = (runDir, path) => join164(sealedWallDir(runDir), basename47(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) => !/^(0|off|false|no)$/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, `
103477
103531
  `), tailLines = (out3) => out3.split(`
103478
103532
  `).filter((x10) => x10.trim()).slice(-12), CARGO_NOISE, cargoMergedDoctestOn = (env = process.env) => !/^(0|off|false|no)$/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) => existsSync117(dir) ? readdirSync56(dir).filter((f) => f.endsWith(".go") && !f.endsWith("_test.go")).map((f) => /^package\s+(\w+)/m.exec(readFileSync149(join164(dir, f), "utf8"))?.[1]).find(Boolean) : undefined, goDirPackage = (dir) => goSiblingPkg(dir) ?? (existsSync117(dir) ? readdirSync56(dir).filter((f) => f.endsWith("_test.go")).map((f) => /^package\s+(\w+)/m.exec(readFileSync149(join164(dir, f), "utf8"))?.[1]?.replace(/_test$/, "")).find(Boolean) : undefined), goPackageBrief = (repoDir, targetDir, runners, texts, importPathOf) => {
103479
103533
  if (!runners.includes("go"))
@@ -103488,7 +103542,7 @@ Go: your test files sit in the package directory, so each one starts with "packa
103488
103542
 
103489
103543
  Go: your test files are copied into ${relative36(repoDir, targetDir) || "the repository root"}/, whose existing Go files declare "package ${here}". Start each file with "package ${here}"; any other package clause breaks that directory's build and the file is discarded.${imp ? ` Import the package under test as "${imp}" and call its identifiers qualified (${p.pkg}.Name).` : ""}` : "";
103490
103544
  }, KNOWN_RUNNERS, SHELL_WORDS, RESERVED_WORDS, WRAPPERS, NO2 = 0, YES = 1, UNKNOWN = 2, triOr = (a, b) => a === YES || b === YES ? YES : a === UNKNOWN || b === UNKNOWN ? UNKNOWN : NO2, TOOL_ALIASES, INLINE_CODE_FLAGS, INTERPRETERS, GO_VERSIONED, wordIsTool = (tool, w) => {
103491
- const name = basename46(w);
103545
+ const name = basename47(w);
103492
103546
  return name === tool || (TOOL_ALIASES[tool]?.includes(name) ?? false) || tool === "go" && GO_VERSIONED.test(name);
103493
103547
  }, TOOL_PATH_VARS, varNamesTool = (tool, v10) => {
103494
103548
  const l = v10.toLowerCase(), last = l.split("_").pop();
@@ -103717,7 +103771,7 @@ var init_check_result = __esm(() => {
103717
103771
  });
103718
103772
 
103719
103773
  // ../../loki-ts/src/council/finding_schema.ts
103720
- import { existsSync as existsSync118, readdirSync as readdirSync57, readFileSync as readFileSync150, statSync as statSync50 } from "fs";
103774
+ import { existsSync as existsSync118, readdirSync as readdirSync57, readFileSync as readFileSync150, statSync as statSync51 } from "fs";
103721
103775
  import { resolve as resolvePath3, dirname as dirname72, relative as relative37, isAbsolute as isAbsolute26, join as join165, sep as sep28 } from "path";
103722
103776
  import { fileURLToPath as fileURLToPath6 } from "url";
103723
103777
  function resolveSchemaDataDir(moduleDir = _moduleDir, candidates2 = SCHEMA_DATA_DIR_CANDIDATES) {
@@ -104200,16 +104254,16 @@ var init_values = __esm(() => {
104200
104254
  });
104201
104255
 
104202
104256
  // ../../loki-ts/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs
104203
- var sleep = (ms, signal) => new Promise((resolve44) => {
104257
+ var sleep = (ms, signal) => new Promise((resolve45) => {
104204
104258
  if (signal?.aborted)
104205
- return resolve44();
104259
+ return resolve45();
104206
104260
  const onAbort = () => {
104207
104261
  clearTimeout(timer);
104208
- resolve44();
104262
+ resolve45();
104209
104263
  };
104210
104264
  const timer = setTimeout(() => {
104211
104265
  signal?.removeEventListener("abort", onAbort);
104212
- resolve44();
104266
+ resolve45();
104213
104267
  }, ms);
104214
104268
  signal?.addEventListener("abort", onAbort, { once: true });
104215
104269
  });
@@ -107546,8 +107600,8 @@ var init_api_promise = __esm(() => {
107546
107600
 
107547
107601
  class APIPromise2 extends Promise {
107548
107602
  constructor(client, responsePromise, parseResponse = defaultParseResponse) {
107549
- super((resolve44) => {
107550
- resolve44(null);
107603
+ super((resolve45) => {
107604
+ resolve45(null);
107551
107605
  });
107552
107606
  this.responsePromise = responsePromise;
107553
107607
  this.parseResponse = parseResponse;
@@ -109826,16 +109880,16 @@ var init_async_queue = __esm(() => {
109826
109880
  if (__classPrivateFieldGet(this, _AsyncQueue_closed, "f") || signal?.aborted) {
109827
109881
  return Promise.resolve({ done: true, value: undefined });
109828
109882
  }
109829
- return new Promise((resolve44) => {
109883
+ return new Promise((resolve45) => {
109830
109884
  const waiter = (r) => {
109831
109885
  signal?.removeEventListener("abort", onAbort);
109832
- resolve44(r);
109886
+ resolve45(r);
109833
109887
  };
109834
109888
  const onAbort = () => {
109835
109889
  const idx = __classPrivateFieldGet(this, _AsyncQueue_waiters, "f").indexOf(waiter);
109836
109890
  if (idx >= 0)
109837
109891
  __classPrivateFieldGet(this, _AsyncQueue_waiters, "f").splice(idx, 1);
109838
- resolve44({ done: true, value: undefined });
109892
+ resolve45({ done: true, value: undefined });
109839
109893
  };
109840
109894
  __classPrivateFieldGet(this, _AsyncQueue_waiters, "f").push(waiter);
109841
109895
  signal?.addEventListener("abort", onAbort, { once: true });
@@ -110488,13 +110542,13 @@ var init_json_schema = () => {};
110488
110542
 
110489
110543
  // ../../loki-ts/node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs
110490
110544
  function promiseWithResolvers() {
110491
- let resolve44;
110545
+ let resolve45;
110492
110546
  let reject;
110493
110547
  const promise = new Promise((res, rej) => {
110494
- resolve44 = res;
110548
+ resolve45 = res;
110495
110549
  reject = rej;
110496
110550
  });
110497
- return { promise, resolve: resolve44, reject };
110551
+ return { promise, resolve: resolve45, reject };
110498
110552
  }
110499
110553
 
110500
110554
  // ../../loki-ts/node_modules/@anthropic-ai/sdk/internal/node.mjs
@@ -111275,10 +111329,10 @@ async function settledOrAborted(p, signal) {
111275
111329
  return;
111276
111330
  }
111277
111331
  let onAbort;
111278
- const aborted = new Promise((resolve44) => {
111279
- onAbort = resolve44;
111332
+ const aborted = new Promise((resolve45) => {
111333
+ onAbort = resolve45;
111280
111334
  if (signal.aborted)
111281
- resolve44();
111335
+ resolve45();
111282
111336
  });
111283
111337
  signal.addEventListener("abort", onAbort, { once: true });
111284
111338
  try {
@@ -112235,7 +112289,7 @@ function betaGrepTool(ctx) {
112235
112289
  });
112236
112290
  }
112237
112291
  function runRipgrep(rg2, pattern, searchPath, signal) {
112238
- return new Promise((resolve45, reject) => {
112292
+ return new Promise((resolve46, reject) => {
112239
112293
  const proc = cp2.spawn(rg2, ["-n", "--no-heading", "-e", pattern, "--", searchPath], {
112240
112294
  ...signal ? { signal } : {}
112241
112295
  });
@@ -112257,12 +112311,12 @@ function runRipgrep(rg2, pattern, searchPath, signal) {
112257
112311
  if (signal?.aborted)
112258
112312
  return reject(new ToolError("grep: aborted"));
112259
112313
  if (truncated)
112260
- return resolve45(out3 + `
112314
+ return resolve46(out3 + `
112261
112315
  [output truncated at ${GREP_OUTPUT_LIMIT} bytes]`);
112262
112316
  if (code === 0)
112263
- return resolve45(out3);
112317
+ return resolve46(out3);
112264
112318
  if (code === 1)
112265
- return resolve45("no matches");
112319
+ return resolve46("no matches");
112266
112320
  reject(new ToolError(`grep: rg failed: ${errOut || `exit ${code}`}`));
112267
112321
  });
112268
112322
  proc.on("error", (e10) => {
@@ -112434,8 +112488,8 @@ var init_node2 = __esm(() => {
112434
112488
  `;
112435
112489
  __classPrivateFieldGet(this, _BashSession_proc, "f").stdin.write(wrapped);
112436
112490
  if (__classPrivateFieldGet(this, _BashSession_buf, "f").indexOf(sentinel3) < 0) {
112437
- const { promise: sentinelSeen, resolve: resolve45 } = promiseWithResolvers();
112438
- __classPrivateFieldSet(this, _BashSession_waiting, { sentinel: sentinel3, resolve: resolve45 }, "f");
112491
+ const { promise: sentinelSeen, resolve: resolve46 } = promiseWithResolvers();
112492
+ __classPrivateFieldSet(this, _BashSession_waiting, { sentinel: sentinel3, resolve: resolve46 }, "f");
112439
112493
  let timer;
112440
112494
  let onAbort;
112441
112495
  try {
@@ -112595,8 +112649,8 @@ async function withTimeout(p, ms) {
112595
112649
  try {
112596
112650
  return await Promise.race([
112597
112651
  p.then(() => false, () => false),
112598
- new Promise((resolve45) => {
112599
- timer = setTimeout(() => resolve45(true), ms);
112652
+ new Promise((resolve46) => {
112653
+ timer = setTimeout(() => resolve46(true), ms);
112600
112654
  })
112601
112655
  ]);
112602
112656
  } finally {
@@ -114269,12 +114323,12 @@ var init_BetaMessageStream = __esm(() => {
114269
114323
  }
114270
114324
  return this._emit("error", new AnthropicError(String(error2)));
114271
114325
  });
114272
- __classPrivateFieldSet(this, _BetaMessageStream_connectedPromise, new Promise((resolve45, reject) => {
114273
- __classPrivateFieldSet(this, _BetaMessageStream_resolveConnectedPromise, resolve45, "f");
114326
+ __classPrivateFieldSet(this, _BetaMessageStream_connectedPromise, new Promise((resolve46, reject) => {
114327
+ __classPrivateFieldSet(this, _BetaMessageStream_resolveConnectedPromise, resolve46, "f");
114274
114328
  __classPrivateFieldSet(this, _BetaMessageStream_rejectConnectedPromise, reject, "f");
114275
114329
  }), "f");
114276
- __classPrivateFieldSet(this, _BetaMessageStream_endPromise, new Promise((resolve45, reject) => {
114277
- __classPrivateFieldSet(this, _BetaMessageStream_resolveEndPromise, resolve45, "f");
114330
+ __classPrivateFieldSet(this, _BetaMessageStream_endPromise, new Promise((resolve46, reject) => {
114331
+ __classPrivateFieldSet(this, _BetaMessageStream_resolveEndPromise, resolve46, "f");
114278
114332
  __classPrivateFieldSet(this, _BetaMessageStream_rejectEndPromise, reject, "f");
114279
114333
  }), "f");
114280
114334
  __classPrivateFieldGet(this, _BetaMessageStream_connectedPromise, "f").catch(() => {});
@@ -114434,11 +114488,11 @@ var init_BetaMessageStream = __esm(() => {
114434
114488
  return this;
114435
114489
  }
114436
114490
  emitted(event) {
114437
- return new Promise((resolve45, reject) => {
114491
+ return new Promise((resolve46, reject) => {
114438
114492
  __classPrivateFieldSet(this, _BetaMessageStream_catchingPromiseCreated, true, "f");
114439
114493
  if (event !== "error")
114440
114494
  this.once("error", reject);
114441
- this.once(event, resolve45);
114495
+ this.once(event, resolve46);
114442
114496
  });
114443
114497
  }
114444
114498
  async done() {
@@ -114815,7 +114869,7 @@ var init_BetaMessageStream = __esm(() => {
114815
114869
  if (done) {
114816
114870
  return { value: undefined, done: true };
114817
114871
  }
114818
- return new Promise((resolve45, reject) => readQueue2.push({ resolve: resolve45, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
114872
+ return new Promise((resolve46, reject) => readQueue2.push({ resolve: resolve46, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
114819
114873
  }
114820
114874
  const chunk = pushQueue.shift();
114821
114875
  return { value: chunk, done: false };
@@ -121206,12 +121260,12 @@ var init_MessageStream = __esm(() => {
121206
121260
  }
121207
121261
  return this._emit("error", new AnthropicError(String(error2)));
121208
121262
  });
121209
- __classPrivateFieldSet(this, _MessageStream_connectedPromise, new Promise((resolve45, reject) => {
121210
- __classPrivateFieldSet(this, _MessageStream_resolveConnectedPromise, resolve45, "f");
121263
+ __classPrivateFieldSet(this, _MessageStream_connectedPromise, new Promise((resolve46, reject) => {
121264
+ __classPrivateFieldSet(this, _MessageStream_resolveConnectedPromise, resolve46, "f");
121211
121265
  __classPrivateFieldSet(this, _MessageStream_rejectConnectedPromise, reject, "f");
121212
121266
  }), "f");
121213
- __classPrivateFieldSet(this, _MessageStream_endPromise, new Promise((resolve45, reject) => {
121214
- __classPrivateFieldSet(this, _MessageStream_resolveEndPromise, resolve45, "f");
121267
+ __classPrivateFieldSet(this, _MessageStream_endPromise, new Promise((resolve46, reject) => {
121268
+ __classPrivateFieldSet(this, _MessageStream_resolveEndPromise, resolve46, "f");
121215
121269
  __classPrivateFieldSet(this, _MessageStream_rejectEndPromise, reject, "f");
121216
121270
  }), "f");
121217
121271
  __classPrivateFieldGet(this, _MessageStream_connectedPromise, "f").catch(() => {});
@@ -121354,11 +121408,11 @@ var init_MessageStream = __esm(() => {
121354
121408
  return this;
121355
121409
  }
121356
121410
  emitted(event) {
121357
- return new Promise((resolve45, reject) => {
121411
+ return new Promise((resolve46, reject) => {
121358
121412
  __classPrivateFieldSet(this, _MessageStream_catchingPromiseCreated, true, "f");
121359
121413
  if (event !== "error")
121360
121414
  this.once("error", reject);
121361
- this.once(event, resolve45);
121415
+ this.once(event, resolve46);
121362
121416
  });
121363
121417
  }
121364
121418
  async done() {
@@ -121683,7 +121737,7 @@ var init_MessageStream = __esm(() => {
121683
121737
  if (done) {
121684
121738
  return { value: undefined, done: true };
121685
121739
  }
121686
- return new Promise((resolve45, reject) => readQueue2.push({ resolve: resolve45, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
121740
+ return new Promise((resolve46, reject) => readQueue2.push({ resolve: resolve46, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
121687
121741
  }
121688
121742
  const chunk = pushQueue.shift();
121689
121743
  return { value: chunk, done: false };
@@ -126991,9 +127045,9 @@ var init_opus_consult = __esm(() => {
126991
127045
  // ../../loki-ts/src/util/conflict_resume.ts
126992
127046
  import { createHash as createHash41 } from "crypto";
126993
127047
  import { execFileSync as execFileSync14 } from "child_process";
126994
- import { chmodSync as chmodSync10, existsSync as existsSync119, mkdirSync as mkdirSync91, mkdtempSync as mkdtempSync28, readdirSync as readdirSync58, readFileSync as readFileSync153, rmSync as rmSync54, statSync as statSync51, symlinkSync as symlinkSync7, writeFileSync as writeFileSync89 } from "fs";
127048
+ import { chmodSync as chmodSync10, existsSync as existsSync119, mkdirSync as mkdirSync91, mkdtempSync as mkdtempSync28, readdirSync as readdirSync58, readFileSync as readFileSync153, rmSync as rmSync54, statSync as statSync52, symlinkSync as symlinkSync7, writeFileSync as writeFileSync89 } from "fs";
126995
127049
  import { tmpdir as tmpdir36 } from "os";
126996
- import { basename as basename47, dirname as dirname74, isAbsolute as isAbsolute28, join as join168, relative as relative38 } from "path";
127050
+ import { basename as basename48, dirname as dirname74, isAbsolute as isAbsolute28, join as join168, relative as relative38 } from "path";
126997
127051
  function answerMark(events2, assumeNext = false) {
126998
127052
  if (assumeNext)
126999
127053
  return events2.length;
@@ -127360,7 +127414,7 @@ async function adjudicateWallConflict(ctx, first, firstSession, wall, deps = {})
127360
127414
  const reason = firstSession.markers.specConflict, rels = wall.map((f5) => relative38(ctx.repoDir, f5.path)), a = reason ? wallAnchor(reason, rels) : null;
127361
127415
  if (!reason || !a)
127362
127416
  return null;
127363
- const f = wall[rels.indexOf(a.file)], o = ctx.outputs(), task = o.intake?.task ?? "", name = basename47(f.path), original = f.content;
127417
+ const f = wall[rels.indexOf(a.file)], o = ctx.outputs(), task = o.intake?.task ?? "", name = basename48(f.path), original = f.content;
127364
127418
  if (!wallRefereeEnabled())
127365
127419
  return legacyReauthor(ctx, first, firstSession, f, a, reason, task);
127366
127420
  const done = o.wall?.arbitration_rounds ?? [];
@@ -127460,7 +127514,7 @@ ${brief}`, ...sid ? { resumeSessionId: sid } : {} });
127460
127514
  }
127461
127515
  }
127462
127516
  async function legacyReauthor(ctx, first, firstSession, f, a, reason, task) {
127463
- const ids = [], o = ctx.outputs(), cwd = mkdtempSync28(join168(tmpdir36(), "loki-e15-wall-")), name = basename47(f.path);
127517
+ const ids = [], o = ctx.outputs(), cwd = mkdtempSync28(join168(tmpdir36(), "loki-e15-wall-")), name = basename48(f.path);
127464
127518
  try {
127465
127519
  writeFileSync89(join168(cwd, name), f.content, "utf8");
127466
127520
  const id2 = `${first.iterationId}-wa`;
@@ -127558,7 +127612,7 @@ async function deliverOverWallConflict(o, repoDir, reverify, emit2, opts = {}) {
127558
127612
  }
127559
127613
  }, modeOf = (p) => {
127560
127614
  try {
127561
- return statSync51(p).mode & 4095;
127615
+ return statSync52(p).mode & 4095;
127562
127616
  } catch {
127563
127617
  return null;
127564
127618
  }
@@ -127825,8 +127879,8 @@ __export(exports_run_outputs, {
127825
127879
  });
127826
127880
  import { execFile as execFile3, spawnSync as spawnSync29 } from "child_process";
127827
127881
  import { createHash as createHash42 } from "crypto";
127828
- import { existsSync as existsSync120, lstatSync as lstatSync36, mkdirSync as mkdirSync92, readdirSync as readdirSync59, readFileSync as readFileSync154, statSync as statSync52, writeFileSync as writeFileSync90 } from "fs";
127829
- import { basename as basename48, join as join169, resolve as resolve45 } from "path";
127882
+ import { existsSync as existsSync120, lstatSync as lstatSync36, mkdirSync as mkdirSync92, readdirSync as readdirSync59, readFileSync as readFileSync154, statSync as statSync53, writeFileSync as writeFileSync90 } from "fs";
127883
+ import { basename as basename49, join as join169, resolve as resolve46 } from "path";
127830
127884
  function intentRevisionsBlock(revs) {
127831
127885
  const r = (revs ?? []).filter((r10) => r10.unapplied !== true).map(({ rev, source, actor, sha: sha6 }) => ({ rev, source, actor, sha: sha6 }));
127832
127886
  return r.length ? { intent_revisions: r } : {};
@@ -127859,7 +127913,7 @@ function sealAccuracyLine(changed, checks, model, env2 = process.env, nowMs = Da
127859
127913
  const res = JSON.parse(readFileSync154(file, "utf8"));
127860
127914
  if (res.manifest_sha256 !== corpus2 || !Array.isArray(res.runs))
127861
127915
  return SEAL_ACCURACY_NOT_MEASURED;
127862
- const first = changed.map((f) => basename48(f)).find((b) => !SPEC_PREFIXES.some((p) => b.startsWith(p)));
127916
+ const first = changed.map((f) => basename49(f)).find((b) => !SPEC_PREFIXES.some((p) => b.startsWith(p)));
127863
127917
  const lang = first === undefined ? "unknown" : LANG_BY_EXT[first.slice(first.lastIndexOf(".")).toLowerCase()] ?? "unknown";
127864
127918
  const runner = checks.find((c) => c.result === "pass")?.cmd.trim().split(/\s+/)[0];
127865
127919
  const run2 = res.runs.find((r) => typeof r["model"] === "string" && resolveClaudeModel(r["model"]) === resolveClaudeModel(model));
@@ -128007,7 +128061,7 @@ function findInterrupted(repoDir, runId2, includeCancelled = false, why) {
128007
128061
  } catch {
128008
128062
  return null;
128009
128063
  }
128010
- const rows = ids.filter((id2) => /^e10-[A-Za-z0-9-]+$/.test(id2) && existsSync120(join169(repoDir, eventsRelPath(id2)))).map((id2) => ({ id: id2, m: statSync52(join169(repoDir, eventsRelPath(id2))).mtimeMs })).sort((a, b) => b.m - a.m);
128064
+ const rows = ids.filter((id2) => /^e10-[A-Za-z0-9-]+$/.test(id2) && existsSync120(join169(repoDir, eventsRelPath(id2)))).map((id2) => ({ id: id2, m: statSync53(join169(repoDir, eventsRelPath(id2))).mtimeMs })).sort((a, b) => b.m - a.m);
128011
128065
  const top = rows[0];
128012
128066
  if (!top)
128013
128067
  return null;
@@ -128285,7 +128339,7 @@ async function resumeFlag(runId2, noPr = false, deps = {}, answer) {
128285
128339
  };
128286
128340
  const supervise = deps.supervise ?? (async (o) => (await Promise.resolve().then(() => (init_supervisor(), exports_supervisor))).runSupervisor(o));
128287
128341
  const { exitCodeOf: exitCodeOf2 } = await Promise.resolve().then(() => (init_output(), exports_output));
128288
- const res = await supervise({ runId: it2.runId, repoDir, env: env2, resume: true, capS: capS === undefined ? undefined : Math.floor(capS), capCeilingS: ceilS === undefined ? undefined : Math.floor(ceilS), restoreBranch: origBranch, workerArgv: [process.execPath, ...SAFE_BUN_FLAGS, resolve45(process.argv[1] ?? ""), "engine10", "worker", it2.runId, provider, model, deep ? "deep" : "fast"], started: { ...st2, resumed_from: rp2.stage, ...answer !== undefined ? { answered: true, answer: redactSecrets(answer), answer_sha256: createHash42("sha256").update(redactSecrets(answer)).digest("hex"), question: String(conflictReasonOf(it2.events) ?? "the run is blocked on a spec conflict").replace(/[\x00-\x1f\x7f]+/g, " ").trim().slice(0, 500) } : {} }, pr: pr2 });
128342
+ const res = await supervise({ runId: it2.runId, repoDir, env: env2, resume: true, capS: capS === undefined ? undefined : Math.floor(capS), capCeilingS: ceilS === undefined ? undefined : Math.floor(ceilS), restoreBranch: origBranch, workerArgv: [process.execPath, ...SAFE_BUN_FLAGS, resolve46(process.argv[1] ?? ""), "engine10", "worker", it2.runId, provider, model, deep ? "deep" : "fast"], started: { ...st2, resumed_from: rp2.stage, ...answer !== undefined ? { answered: true, answer: redactSecrets(answer), answer_sha256: createHash42("sha256").update(redactSecrets(answer)).digest("hex"), question: String(conflictReasonOf(it2.events) ?? "the run is blocked on a spec conflict").replace(/[\x00-\x1f\x7f]+/g, " ").trim().slice(0, 500) } : {} }, pr: pr2 });
128289
128343
  out3(`engine10: resumed run ${it2.runId}: ${res.outcome}
128290
128344
  `);
128291
128345
  return exitCodeOf2(res.outcome);
@@ -128304,7 +128358,7 @@ async function signedReceiptFacts(runDir, runId2, events2) {
128304
128358
  for (const f of [file, join169(runDir, "events.jsonl")]) {
128305
128359
  try {
128306
128360
  if (lstatSync36(f).isSymbolicLink())
128307
- return { problem: `${basename48(f)} is a symlink; a run's own files are never links` };
128361
+ return { problem: `${basename49(f)} is a symlink; a run's own files are never links` };
128308
128362
  } catch {}
128309
128363
  }
128310
128364
  let r;
@@ -128674,7 +128728,7 @@ function issueStatusProjector(o) {
128674
128728
  return r.catch(() => null);
128675
128729
  };
128676
128730
  }
128677
- function policyGate(repoDir, action, env2 = process.env, checkJs = resolve45(import.meta.dir, "../../../src/policies/check.js"), timeoutMs = 30000) {
128731
+ function policyGate(repoDir, action, env2 = process.env, checkJs = resolve46(import.meta.dir, "../../../src/policies/check.js"), timeoutMs = 30000) {
128678
128732
  if (policyFile(repoDir, env2) === null)
128679
128733
  return { decision: "allow", reason: "no policy file" };
128680
128734
  if (env2.LOKI_POLICY_REQUIRE_NODE === "0" && spawnSync29("node", ["--version"], { env: { PATH: env2.PATH }, encoding: "utf8" }).status !== 0)
@@ -128909,7 +128963,7 @@ var init_run_outputs = __esm(() => {
128909
128963
 
128910
128964
  // ../../loki-ts/src/util/composite_seal.ts
128911
128965
  import { existsSync as existsSync121, readFileSync as readFileSync155 } from "fs";
128912
- import { basename as basename49, dirname as dirname75, join as join170 } from "path";
128966
+ import { basename as basename50, dirname as dirname75, join as join170 } from "path";
128913
128967
  function logProblem(runDir, integ) {
128914
128968
  if (typeof integ["log_sha256"] !== "string")
128915
128969
  return null;
@@ -128980,8 +129034,8 @@ function composeComposite(runDir, rh, toolchain = collectToolchain()) {
128980
129034
  throw new Error("workspace has no repos");
128981
129035
  return {
128982
129036
  schema: COMPOSITE_SCHEMA,
128983
- workspace: basename49(dirname75(runDir)),
128984
- run_id: basename49(runDir),
129037
+ workspace: basename50(dirname75(runDir)),
129038
+ run_id: basename50(runDir),
128985
129039
  integration_sha256: sha3(ibytes),
128986
129040
  integration: { status: String(integ["status"]), exit_code: typeof integ["exit_code"] === "number" ? integ["exit_code"] : null, log_sha256: typeof integ["log_sha256"] === "string" ? integ["log_sha256"] : null, heads },
128987
129041
  children,
@@ -129108,8 +129162,8 @@ __export(exports_verify_cmd, {
129108
129162
  checkEventLog: () => checkEventLog,
129109
129163
  checkAttestation: () => checkAttestation
129110
129164
  });
129111
- import { existsSync as existsSync122, readFileSync as readFileSync156, renameSync as renameSync30, statSync as statSync53, writeFileSync as writeFileSync91 } from "fs";
129112
- import { basename as basename50, dirname as dirname76, join as join171 } from "path";
129165
+ import { existsSync as existsSync122, readFileSync as readFileSync156, renameSync as renameSync30, statSync as statSync54, writeFileSync as writeFileSync91 } from "fs";
129166
+ import { basename as basename51, dirname as dirname76, join as join171 } from "path";
129113
129167
  import { createHash as createHash43, verify as verify5 } from "crypto";
129114
129168
  function checkAttestation(jwt, expectedHash, given) {
129115
129169
  const bad = (reason) => ({ status: "tampered", reason });
@@ -129144,11 +129198,11 @@ function wallTamperProblem(receiptPath, receipt) {
129144
129198
  cur = createHash43("sha256").update(readFileSync156(copy)).digest("hex");
129145
129199
  } catch {
129146
129200
  if (haveWallDir)
129147
- return `sealed Wall file ${basename50(f.path)} is missing from the run's wall directory: it was deleted after the seal`;
129201
+ return `sealed Wall file ${basename51(f.path)} is missing from the run's wall directory: it was deleted after the seal`;
129148
129202
  continue;
129149
129203
  }
129150
129204
  if (cur !== f.sha256)
129151
- return `sealed Wall file ${basename50(f.path)} changed after the seal: receipt recorded sha256 ${f.sha256}, on disk ${cur}`;
129205
+ return `sealed Wall file ${basename51(f.path)} changed after the seal: receipt recorded sha256 ${f.sha256}, on disk ${cur}`;
129152
129206
  }
129153
129207
  return null;
129154
129208
  }
@@ -129330,7 +129384,7 @@ async function verifyCompositeFile(receiptPath, receipt, deps) {
129330
129384
  }
129331
129385
  function sealCompositeCmd(runDir) {
129332
129386
  let body;
129333
- if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(basename50(runDir.replace(/\/+$/, ""))))
129387
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(basename51(runDir.replace(/\/+$/, ""))))
129334
129388
  return process.stderr.write(`loki verify: run directory name is not a valid run id; composite would never verify
129335
129389
  `), 2;
129336
129390
  try {
@@ -129426,7 +129480,7 @@ ${/^(unknown option|expected at most one)/.test(pk.error) ? `Usage: loki verify
129426
129480
  if (!runId2)
129427
129481
  return process.stderr.write(`loki verify: no runs found
129428
129482
  `), 66;
129429
- const isFile2 = existsSync122(runId2) && statSync53(runId2).isFile();
129483
+ const isFile2 = existsSync122(runId2) && statSync54(runId2).isFile();
129430
129484
  const isPath = isFile2 || /[\\/]/.test(runId2) || runId2.endsWith(".json");
129431
129485
  const receiptPath = isPath ? runId2 : join171(runsRoot2, runId2, "receipt.json");
129432
129486
  const byRunId = !isPath;
@@ -129572,8 +129626,8 @@ var init_verify_cmd = __esm(() => {
129572
129626
  });
129573
129627
 
129574
129628
  // src/server/app.ts
129575
- import { existsSync as existsSync125, readFileSync as readFileSync160, statSync as statSync55 } from "fs";
129576
- import { join as join175, resolve as resolve47, sep as sep31 } from "path";
129629
+ import { existsSync as existsSync125, readFileSync as readFileSync160, statSync as statSync56 } from "fs";
129630
+ import { join as join175, resolve as resolve48, sep as sep31 } from "path";
129577
129631
 
129578
129632
  // node_modules/hono/dist/request/constants.js
129579
129633
  var GET_MATCH_RESULT = Symbol();
@@ -136218,6 +136272,7 @@ function reconcileDeadRuns(db, o = {}) {
136218
136272
 
136219
136273
  // src/server/repos.ts
136220
136274
  import { execFile } from "child_process";
136275
+ import { statSync as statSync6 } from "fs";
136221
136276
  import { basename as basename2, resolve as resolve5 } from "path";
136222
136277
  init_discover();
136223
136278
  function syncLocalRepos(db, repoDir, env = process.env) {
@@ -136228,6 +136283,17 @@ function syncLocalRepos(db, repoDir, env = process.env) {
136228
136283
  }
136229
136284
  return found.length;
136230
136285
  }
136286
+ function repoPathsByName(db, name) {
136287
+ const rows = db.select({ sourceId: localRepos.sourceId, realpath: localRepos.realpath, name: localRepos.name }).from(localRepos).all();
136288
+ const byOrigin = new Set(db.selectDistinct({ s: runs.sourceId, r: runs.originRepo }).from(runs).all().filter((x) => x.r !== null && x.r.split("/").pop() === name).map((x) => x.s));
136289
+ return [...new Set(rows.filter((r) => r.name === name || byOrigin.has(r.sourceId)).map((r) => r.realpath))].filter((d) => {
136290
+ try {
136291
+ return statSync6(d).isDirectory();
136292
+ } catch {
136293
+ return false;
136294
+ }
136295
+ });
136296
+ }
136231
136297
  function repoNames(db) {
136232
136298
  return [...new Set(db.select({ name: localRepos.name }).from(localRepos).all().map((r) => r.name))].sort();
136233
136299
  }
@@ -136390,7 +136456,7 @@ function mount2(ctx) {
136390
136456
  import { basename as basename4 } from "path";
136391
136457
 
136392
136458
  // src/ask/policy.ts
136393
- import { chmodSync as chmodSync3, existsSync as existsSync8, lstatSync as lstatSync4, mkdtempSync as mkdtempSync3, readFileSync as readFileSync13, realpathSync as realpathSync7, rmSync as rmSync5, statSync as statSync6, writeFileSync as writeFileSync8 } from "fs";
136459
+ import { chmodSync as chmodSync3, existsSync as existsSync8, lstatSync as lstatSync4, mkdtempSync as mkdtempSync3, readFileSync as readFileSync13, realpathSync as realpathSync7, rmSync as rmSync5, statSync as statSync7, writeFileSync as writeFileSync8 } from "fs";
136394
136460
  import { tmpdir as tmpdir5 } from "os";
136395
136461
  import { dirname as dirname7, join as join19, parse } from "path";
136396
136462
  var MCP_SERVER_NAME = "loki-ask";
@@ -136505,7 +136571,7 @@ function removeJobDir(dir) {
136505
136571
  const marker = join19(dir, MARKER);
136506
136572
  if (!existsSync8(marker) || readFileSync13(marker, "utf8") !== dir)
136507
136573
  refuse("marker missing or wrong");
136508
- if (!statSync6(marker).isFile())
136574
+ if (!statSync7(marker).isFile())
136509
136575
  refuse("marker is not a file");
136510
136576
  rmSync5(dir, { recursive: true, force: true });
136511
136577
  }
@@ -136626,7 +136692,7 @@ import { join as join21 } from "path";
136626
136692
  // src/server/spawn.ts
136627
136693
  init_types();
136628
136694
  import { spawn } from "child_process";
136629
- import { existsSync as existsSync9, readFileSync as readFileSync14, realpathSync as realpathSync8, statSync as statSync7 } from "fs";
136695
+ import { existsSync as existsSync9, readFileSync as readFileSync14, realpathSync as realpathSync8, statSync as statSync8 } from "fs";
136630
136696
  import { homedir as homedir7 } from "os";
136631
136697
  import { basename as basename3, dirname as dirname8, join as join20, resolve as resolve6 } from "path";
136632
136698
  var ISSUE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}\/[A-Za-z0-9._-]{1,100}#[1-9][0-9]{0,8}$/;
@@ -136665,7 +136731,7 @@ function repoRefusal(cwd, env = process.env) {
136665
136731
  function registryRepos2(env = process.env) {
136666
136732
  try {
136667
136733
  const j = JSON.parse(readFileSync14(join20(env.HOME || homedir7(), ".loki", "dashboard", "projects.json"), "utf8"));
136668
- return Object.values(j.projects ?? {}).map((p) => typeof p?.path === "string" ? p.path : "").filter((p) => p && existsSync9(p) && statSync7(p).isDirectory());
136734
+ return Object.values(j.projects ?? {}).map((p) => typeof p?.path === "string" ? p.path : "").filter((p) => p && existsSync9(p) && statSync8(p).isDirectory());
136669
136735
  } catch {
136670
136736
  return [];
136671
136737
  }
@@ -137365,11 +137431,11 @@ function mount5(ctx) {
137365
137431
 
137366
137432
  // src/server/routes/checkpoints.ts
137367
137433
  init_safe_git();
137368
- import { appendFileSync as appendFileSync3, copyFileSync, cpSync, existsSync as existsSync11, lstatSync as lstatSync5, mkdirSync as mkdirSync9, readdirSync as readdirSync9, readFileSync as readFileSync16, realpathSync as realpathSync9, rmSync as rmSync6, statSync as statSync9, writeFileSync as writeFileSync10 } from "fs";
137434
+ import { appendFileSync as appendFileSync3, copyFileSync, cpSync, existsSync as existsSync11, lstatSync as lstatSync5, mkdirSync as mkdirSync9, readdirSync as readdirSync9, readFileSync as readFileSync16, realpathSync as realpathSync9, rmSync as rmSync6, statSync as statSync10, writeFileSync as writeFileSync10 } from "fs";
137369
137435
  import { join as join23, sep as sep6 } from "path";
137370
137436
 
137371
137437
  // src/server/routes/cost_ledger.ts
137372
- import { existsSync as existsSync10, readdirSync as readdirSync8, readFileSync as readFileSync15, statSync as statSync8 } from "fs";
137438
+ import { existsSync as existsSync10, readdirSync as readdirSync8, readFileSync as readFileSync15, statSync as statSync9 } from "fs";
137373
137439
  import { join as join22 } from "path";
137374
137440
  var isNum2 = (v) => typeof v === "number" && Number.isFinite(v);
137375
137441
  var isObj3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
@@ -137594,7 +137660,7 @@ function costTimeline(lokiDir2) {
137594
137660
  } catch {}
137595
137661
  for (const e of entries) {
137596
137662
  try {
137597
- if (!statSync8(join22(proofs, e)).isDirectory())
137663
+ if (!statSync9(join22(proofs, e)).isDirectory())
137598
137664
  continue;
137599
137665
  } catch {
137600
137666
  continue;
@@ -137759,7 +137825,7 @@ function rollbackCheckpoint(repoDir, id, now2 = new Date) {
137759
137825
  } catch {
137760
137826
  return null;
137761
137827
  }
137762
- if (!real3.startsWith(`${realStore}${sep6}`) || !statSync9(real3).isDirectory())
137828
+ if (!real3.startsWith(`${realStore}${sep6}`) || !statSync10(real3).isDirectory())
137763
137829
  return null;
137764
137830
  const preId = `rb-pre-${stamp(now2)}`, pre = join23(store, preId);
137765
137831
  mkdirSync9(pre, { recursive: true });
@@ -137891,8 +137957,8 @@ function mount7(ctx) {
137891
137957
 
137892
137958
  // src/server/routes/config.ts
137893
137959
  import { createHash as createHash6, randomBytes as randomBytes2 } from "crypto";
137894
- import { closeSync as closeSync6, fchmodSync, fsyncSync as fsyncSync2, lstatSync as lstatSync6, openSync as openSync6, readFileSync as readFileSync17, realpathSync as realpathSync10, renameSync as renameSync5, statSync as statSync10, unlinkSync as unlinkSync2, writeSync as writeSync3 } from "fs";
137895
- import { basename as basename5, dirname as dirname9, join as join24, sep as sep7 } from "path";
137960
+ import { closeSync as closeSync6, fchmodSync, fsyncSync as fsyncSync2, lstatSync as lstatSync6, openSync as openSync6, readFileSync as readFileSync17, realpathSync as realpathSync10, renameSync as renameSync5, statSync as statSync11, unlinkSync as unlinkSync2, writeSync as writeSync3 } from "fs";
137961
+ import { basename as basename6, dirname as dirname9, join as join24, sep as sep7 } from "path";
137896
137962
 
137897
137963
  // node_modules/yaml/dist/index.js
137898
137964
  var composer = require_composer();
@@ -137941,6 +138007,7 @@ var $visit = visit.visit;
137941
138007
  var $visitAsync = visit.visitAsync;
137942
138008
 
137943
138009
  // src/server/routes/start.ts
138010
+ import { basename as basename5, resolve as resolve7 } from "path";
137944
138011
  function originOk(origin) {
137945
138012
  if (origin === undefined || origin === null)
137946
138013
  return true;
@@ -137969,7 +138036,18 @@ function mount8(ctx) {
137969
138036
  return c.json({ error: "invalid JSON" }, 400);
137970
138037
  }
137971
138038
  const target = typeof body?.target === "string" ? body.target : undefined;
137972
- const plan = planStart(body, [repoDir, ...registryRepos2()], ctx.startBin);
138039
+ const b = body, known = [repoDir, ...registryRepos2()];
138040
+ if (b && typeof b.repo === "string" && b.repo !== "" && !b.repo.includes("/") && !known.some((k) => basename5(resolve7(k)) === b.repo)) {
138041
+ const hits = repoPathsByName(db, b.repo);
138042
+ if (hits.length === 1) {
138043
+ known.push(hits[0]);
138044
+ b.repo = hits[0];
138045
+ } else if (hits.length > 1) {
138046
+ audit3(db, { kind: "run.start", target, result: "refused", detail: `${hits.length} checkouts match ${b.repo}` });
138047
+ return c.json({ error: `${hits.length} checkouts on this machine belong to ${b.repo}; start the run from the one you mean with loki start` }, 400);
138048
+ }
138049
+ }
138050
+ const plan = planStart(body, known, ctx.startBin);
137973
138051
  if (!plan.ok) {
137974
138052
  audit3(db, { kind: "run.start", target, result: "refused", detail: plan.error });
137975
138053
  return c.json({ error: plan.error }, 400);
@@ -138348,7 +138426,7 @@ function resolveConfigFile(repoDir) {
138348
138426
  }
138349
138427
  if (!real3.startsWith(root + sep7))
138350
138428
  return { ok: false, status: 400, error: "loki.yaml is a symlink that resolves outside the repo" };
138351
- if (!statSync10(real3).isFile())
138429
+ if (!statSync11(real3).isFile())
138352
138430
  return { ok: false, status: 422, error: "loki.yaml is not a regular file" };
138353
138431
  return { ok: true, file: real3, exists: true };
138354
138432
  }
@@ -138357,7 +138435,7 @@ function resolveConfigFile(repoDir) {
138357
138435
  return { ok: true, file: p, exists: true };
138358
138436
  }
138359
138437
  function atomicWrite(file, text2, mode) {
138360
- const tmp = join24(dirname9(file), `.${basename5(file)}.${process.pid}.${randomBytes2(6).toString("hex")}.tmp`);
138438
+ const tmp = join24(dirname9(file), `.${basename6(file)}.${process.pid}.${randomBytes2(6).toString("hex")}.tmp`);
138361
138439
  const fd = openSync6(tmp, "wx", mode);
138362
138440
  try {
138363
138441
  writeSync3(fd, text2);
@@ -138397,7 +138475,7 @@ function mount9(ctx) {
138397
138475
  return deny(c, "config.read", r.status, r.error);
138398
138476
  let raw2 = "";
138399
138477
  if (r.exists) {
138400
- if (statSync10(r.file).size > MAX_FILE)
138478
+ if (statSync11(r.file).size > MAX_FILE)
138401
138479
  return deny(c, "config.read", 413, "loki.yaml is too large");
138402
138480
  raw2 = readFileSync17(r.file, "utf8");
138403
138481
  }
@@ -138462,7 +138540,7 @@ function mount9(ctx) {
138462
138540
  return refuse(r.status, r.error);
138463
138541
  let raw2 = "";
138464
138542
  if (r.exists) {
138465
- if (statSync10(r.file).size > MAX_FILE)
138543
+ if (statSync11(r.file).size > MAX_FILE)
138466
138544
  return refuse(400, "loki.yaml is too large");
138467
138545
  raw2 = readFileSync17(r.file, "utf8");
138468
138546
  }
@@ -138489,7 +138567,7 @@ function mount9(ctx) {
138489
138567
  return refuse(400, "could not render the config safely");
138490
138568
  const changed = [...new Set([...Object.keys(prev), ...Object.keys(next)])].filter((k) => !deepEq(prev[k], next[k]));
138491
138569
  try {
138492
- const mode = r.exists ? statSync10(r.file).mode & 511 : 420;
138570
+ const mode = r.exists ? statSync11(r.file).mode & 511 : 420;
138493
138571
  if (r.exists)
138494
138572
  atomicWrite(`${r.file}.bak`, raw2, 384);
138495
138573
  atomicWrite(r.file, out, mode);
@@ -138508,7 +138586,7 @@ function mount9(ctx) {
138508
138586
 
138509
138587
  // src/server/routes/control.ts
138510
138588
  import { existsSync as existsSync12, realpathSync as realpathSync11 } from "fs";
138511
- import { join as join25, resolve as resolve7, sep as sep8 } from "path";
138589
+ import { join as join25, resolve as resolve8, sep as sep8 } from "path";
138512
138590
  init_run_pid();
138513
138591
  var ID4 = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
138514
138592
  var busy = new Set;
@@ -138534,7 +138612,7 @@ function mount10(ctx) {
138534
138612
  }
138535
138613
  if (!repo)
138536
138614
  return done(404, "refused", { error: "this run's repo is not known on this machine" });
138537
- const runsRoot = join25(repo, ".loki", "runs"), runDir = resolve7(runsRoot, id);
138615
+ const runsRoot = join25(repo, ".loki", "runs"), runDir = resolve8(runsRoot, id);
138538
138616
  if (!runDir.startsWith(runsRoot + sep8))
138539
138617
  return done(400, "refused", { error: "invalid run id" }, "path escape");
138540
138618
  return handler({ source, run: id, repo, runDir }, done);
@@ -138691,7 +138769,7 @@ var DOCTOR_TIMEOUT_MS = 25000;
138691
138769
  var MAX_OUT = 1e6;
138692
138770
  var isStatus = (s) => s === "pass" || s === "warn" || s === "fail";
138693
138771
  function runDoctor(bin, timeoutMs = DOCTOR_TIMEOUT_MS) {
138694
- return new Promise((resolve8, reject) => {
138772
+ return new Promise((resolve9, reject) => {
138695
138773
  let out2 = "";
138696
138774
  let done = false;
138697
138775
  let child;
@@ -138718,7 +138796,7 @@ function runDoctor(bin, timeoutMs = DOCTOR_TIMEOUT_MS) {
138718
138796
  out2 += d.toString("utf8");
138719
138797
  });
138720
138798
  child.on("error", (e) => finish2(() => reject(new Error(`could not run loki doctor: ${e.message}`))));
138721
- child.on("close", () => finish2(() => resolve8(out2)));
138799
+ child.on("close", () => finish2(() => resolve9(out2)));
138722
138800
  });
138723
138801
  }
138724
138802
  function mapDoctor(raw2) {
@@ -138764,7 +138842,7 @@ function mount12(ctx) {
138764
138842
  // src/server/routes/fleet.ts
138765
138843
  import { readdirSync as readdirSync10, readFileSync as readFileSync18 } from "fs";
138766
138844
  import { homedir as homedir8 } from "os";
138767
- import { basename as basename6, join as join26 } from "path";
138845
+ import { basename as basename7, join as join26 } from "path";
138768
138846
  var isNum3 = (v) => typeof v === "number" && Number.isFinite(v);
138769
138847
  var isObj6 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
138770
138848
  var registryFile = () => join26(process.env.HOME ?? homedir8(), ".loki", "dashboard", "projects.json");
@@ -138845,7 +138923,7 @@ function fleetRuns(includeInactive = true, file = registryFile()) {
138845
138923
  }
138846
138924
  return {
138847
138925
  id: p.id ?? null,
138848
- name: p.name || (path ? basename6(path) : "project"),
138926
+ name: p.name || (path ? basename7(path) : "project"),
138849
138927
  path,
138850
138928
  status,
138851
138929
  running,
@@ -138881,7 +138959,7 @@ function mount13(ctx) {
138881
138959
  }
138882
138960
 
138883
138961
  // src/server/routes/memory.ts
138884
- import { existsSync as existsSync13, readFileSync as readFileSync19, readdirSync as readdirSync11, realpathSync as realpathSync12, statSync as statSync11 } from "fs";
138962
+ import { existsSync as existsSync13, readFileSync as readFileSync19, readdirSync as readdirSync11, realpathSync as realpathSync12, statSync as statSync12 } from "fs";
138885
138963
  import { join as join27, sep as sep9 } from "path";
138886
138964
  var isObj7 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
138887
138965
  var nonEmpty = (v) => !(v === undefined || v === null || v === "" || Array.isArray(v) && v.length === 0 || isObj7(v) && Object.keys(v).length === 0);
@@ -138935,12 +139013,12 @@ function setFocus(repoDir, raw2, registry = registryFile()) {
138935
139013
  let real3 = "";
138936
139014
  try {
138937
139015
  real3 = realpathSync12(s);
138938
- if (!statSync11(real3).isDirectory())
139016
+ if (!statSync12(real3).isDirectory())
138939
139017
  throw new Error("not a dir");
138940
139018
  } catch {
138941
139019
  return { ok: false, error: `Directory does not exist: ${s}` };
138942
139020
  }
138943
- if (!existsSync13(join27(real3, ".loki")) || !statSync11(join27(real3, ".loki")).isDirectory())
139021
+ if (!existsSync13(join27(real3, ".loki")) || !statSync12(join27(real3, ".loki")).isDirectory())
138944
139022
  return { ok: false, error: `Directory does not contain a .loki/ subdirectory: ${s}` };
138945
139023
  const allowed = new Set;
138946
139024
  try {
@@ -139159,7 +139237,7 @@ function mount14(ctx) {
139159
139237
  }
139160
139238
 
139161
139239
  // src/server/routes/metrics.ts
139162
- import { readdirSync as readdirSync12, readFileSync as readFileSync20, statSync as statSync12 } from "fs";
139240
+ import { readdirSync as readdirSync12, readFileSync as readFileSync20, statSync as statSync13 } from "fs";
139163
139241
  import { join as join28 } from "path";
139164
139242
  var isObj8 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
139165
139243
  var arr = (v) => Array.isArray(v) ? v : [];
@@ -139233,7 +139311,7 @@ function buildMetricsText(repoDir, now2 = Date.now()) {
139233
139311
  } catch {}
139234
139312
  for (const e of entries) {
139235
139313
  try {
139236
- if (!statSync12(join28(pdir, e)).isDirectory())
139314
+ if (!statSync13(join28(pdir, e)).isDirectory())
139237
139315
  continue;
139238
139316
  } catch {
139239
139317
  continue;
@@ -139485,7 +139563,7 @@ function mount16(ctx) {
139485
139563
 
139486
139564
  // src/server/routes/integrations.ts
139487
139565
  import { spawn as spawn4 } from "child_process";
139488
- import { existsSync as existsSync15, readFileSync as readFileSync22, statSync as statSync13 } from "fs";
139566
+ import { existsSync as existsSync15, readFileSync as readFileSync22, statSync as statSync14 } from "fs";
139489
139567
  import { delimiter, join as join30 } from "path";
139490
139568
  var GH_TIMEOUT_MS = 3000;
139491
139569
  var isSet = (n3) => !!n3 && (process.env[n3] ?? "") !== "";
@@ -139493,21 +139571,21 @@ function ghAuthed(pathVar = process.env.PATH ?? "", timeoutMs = GH_TIMEOUT_MS) {
139493
139571
  const exe = pathVar.split(delimiter).filter(Boolean).map((d) => join30(d, "gh")).find((p) => existsSync15(p));
139494
139572
  if (!exe)
139495
139573
  return Promise.resolve(null);
139496
- return new Promise((resolve8) => {
139574
+ return new Promise((resolve9) => {
139497
139575
  let done = false;
139498
139576
  let timer;
139499
139577
  const finish2 = (v) => {
139500
139578
  if (!done) {
139501
139579
  done = true;
139502
139580
  clearTimeout(timer);
139503
- resolve8(v);
139581
+ resolve9(v);
139504
139582
  }
139505
139583
  };
139506
139584
  let child;
139507
139585
  try {
139508
139586
  child = spawn4(exe, ["auth", "status"], { stdio: "ignore", env: { ...process.env, NO_COLOR: "1" } });
139509
139587
  } catch {
139510
- return resolve8(null);
139588
+ return resolve9(null);
139511
139589
  }
139512
139590
  timer = setTimeout(() => {
139513
139591
  try {
@@ -139522,7 +139600,7 @@ function ghAuthed(pathVar = process.env.PATH ?? "", timeoutMs = GH_TIMEOUT_MS) {
139522
139600
  function configuredName(repoDir, path) {
139523
139601
  try {
139524
139602
  const r = resolveConfigFile(repoDir);
139525
- if (!r.ok || !r.exists || statSync13(r.file).size > 1e6)
139603
+ if (!r.ok || !r.exists || statSync14(r.file).size > 1e6)
139526
139604
  return null;
139527
139605
  const doc = $parseDocument(readFileSync22(r.file, "utf8"));
139528
139606
  if (doc.errors.length)
@@ -139536,7 +139614,7 @@ function configuredName(repoDir, path) {
139536
139614
  function mcpServers(repoDir) {
139537
139615
  try {
139538
139616
  const p = join30(repoDir, ".mcp.json");
139539
- if (!existsSync15(p) || statSync13(p).size > 1e6)
139617
+ if (!existsSync15(p) || statSync14(p).size > 1e6)
139540
139618
  return null;
139541
139619
  const j = JSON.parse(readFileSync22(p, "utf8"));
139542
139620
  return j.mcpServers && typeof j.mcpServers === "object" ? Object.keys(j.mcpServers).length : null;
@@ -139617,7 +139695,7 @@ function mount17(ctx) {
139617
139695
  // src/server/routes/merge_risk.ts
139618
139696
  import { spawn as spawn5 } from "child_process";
139619
139697
  import { realpathSync as realpathSync13 } from "fs";
139620
- import { basename as basename7, resolve as resolve8 } from "path";
139698
+ import { basename as basename8, resolve as resolve9 } from "path";
139621
139699
  var PR = /^[0-9]{1,7}$/;
139622
139700
  var REF = /^[A-Za-z0-9._/][A-Za-z0-9._/-]{0,99}$/;
139623
139701
  var MAX_OUT2 = 256 * 1024;
@@ -139729,12 +139807,12 @@ function mount18(ctx) {
139729
139807
  for (const k of [ctx.repoDir, ...registryRepos2()]) {
139730
139808
  const r = real3(k);
139731
139809
  if (r)
139732
- known.set(r, basename7(resolve8(k)));
139810
+ known.set(r, basename8(resolve9(k)));
139733
139811
  }
139734
139812
  const wantReal = real3(want);
139735
139813
  if (wantReal && known.has(wantReal))
139736
139814
  return wantReal;
139737
- const named = [...known].filter(([r, label2]) => label2 === want || basename7(r) === want).map(([r]) => r);
139815
+ const named = [...known].filter(([r, label2]) => label2 === want || basename8(r) === want).map(([r]) => r);
139738
139816
  return named.length === 1 ? named[0] : null;
139739
139817
  };
139740
139818
  const slot = async (c, kind, auditKind, fn) => {
@@ -139949,7 +140027,7 @@ function probeCli(bin, timeoutMs, pathVar = process.env.PATH ?? "") {
139949
140027
  const exe = findOnPath(bin, pathVar);
139950
140028
  if (!exe)
139951
140029
  return Promise.resolve({ installed: false, version: null, probe: "not_found" });
139952
- return new Promise((resolve9) => {
140030
+ return new Promise((resolve10) => {
139953
140031
  let out2 = "";
139954
140032
  let done = false;
139955
140033
  let timer;
@@ -139957,14 +140035,14 @@ function probeCli(bin, timeoutMs, pathVar = process.env.PATH ?? "") {
139957
140035
  if (!done) {
139958
140036
  done = true;
139959
140037
  clearTimeout(timer);
139960
- resolve9(r);
140038
+ resolve10(r);
139961
140039
  }
139962
140040
  };
139963
140041
  let child;
139964
140042
  try {
139965
140043
  child = spawn6(exe, ["--version"], { stdio: ["ignore", "pipe", "ignore"], env: { ...process.env, NO_COLOR: "1" } });
139966
140044
  } catch {
139967
- return resolve9({ installed: true, version: null, probe: "error" });
140045
+ return resolve10({ installed: true, version: null, probe: "error" });
139968
140046
  }
139969
140047
  timer = setTimeout(() => {
139970
140048
  try {
@@ -140120,9 +140198,9 @@ function mount21(ctx) {
140120
140198
  }
140121
140199
 
140122
140200
  // src/server/routes/workspace.ts
140123
- import { existsSync as existsSync123, mkdirSync as mkdirSync93, readFileSync as readFileSync158, readdirSync as readdirSync60, renameSync as renameSync31, statSync as statSync54, writeFileSync as writeFileSync92 } from "fs";
140201
+ import { existsSync as existsSync123, mkdirSync as mkdirSync93, readFileSync as readFileSync158, readdirSync as readdirSync60, renameSync as renameSync31, statSync as statSync55, writeFileSync as writeFileSync92 } from "fs";
140124
140202
  import { homedir as homedir18, userInfo } from "os";
140125
- import { dirname as dirname77, join as join173, resolve as resolve46, sep as sep30 } from "path";
140203
+ import { dirname as dirname77, join as join173, resolve as resolve47, sep as sep30 } from "path";
140126
140204
  var ID7 = /^[a-z0-9][a-z0-9-]{0,39}$/;
140127
140205
  var MAX_BYTES3 = 200000;
140128
140206
  var workspaceFile = (env2 = process.env) => env2["LOKI_WORKSPACE_FILE"] || join173(homedir18(), ".loki", "control", "workspace.json");
@@ -140192,7 +140270,7 @@ function repoDirsOf(db2, name) {
140192
140270
  const rows = db2.select({ name: localRepos.name, realpath: localRepos.realpath }).from(localRepos).all().filter((r) => r.name === name);
140193
140271
  return [...new Set(rows.map((r) => r.realpath))].filter((d) => {
140194
140272
  try {
140195
- return statSync54(d).isDirectory();
140273
+ return statSync55(d).isDirectory();
140196
140274
  } catch {
140197
140275
  return false;
140198
140276
  }
@@ -140203,7 +140281,7 @@ var INSTRUCTION_FILES = ["CLAUDE.md", "CLAUDE.local.md", ".claude/CLAUDE.md", "A
140203
140281
  var NOTE_DIRS = [".loki/memory", ".loki/learnings", ".claude/rules"];
140204
140282
  var readCapped3 = (p) => {
140205
140283
  try {
140206
- const st2 = statSync54(p);
140284
+ const st2 = statSync55(p);
140207
140285
  if (!st2.isFile())
140208
140286
  return null;
140209
140287
  const b = readFileSync158(p);
@@ -140234,7 +140312,7 @@ function repoKnowledge(dir) {
140234
140312
  return { instructions, notes };
140235
140313
  }
140236
140314
  function writeInstructions(dir, content) {
140237
- const root = resolve46(dir), target = join173(root, "CLAUDE.md");
140315
+ const root = resolve47(dir), target = join173(root, "CLAUDE.md");
140238
140316
  if (!target.startsWith(root + sep30))
140239
140317
  throw new Error("path outside the repository");
140240
140318
  const tmp = `${target}.${process.pid}.tmp`;
@@ -141046,9 +141124,9 @@ function createApp(opts) {
141046
141124
  }
141047
141125
  if (!uiDir || p.startsWith("/v1/"))
141048
141126
  return c.json({ error: "not found" }, 404);
141049
- const root = resolve47(uiDir);
141050
- const f = resolve47(root, `.${p}`);
141051
- if (f.startsWith(root + sep31) && existsSync125(f) && statSync55(f).isFile())
141127
+ const root = resolve48(uiDir);
141128
+ const f = resolve48(root, `.${p}`);
141129
+ if (f.startsWith(root + sep31) && existsSync125(f) && statSync56(f).isFile())
141052
141130
  return new Response(Bun.file(f));
141053
141131
  if (/\.[a-z0-9]+$/i.test(p))
141054
141132
  return c.json({ error: "not found" }, 404);