loki-mode 11.17.49 → 11.17.50

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 (70) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/autonomy/lib/secure-scan.py +85 -5
  4. package/dashboard/__init__.py +1 -1
  5. package/docs/CLI-REFERENCE.md +1 -1
  6. package/docs/INSTALLATION.md +1 -1
  7. package/docs/v10/BOARD.md +30 -0
  8. package/docs/v10/PROGRESS.md +3 -0
  9. package/loki-ts/dist/loki.js +1169 -1153
  10. package/mcp/__init__.py +1 -1
  11. package/package.json +2 -2
  12. package/packages/control-plane/dist/server.js +133 -98
  13. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  14. package/web-app/dist/assets/{AdminPage-s0UfQ54A.js → AdminPage-BhNiznHb.js} +1 -1
  15. package/web-app/dist/assets/{Avatar-C65GqVWB.js → Avatar-Csup5Xis.js} +1 -1
  16. package/web-app/dist/assets/{Badge-Bx6KyeF8.js → Badge-CrJlENJK.js} +1 -1
  17. package/web-app/dist/assets/{Button-Gp5vTh3P.js → Button-BcUzAbPq.js} +1 -1
  18. package/web-app/dist/assets/{CockpitPage-BknRMDid.js → CockpitPage-Dc4SLjQq.js} +1 -1
  19. package/web-app/dist/assets/{ComparePage-c-mU2XHA.js → ComparePage-DajYEz-c.js} +1 -1
  20. package/web-app/dist/assets/{ErrorBoundary-ngcvdCD8.js → ErrorBoundary-CoeNvDkV.js} +1 -1
  21. package/web-app/dist/assets/{EvidenceReceiptPanel-fKH6e1EW.js → EvidenceReceiptPanel-BEmldZp_.js} +1 -1
  22. package/web-app/dist/assets/{GitHubIssuesPanel-BpZ2v9n0.js → GitHubIssuesPanel-gzpcyB_N.js} +1 -1
  23. package/web-app/dist/assets/{GitHubPRsPanel-C6D5PLlR.js → GitHubPRsPanel-BB3neVc4.js} +1 -1
  24. package/web-app/dist/assets/{HomePage-BykPt2x_.js → HomePage-BtRPqIs7.js} +2 -2
  25. package/web-app/dist/assets/{LoginPage-CXNSVFwK.js → LoginPage-DKfATAQU.js} +1 -1
  26. package/web-app/dist/assets/{MagicPage-BPm8lvGR.js → MagicPage-Hxf7qR0V.js} +1 -1
  27. package/web-app/dist/assets/{MetricsPage-B-Zue4zV.js → MetricsPage-drWeqaBS.js} +1 -1
  28. package/web-app/dist/assets/{NotFoundPage-CfbRFDzs.js → NotFoundPage-CMNdP6dn.js} +1 -1
  29. package/web-app/dist/assets/{ProjectPage-BJJ5ilR5.js → ProjectPage-g8S3u0FA.js} +3 -3
  30. package/web-app/dist/assets/{ProjectsPage-BihWTnjx.js → ProjectsPage-7pjoEM-2.js} +1 -1
  31. package/web-app/dist/assets/{SettingsPage-DEVFSLVd.js → SettingsPage-Gioai1wL.js} +1 -1
  32. package/web-app/dist/assets/{ShowcasePage-BBkoZFps.js → ShowcasePage-C_cqkLEK.js} +1 -1
  33. package/web-app/dist/assets/{SystemSettingsPage-CzOE74Q7.js → SystemSettingsPage--8scO38M.js} +1 -1
  34. package/web-app/dist/assets/{TeamsPage-BdPX6dgE.js → TeamsPage-CSocxhvI.js} +1 -1
  35. package/web-app/dist/assets/{TemplatesPage-C8mVITpx.js → TemplatesPage-6kiVLPXw.js} +1 -1
  36. package/web-app/dist/assets/{TerminalOutput-Bc00RcJc.js → TerminalOutput-CV5d24Hw.js} +1 -1
  37. package/web-app/dist/assets/{activity-CDLuOW9_.js → activity-CSEyJdZS.js} +1 -1
  38. package/web-app/dist/assets/{bell-025wj1sV.js → bell-C5f3HdA2.js} +1 -1
  39. package/web-app/dist/assets/{bot-DWh-OnmY.js → bot-BoKFKEio.js} +1 -1
  40. package/web-app/dist/assets/{check-l7LspX4l.js → check-fy_vQdzI.js} +1 -1
  41. package/web-app/dist/assets/{chevron-left-DKO1-YmL.js → chevron-left-DAHyUzlO.js} +1 -1
  42. package/web-app/dist/assets/{circle-alert-BfV2uDVQ.js → circle-alert-CWntk0QY.js} +1 -1
  43. package/web-app/dist/assets/{clock-CCakP4hk.js → clock-fxsQrb2m.js} +1 -1
  44. package/web-app/dist/assets/{cloud-CaMXUXfG.js → cloud-CUnU_iub.js} +1 -1
  45. package/web-app/dist/assets/{code-xml-DUvRZwB9.js → code-xml-BrR_m5VJ.js} +1 -1
  46. package/web-app/dist/assets/{database-BHuS_k85.js → database-B3pH1GWy.js} +1 -1
  47. package/web-app/dist/assets/{dollar-sign-BhXGrkPP.js → dollar-sign-BPS3sHEe.js} +1 -1
  48. package/web-app/dist/assets/{file-code-corner-A7mPiq0J.js → file-code-corner-CH5E3IOJ.js} +1 -1
  49. package/web-app/dist/assets/{file-plus-CGbNX6r_.js → file-plus-BwSa2lT9.js} +1 -1
  50. package/web-app/dist/assets/{globe-bPOnAxns.js → globe-DRP1ZAtM.js} +1 -1
  51. package/web-app/dist/assets/{hammer-BJg7R73E.js → hammer-84LLqM3v.js} +1 -1
  52. package/web-app/dist/assets/{index-DXT0GsX7.js → index-CYK0QWKn.js} +3 -3
  53. package/web-app/dist/assets/{layers-CTHygTS7.js → layers-BRqTAzOW.js} +1 -1
  54. package/web-app/dist/assets/{loader-circle-DKdXgG0q.js → loader-circle-DjKTXDpv.js} +1 -1
  55. package/web-app/dist/assets/{lock-053N_MGE.js → lock-Ch8pzNIT.js} +1 -1
  56. package/web-app/dist/assets/{package-SA20Nj5k.js → package-CHytm1m3.js} +1 -1
  57. package/web-app/dist/assets/{plus-D6Ay8g2_.js → plus-g2VVODXn.js} +1 -1
  58. package/web-app/dist/assets/{refresh-cw-BWJ5g4al.js → refresh-cw-Dl2yLInA.js} +1 -1
  59. package/web-app/dist/assets/{rotate-ccw-FpwQ4jBk.js → rotate-ccw-JovbcpUY.js} +1 -1
  60. package/web-app/dist/assets/{scroll-text-BfSXM3oJ.js → scroll-text-0fYxnG92.js} +1 -1
  61. package/web-app/dist/assets/{server-CWiRm4Ss.js → server-C0YVb_id.js} +1 -1
  62. package/web-app/dist/assets/{shield-alert-nFmFAjOa.js → shield-alert-D67z-PtO.js} +1 -1
  63. package/web-app/dist/assets/{thumbs-up-DRcA4ke1.js → thumbs-up-Dj7s0IEe.js} +1 -1
  64. package/web-app/dist/assets/{trash-2-ClXTj6YH.js → trash-2-Cj3lkZd7.js} +1 -1
  65. package/web-app/dist/assets/{trending-down-Dd_CU85r.js → trending-down-CkTpkspK.js} +1 -1
  66. package/web-app/dist/assets/{trending-up-Csbq5ve6.js → trending-up-DkoyagyG.js} +1 -1
  67. package/web-app/dist/assets/{upload-D2aKAKqW.js → upload-ByCFajVt.js} +1 -1
  68. package/web-app/dist/assets/{usePolling-Cn5Z9_7V.js → usePolling-DMiMMinA.js} +1 -1
  69. package/web-app/dist/assets/{user-Bt-F2IL3.js → user-D39KFCla.js} +1 -1
  70. package/web-app/dist/index.html +1 -1
@@ -160,6 +160,11 @@ var init_redact = __esm(() => {
160
160
  [/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g, "[REDACTED:JWT]"],
161
161
  [/\bSG\.[A-Za-z0-9_-]{16,}\.[A-Za-z0-9_-]{16,}/g, "[REDACTED:SENDGRID_KEY]"],
162
162
  [/\bSK[0-9a-f]{32}\b/g, "[REDACTED:TWILIO_KEY]"],
163
+ [/\bpypi-AgEI[A-Za-z0-9_-]{50,}/g, "[REDACTED:PYPI_TOKEN]"],
164
+ [/\bshp(?:at|ca|pa|ss)_[a-f0-9]{32}\b/g, "[REDACTED:SHOPIFY_TOKEN]"],
165
+ [/\bPMAK-[a-f0-9]{24}-[a-f0-9]{34}\b/g, "[REDACTED:POSTMAN_KEY]"],
166
+ [/\bdapi[a-f0-9]{32}(?:-\d)?\b/g, "[REDACTED:DATABRICKS_TOKEN]"],
167
+ [/\bkey-[a-f0-9]{32}\b/g, "[REDACTED:MAILGUN_KEY]"],
163
168
  [/\bdckr_pat_[A-Za-z0-9_-]{20,}/g, "[REDACTED:DOCKER_TOKEN]"],
164
169
  [/\bdop_v1_[a-f0-9]{64}\b/g, "[REDACTED:DIGITALOCEAN_TOKEN]"],
165
170
  [/\bya29\.[A-Za-z0-9_-]{20,}/g, "[REDACTED:GOOGLE_OAUTH_TOKEN]"],
@@ -7615,8 +7620,8 @@ var init_paths = __esm(() => {
7615
7620
 
7616
7621
  // ../../loki-ts/src/engine10/cache.ts
7617
7622
  import { createHash as createHash6 } from "crypto";
7618
- import { existsSync as existsSync15, mkdirSync as mkdirSync5, readFileSync as readFileSync18, writeFileSync as writeFileSync8 } from "fs";
7619
- import { resolve as resolve8 } from "path";
7623
+ import { existsSync as existsSync15, mkdirSync as mkdirSync5, readdirSync as readdirSync9, readFileSync as readFileSync18, statSync as statSync12, unlinkSync as unlinkSync3, writeFileSync as writeFileSync8 } from "fs";
7624
+ import { basename as basename8, resolve as resolve8 } from "path";
7620
7625
  function repoKey(originUrl, repoDir) {
7621
7626
  const basis = originUrl && originUrl.trim() !== "" ? originUrl : resolve8(repoDir);
7622
7627
  return createHash6("sha256").update(basis).digest("hex");
@@ -7799,12 +7804,12 @@ var init_price_table = __esm(() => {
7799
7804
  });
7800
7805
 
7801
7806
  // ../../loki-ts/src/providers/provider_cost.ts
7802
- import { existsSync as existsSync16, mkdirSync as mkdirSync6, readdirSync as readdirSync9, readFileSync as readFileSync20, renameSync as renameSync4, writeFileSync as writeFileSync9 } from "fs";
7807
+ import { existsSync as existsSync16, mkdirSync as mkdirSync6, readdirSync as readdirSync10, readFileSync as readFileSync20, renameSync as renameSync4, writeFileSync as writeFileSync9 } from "fs";
7803
7808
  import { dirname as dirname7, join as join27 } from "path";
7804
7809
  function withArchivedCosts(lokiRoot, ids, keep = () => true) {
7805
7810
  let files = [];
7806
7811
  try {
7807
- files = readdirSync9(join27(lokiRoot, "metrics"));
7812
+ files = readdirSync10(join27(lokiRoot, "metrics"));
7808
7813
  } catch {}
7809
7814
  return [...new Set([...ids, ...ids.flatMap((id) => files.filter((f) => f.startsWith(`result-cost-${id}-q`) && f.endsWith(".json")).map((f) => f.slice("result-cost-".length, -".json".length)).filter(keep))])];
7810
7815
  }
@@ -7869,7 +7874,7 @@ function routerMode(env = process.env) {
7869
7874
  var routerEnabled = (env = process.env) => routerMode(env) === "on";
7870
7875
 
7871
7876
  // ../../loki-ts/src/engine10/cost.ts
7872
- import { readdirSync as readdirSync10, readFileSync as readFileSync21 } from "fs";
7877
+ import { readdirSync as readdirSync11, readFileSync as readFileSync21 } from "fs";
7873
7878
  import { join as join28 } from "path";
7874
7879
  function routerTelemetryOn(env = process.env) {
7875
7880
  return routerEnabled(env);
@@ -8030,8 +8035,8 @@ import {
8030
8035
  readSync as readSync4,
8031
8036
  renameSync as renameSync5,
8032
8037
  rmSync as rmSync5,
8033
- statSync as statSync12,
8034
- unlinkSync as unlinkSync3,
8038
+ statSync as statSync13,
8039
+ unlinkSync as unlinkSync4,
8035
8040
  writeFileSync as writeFileSync11,
8036
8041
  writeSync as writeSync3
8037
8042
  } from "fs";
@@ -8069,13 +8074,23 @@ function atomicWriteJson(target, data) {
8069
8074
  function tmpPathFor(target) {
8070
8075
  return `${target}.tmp.${process.pid}.${++_tmpCounter}`;
8071
8076
  }
8077
+ function atomicWriteText(target, body, opts = {}) {
8078
+ if (opts.durable === false) {
8079
+ mkdirSync8(dirname8(target), { recursive: true });
8080
+ const tmp = tmpPathFor(target);
8081
+ writeFileSync11(tmp, body);
8082
+ renameSync5(tmp, target);
8083
+ return;
8084
+ }
8085
+ durableWriteThenRename(target, body);
8086
+ }
8072
8087
  var _tmpCounter = 0, _appendChains;
8073
8088
  var init_atomic = __esm(() => {
8074
8089
  _appendChains = new Map;
8075
8090
  });
8076
8091
 
8077
8092
  // ../../loki-ts/src/runner/budget.ts
8078
- import { existsSync as existsSync17, mkdirSync as mkdirSync9, readdirSync as readdirSync11, readFileSync as readFileSync22, writeFileSync as writeFileSync12 } from "fs";
8093
+ import { existsSync as existsSync17, mkdirSync as mkdirSync9, readdirSync as readdirSync12, readFileSync as readFileSync22, writeFileSync as writeFileSync12 } from "fs";
8079
8094
  import { dirname as dirname9, join as join29, resolve as resolve10 } from "path";
8080
8095
  import { fileURLToPath as fileURLToPath2 } from "url";
8081
8096
  function loadDefaultMaxCostUsd(dataDirs = [["..", "..", "data"], ["..", "data"]]) {
@@ -8234,7 +8249,7 @@ var init_types = __esm(() => {
8234
8249
  var init_decision = () => {};
8235
8250
 
8236
8251
  // ../../loki-ts/src/project_model/schema.ts
8237
- import { existsSync as existsSync18, lstatSync as lstatSync6, realpathSync as realpathSync14, statSync as statSync13 } from "fs";
8252
+ import { existsSync as existsSync18, lstatSync as lstatSync6, realpathSync as realpathSync14, statSync as statSync14 } from "fs";
8238
8253
  import { isAbsolute, join as join30, normalize, sep as sep9 } from "path";
8239
8254
  function safeRel(p) {
8240
8255
  const n2 = normalize(p.trim()).split(sep9).join("/").replace(/\/$/, "");
@@ -8258,7 +8273,7 @@ function checkCitation(repoDir, raw2) {
8258
8273
  if (rel === null)
8259
8274
  return `citation "${raw2}" is not a repo-relative path`;
8260
8275
  const abs = join30(repoDir, rel);
8261
- if (!existsSync18(abs) || !statSync13(abs).isFile() || !insideRepo(repoDir, rel))
8276
+ if (!existsSync18(abs) || !statSync14(abs).isFile() || !insideRepo(repoDir, rel))
8262
8277
  return `citation "${raw2}" names a file that does not exist`;
8263
8278
  return null;
8264
8279
  }
@@ -8298,7 +8313,7 @@ function checkDir(repoDir, v, where, errs) {
8298
8313
  return ".";
8299
8314
  }
8300
8315
  const abs = join30(repoDir, rel);
8301
- if (!existsSync18(abs) || !statSync13(abs).isDirectory() || !insideRepo(repoDir, rel))
8316
+ if (!existsSync18(abs) || !statSync14(abs).isDirectory() || !insideRepo(repoDir, rel))
8302
8317
  errs.push(`${where}: directory "${rel}" does not exist`);
8303
8318
  return rel;
8304
8319
  }
@@ -8657,9 +8672,9 @@ var init_model_rank = __esm(() => {
8657
8672
 
8658
8673
  // ../../loki-ts/src/engine10/sizing.ts
8659
8674
  import { existsSync as existsSync20, readFileSync as readFileSync25 } from "fs";
8660
- import { basename as basename8 } from "path";
8675
+ import { basename as basename9 } from "path";
8661
8676
  function namedFiles(task, map) {
8662
- return (map?.files ?? []).filter((f) => task.toLowerCase().includes(basename8(f).toLowerCase()));
8677
+ return (map?.files ?? []).filter((f) => task.toLowerCase().includes(basename9(f).toLowerCase()));
8663
8678
  }
8664
8679
  function sizeTask(task, map, tests) {
8665
8680
  const named = namedFiles(task, map).length;
@@ -8696,9 +8711,27 @@ function hasRelevantTests(task, map, tests, impacted) {
8696
8711
  likely.push(...speedLikelyFiles(task, map));
8697
8712
  return likely.length > 0 && impacted(tests, likely).length > 0;
8698
8713
  }
8699
- var LARGE_NAMED_FILES = 8, smallMaxChars = (env = process.env) => Number(env.LOKI_E10_SMALL_MAX_CHARS) > 0 ? Number(env.LOKI_E10_SMALL_MAX_CHARS) : 600, smallTaskPath = (size, relevantTests) => size === "small" && relevantTests ? "lean" : "wall", knob = (v, words) => words.includes((v ?? "").toLowerCase()), planMode = (env = process.env) => knob(env.LOKI_E10_PLAN, ["0", "off", "never", "false"]) ? "never" : knob(env.LOKI_E10_PLAN, ["1", "on", "always", "true"]) ? "always" : "auto", wallEnabled = (env = process.env) => !knob(env.LOKI_E10_WALL, ["0", "off", "false"]), wallLimitS = (size, env = process.env) => {
8700
- const n2 = Number(env.LOKI_E10_WALL_LIMIT_S);
8701
- return Number.isFinite(n2) && n2 > 0 ? Math.min(300, n2) : size === "small" ? 90 : 180;
8714
+ var LARGE_NAMED_FILES = 8, noted, noteOnce = (name, raw2, why) => {
8715
+ if (raw2 === undefined || !raw2.trim() || noted.has(name + raw2))
8716
+ return;
8717
+ noted.add(name + raw2);
8718
+ process.stderr.write(`loki: ${name}="${raw2}" ${why}
8719
+ `);
8720
+ }, smallMaxChars = (env = process.env) => {
8721
+ const n2 = Number(env.LOKI_E10_SMALL_MAX_CHARS);
8722
+ if (n2 > 0)
8723
+ return n2;
8724
+ noteOnce("LOKI_E10_SMALL_MAX_CHARS", env.LOKI_E10_SMALL_MAX_CHARS, "is not a positive number; using 600");
8725
+ return 600;
8726
+ }, smallTaskPath = (size, relevantTests) => size === "small" && relevantTests ? "lean" : "wall", knob = (v, words) => words.includes((v ?? "").toLowerCase()), planMode = (env = process.env) => knob(env.LOKI_E10_PLAN, ["0", "off", "never", "false"]) ? "never" : knob(env.LOKI_E10_PLAN, ["1", "on", "always", "true"]) ? "always" : "auto", wallEnabled = (env = process.env) => !knob(env.LOKI_E10_WALL, ["0", "off", "false"]), wallLimitS = (size, env = process.env) => {
8727
+ const raw2 = env.LOKI_E10_WALL_LIMIT_S, n2 = Number(raw2), dflt = size === "small" ? 90 : 180;
8728
+ if (Number.isFinite(n2) && n2 > 0) {
8729
+ if (n2 > 300)
8730
+ noteOnce("LOKI_E10_WALL_LIMIT_S", raw2, "exceeds the 300s maximum; using 300");
8731
+ return Math.min(300, n2);
8732
+ }
8733
+ noteOnce("LOKI_E10_WALL_LIMIT_S", raw2, `is not a positive number; using ${dflt}`);
8734
+ return dflt;
8702
8735
  }, resolveModelAlias, wallModel = (env = process.env) => resolveModelAlias(env.LOKI_E10_WALL_TIER || "sonnet"), wallFirstModel = (size, env = process.env) => {
8703
8736
  if (knob(env.LOKI_E10_WALL_FIRST, ["0", "off", "false"]) || env.LOKI_E10_WALL_TIER || env.LOKI_MODEL_OVERRIDE || env.LOKI_E10_WALL_CONCURRENT === "1")
8704
8737
  return wallModel(env);
@@ -8709,6 +8742,7 @@ var init_sizing = __esm(() => {
8709
8742
  init_lean_select();
8710
8743
  init_claude_model();
8711
8744
  init_model_rank();
8745
+ noted = new Set;
8712
8746
  resolveModelAlias = resolveClaudeModel;
8713
8747
  });
8714
8748
 
@@ -8870,9 +8904,9 @@ var init_scope = __esm(() => {
8870
8904
  });
8871
8905
 
8872
8906
  // ../../loki-ts/src/util/test_file_text.ts
8873
- import { basename as basename9 } from "path";
8907
+ import { basename as basename10 } from "path";
8874
8908
  function isTestFile(rel) {
8875
- const name = basename9(rel);
8909
+ const name = basename10(rel);
8876
8910
  return JS_TEST_RE.test(name) || PY_TEST_RE.test(name) || GO_TEST_RE.test(name);
8877
8911
  }
8878
8912
  var JS_TEST_RE, PY_TEST_RE, GO_TEST_RE;
@@ -8883,8 +8917,8 @@ var init_test_file_text = __esm(() => {
8883
8917
  });
8884
8918
 
8885
8919
  // ../../loki-ts/src/engine10/testmap.ts
8886
- import { existsSync as existsSync22, lstatSync as lstatSync8, readdirSync as readdirSync12, readFileSync as readFileSync27, realpathSync as realpathSync15 } from "fs";
8887
- import { basename as basename10, extname, isAbsolute as isAbsolute2, join as join36, relative, sep as sep10 } from "path";
8920
+ import { existsSync as existsSync22, lstatSync as lstatSync8, readdirSync as readdirSync13, readFileSync as readFileSync27, realpathSync as realpathSync15 } from "fs";
8921
+ import { basename as basename11, extname, isAbsolute as isAbsolute2, join as join36, relative, sep as sep10 } from "path";
8888
8922
  function projectInterpreter(root) {
8889
8923
  const ve = process.env["VIRTUAL_ENV"], inRepo = (p) => {
8890
8924
  try {
@@ -8921,7 +8955,7 @@ var init_testmap = __esm(() => {
8921
8955
 
8922
8956
  // ../../loki-ts/src/util/check_result.ts
8923
8957
  import { existsSync as existsSync23, mkdirSync as mkdirSync12, readFileSync as readFileSync28, realpathSync as realpathSync16, renameSync as renameSync7, writeFileSync as writeFileSync15 } from "fs";
8924
- import { basename as basename11, isAbsolute as isAbsolute3, join as join37 } from "path";
8958
+ import { basename as basename12, isAbsolute as isAbsolute3, join as join37 } from "path";
8925
8959
  function plainTestEnv(base = process.env) {
8926
8960
  const e = {};
8927
8961
  for (const [k, v] of Object.entries(tokenFreeEnv(base)))
@@ -8939,7 +8973,7 @@ function ran(raw2, path, ok) {
8939
8973
  if (blk) {
8940
8974
  const c = n2(blk, /(?:#|\u2139) pass (\d+)/) + n2(blk, /(?:#|\u2139) fail (\d+)/);
8941
8975
  const nm = out2.match(/^(?:ok \d+ - |\u2714 )(\S+\.[cm]?[jt]s)(?: \(|$)/m)?.[1];
8942
- return c === 1 && nm && (!path || basename11(nm) === basename11(path)) ? 0 : c;
8976
+ return c === 1 && nm && (!path || basename12(nm) === basename12(path)) ? 0 : c;
8943
8977
  }
8944
8978
  const cg = cargoTrailer(out2);
8945
8979
  if (cg.length)
@@ -9030,16 +9064,16 @@ function goRunner(cmd, args) {
9030
9064
  let k = 0;
9031
9065
  for (;k < t.length; k++) {
9032
9066
  const x = t[k];
9033
- if (/^[A-Za-z_]\w*=/.test(x) || /^(?:env|command|exec|time|nohup)$/.test(basename11(x)))
9067
+ if (/^[A-Za-z_]\w*=/.test(x) || /^(?:env|command|exec|time|nohup)$/.test(basename12(x)))
9034
9068
  continue;
9035
- if (/^-/.test(x) && k > 0 && basename11(t[k - 1]) === "env") {
9069
+ if (/^-/.test(x) && k > 0 && basename12(t[k - 1]) === "env") {
9036
9070
  if (x === "-u" || x === "-C" || x === "-S")
9037
9071
  k++;
9038
9072
  continue;
9039
9073
  }
9040
9074
  break;
9041
9075
  }
9042
- if (t[k] !== undefined && basename11(t[k]) === "go")
9076
+ if (t[k] !== undefined && basename12(t[k]) === "go")
9043
9077
  return { runner: "go" };
9044
9078
  }
9045
9079
  return {};
@@ -9471,7 +9505,7 @@ var init_check_result = __esm(() => {
9471
9505
 
9472
9506
  // ../../loki-ts/src/util/receipt_signer.ts
9473
9507
  import { createHash as createHash8, randomBytes as randomBytes3, createPrivateKey, createPublicKey as createPublicKey2, generateKeyPairSync, sign, verify as verify2 } from "crypto";
9474
- import { chmodSync as chmodSync4, linkSync, mkdirSync as mkdirSync13, readdirSync as readdirSync13, readFileSync as readFileSync29, renameSync as renameSync8, statSync as statSync14, unlinkSync as unlinkSync4, writeFileSync as writeFileSync16 } from "fs";
9508
+ import { chmodSync as chmodSync4, linkSync, mkdirSync as mkdirSync13, readdirSync as readdirSync14, readFileSync as readFileSync29, renameSync as renameSync8, statSync as statSync15, unlinkSync as unlinkSync5, writeFileSync as writeFileSync16 } from "fs";
9475
9509
  import { homedir as homedir8 } from "os";
9476
9510
  import { spawnSync as spawnSync2 } from "child_process";
9477
9511
  import { dirname as dirname12, join as join38 } from "path";
@@ -9500,7 +9534,7 @@ function loadSigningKey(generate = true) {
9500
9534
  pem = readFileSync29(file);
9501
9535
  if (!given) {
9502
9536
  for (const [f, m] of [[file, 384], [dirname12(file), 448]])
9503
- if (statSync14(f).mode & 63)
9537
+ if (statSync15(f).mode & 63)
9504
9538
  chmodSync4(f, m);
9505
9539
  }
9506
9540
  } catch (e) {
@@ -9518,7 +9552,7 @@ function loadSigningKey(generate = true) {
9518
9552
  if (l.code !== "EEXIST")
9519
9553
  throw l;
9520
9554
  } finally {
9521
- unlinkSync4(tmp);
9555
+ unlinkSync5(tmp);
9522
9556
  }
9523
9557
  pem = readFileSync29(file);
9524
9558
  }
@@ -10455,8 +10489,8 @@ var init_state = __esm(() => {
10455
10489
 
10456
10490
  // ../../loki-ts/src/runner/repo_profile.ts
10457
10491
  import { spawnSync as spawnSync3 } from "child_process";
10458
- import { existsSync as existsSync24, lstatSync as lstatSync10, readFileSync as readFileSync30, mkdirSync as mkdirSync14, readdirSync as readdirSync14, renameSync as renameSync9, rmSync as rmSync8, writeFileSync as writeFileSync17 } from "fs";
10459
- import { basename as basename12, join as join39, resolve as resolve13, isAbsolute as isAbsolute4 } from "path";
10492
+ import { existsSync as existsSync24, lstatSync as lstatSync10, readFileSync as readFileSync30, mkdirSync as mkdirSync14, readdirSync as readdirSync15, renameSync as renameSync9, rmSync as rmSync8, writeFileSync as writeFileSync17 } from "fs";
10493
+ import { basename as basename13, join as join39, resolve as resolve13, isAbsolute as isAbsolute4 } from "path";
10460
10494
  function detectFormatters(repoDir) {
10461
10495
  const out2 = [];
10462
10496
  const has = (...fs2) => fs2.some((f) => existsSync24(join39(repoDir, f)));
@@ -10468,7 +10502,7 @@ function detectFormatters(repoDir) {
10468
10502
  prettierKey = pj !== "" && "prettier" in JSON.parse(pj);
10469
10503
  } catch {}
10470
10504
  const local = join39(repoDir, "node_modules", ".bin", "prettier");
10471
- if ((prettierKey || readdirSync14(repoDir).some((f) => /^(\.prettierrc(\.[a-z0-9]+)?|prettier\.config\.[cm]?[jt]s)$/.test(f))) && existsSync24(local))
10505
+ if ((prettierKey || readdirSync15(repoDir).some((f) => /^(\.prettierrc(\.[a-z0-9]+)?|prettier\.config\.[cm]?[jt]s)$/.test(f))) && existsSync24(local))
10472
10506
  out2.push({ tool: "prettier", argv: [local, "--write"], exts: /\.(?:[cm]?[jt]sx?|json|css|scss|md|ya?ml|html)$/ });
10473
10507
  if (has("go.mod"))
10474
10508
  out2.push({ tool: "gofmt", argv: ["gofmt", "-w"], exts: /\.go$/ });
@@ -10634,9 +10668,9 @@ var init_context = __esm(() => {
10634
10668
  });
10635
10669
 
10636
10670
  // ../../loki-ts/src/util/steer.ts
10637
- import { appendFileSync as appendFileSync2, closeSync as closeSync8, constants as constants2, fstatSync as fstatSync6, readdirSync as readdirSync15, lstatSync as lstatSync11, mkdirSync as mkdirSync15, linkSync as linkSync2, openSync as openSync8, readFileSync as readFileSync31, readSync as readSync7, renameSync as renameSync10, statSync as statSync15, lutimesSync, rmSync as rmSync9, unlinkSync as unlinkSync5, writeFileSync as writeFileSync18, existsSync as existsSync25 } from "fs";
10671
+ import { appendFileSync as appendFileSync2, closeSync as closeSync8, constants as constants2, fstatSync as fstatSync6, readdirSync as readdirSync16, lstatSync as lstatSync11, mkdirSync as mkdirSync15, linkSync as linkSync2, openSync as openSync8, readFileSync as readFileSync31, readSync as readSync7, renameSync as renameSync10, statSync as statSync16, lutimesSync, rmSync as rmSync9, unlinkSync as unlinkSync6, writeFileSync as writeFileSync18, existsSync as existsSync25 } from "fs";
10638
10672
  import { createHash as createHash9, randomBytes as randomBytes4 } from "crypto";
10639
- import { basename as basename13, join as join40 } from "path";
10673
+ import { basename as basename14, join as join40 } from "path";
10640
10674
  function archiveTo(logs, prefix, src, link = linkSync2, onLinked) {
10641
10675
  for (let i = 0;; i++) {
10642
10676
  const name = i === 0 ? `${prefix}.md` : `${prefix}-${i}.md`;
@@ -10655,7 +10689,7 @@ function archiveTo(logs, prefix, src, link = linkSync2, onLinked) {
10655
10689
  }
10656
10690
  onLinked?.(name);
10657
10691
  try {
10658
- unlinkSync5(src);
10692
+ unlinkSync6(src);
10659
10693
  } catch {}
10660
10694
  return name;
10661
10695
  }
@@ -10664,11 +10698,11 @@ function orphanAlreadyArchived(logs, claim) {
10664
10698
  const c = lstatSync11(claim);
10665
10699
  if (!c.isFile())
10666
10700
  return false;
10667
- for (const a of readdirSync15(logs)) {
10701
+ for (const a of readdirSync16(logs)) {
10668
10702
  if (!/^human-input-.*\.md$/.test(a))
10669
10703
  continue;
10670
10704
  try {
10671
- const s = statSync15(join40(logs, a));
10705
+ const s = statSync16(join40(logs, a));
10672
10706
  if (s.ino !== c.ino || s.dev !== c.dev)
10673
10707
  continue;
10674
10708
  if (/^human-input-(ORPHAN|REJECTED)-/.test(a) || existsSync25(appliedMarker(logs, a)))
@@ -10680,7 +10714,7 @@ function orphanAlreadyArchived(logs, claim) {
10680
10714
  function sweepOrphans(logs, stamp2, unapplied, link, nowMs = Date.now()) {
10681
10715
  let names;
10682
10716
  try {
10683
- names = readdirSync15(logs);
10717
+ names = readdirSync16(logs);
10684
10718
  } catch {
10685
10719
  return;
10686
10720
  }
@@ -10688,7 +10722,7 @@ function sweepOrphans(logs, stamp2, unapplied, link, nowMs = Date.now()) {
10688
10722
  for (const n2 of names)
10689
10723
  if (n2.startsWith(".applied-") && !present.has(n2.slice(".applied-".length))) {
10690
10724
  try {
10691
- unlinkSync5(join40(logs, n2));
10725
+ unlinkSync6(join40(logs, n2));
10692
10726
  } catch {}
10693
10727
  }
10694
10728
  for (const n2 of names) {
@@ -10705,7 +10739,7 @@ function sweepOrphans(logs, stamp2, unapplied, link, nowMs = Date.now()) {
10705
10739
  if (alive) {
10706
10740
  let ageMs = 0;
10707
10741
  try {
10708
- ageMs = nowMs - statSync15(join40(logs, n2)).mtimeMs;
10742
+ ageMs = nowMs - statSync16(join40(logs, n2)).mtimeMs;
10709
10743
  } catch {
10710
10744
  continue;
10711
10745
  }
@@ -10714,7 +10748,7 @@ function sweepOrphans(logs, stamp2, unapplied, link, nowMs = Date.now()) {
10714
10748
  }
10715
10749
  try {
10716
10750
  if (orphanAlreadyArchived(logs, join40(logs, n2))) {
10717
- unlinkSync5(join40(logs, n2));
10751
+ unlinkSync6(join40(logs, n2));
10718
10752
  continue;
10719
10753
  }
10720
10754
  archiveTo(logs, `human-input-ORPHAN-${stamp2}`, join40(logs, n2), link);
@@ -10773,7 +10807,7 @@ function consumeSteer(repoDir, env = process.env, now2 = () => new Date, sink, h
10773
10807
  return reject("NOTFILE", "not a regular file");
10774
10808
  try {
10775
10809
  if (!lstatSync11(claimed, { throwIfNoEntry: false })?.isDirectory())
10776
- unlinkSync5(claimed);
10810
+ unlinkSync6(claimed);
10777
10811
  } catch {}
10778
10812
  claimed = "";
10779
10813
  unapplied("not a regular file");
@@ -10833,7 +10867,7 @@ function consumeSteer(repoDir, env = process.env, now2 = () => new Date, sink, h
10833
10867
  archiveTo(join40(repoDir, ".loki", "logs"), `human-input-${now2().toISOString().replace(/[-:]/g, "").replace(/\..*/, "")}`, claimed, hooks2?.link);
10834
10868
  unapplied("logs dir unwritable or file unreadable");
10835
10869
  } catch {
10836
- unapplied(`steer stranded at .loki/logs/${basename13(claimed)}`);
10870
+ unapplied(`steer stranded at .loki/logs/${basename14(claimed)}`);
10837
10871
  }
10838
10872
  } else
10839
10873
  try {
@@ -10918,7 +10952,7 @@ var init_steer = __esm(() => {
10918
10952
 
10919
10953
  // ../../loki-ts/src/util/run_outputs.ts
10920
10954
  import { createHash as createHash10 } from "crypto";
10921
- import { existsSync as existsSync26, mkdirSync as mkdirSync16, readdirSync as readdirSync16, readFileSync as readFileSync32, statSync as statSync16, writeFileSync as writeFileSync19 } from "fs";
10955
+ import { existsSync as existsSync26, mkdirSync as mkdirSync16, readdirSync as readdirSync17, readFileSync as readFileSync32, statSync as statSync17, writeFileSync as writeFileSync19 } from "fs";
10922
10956
  import { join as join41, resolve as resolve14 } from "path";
10923
10957
  function intentRevisionsBlock(revs) {
10924
10958
  const r = (revs ?? []).filter((r2) => r2.unapplied !== true).map(({ rev, source, actor, sha: sha2 }) => ({ rev, source, actor, sha: sha2 }));
@@ -11128,7 +11162,7 @@ function aiTrailers(i, env = process.env) {
11128
11162
  return [];
11129
11163
  return ["AI-Generated: true", `AI-Provider: ${clean2(i.provider)}`, `AI-Model: ${clean2(i.model)}`, `Loki-Receipt: ${clean2(i.receiptRel)}`];
11130
11164
  }
11131
- var markingOn = (env) => env["LOKI_AI_MARKING"] === "1", cleanFull = (v) => v.replace(/[\u0000-\u001f\u007f\u2028\u2029]+/g, " ").replace(/\s+/g, " ").trim(), clean2 = (v) => cleanFull(v).slice(0, 100) || "unknown";
11165
+ var markingOn = (env) => /^(1|true|yes)$/i.test((env["LOKI_AI_MARKING"] ?? "").trim()), cleanFull = (v) => v.replace(/[\u0000-\u001f\u007f\u2028\u2029]+/g, " ").replace(/\s+/g, " ").trim(), clean2 = (v) => cleanFull(v).slice(0, 100) || "unknown";
11132
11166
 
11133
11167
  // ../../loki-ts/src/util/run_cap.ts
11134
11168
  var MAX_SCOPE_BYTES;
@@ -11141,7 +11175,7 @@ var init_run_cap = __esm(() => {
11141
11175
  // ../../loki-ts/src/util/mutation_proof.ts
11142
11176
  import { existsSync as existsSync27, mkdirSync as mkdirSync17, mkdtempSync as mkdtempSync3, readFileSync as readFileSync34, rmSync as rmSync10, symlinkSync, writeFileSync as writeFileSync20 } from "fs";
11143
11177
  import { tmpdir as tmpdir4 } from "os";
11144
- import { basename as basename14, dirname as dirname13, isAbsolute as isAbsolute6, join as join43, relative as relative3 } from "path";
11178
+ import { basename as basename15, dirname as dirname13, isAbsolute as isAbsolute6, join as join43, relative as relative3 } from "path";
11145
11179
  function mutationProof(i) {
11146
11180
  const rels = i.wallFiles.map((f) => isAbsolute6(f.path) ? relative3(i.repoDir, f.path) : f.path);
11147
11181
  if (rels.length === 0)
@@ -11166,7 +11200,7 @@ function mutationProof(i) {
11166
11200
  if (add3.status !== 0)
11167
11201
  return np("could not create the base worktree");
11168
11202
  for (const rel of rels) {
11169
- const sealed = join43(i.runDir, "wall", basename14(rel)), src = existsSync27(sealed) ? sealed : join43(i.repoDir, rel);
11203
+ const sealed = join43(i.runDir, "wall", basename15(rel)), src = existsSync27(sealed) ? sealed : join43(i.repoDir, rel);
11170
11204
  if (!existsSync27(src))
11171
11205
  return np(`Wall file missing: ${rel}`);
11172
11206
  mkdirSync17(dirname13(join43(wt, rel)), { recursive: true });
@@ -11321,7 +11355,7 @@ var init_shell = __esm(() => {
11321
11355
  });
11322
11356
 
11323
11357
  // ../../loki-ts/src/util/python.ts
11324
- import { accessSync, constants as constants3, existsSync as existsSync28, mkdtempSync as mkdtempSync4, readFileSync as readFileSync35, realpathSync as realpathSync18, rmSync as rmSync11, statSync as statSync17 } from "fs";
11358
+ import { accessSync, constants as constants3, existsSync as existsSync28, mkdtempSync as mkdtempSync4, readFileSync as readFileSync35, realpathSync as realpathSync18, rmSync as rmSync11, statSync as statSync18 } from "fs";
11325
11359
  import { spawnSync as spawnSync4 } from "child_process";
11326
11360
  import { tmpdir as tmpdir5 } from "os";
11327
11361
  async function findPython3() {
@@ -11348,7 +11382,7 @@ function resolvePython3() {
11348
11382
  const cand = `${dir}/python3`;
11349
11383
  try {
11350
11384
  accessSync(cand, constants3.X_OK);
11351
- if (statSync17(cand).isFile())
11385
+ if (statSync18(cand).isFile())
11352
11386
  return cand;
11353
11387
  } catch {}
11354
11388
  }
@@ -11679,7 +11713,7 @@ var init_wall_manifest = __esm(() => {
11679
11713
 
11680
11714
  // ../../loki-ts/src/features/wall_manifest_wire.ts
11681
11715
  import { createHash as createHash12 } from "crypto";
11682
- import { basename as basename15, dirname as dirname14 } from "path";
11716
+ import { basename as basename16, dirname as dirname14 } from "path";
11683
11717
  function blobEntries(ls) {
11684
11718
  const out2 = [];
11685
11719
  for (const raw2 of ls.toString("latin1").split("\x00")) {
@@ -11709,12 +11743,12 @@ function wallManifestFor(repoDir, tree, task, env = process.env) {
11709
11743
  return null;
11710
11744
  const low = task.toLowerCase().replace(/\\/g, "/");
11711
11745
  const token = (n2) => new RegExp(`(?<![A-Za-z0-9_])${n2.toLowerCase().replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?![A-Za-z0-9_])`).test(low);
11712
- const dirModule = (e) => /^(index|__init__|mod|main)\.[^.]+$/.test(basename15(e.path)) && e.path.includes("/") && token(dirname14(e.path));
11713
- const matched = all.filter((e) => SOURCE.test(e.path) && (token(basename15(e.path)) || token(e.path) || token(basename15(e.path).replace(/\.[^.]*$/, "")) || dirModule(e)));
11746
+ const dirModule = (e) => /^(index|__init__|mod|main)\.[^.]+$/.test(basename16(e.path)) && e.path.includes("/") && token(dirname14(e.path));
11747
+ const matched = all.filter((e) => SOURCE.test(e.path) && (token(basename16(e.path)) || token(e.path) || token(basename16(e.path).replace(/\.[^.]*$/, "")) || dirModule(e)));
11714
11748
  const spans = (p) => [...low.matchAll(new RegExp(`(?<![A-Za-z0-9_])${p.toLowerCase().replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?![A-Za-z0-9_])`, "g"))].map((m) => [m.index, m.index + m[0].length]);
11715
11749
  const occ = new Map(matched.map((e) => [e, spans(e.path)]));
11716
11750
  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)));
11717
- const byPath2 = matched.filter(exact).sort((a, b) => b.path.length - a.path.length), byBase = matched.filter((e) => !byPath2.includes(e) && token(basename15(e.path)));
11751
+ const byPath2 = matched.filter(exact).sort((a, b) => b.path.length - a.path.length), byBase = matched.filter((e) => !byPath2.includes(e) && token(basename16(e.path)));
11718
11752
  const named = [...byPath2, ...byBase, ...matched.filter((e) => !byPath2.includes(e) && !byBase.includes(e))].slice(0, MAX_NAMED);
11719
11753
  const tests = all.filter((e) => TESTISH.test(e.path)).slice(0, MAX_FILES), listed = tests.filter((e) => !SOURCE.test(e.path));
11720
11754
  const want = [...new Set([...all.filter((e) => CONFIG.test(e.path)), ...tests.filter((e) => SOURCE.test(e.path)), ...named])];
@@ -11773,7 +11807,7 @@ Example: test('name', () => { assert.strictEqual(fn(1), 2); }); Run: node --tes
11773
11807
  import { createHash as createHash13 } from "crypto";
11774
11808
  import { appendFileSync as appendFileSync3, copyFileSync as copyFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync18, readFileSync as readFileSync36, rmSync as rmSync12, writeFileSync as writeFileSync21 } from "fs";
11775
11809
  import { tmpdir as tmpdir6 } from "os";
11776
- import { basename as basename16, join as join44, relative as relative4 } from "path";
11810
+ import { basename as basename17, join as join44, relative as relative4 } from "path";
11777
11811
  function wallHoldoutRatio(env = process.env) {
11778
11812
  if (env["LOKI_WALL_HOLDOUT"]?.trim() === "0")
11779
11813
  return 0;
@@ -11818,7 +11852,7 @@ function stageHoldout(dir, repoDir) {
11818
11852
  man = JSON.parse(readFileSync36(join44(dir, MANIFEST), "utf8"));
11819
11853
  } catch {}
11820
11854
  if (!man)
11821
- return { tests, missing: [`holdout store unreadable: ${basename16(dir)}`], cleanup: () => {} };
11855
+ return { tests, missing: [`holdout store unreadable: ${basename17(dir)}`], cleanup: () => {} };
11822
11856
  mkdirSync18(man.targetDir, { recursive: true });
11823
11857
  man.files.forEach((f, i) => {
11824
11858
  const src = join44(dir, f.name);
@@ -12249,9 +12283,9 @@ import { execFileSync as execFileSync3 } from "child_process";
12249
12283
  import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync38, rmSync as rmSync13 } from "fs";
12250
12284
  import { tmpdir as tmpdir7 } from "os";
12251
12285
  import { join as join46 } from "path";
12252
- import { basename as basename17 } from "path";
12286
+ import { basename as basename18 } from "path";
12253
12287
  function classifyAssertDelta(inp) {
12254
- const f = basename17(inp.path);
12288
+ const f = basename18(inp.path);
12255
12289
  if (!/^(test_.*|.*_test)\.py$/.test(f))
12256
12290
  return WEAKENED;
12257
12291
  if (inp.headCounts.run !== inp.baseCounts.run || inp.headCounts.skipped !== inp.baseCounts.skipped)
@@ -12514,7 +12548,7 @@ var init_runner_errors = __esm(() => {
12514
12548
  import { spawnSync as spawnSync5 } from "child_process";
12515
12549
  import { mkdtempSync as mkdtempSync6, realpathSync as realpathSync19, rmSync as rmSync14 } from "fs";
12516
12550
  import { tmpdir as tmpdir8 } from "os";
12517
- import { basename as basename18, extname as extname2, join as join47 } from "path";
12551
+ import { basename as basename19, extname as extname2, join as join47 } from "path";
12518
12552
  function changedFilesNamed(out2, repoDir, changed) {
12519
12553
  return changed.filter((f) => {
12520
12554
  if (out2.includes(f) || out2.includes(join47(repoDir, f)))
@@ -12524,7 +12558,7 @@ function changedFilesNamed(out2, repoDir, changed) {
12524
12558
  return true;
12525
12559
  if (extname2(f) === ".go" && segs.length > 1 && suffixes(segs.slice(0, -1), 1).some((d) => new RegExp(`(?<=[\\w-])/${esc(d)}(?![\\w./-])`).test(out2)))
12526
12560
  return true;
12527
- const stem = basename18(f, extname2(f));
12561
+ const stem = basename19(f, extname2(f));
12528
12562
  if (stem.length < 2 || stem === "index" || stem === "__init__")
12529
12563
  return false;
12530
12564
  return new RegExp(`(?<![\\w-])${esc(stem)}(?![\\w-])`).test(out2);
@@ -12816,7 +12850,7 @@ app_runner_stop >/dev/null 2>&1
12816
12850
  });
12817
12851
 
12818
12852
  // ../../loki-ts/src/util/secure_scan.ts
12819
- import { existsSync as existsSync31, mkdirSync as mkdirSync20, mkdtempSync as mkdtempSync7, readFileSync as readFileSync40, realpathSync as realpathSync20, rmSync as rmSync15, statSync as statSync18, writeFileSync as writeFileSync23 } from "fs";
12853
+ import { existsSync as existsSync31, mkdirSync as mkdirSync20, mkdtempSync as mkdtempSync7, readFileSync as readFileSync40, realpathSync as realpathSync20, rmSync as rmSync15, statSync as statSync19, writeFileSync as writeFileSync23 } from "fs";
12820
12854
  import { tmpdir as tmpdir9 } from "os";
12821
12855
  import { dirname as dirname16, join as join50, resolve as resolve15, sep as sep11 } from "path";
12822
12856
  function fail(error) {
@@ -12992,7 +13026,7 @@ async function scanAddedLines(repoDir, opts = {}) {
12992
13026
  return fail("secure-scan: git ls-files failed");
12993
13027
  for (const p of untracked.split("\x00").filter(Boolean)) {
12994
13028
  try {
12995
- const st = statSync18(join50(repoDir, p));
13029
+ const st = statSync19(join50(repoDir, p));
12996
13030
  if (!st.isFile() || st.size > MAX_ADDED_FILE_BYTES)
12997
13031
  continue;
12998
13032
  const lines2 = new Map;
@@ -13163,7 +13197,7 @@ var init_route_block = __esm(() => {
13163
13197
  // ../../loki-ts/src/features/visual_evidence.ts
13164
13198
  import { spawn as spawn7 } from "child_process";
13165
13199
  import { createHash as createHash14, randomBytes as randomBytes5 } from "crypto";
13166
- import { existsSync as existsSync32, lstatSync as lstatSync12, mkdirSync as mkdirSync21, readdirSync as readdirSync17, readFileSync as readFileSync41, writeFileSync as writeFileSync24 } from "fs";
13200
+ import { existsSync as existsSync32, lstatSync as lstatSync12, mkdirSync as mkdirSync21, readdirSync as readdirSync18, readFileSync as readFileSync41, writeFileSync as writeFileSync24 } from "fs";
13167
13201
  import { createServer } from "net";
13168
13202
  import { dirname as dirname17, isAbsolute as isAbsolute8, join as join51, normalize as normalize3, relative as relative6, sep as sep12 } from "path";
13169
13203
  function routeFor(file) {
@@ -13265,7 +13299,7 @@ async function recordE2eMedia(repoDir, runDir, relDir, base, routes, ms, signal)
13265
13299
  return { rels: [], skipped: "playwright e2e video and trace skipped: the run failed or timed out" };
13266
13300
  const rels = [];
13267
13301
  const walk = (d) => {
13268
- for (const e of readdirSync17(d, { withFileTypes: true })) {
13302
+ for (const e of readdirSync18(d, { withFileTypes: true })) {
13269
13303
  const full = join51(d, e.name);
13270
13304
  if (e.isDirectory())
13271
13305
  walk(full);
@@ -14245,9 +14279,9 @@ function runnerCmd(t, repoDir) {
14245
14279
  return [cmd, [...pre, "-m", "pytest", "-q", t.path], interpreter];
14246
14280
  }
14247
14281
  case "vitest":
14248
- return ["npx", ["vitest", "run", t.path]];
14282
+ return ["npx", ["--no-install", "vitest", "run", t.path]];
14249
14283
  case "jest":
14250
- return ["npx", ["jest", t.path]];
14284
+ return ["npx", ["--no-install", "jest", t.path]];
14251
14285
  case "bun":
14252
14286
  return ["bun", ["test", t.path]];
14253
14287
  case "node":
@@ -14411,10 +14445,10 @@ async function runLintChecks(ctx, changed, signal, checks, opts = {}) {
14411
14445
  for (const g of groupByPackage(api, ctx.repoDir, changed.filter((f) => /\.(ts|tsx|js|jsx)$/.test(f)))) {
14412
14446
  const sfx = g.root === "." ? "" : `:${g.root}`, co = g.root === "." ? opts : { ...opts, cwd: g.cwd };
14413
14447
  if (existsSync37(join57(g.cwd, "tsconfig.json")))
14414
- await runCheck(ctx, `lint:tsc${sfx}`, "npx", ["tsc", "--noEmit", "-p", "."], signal, checks, { ...co, kind: "static" });
14448
+ await runCheck(ctx, `lint:tsc${sfx}`, "npx", ["--no-install", "tsc", "--noEmit", "-p", "."], signal, checks, { ...co, kind: "static" });
14415
14449
  if (ESLINT_CONFIGS.some((f) => existsSync37(join57(g.cwd, f)))) {
14416
- const c = await runCheck(ctx, `lint:eslint${sfx}`, "npx", ["eslint", ...g.rel], signal, checks, { ...co, kind: "static" });
14417
- if (await excuseLint(ctx, signal, c, "eslint", "npx", ["eslint"], g.cwd, g.rel, co))
14450
+ const c = await runCheck(ctx, `lint:eslint${sfx}`, "npx", ["--no-install", "eslint", ...g.rel], signal, checks, { ...co, kind: "static" });
14451
+ if (await excuseLint(ctx, signal, c, "eslint", "npx", ["--no-install", "eslint"], g.cwd, g.rel, co))
14418
14452
  pre.push(c.name);
14419
14453
  }
14420
14454
  }
@@ -14593,7 +14627,7 @@ ${x}` : c.cmd };
14593
14627
  });
14594
14628
 
14595
14629
  // ../../loki-ts/src/project_model/conventions.ts
14596
- import { existsSync as existsSync38, readdirSync as readdirSync18, readFileSync as readFileSync45 } from "fs";
14630
+ import { existsSync as existsSync38, readdirSync as readdirSync19, readFileSync as readFileSync45 } from "fs";
14597
14631
  import { dirname as dirname22, join as join58 } from "path";
14598
14632
  function parseJsonc(text2) {
14599
14633
  let out2 = "", i = 0;
@@ -14635,7 +14669,7 @@ function moduleOf(file, depth = 0) {
14635
14669
  function readPackageConventions(pkgDir, runner = null) {
14636
14670
  let names = [];
14637
14671
  try {
14638
- names = readdirSync18(pkgDir).filter((f) => f.endsWith(".json")).sort((x, y) => x.length - y.length || x.localeCompare(y));
14672
+ names = readdirSync19(pkgDir).filter((f) => f.endsWith(".json")).sort((x, y) => x.length - y.length || x.localeCompare(y));
14639
14673
  } catch {
14640
14674
  return null;
14641
14675
  }
@@ -14679,7 +14713,7 @@ var init_conventions = () => {};
14679
14713
 
14680
14714
  // ../../loki-ts/src/engine10/stages/wall.ts
14681
14715
  import { spawnSync as spawnSync7 } from "child_process";
14682
- import { existsSync as existsSync39, mkdirSync as mkdirSync25, mkdtempSync as mkdtempSync11, readFileSync as readFileSync46, readdirSync as readdirSync19, rmSync as rmSync19, writeFileSync as writeFileSync28 } from "fs";
14716
+ import { existsSync as existsSync39, mkdirSync as mkdirSync25, mkdtempSync as mkdtempSync11, readFileSync as readFileSync46, readdirSync as readdirSync20, rmSync as rmSync19, writeFileSync as writeFileSync28 } from "fs";
14683
14717
  import { tmpdir as tmpdir12 } from "os";
14684
14718
  import { dirname as dirname23, join as join59, relative as relative8 } from "path";
14685
14719
 
@@ -14805,7 +14839,7 @@ async function wallAuthor(ctx, signal, retry) {
14805
14839
  rmSync19(cwd, { recursive: true, force: true });
14806
14840
  return done({ status: "failed", data: { iteration_ids: [iterationId], model }, reason: "wall session aborted, killed, or timed out", killed: true });
14807
14841
  }
14808
- const all = readdirSync19(cwd).filter((f) => f.startsWith(WALL_PREFIX)), held = stashHoldout({ runId: ctx.runId, repoDir: ctx.repoDir, srcDir: cwd, targetDir, names: all.filter((n2) => !conventionViolation(conv2, n2, readFileSync46(join59(cwd, n2), "utf8"))), runnerOf: (n2) => guessRunner(n2, runners) }), generated = all.filter((n2) => !held?.names.has(n2));
14842
+ const all = readdirSync20(cwd).filter((f) => f.startsWith(WALL_PREFIX)), held = stashHoldout({ runId: ctx.runId, repoDir: ctx.repoDir, srcDir: cwd, targetDir, names: all.filter((n2) => !conventionViolation(conv2, n2, readFileSync46(join59(cwd, n2), "utf8"))), runnerOf: (n2) => guessRunner(n2, runners) }), generated = all.filter((n2) => !held?.names.has(n2));
14809
14843
  const sealedDir = join59(ctx.runDir, "wall");
14810
14844
  if (generated.length > 0)
14811
14845
  mkdirSync25(sealedDir, { recursive: true });
@@ -14920,7 +14954,7 @@ var init_wall = __esm(() => {
14920
14954
  });
14921
14955
 
14922
14956
  // ../../loki-ts/src/e10ext/discard.ts
14923
- import { chmodSync as chmodSync5, closeSync as closeSync9, lstatSync as lstatSync15, mkdirSync as mkdirSync26, openSync as openSync9, readFileSync as readFileSync47, realpathSync as realpathSync23, rmdirSync, unlinkSync as unlinkSync6, writeFileSync as writeFileSync29 } from "fs";
14957
+ import { chmodSync as chmodSync5, closeSync as closeSync9, lstatSync as lstatSync15, mkdirSync as mkdirSync26, openSync as openSync9, readFileSync as readFileSync47, realpathSync as realpathSync23, rmdirSync, unlinkSync as unlinkSync7, writeFileSync as writeFileSync29 } from "fs";
14924
14958
  import { dirname as dirname24, join as join60, relative as relative9, sep as sep13 } from "path";
14925
14959
  function safeRestore(repoDir, f, want, mode) {
14926
14960
  const root = realpathSync23(repoDir), fp = join60(root, f), rel = relative9(root, dirname24(fp));
@@ -14953,7 +14987,7 @@ function safeRestore(repoDir, f, want, mode) {
14953
14987
  if (st.isDirectory())
14954
14988
  rmdirSync(fp);
14955
14989
  else
14956
- unlinkSync6(fp);
14990
+ unlinkSync7(fp);
14957
14991
  }
14958
14992
  const fd = openSync9(fp, "wx", mode);
14959
14993
  try {
@@ -15047,7 +15081,7 @@ var init_commit_filter = __esm(() => {
15047
15081
  });
15048
15082
 
15049
15083
  // ../../loki-ts/src/e10ext/scope.ts
15050
- import { basename as basename20, dirname as dirname26 } from "path";
15084
+ import { basename as basename21, dirname as dirname26 } from "path";
15051
15085
  function contractText(o) {
15052
15086
  const c = o.intake?.contract_snapshot?.contract;
15053
15087
  return Array.isArray(c?.criteria) ? c.criteria.map((x) => typeof x?.text === "string" ? x.text : "").join(`
@@ -15062,7 +15096,7 @@ function outsideScope(o, staged) {
15062
15096
  ${typeof o.intake?.task === "string" ? o.intake.task : ""}
15063
15097
  ${contractText(o)}`, pre = o.intake?.preexisting_dirty ?? {};
15064
15098
  const toks = surfaceTokens(text2), plannedDirs = new Set(rel.map((r) => dirname26(r)).filter((d) => d !== "."));
15065
- return staged.filter(({ st, f }) => st !== "A" && !isTestFile(f) && !Object.hasOwn(pre, f) && !rel.includes(f) && !mentions(text2, f) && !mentions(text2, basename20(f)) && !plannedDirs.has(dirname26(f)) && !dirSegs(f).some((d) => toks.has(d))).map(({ f }) => f);
15099
+ return staged.filter(({ st, f }) => st !== "A" && !isTestFile(f) && !Object.hasOwn(pre, f) && !rel.includes(f) && !mentions(text2, f) && !mentions(text2, basename21(f)) && !plannedDirs.has(dirname26(f)) && !dirSegs(f).some((d) => toks.has(d))).map(({ f }) => f);
15066
15100
  }
15067
15101
  function flagOutsideScope(o, staged) {
15068
15102
  const unit = unitFlags(staged, process.env, o.intake?.preexisting_dirty ?? {});
@@ -15077,7 +15111,7 @@ var init_scope2 = __esm(() => {
15077
15111
  });
15078
15112
 
15079
15113
  // ../../loki-ts/src/council/role_agents.ts
15080
- import { existsSync as existsSync40, readdirSync as readdirSync20, readFileSync as readFileSync48 } from "fs";
15114
+ import { existsSync as existsSync40, readdirSync as readdirSync21, readFileSync as readFileSync48 } from "fs";
15081
15115
  import { homedir as homedir9 } from "os";
15082
15116
  import { join as join61 } from "path";
15083
15117
  function agentDirs(repoDir, env = process.env) {
@@ -15102,7 +15136,7 @@ function loadRoleAgent(repoDir, role, env = process.env) {
15102
15136
  continue;
15103
15137
  let names;
15104
15138
  try {
15105
- names = readdirSync20(d).filter((n2) => n2.endsWith(".md") && !n2.startsWith(".")).sort();
15139
+ names = readdirSync21(d).filter((n2) => n2.endsWith(".md") && !n2.startsWith(".")).sort();
15106
15140
  } catch {
15107
15141
  continue;
15108
15142
  }
@@ -15204,12 +15238,12 @@ var init_colors = __esm(() => {
15204
15238
  });
15205
15239
 
15206
15240
  // ../../loki-ts/src/util/run_summary.ts
15207
- import { existsSync as existsSync41, mkdirSync as mkdirSync28, readFileSync as readFileSync49, renameSync as renameSync12, statSync as statSync19, writeFileSync as writeFileSync30 } from "fs";
15241
+ import { existsSync as existsSync41, mkdirSync as mkdirSync28, readFileSync as readFileSync49, renameSync as renameSync12, statSync as statSync20, writeFileSync as writeFileSync30 } from "fs";
15208
15242
  import { join as join63 } from "path";
15209
15243
  function readRiskRecord(repoDir, sinceMs = 0) {
15210
15244
  try {
15211
15245
  const p = join63(repoDir, ".loki", "state", "risk-tier.json");
15212
- if (statSync19(p).mtimeMs < sinceMs)
15246
+ if (statSync20(p).mtimeMs < sinceMs)
15213
15247
  return null;
15214
15248
  const r = JSON.parse(readFileSync49(p, "utf8"));
15215
15249
  return r && typeof r === "object" ? r : null;
@@ -15547,7 +15581,7 @@ var init_contract = __esm(() => {
15547
15581
 
15548
15582
  // ../../loki-ts/src/features/speed/seal_group.ts
15549
15583
  import { createHash as createHash17 } from "crypto";
15550
- import { existsSync as existsSync44, mkdirSync as mkdirSync30, readdirSync as readdirSync21, readFileSync as readFileSync52, renameSync as renameSync13, statSync as statSync20, writeFileSync as writeFileSync32 } from "fs";
15584
+ import { existsSync as existsSync44, mkdirSync as mkdirSync30, readdirSync as readdirSync22, readFileSync as readFileSync52, renameSync as renameSync13, statSync as statSync21, writeFileSync as writeFileSync32 } from "fs";
15551
15585
  import { dirname as dirname28, join as join66 } from "path";
15552
15586
  function sealGroup(runDir, rh) {
15553
15587
  const manifestPath = join66(runDir, "group", "manifest.json");
@@ -15637,7 +15671,7 @@ async function verifyGroup(receiptPath, receipt, rh, verifyOne, deps = {}) {
15637
15671
  return bad(`unit ${id} is out of order (index ${String(e["index"])} at position ${i})`);
15638
15672
  let bytes;
15639
15673
  try {
15640
- if (!statSync20(dir).isDirectory())
15674
+ if (!statSync21(dir).isDirectory())
15641
15675
  return bad(`unit ${id} is not a directory`);
15642
15676
  bytes = readFileSync52(rp);
15643
15677
  } catch {
@@ -15676,7 +15710,7 @@ var ID_RE, PASSING, sha3 = (b) => createHash17("sha256").update(b).digest("hex")
15676
15710
  }
15677
15711
  }, dirNames = (d) => {
15678
15712
  try {
15679
- return readdirSync21(d).filter((n3) => !n3.startsWith(".")).sort();
15713
+ return readdirSync22(d).filter((n3) => !n3.startsWith(".")).sort();
15680
15714
  } catch {
15681
15715
  return null;
15682
15716
  }
@@ -15688,8 +15722,8 @@ var init_seal_group = __esm(() => {
15688
15722
  });
15689
15723
 
15690
15724
  // ../../loki-ts/src/supply/supply_guard.ts
15691
- import { existsSync as existsSync45, readFileSync as readFileSync53, statSync as statSync21 } from "fs";
15692
- import { basename as basename21, join as join67 } from "path";
15725
+ import { existsSync as existsSync45, readFileSync as readFileSync53, statSync as statSync22 } from "fs";
15726
+ import { basename as basename22, join as join67 } from "path";
15693
15727
  function supplyEnabled(env) {
15694
15728
  return env["LOKI_SUPPLY_GUARD"] !== "0";
15695
15729
  }
@@ -15701,14 +15735,14 @@ function supplyVerdict(verdict, r) {
15701
15735
  return r.blocked && verdict === "VERIFIED" ? "FAILED" : verdict;
15702
15736
  }
15703
15737
  function isManifestPath(path) {
15704
- return MANIFESTS.test(basename21(path));
15738
+ return MANIFESTS.test(basename22(path));
15705
15739
  }
15706
15740
  function readDeclared(repoDir) {
15707
15741
  const p = join67(repoDir, ".loki", DECLARED_FILE);
15708
15742
  if (!existsSync45(p))
15709
15743
  return { deps: [], problem: null };
15710
15744
  try {
15711
- if (statSync21(p).size > MAX_FILE_BYTES)
15745
+ if (statSync22(p).size > MAX_FILE_BYTES)
15712
15746
  return { deps: [], problem: "declaration file too large" };
15713
15747
  const j = JSON.parse(readFileSync53(p, "utf8"));
15714
15748
  if (!Array.isArray(j))
@@ -15917,7 +15951,7 @@ var MIN_AGE_DAYS = 7, DECLARED_FILE = "supply-declared.json", MAX_CHECKED = 50,
15917
15951
  }
15918
15952
  }, 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)), readSmall = (p) => {
15919
15953
  try {
15920
- return statSync21(p).size <= MAX_FILE_BYTES ? readFileSync53(p, "utf8") : "";
15954
+ return statSync22(p).size <= MAX_FILE_BYTES ? readFileSync53(p, "utf8") : "";
15921
15955
  } catch {
15922
15956
  return "";
15923
15957
  }
@@ -15933,8 +15967,8 @@ var init_supply_guard = __esm(() => {
15933
15967
 
15934
15968
  // ../../loki-ts/src/engine10/stages/seal.ts
15935
15969
  import { createHash as createHash18 } from "crypto";
15936
- import { existsSync as existsSync46, readdirSync as readdirSync22, mkdirSync as mkdirSync31, readFileSync as readFileSync54, writeFileSync as writeFileSync33 } from "fs";
15937
- import { basename as basename22, isAbsolute as isAbsolute11, join as join68, relative as relative10 } from "path";
15970
+ import { existsSync as existsSync46, readdirSync as readdirSync23, mkdirSync as mkdirSync31, readFileSync as readFileSync54 } from "fs";
15971
+ import { basename as basename23, isAbsolute as isAbsolute11, join as join68, relative as relative10 } from "path";
15938
15972
  function sanitizeReason(s) {
15939
15973
  const collapsed = s.replace(/[\x00-\x1f\x7f]+/g, " ").trim();
15940
15974
  const capped = collapsed.length > 500 ? `${collapsed.slice(0, 500)}...` : collapsed;
@@ -16042,6 +16076,7 @@ var init_seal = __esm(() => {
16042
16076
  init_seal_group();
16043
16077
  init_supply_guard();
16044
16078
  init_hooks();
16079
+ init_atomic();
16045
16080
  init_safe_git();
16046
16081
  DEEP_NOT_PROVEN = ["full suite", "app boot", "council", "security scan"];
16047
16082
  commitStage = {
@@ -16125,8 +16160,8 @@ var init_seal = __esm(() => {
16125
16160
  notProven.add(`Wall test not executed: ${wallNotRun} file(s), no reason recorded`);
16126
16161
  if (wallNotRun > 0) {
16127
16162
  try {
16128
- const kept = new Set((Array.isArray(o.wall?.files) ? o.wall.files : []).map((f) => basename22(String(f.path))));
16129
- for (const n3 of readdirSync22(join68(ctx.runDir, "wall")).sort())
16163
+ const kept = new Set((Array.isArray(o.wall?.files) ? o.wall.files : []).map((f) => basename23(String(f.path))));
16164
+ for (const n3 of readdirSync23(join68(ctx.runDir, "wall")).sort())
16130
16165
  if (!kept.has(n3))
16131
16166
  notProven.add(`wall test discarded: ${n3} (not_run)`);
16132
16167
  } catch {}
@@ -16268,9 +16303,9 @@ var init_seal = __esm(() => {
16268
16303
  const receipt = { ...body, receipt_sha256: hash, verification: { jwt: sig.jwt, kid: sig.kid } };
16269
16304
  mkdirSync31(ctx.runDir, { recursive: true });
16270
16305
  const path = join68(ctx.runDir, "receipt.json");
16271
- writeFileSync33(path, JSON.stringify(receipt, null, 2) + `
16306
+ atomicWriteText(path, JSON.stringify(receipt, null, 2) + `
16272
16307
  `);
16273
- writeFileSync33(join68(ctx.runDir, "receipt.md"), renderReceiptMd(receipt));
16308
+ atomicWriteText(join68(ctx.runDir, "receipt.md"), renderReceiptMd(receipt));
16274
16309
  recordRun(process.env, ctx.repoDir, ranModel(o.implement, ctx.model, o.fix), verdict, cost.usd, cost.unmetered === true, totalS);
16275
16310
  try {
16276
16311
  hooks.sealed?.(ctx.runDir, JSON.parse(JSON.stringify(receipt), (_k, v) => v && typeof v === "object" ? Object.freeze(v) : v));
@@ -16296,7 +16331,7 @@ var init_seal = __esm(() => {
16296
16331
 
16297
16332
  // ../../loki-ts/src/util/composite_seal.ts
16298
16333
  import { existsSync as existsSync47, readFileSync as readFileSync55 } from "fs";
16299
- import { basename as basename23, dirname as dirname30, join as join69 } from "path";
16334
+ import { basename as basename24, dirname as dirname30, join as join69 } from "path";
16300
16335
  function logProblem(runDir, integ) {
16301
16336
  if (typeof integ["log_sha256"] !== "string")
16302
16337
  return null;
@@ -16418,8 +16453,8 @@ var init_keys_cmd = __esm(() => {
16418
16453
  });
16419
16454
 
16420
16455
  // ../../loki-ts/src/engine10/verify_cmd.ts
16421
- import { existsSync as existsSync48, readFileSync as readFileSync56, renameSync as renameSync14, statSync as statSync23, writeFileSync as writeFileSync34 } from "fs";
16422
- import { basename as basename24, dirname as dirname31, join as join70 } from "path";
16456
+ import { existsSync as existsSync48, readFileSync as readFileSync56, renameSync as renameSync14, statSync as statSync24, writeFileSync as writeFileSync33 } from "fs";
16457
+ import { basename as basename25, dirname as dirname31, join as join70 } from "path";
16423
16458
  import { createHash as createHash19, createPublicKey as createPublicKey4, verify as verify4 } from "crypto";
16424
16459
  function pubFor(kid, given) {
16425
16460
  if (given)
@@ -16601,7 +16636,7 @@ var init_verify_cmd = __esm(() => {
16601
16636
  });
16602
16637
 
16603
16638
  // src/server/app.ts
16604
- import { existsSync as existsSync50, readFileSync as readFileSync59, statSync as statSync24 } from "fs";
16639
+ import { existsSync as existsSync50, readFileSync as readFileSync59, statSync as statSync25 } from "fs";
16605
16640
  import { join as join73, resolve as resolve16, sep as sep15 } from "path";
16606
16641
 
16607
16642
  // node_modules/hono/dist/request/constants.js
@@ -27694,7 +27729,7 @@ function createApp(opts) {
27694
27729
  return c.json({ error: "not found" }, 404);
27695
27730
  const root = resolve16(uiDir);
27696
27731
  const f = resolve16(root, `.${p}`);
27697
- if (f.startsWith(root + sep15) && existsSync50(f) && statSync24(f).isFile())
27732
+ if (f.startsWith(root + sep15) && existsSync50(f) && statSync25(f).isFile())
27698
27733
  return new Response(Bun.file(f));
27699
27734
  if (/\.[a-z0-9]+$/i.test(p))
27700
27735
  return c.json({ error: "not found" }, 404);