loki-mode 11.127.0 → 11.128.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/dashboard/__init__.py +1 -1
  4. package/docs/CLI-REFERENCE.md +1 -1
  5. package/docs/INSTALLATION.md +1 -1
  6. package/docs/environment-variables.md +2 -0
  7. package/loki-ts/dist/loki.js +1487 -1481
  8. package/mcp/__init__.py +1 -1
  9. package/package.json +2 -2
  10. package/packages/control-plane/dist/server.js +273 -52
  11. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  12. package/web-app/dist/assets/{AdminPage-BhYJuqnY.js → AdminPage-DU19V0Z8.js} +1 -1
  13. package/web-app/dist/assets/{Avatar-QBOiE61Q.js → Avatar-8tZOYCzr.js} +1 -1
  14. package/web-app/dist/assets/{Badge-D2KcyIC8.js → Badge-WsBr_wmd.js} +1 -1
  15. package/web-app/dist/assets/{Button-B2-mrb3C.js → Button-dbsRjgbK.js} +1 -1
  16. package/web-app/dist/assets/{CockpitPage-DVHDVtUX.js → CockpitPage-BdmKE1BD.js} +1 -1
  17. package/web-app/dist/assets/{ComparePage-CM4RrgWg.js → ComparePage-B0baIWVY.js} +1 -1
  18. package/web-app/dist/assets/{ErrorBoundary-BOKHLzbP.js → ErrorBoundary-KGmneVKo.js} +1 -1
  19. package/web-app/dist/assets/{EvidenceReceiptPanel-D1szQE8S.js → EvidenceReceiptPanel-DzbcVDL0.js} +1 -1
  20. package/web-app/dist/assets/{GitHubIssuesPanel-Bd7_KCOB.js → GitHubIssuesPanel-BO6bSgxF.js} +1 -1
  21. package/web-app/dist/assets/{GitHubPRsPanel-uiC7HaYo.js → GitHubPRsPanel-BYiyPZye.js} +1 -1
  22. package/web-app/dist/assets/{HomePage-Cq9xHgPy.js → HomePage-DDVp5P4l.js} +2 -2
  23. package/web-app/dist/assets/{LoginPage-LcYUFhND.js → LoginPage-CSMf6PA9.js} +1 -1
  24. package/web-app/dist/assets/{MagicPage-CaPWLLbk.js → MagicPage-CHxAoj4t.js} +1 -1
  25. package/web-app/dist/assets/{MetricsPage-LGzejHhA.js → MetricsPage-BgSvqiiI.js} +1 -1
  26. package/web-app/dist/assets/{NotFoundPage-C9aJWNec.js → NotFoundPage-DMC9Etyr.js} +1 -1
  27. package/web-app/dist/assets/{ProjectPage-DIWDOTcy.js → ProjectPage-BYpWEnfs.js} +3 -3
  28. package/web-app/dist/assets/{ProjectsPage-DoYOYXdi.js → ProjectsPage-DksZuUPc.js} +1 -1
  29. package/web-app/dist/assets/{SettingsPage-CLai0Lq3.js → SettingsPage-BRghQ4OZ.js} +1 -1
  30. package/web-app/dist/assets/{ShowcasePage-CCaah9Ny.js → ShowcasePage-AX3TFZdD.js} +1 -1
  31. package/web-app/dist/assets/{SystemSettingsPage-MhXR2uEt.js → SystemSettingsPage-DVg5oEf3.js} +1 -1
  32. package/web-app/dist/assets/{TeamsPage-IkVC44NR.js → TeamsPage-CNKKrZdS.js} +1 -1
  33. package/web-app/dist/assets/{TemplatesPage-5AMd6coY.js → TemplatesPage-DReGZVmw.js} +1 -1
  34. package/web-app/dist/assets/{TerminalOutput-zLHjQBUu.js → TerminalOutput-6g4gZVbt.js} +1 -1
  35. package/web-app/dist/assets/{activity-DTaR8f_c.js → activity-kKs9rNVl.js} +1 -1
  36. package/web-app/dist/assets/{bell-B3TiasQs.js → bell-D2f6TSrY.js} +1 -1
  37. package/web-app/dist/assets/{bot-DcYchzMp.js → bot-CTiUgNPd.js} +1 -1
  38. package/web-app/dist/assets/{check-qAOmxxI-.js → check-b7nwLuDG.js} +1 -1
  39. package/web-app/dist/assets/{chevron-left-Dnw3FUfv.js → chevron-left-z43N9oQm.js} +1 -1
  40. package/web-app/dist/assets/{circle-alert-0YuABQsp.js → circle-alert-CFXh7q4_.js} +1 -1
  41. package/web-app/dist/assets/{clock-BfTPBqE_.js → clock-C5XlY5gQ.js} +1 -1
  42. package/web-app/dist/assets/{cloud-U5rcxyaM.js → cloud-DiRynGU2.js} +1 -1
  43. package/web-app/dist/assets/{code-xml-CT7mnLo9.js → code-xml-D0-7LFV7.js} +1 -1
  44. package/web-app/dist/assets/{database-DnFRHe25.js → database-BL7633cr.js} +1 -1
  45. package/web-app/dist/assets/{dollar-sign-Cg8vSzut.js → dollar-sign-DYcrnk0S.js} +1 -1
  46. package/web-app/dist/assets/{file-code-corner-C9wJ5M9f.js → file-code-corner-CUf4Ao24.js} +1 -1
  47. package/web-app/dist/assets/{file-plus-DAGg8T5E.js → file-plus-DiPFi2oQ.js} +1 -1
  48. package/web-app/dist/assets/{globe-SQIq4mlt.js → globe-2vq90XD6.js} +1 -1
  49. package/web-app/dist/assets/{hammer-BE_VAWqK.js → hammer-CPLZcW5e.js} +1 -1
  50. package/web-app/dist/assets/{index-Nrc84uca.js → index-8TqwI_NF.js} +3 -3
  51. package/web-app/dist/assets/{layers-CvPzIFLN.js → layers-DkjwiuGI.js} +1 -1
  52. package/web-app/dist/assets/{loader-circle-DrknPciC.js → loader-circle-B6seK0mv.js} +1 -1
  53. package/web-app/dist/assets/{lock-TPRS1m2Y.js → lock-BokWI7Bq.js} +1 -1
  54. package/web-app/dist/assets/{package-0KxSELeP.js → package-Bwj3Yy9P.js} +1 -1
  55. package/web-app/dist/assets/{plus-D38LiOt0.js → plus-DDtdbe28.js} +1 -1
  56. package/web-app/dist/assets/{refresh-cw-Bq5kDx5g.js → refresh-cw-MCFH-IYf.js} +1 -1
  57. package/web-app/dist/assets/{rotate-ccw-D-9KOiif.js → rotate-ccw-DpGrHe4v.js} +1 -1
  58. package/web-app/dist/assets/{scroll-text-Bz2BxifR.js → scroll-text-AlMeqOJW.js} +1 -1
  59. package/web-app/dist/assets/{server-Bt7O7NPG.js → server-DlQAxyoR.js} +1 -1
  60. package/web-app/dist/assets/{shield-alert-C_x87oIm.js → shield-alert-QMLIe6EO.js} +1 -1
  61. package/web-app/dist/assets/{thumbs-up-3W29s5do.js → thumbs-up-CH-iPy2L.js} +1 -1
  62. package/web-app/dist/assets/{trash-2-Dk7t0nmx.js → trash-2-CC40OFfT.js} +1 -1
  63. package/web-app/dist/assets/{trending-down-Dfq93DOI.js → trending-down-BkpkaJJX.js} +1 -1
  64. package/web-app/dist/assets/{trending-up-CfGRGEXJ.js → trending-up-M8yk4S0A.js} +1 -1
  65. package/web-app/dist/assets/{upload-DJ3iWPcy.js → upload-EHu6t2yj.js} +1 -1
  66. package/web-app/dist/assets/{usePolling-BHg1_N-o.js → usePolling-BavtK4H1.js} +1 -1
  67. package/web-app/dist/assets/{user-BxZEq1F9.js → user-DP41l_sQ.js} +1 -1
  68. package/web-app/dist/index.html +1 -1
package/mcp/__init__.py CHANGED
@@ -75,4 +75,4 @@ try:
75
75
  except ImportError:
76
76
  __all__ = ['mcp']
77
77
 
78
- __version__ = '11.127.0'
78
+ __version__ = '11.128.1'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "loki-mode",
3
3
  "mcpName": "io.github.asklokesh/loki-mode",
4
- "version": "11.127.0",
4
+ "version": "11.128.1",
5
5
  "description": "An autonomous software factory that knows what it is supposed to deliver, and proves it did.",
6
6
  "keywords": [
7
7
  "agent",
@@ -161,5 +161,5 @@
161
161
  "dependencies": {
162
162
  "@resvg/resvg-wasm": "^2.6.2"
163
163
  },
164
- "gitHead": "9591c6212308c4a0838e2bbfc8347f1b356acd44"
164
+ "gitHead": "56dc3d5a7d69f12288d0bdbe43303bf43e9011d2"
165
165
  }
@@ -11880,7 +11880,7 @@ function pySpans(src) {
11880
11880
  if (!m)
11881
11881
  continue;
11882
11882
  const indent = m[1].length;
11883
- while (stack.length && stack[stack.length - 1].indent >= indent)
11883
+ while (stack.length && (stack[stack.length - 1].indent >= indent || stack[stack.length - 1].span.end < k + 1))
11884
11884
  stack.pop();
11885
11885
  let end = k, depth = 0;
11886
11886
  for (let j = k;j < lines.length; j++) {
@@ -15255,6 +15255,14 @@ function buildTestMap(root) {
15255
15255
  }
15256
15256
  }
15257
15257
  const sourceRefs = Object.create(null);
15258
+ const goMods = files.filter((f) => basename14(f) === "go.mod").map((f) => ({ dir: dirname15(f), path: /^module\s+(\S+)/m.exec(readText(join50(root, f)))?.[1] })).filter((m) => !!m.path).sort((a, b) => b.path.length - a.path.length);
15259
+ const goImportDir = (imp) => {
15260
+ const m = goMods.find((x) => imp === x.path || imp.startsWith(`${x.path}/`));
15261
+ if (!m)
15262
+ return null;
15263
+ const rel = join50(m.dir, imp.slice(m.path.length + 1));
15264
+ return rel === "" ? "." : rel;
15265
+ };
15258
15266
  const specs = Object.create(null);
15259
15267
  for (const t of tests) {
15260
15268
  const text3 = jsText.get(t.path) ?? readText(join50(root, t.path));
@@ -15264,6 +15272,12 @@ function buildTestMap(root) {
15264
15272
  if (/\.(?:java|cs)$/.test(t.path))
15265
15273
  for (const w of pascalWords(text3))
15266
15274
  names.add(w);
15275
+ if (t.runner === "go")
15276
+ for (const m of text3.matchAll(/"([\w.\-~]+(?:\/[\w.\-~]+)*)"/g)) {
15277
+ const d = goImportDir(m[1]);
15278
+ if (d !== null)
15279
+ names.add(`godir:${d}`);
15280
+ }
15267
15281
  for (const n3 of names) {
15268
15282
  (sourceRefs[n3] ??= []).push(t.path);
15269
15283
  }
@@ -15301,6 +15315,13 @@ function impactedRefs(map, changedFiles) {
15301
15315
  for (const s of stems)
15302
15316
  for (const p of sourceRefs[s] ?? [])
15303
15317
  add3(map.tests.find((t) => t.path === p));
15318
+ if (extname2(rel) === ".go") {
15319
+ for (const t of map.tests)
15320
+ if (t.runner === "go" && dirname15(t.path) === dirname15(rel))
15321
+ add3(t);
15322
+ for (const p of sourceRefs[`godir:${dirname15(rel)}`] ?? [])
15323
+ add3(map.tests.find((t) => t.path === p));
15324
+ }
15304
15325
  }
15305
15326
  return scopeRefs(map, changedFiles.map(normalizeRel), out2);
15306
15327
  }
@@ -16579,20 +16600,49 @@ function* corroborateGoSteps(c, out2, cmdOrLine, args, toks, o) {
16579
16600
  };
16580
16601
  try {
16581
16602
  const want = new Set(names.map((n3) => n3.slice(0, n3.indexOf("::")))), expected = new Set;
16582
- const ls2 = yield ["go", ["list", "-json=ImportPath,Dir,GoFiles,CgoFiles", ...where], spawnOpts];
16583
- if (ls2.status !== 0)
16603
+ const listed = (out3) => {
16604
+ const r2 = [];
16605
+ for (const chunk of out3.split(/\n(?=\{\n)/)) {
16606
+ try {
16607
+ r2.push(JSON.parse(chunk));
16608
+ } catch {
16609
+ return null;
16610
+ }
16611
+ }
16612
+ return r2;
16613
+ };
16614
+ const ls2 = yield ["go", ["list", "-json=ImportPath,Dir,GoFiles,CgoFiles,TestImports,XTestImports", ...where], spawnOpts];
16615
+ const top = ls2.status === 0 ? listed(ls2.output) : null;
16616
+ if (!top)
16584
16617
  return refuse;
16585
- const perPkg = new Map;
16586
- for (const chunk of ls2.output.split(/\n(?=\{\n)/)) {
16587
- let pk;
16588
- try {
16589
- pk = JSON.parse(chunk);
16590
- } catch {
16591
- return refuse;
16618
+ const cover = new Map, testOnly = [], ownImports = [];
16619
+ for (const pk of top)
16620
+ if (pk.ImportPath && want.has(pk.ImportPath)) {
16621
+ if (pk.GoFiles?.length)
16622
+ cover.set(pk.ImportPath, pk);
16623
+ else {
16624
+ const imps = [...pk.TestImports ?? [], ...pk.XTestImports ?? []];
16625
+ testOnly.push(...imps);
16626
+ ownImports.push(imps);
16627
+ }
16592
16628
  }
16593
- if (!pk.ImportPath || !want.has(pk.ImportPath))
16594
- continue;
16595
- if (!pk.Dir || !pk.GoFiles?.length || pk.CgoFiles?.length)
16629
+ const viaImports = [...new Set(testOnly)].filter((i) => !cover.has(i) && !want.has(i));
16630
+ if (top.some((pk) => pk.ImportPath && want.has(pk.ImportPath) && !pk.GoFiles?.length) && viaImports.length) {
16631
+ const li = yield ["go", ["list", "-e", "-json=ImportPath,Dir,GoFiles,CgoFiles,Standard,Module", ...viaImports], spawnOpts];
16632
+ const deps = li.status === 0 ? listed(li.output) : null;
16633
+ if (!deps)
16634
+ return refuse;
16635
+ for (const pk of deps)
16636
+ if (pk.ImportPath && !pk.Standard && pk.Module?.Main === true && pk.GoFiles?.length)
16637
+ cover.set(pk.ImportPath, pk);
16638
+ }
16639
+ if (cover.size === 0 || [...want].some((pk) => !cover.has(pk) && !top.some((t) => t.ImportPath === pk && !t.GoFiles?.length)))
16640
+ return refuse;
16641
+ if (ownImports.some((imps) => !imps.some((i) => cover.has(i))))
16642
+ return refuse;
16643
+ const perPkg = new Map;
16644
+ for (const pk of cover.values()) {
16645
+ if (!pk.ImportPath || !pk.Dir || !pk.GoFiles?.length || pk.CgoFiles?.length)
16596
16646
  return refuse;
16597
16647
  perPkg.set(pk.ImportPath, 0);
16598
16648
  for (const f of pk.GoFiles) {
@@ -16612,16 +16662,17 @@ function* corroborateGoSteps(c, out2, cmdOrLine, args, toks, o) {
16612
16662
  });
16613
16663
  }
16614
16664
  }
16615
- if (![...want].every((pk) => (perPkg.get(pk) ?? 0) > 0))
16665
+ if (![...cover.keys()].every((pk) => (perPkg.get(pk) ?? 0) > 0))
16616
16666
  return refuse;
16617
- const r = yield ["go", ["test", "-json", "-count=1", `-coverprofile=${prof}`, ...run2, ...where], spawnOpts];
16667
+ const viaPkg = [...cover.keys()].some((pk) => !want.has(pk));
16668
+ const r = yield ["go", ["test", "-json", "-count=1", `-coverprofile=${prof}`, ...viaPkg ? [`-coverpkg=${[...cover.keys()].join(",")}`] : [], ...run2, ...where], spawnOpts];
16618
16669
  const second = goJson(stripAnsi(r.output));
16619
16670
  if (r.status !== 0 || !second || second.failed || !second.complete)
16620
16671
  return refuse;
16621
16672
  const again = new Set(second.passedNames);
16622
16673
  if (!names.every((n3) => again.has(n3)))
16623
16674
  return refuse;
16624
- const got = [...profBlocks()].filter((k) => [...want].some((pk) => k.startsWith(`${pk}/`) && !k.slice(pk.length + 1).includes("/")));
16675
+ const got = [...profBlocks()].filter((k) => [...cover.keys()].some((pk) => k.startsWith(`${pk}/`) && !k.slice(pk.length + 1).includes("/")));
16625
16676
  return got.length === expected.size && got.every((k) => expected.has(k)) ? c : refuse;
16626
16677
  } finally {
16627
16678
  rmSync10(dir, { recursive: true, force: true });
@@ -16826,12 +16877,109 @@ function changedSymbols(diffU0) {
16826
16877
  flush();
16827
16878
  return [...out2];
16828
16879
  }
16880
+ function goInterfaceMethod(name, methods) {
16881
+ if (["Error", "String", "GoString", "Format"].includes(name))
16882
+ return true;
16883
+ if (["Unwrap", "Is", "As"].includes(name))
16884
+ return methods.has("Error");
16885
+ const sorts = GO_SORT.every((m) => methods.has(m));
16886
+ return (GO_SORT.includes(name) || name === "Push" || name === "Pop") && sorts && (GO_SORT.includes(name) || methods.has("Push") && methods.has("Pop"));
16887
+ }
16888
+ function addedPublicFunctions(path, head, base) {
16889
+ if (notApiFile(path, head))
16890
+ return [];
16891
+ const lang = langOf(path);
16892
+ if (lang !== "py" && lang !== "go" && lang !== "rs" && lang !== "ts")
16893
+ return [];
16894
+ const spans = symbolSpans(path, head), had = new Set(symbolSpans(path, base).map((x) => x.name)), byName = new Map(spans.map((x) => [x.name, x]));
16895
+ const lines = head.split(`
16896
+ `), exported = lang === "ts" ? tsExportList(head) : new Set, out2 = new Set;
16897
+ const declOf = (start) => lines.slice(start - 1, start + 4).find((l) => !/^\s*@/.test(l)) ?? "";
16898
+ for (const sp of spans) {
16899
+ if (sp.container || had.has(sp.name))
16900
+ continue;
16901
+ const parts = sp.name.split("."), name = parts[parts.length - 1], parent = parts.length > 1 ? byName.get(parts.slice(0, -1).join(".")) : undefined, decl = declOf(sp.start);
16902
+ if (lang === "py") {
16903
+ if (/^\s*(?:async\s+)?def\s/.test(decl) && parts.every((x) => !x.startsWith("_")))
16904
+ out2.add(name);
16905
+ continue;
16906
+ }
16907
+ if (lang === "go") {
16908
+ const recv = parent?.name ?? (parts.length > 1 ? parts[parts.length - 2] : undefined);
16909
+ if (/^func\b/.test(decl) && /^[A-Z]/.test(name) && (recv === undefined ? true : /^[A-Z]/.test(recv) && !goInterfaceMethod(name, new Set(spans.filter((x) => x.name.startsWith(`${recv}.`)).map((x) => x.name.slice(recv.length + 1))))))
16910
+ out2.add(name);
16911
+ continue;
16912
+ }
16913
+ if (lang === "rs") {
16914
+ if (/\bpub(?:\([^)]*\))?\s+(?:const\s+)?(?:async\s+)?(?:unsafe\s+)?(?:extern\s+"[^"]*"\s+)?fn\s/.test(decl))
16915
+ out2.add(name);
16916
+ continue;
16917
+ }
16918
+ const arrowHead = /^\s*(?:export\s+)?(?:const|let|var)\s[^=]*=\s*(?:async\s*)?(?:<[^>]*>\s*)?\(\s*$/.test(decl) ? lines.slice(sp.start - 1, Math.min(sp.end, sp.start + 30)).join(`
16919
+ `) : "";
16920
+ const fnLike = /\bfunction\b|=>|^\s*(?:(?:public|static|async|override|readonly|get|set)\s+)*[A-Za-z_$][\w$]*\s*(?:<[^>]*>)?\s*\(/.test(decl) || /^[^]*?\)\s*(?::[^=]*?)?=>/.test(arrowHead);
16921
+ if (!fnLike || name === "constructor" || /^\s*(?:export\s+)?(?:declare\s|type\s)/.test(decl))
16922
+ continue;
16923
+ if (parent) {
16924
+ const cls = declOf(parent.start);
16925
+ if ((/^\s*export\s/.test(cls) || exported.has(parent.name)) && !/^\s*(?:private|protected)\b|#/.test(decl))
16926
+ out2.add(name);
16927
+ } else if (/^\s*export\s/.test(decl) || exported.has(name))
16928
+ out2.add(name);
16929
+ }
16930
+ if (lang === "go") {
16931
+ const vars = (src) => new Set([...src.matchAll(/^var\s+([A-Z]\w*)\s*=\s*func\b/gm)].map((m) => m[1]));
16932
+ const was = vars(base);
16933
+ for (const v of vars(head))
16934
+ if (!was.has(v))
16935
+ out2.add(v);
16936
+ }
16937
+ return [...out2];
16938
+ }
16939
+ function unreferenced(symbols, sources2) {
16940
+ const sets = sources2.map((x) => identifierSet(x)), plain = symbols.filter((x) => !PLAIN_IDENT.test(x)), code = plain.length ? sources2.map(codeOnly) : [];
16941
+ return symbols.filter((sym) => PLAIN_IDENT.test(sym) ? !sets.some((st) => st.has(sym)) : !code.some((src) => refRe(sym).test(src)));
16942
+ }
16829
16943
  function symbolGap(symbols, testSources) {
16830
16944
  if (symbols.length === 0)
16831
16945
  return ["(no declared symbol)"];
16832
- const ref = (sym, src) => new RegExp(`(?<![\\w$])${sym.replace(/[$]/g, "\\$")}(?![\\w$])`).test(src);
16833
- const code = testSources.map(stripComments);
16834
- return code.some((src) => symbols.some((sym) => ref(sym, src))) ? [] : [...symbols];
16946
+ return unreferenced(symbols, testSources).length === symbols.length ? [...symbols] : [];
16947
+ }
16948
+ function callerFiles(changed, candidates) {
16949
+ const names = new Set(changed.flatMap((f) => symbolSpans(f.path, f.src).filter((x) => !x.container).map((x) => x.name.split(".").pop())));
16950
+ if (names.size === 0)
16951
+ return [];
16952
+ return candidates.filter((f) => {
16953
+ for (const n3 of calledNames(codeOnly(f.src)))
16954
+ if (names.has(n3))
16955
+ return true;
16956
+ return false;
16957
+ });
16958
+ }
16959
+ function exercisedViaCallers(unexercised, seed, files) {
16960
+ const byName = new Map, seeds = [];
16961
+ for (const f of files) {
16962
+ const code = codeOnly(f.src), lines = code.split(`
16963
+ `);
16964
+ for (const x of symbolSpans(f.path, f.src)) {
16965
+ if (x.container)
16966
+ continue;
16967
+ const name = x.name.split(".").pop(), called = calledNames(lines.slice(x.start, x.end).join(`
16968
+ `));
16969
+ (byName.get(name) ?? byName.set(name, []).get(name)).push(called);
16970
+ if (seed(name, f.path))
16971
+ seeds.push(name);
16972
+ }
16973
+ }
16974
+ const covered = new Set(seeds), work = [...covered];
16975
+ for (let n3 = work.pop();n3 !== undefined; n3 = work.pop())
16976
+ for (const called of byName.get(n3) ?? [])
16977
+ for (const c of called)
16978
+ if (byName.has(c) && !covered.has(c)) {
16979
+ covered.add(c);
16980
+ work.push(c);
16981
+ }
16982
+ return unexercised.filter((f) => !covered.has(f));
16835
16983
  }
16836
16984
  function explainGates(receiptPath) {
16837
16985
  let checks = [];
@@ -18092,6 +18240,9 @@ exit $st`, wrapperOr = (repoDir, w, bare) => existsSync33(join53(repoDir, w)) ?
18092
18240
  if (m)
18093
18241
  out2.push(m[1]);
18094
18242
  return out2.filter((n3) => !NOT_A_NAME.has(n3));
18243
+ }, GO_SORT, API_FILE_EXT, GENERATED_PATH, TEST_SUPPORT_PATH, GENERATED_HEADER, notApiFile = (path, src = "") => !API_FILE_EXT.test(path) || isTestFile(path) || TEST_SUPPORT_PATH.test(path) || GENERATED_PATH.test(path) || GENERATED_HEADER.test(src.slice(0, 2000)), tsExportList = (src) => new Set([...src.matchAll(/^\s*export\s*\{([^}]*)\}/gm)].flatMap((m) => m[1].split(",").map((x) => x.trim().split(/\s+as\s+/)[0].trim()).filter(Boolean)).concat([...src.matchAll(/^\s*export\s+default\s+([A-Za-z_$][\w$]*)\s*;?\s*$/gm)].map((m) => m[1]))), codeOnly = (src) => stripComments(src.replace(/"""[\s\S]*?"""|'''[\s\S]*?'''|`(?:\\[\s\S]|[^`\\])*`|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'/g, '""')), refRe = (sym) => new RegExp(`(?<![\\w$])${sym.replace(/[$]/g, "\\$")}(?![\\w$])`), IDENT2, PLAIN_IDENT, identifierSet = (src, keepStrings = false) => new Set((keepStrings ? stripComments(src) : codeOnly(src)).match(IDENT2) ?? []), CALL, calledNames = (code) => new Set([...code.matchAll(CALL)].map((m) => m[1])), moduleToken = (path) => {
18244
+ const parts = path.split("/"), base = (parts.pop() ?? "").replace(/\.[^.]+$/, "");
18245
+ return path.endsWith(".go") || /^(?:index|__init__|mod|lib|main)$/.test(base) ? parts.pop() ?? base : base;
18095
18246
  }, printable = (s) => s.replace(UNSAFE_TERMINAL_CHARS_RE, "?"), SENSITIVE, API, TEST_CFG, RANK3, FILES_MEDIUM = 4, FILES_HIGH = 15, LINES_MEDIUM = 100, LINES_HIGH = 500, RAN_ALWAYS, REVIEWER_ITEM = "one reviewer", PLAN, LOW_SKIPPED, deferredOf = (tier, selected, executed) => (tier === "low" ? LOW_SKIPPED : selected).filter((c) => !RAN_ALWAYS.includes(c) && !executed.includes(c)), DEEP_ITEMS, NOT_SELECTED = "not selected by risk tier: ", SECURITY_SCAN = "security scan", MANIFEST_LOCKS, dirOf = (p) => p.includes("/") ? p.slice(0, p.lastIndexOf("/")) : "", PKG_DEP_KEYS, PYPROJECT_NONDEP, SEM_RULES, DOC_FILE, readOr = (p) => {
18096
18247
  try {
18097
18248
  return readFileSync43(p, "utf8");
@@ -18127,6 +18278,7 @@ var init_check_result = __esm(() => {
18127
18278
  init_safe_git();
18128
18279
  init_redact();
18129
18280
  init_spec_file();
18281
+ init_context_pack();
18130
18282
  FAIL_EVIDENCE = /\[(?:build|setup) failed\]|^--- FAIL|^[\w./-]+\.go:\d+:\d+: \S|\b[1-9]\d* (?:failed|errors?)\b/m;
18131
18283
  GO_FAIL_EVIDENCE = /^FAIL\t\S+\t[\d.]+s$|^panic: /m;
18132
18284
  CARGO_NOISE = /^\s*(?:Compiling|Finished|Running|Doc-tests|Fresh|Blocking|Downloaded|Downloading|Updating|Locking|Adding|Packaging|Building)\b|^(?:warning|error|note|help)\b|^\s*(?:-->|=\s|\||\d+\s*\||\^|~)|^(?:Some errors have detailed|For more information about)/;
@@ -18166,6 +18318,14 @@ var init_check_result = __esm(() => {
18166
18318
  GO_METHOD_RE = /\bfunc\s*\([^)]*\)\s*([A-Za-z_]\w*)/g;
18167
18319
  METHOD_RE = /^\s*(?:(?:public|private|protected|static|async|export|override|final|abstract)\s+)*([A-Za-z_$][\w$]*)\s*\([^)]*\)\s*(?::\s*[^{=]+)?\{\s*$/;
18168
18320
  NOT_A_NAME = new Set(["if", "for", "while", "switch", "catch", "function", "return", "else", "with", "constructor"]);
18321
+ GO_SORT = ["Len", "Less", "Swap"];
18322
+ API_FILE_EXT = /\.(?:[cm]?[jt]sx?|py|go|rs)$/;
18323
+ GENERATED_PATH = /(?:\.pb\.go|_pb2(?:_grpc)?\.pyi?|\.pb\.[cm]?[jt]s|[._-]gen(?:erated)?\.\w+|\.d\.[cm]?ts)$/;
18324
+ TEST_SUPPORT_PATH = /(^|\/)(?:tests?|__tests__|spec|testutils?|testhelpers?|test_?helpers?|testing|testdata|fixtures?|mocks?)\/|(^|\/)conftest\.py$/;
18325
+ GENERATED_HEADER = /^\s*(?:\/\/|#)\s*Code generated .* DO NOT EDIT\.?\s*$|@generated\b/m;
18326
+ IDENT2 = /[\w$]+/g;
18327
+ PLAIN_IDENT = /^[\w$]+$/;
18328
+ CALL = /(?<![\w$])([\w$]+)\s*\(/g;
18169
18329
  SENSITIVE = [
18170
18330
  ["auth", /(^|\/)(auth|oauth|sso|session|login|permission|rbac|acl)[\w.-]*(\/|\.|$)/i],
18171
18331
  ["crypto", /(^|\/)(crypt|crypto|jwt|signing|keys?|secrets?|tokens?|credential|password)[\w.-]*(\/|\.|$)/i],
@@ -30627,6 +30787,7 @@ __export(exports_seal, {
30627
30787
  commitStage: () => commitStage,
30628
30788
  canonicalJson: () => canonicalJson,
30629
30789
  WALL_GREEN_ON_BASE_REASON: () => WALL_GREEN_ON_BASE_REASON,
30790
+ UNEXERCISED_PUBLIC: () => UNEXERCISED_PUBLIC,
30630
30791
  SIGNING_UNAVAILABLE: () => SIGNING_UNAVAILABLE,
30631
30792
  LEAN_NO_SYMBOL: () => LEAN_NO_SYMBOL,
30632
30793
  EXTERNAL_NO_WALL: () => EXTERNAL_NO_WALL,
@@ -30637,30 +30798,67 @@ __export(exports_seal, {
30637
30798
  import { createHash as createHash30 } from "crypto";
30638
30799
  import { existsSync as existsSync62, readdirSync as readdirSync33, mkdirSync as mkdirSync43, readFileSync as readFileSync81 } from "fs";
30639
30800
  import { basename as basename26, isAbsolute as isAbsolute16, join as join95, relative as relative19 } from "path";
30640
- async function leanSymbolGap(ctx, o, rawDiff, head, vraw) {
30641
- if (externalRun(o) || Array.isArray(o.wall?.files) && o.wall.files.length > 0 || o.intake?.already_satisfied === true || o.implement?.exit === "already_done")
30642
- return [];
30643
- const code = [];
30801
+ async function symbolGaps(ctx, o, rawDiff, head, vraw) {
30802
+ const none = { lean: [], pub: [] };
30803
+ if (externalRun(o) || o.intake?.already_satisfied === true || o.implement?.exit === "already_done")
30804
+ return none;
30805
+ const touched = new Set, code = [], added = [];
30644
30806
  for (let i = 0;i + 1 < rawDiff.length; i += 2) {
30645
30807
  const st = rawDiff[i].trim().split(" ").pop() ?? "", f = rawDiff[i + 1];
30646
- if (st !== "D" && CODE_FILE_EXT.test(f) && !isTestFile(f))
30808
+ touched.add(f);
30809
+ if (st !== "D" && (CODE_FILE_EXT.test(f) || API_FILE_EXT.test(f)) && !isTestFile(f))
30647
30810
  code.push(f);
30811
+ if (st === "A")
30812
+ added.push(f);
30648
30813
  }
30649
30814
  if (code.length === 0)
30650
- return [];
30651
- const d = await safeGitRun(ctx.repoDir, ["diff", "-U0", "--no-color", "--no-ext-diff", "--no-textconv", "--no-renames", ctx.baseSha, head, "--", ...code], { timeoutMs: 20000 });
30652
- if (d.exitCode !== 0)
30653
- return [];
30654
- const sources2 = [];
30655
- for (const c of vraw)
30656
- if (isExecutedProof(c)) {
30657
- const n3 = String(c.name ?? ""), p = n3.slice(n3.indexOf(":") + 1);
30658
- if (n3.includes(":") && isTestFile(p))
30659
- try {
30660
- sources2.push(readFileSync81(join95(ctx.repoDir, p), "utf8"));
30661
- } catch {}
30815
+ return none;
30816
+ const read3 = (p) => {
30817
+ try {
30818
+ return readFileSync81(join95(ctx.repoDir, p), "utf8");
30819
+ } catch {
30820
+ return "";
30662
30821
  }
30663
- return symbolGap(changedSymbols(d.stdout), sources2);
30822
+ };
30823
+ const executed = vraw.filter((c) => isExecutedProof(c)), testOf = (c) => {
30824
+ const n3 = String(c.name ?? ""), p = n3.slice(n3.indexOf(":") + 1);
30825
+ return n3.includes(":") && !n3.startsWith("full suite:") && isTestFile(p) ? p : null;
30826
+ };
30827
+ const allSources = executed.map(testOf).filter((p) => p !== null).map(read3);
30828
+ const ranWall = Array.isArray(o.wall?.files) && o.wall.files.length > 0, leanFiles = code.filter((f) => CODE_FILE_EXT.test(f));
30829
+ let lean = [];
30830
+ if (!ranWall && leanFiles.length) {
30831
+ const d = await safeGitRun(ctx.repoDir, ["diff", "-U0", "--no-color", "--no-ext-diff", "--no-textconv", "--no-renames", ctx.baseSha, head, "--", ...leanFiles], { timeoutMs: 20000 });
30832
+ if (d.exitCode === 0)
30833
+ lean = symbolGap(changedSymbols(d.stdout), allSources);
30834
+ }
30835
+ if (process.env["LOKI_E10_PUBLIC_GAP"] !== "1")
30836
+ return { lean, pub: [] };
30837
+ const files = code.filter((f) => API_FILE_EXT.test(f)).map((path) => ({ path, src: read3(path) }));
30838
+ const fns = [];
30839
+ for (const f of files) {
30840
+ const base2 = added.includes(f.path) ? "" : await safeGitRun(ctx.repoDir, ["show", `${ctx.baseSha}:${f.path}`], { timeoutMs: 20000 });
30841
+ const b = typeof base2 === "string" ? base2 : base2.exitCode === 0 ? base2.stdout : null;
30842
+ if (b !== null)
30843
+ fns.push(...addedPublicFunctions(f.path, f.src, b));
30844
+ }
30845
+ if (fns.length === 0)
30846
+ return { lean, pub: [] };
30847
+ const wall = new Set((o.wall?.files ?? []).map((f) => isAbsolute16(f.path) ? relative19(ctx.repoDir, f.path) : f.path));
30848
+ const paths = new Set(executed.map(testOf).filter((p) => p !== null && (wall.has(p) || !touched.has(p))));
30849
+ const ls2 = await safeGitRun(ctx.repoDir, ["ls-files", "-z"], { timeoutMs: 20000 }), tracked = ls2.exitCode === 0 ? ls2.stdout.split("\x00").filter((t) => t && !touched.has(t)) : [];
30850
+ if (executed.some((c) => String(c.name ?? "").startsWith("full suite:"))) {
30851
+ for (const t of tracked)
30852
+ if (isTestFile(t))
30853
+ paths.add(t);
30854
+ }
30855
+ const texts = [...paths].map(read3), idents = texts.map((t) => identifierSet(t)), imports2 = texts.map((t) => identifierSet(t, true)), named2 = new Set(fns.filter((f) => idents.some((st) => st.has(f))));
30856
+ const pending = [...new Set(fns)].filter((f) => !named2.has(f));
30857
+ if (pending.length === 0)
30858
+ return { lean, pub: [] };
30859
+ const candidates = tracked.filter((t) => !notApiFile(t)).slice(0, CALLER_SCAN).map((path) => ({ path, src: read3(path) })).filter((f) => f.src.length <= CALLER_MAX_BYTES && !notApiFile(f.path, f.src));
30860
+ const changedPaths = new Set(files.map((f) => f.path)), seed = (name, path) => idents.some((st, i) => st.has(name) && (changedPaths.has(path) || imports2[i].has(moduleToken(path))));
30861
+ return { lean, pub: exercisedViaCallers(pending, seed, [...files, ...callerFiles(files, candidates)]) };
30664
30862
  }
30665
30863
  function receiptSha256(r) {
30666
30864
  const { verification: _v, receipt_sha256: _h, ...body } = r;
@@ -30742,7 +30940,7 @@ function renderReceiptMd(r) {
30742
30940
  ].join(`
30743
30941
  `);
30744
30942
  }
30745
- var SYSTEM_INTERP = "tests ran on the system interpreter", SYSTEM_INTERP_SUFFIX = " (the repo declares no Python dependencies, so this is its interpreter; informational, does not cap)", SIGNING_UNAVAILABLE = "receipt signing unavailable (no usable signing key: invalid key or unwritable ~/.loki/keys)", AGENT_ONLY_REASON = "only agent-authored tests executed (no agent-independent proof)", WALL_GREEN_ON_BASE_REASON = "Wall green on base: no Wall test discriminates the change", EXCLUDE_LOKI = ":(exclude).loki", sha2562 = (s) => createHash30("sha256").update(s).digest("hex"), str3 = (v) => typeof v === "string" && v !== "" ? v : null, EXTERNAL_MODEL_LABEL = "external (no Loki implement session)", EXTERNAL_DIFF_NOT_ISOLATED = "Wall author not filesystem-isolated from the external diff", EXTERNAL_NO_WALL = "external diff sealed with no Wall file that ran; the only checks are the repo's existing tests", externalRun = (o) => o.implement?.exit === "external", LEAN_NO_SYMBOL = "no passing check references a changed symbol and no Wall file ran", strs2 = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string" && x !== "") : [], g = (ctx) => (a) => git5(ctx, a), receiptRel = (ctx) => {
30943
+ var SYSTEM_INTERP = "tests ran on the system interpreter", SYSTEM_INTERP_SUFFIX = " (the repo declares no Python dependencies, so this is its interpreter; informational, does not cap)", SIGNING_UNAVAILABLE = "receipt signing unavailable (no usable signing key: invalid key or unwritable ~/.loki/keys)", AGENT_ONLY_REASON = "only agent-authored tests executed (no agent-independent proof)", WALL_GREEN_ON_BASE_REASON = "Wall green on base: no Wall test discriminates the change", EXCLUDE_LOKI = ":(exclude).loki", sha2562 = (s) => createHash30("sha256").update(s).digest("hex"), str3 = (v) => typeof v === "string" && v !== "" ? v : null, EXTERNAL_MODEL_LABEL = "external (no Loki implement session)", EXTERNAL_DIFF_NOT_ISOLATED = "Wall author not filesystem-isolated from the external diff", EXTERNAL_NO_WALL = "external diff sealed with no Wall file that ran; the only checks are the repo's existing tests", externalRun = (o) => o.implement?.exit === "external", LEAN_NO_SYMBOL = "no passing check references a changed symbol and no Wall file ran", UNEXERCISED_PUBLIC = "no agent-independent passing test calls these added public functions", CALLER_SCAN = 3000, CALLER_MAX_BYTES = 200000, strs2 = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string" && x !== "") : [], g = (ctx) => (a) => git5(ctx, a), receiptRel = (ctx) => {
30746
30944
  const r = relative19(ctx.repoDir, join95(ctx.runDir, "receipt.json"));
30747
30945
  return r.startsWith("..") || isAbsolute16(r) ? `.loki/runs/${ctx.runId}/receipt.json` : r;
30748
30946
  }, commitStage, wallGreenOnBaseOf = (o) => {
@@ -30855,9 +31053,9 @@ var init_seal = __esm(() => {
30855
31053
  const grp = sealGroup(ctx.runDir, receiptSha256);
30856
31054
  const executed = hasExecutedProof(vraw), proof = process.env["LOKI_EXOGENOUS_PROOF"] === "0" ? executed : hasExogenousProof(vraw, pctx);
30857
31055
  const uncoveredAfterLimit = o.implement?.exit === "killed" ? strs2(o.verify?.uncovered_changed) : [];
30858
- const leanGap = diffOk ? await leanSymbolGap(ctx, o, rawDiff, head, vraw) : [];
31056
+ const { lean: leanGap, pub: pubGap } = diffOk ? await symbolGaps(ctx, o, rawDiff, head, vraw) : { lean: [], pub: [] };
30859
31057
  const wpAll = publishableWall(ctx.repoDir, ctx.runDir, o, process.env, loadTaskText(ctx, str3(o.intake?.task) ?? undefined));
30860
- const verdict0 = capGroupVerdict(verdictOf2(o, checks.filter((c) => !(c.result === "fail" && preRedChecks.includes(c.name)) && c.repo_skipped !== true), !diffOk || diff.stdout === "", capVerify.length > 0 || weakTests.length > 0 || capRc.length > 0, wallGreenOnBase, proof, targetProofOf(o.verify), uncoveredAfterLimit, leanGap, wpAll.notes, wpAll.clauseGap), grp);
31058
+ const verdict0 = capGroupVerdict(verdictOf2(o, checks.filter((c) => !(c.result === "fail" && preRedChecks.includes(c.name)) && c.repo_skipped !== true), !diffOk || diff.stdout === "", capVerify.length > 0 || weakTests.length > 0 || capRc.length > 0, wallGreenOnBase, proof, targetProofOf(o.verify), uncoveredAfterLimit, [...leanGap, ...pubGap], wpAll.notes, wpAll.clauseGap), grp);
30861
31059
  const supply = await supplyGuard(ctx.repoDir, rawDiff.filter((_, i) => i % 2 === 1), readDeclared(ctx.repoDir), process.env);
30862
31060
  const verdict1 = supplyVerdict(verdict0, supply);
30863
31061
  const xr = await crossReview(ctx, verdict1, head, signal), verdict2 = minVerdict(verdict1, xr);
@@ -30958,6 +31156,8 @@ var init_seal = __esm(() => {
30958
31156
  notProven.add(o.verify.baseline_line);
30959
31157
  if (leanGap.length > 0)
30960
31158
  notProven.add(`${LEAN_NO_SYMBOL}: ${leanGap.join(", ")}`);
31159
+ if (pubGap.length > 0)
31160
+ notProven.add(`${UNEXERCISED_PUBLIC}: ${pubGap.join(", ")}`);
30961
31161
  if (externalRun(o) && !(Array.isArray(o.wall?.files) && o.wall.files.length > 0))
30962
31162
  notProven.add(EXTERNAL_NO_WALL);
30963
31163
  if (externalRun(o))
@@ -32697,13 +32897,16 @@ async function routeEscalate(ctx, first, session, rt, ids, noDiff = () => false)
32697
32897
  first.model = rt.current;
32698
32898
  first.iterationId = `${first.iterationId}-esc`;
32699
32899
  ids.push(first.iterationId);
32700
- return ctx.sessions.run(first);
32900
+ return ctx.sessions.run(trig === "already_done_claim" ? { ...first, brief: `${first.brief}
32901
+
32902
+ ${REDO_CHALLENGE}` } : first);
32701
32903
  }
32702
32904
  var UNIT = "run";
32703
32905
  var init_implement_route = __esm(() => {
32704
32906
  init_model_rank();
32705
32907
  init_unit_model();
32706
32908
  init_history();
32909
+ init_conflict_resume();
32707
32910
  });
32708
32911
 
32709
32912
  // ../../loki-ts/src/util/test_guard.ts
@@ -32935,10 +33138,22 @@ var init_implement = __esm(() => {
32935
33138
  ids.push(...w.ids);
32936
33139
  }
32937
33140
  }
32938
- if (!signal.aborted && !session.killed && session.exit === 0 && !session.markers.specConflict && !session.markers.alreadyDone && treeIsEmpty(ctx)) {
32939
- const r = await resumeAfterEmptyDone(ctx, { ...unchained(), iterationId: ids[ids.length - 1] }, session);
33141
+ let challenged = false;
33142
+ const routerRedid = rt?.escalations.some((e) => e.trigger === "already_done_claim") ?? false;
33143
+ const challenge = async () => {
33144
+ if (signal.aborted || session.killed || !session.markers.alreadyDone || session.markers.specConflict || challenged || routerRedid || process.env.LOKI_E10_ALREADY_DONE_CHALLENGE === "0")
33145
+ return;
33146
+ challenged = true;
33147
+ const r = await resumeAfterAlreadyDone(ctx, { ...unchained(), iterationId: ids[ids.length - 1] }, session);
33148
+ session = r.session;
33149
+ ids.push(r.iterationId);
33150
+ };
33151
+ await challenge();
33152
+ if (!challenged && !signal.aborted && !session.killed && session.exit === 0 && !session.markers.specConflict && !session.markers.alreadyDone && treeIsEmpty(ctx)) {
33153
+ const r = await resumeAfterEmptyDone(ctx, { ...unchained(), iterationId: ids[ids.length - 1] }, session, routerRedid);
32940
33154
  session = r.session;
32941
33155
  ids.push(r.iterationId);
33156
+ await challenge();
32942
33157
  }
32943
33158
  if (process.env.LOKI_E10_REPRO === "1" && !plan && !signal.aborted && !session.killed && session.exit === 0) {
32944
33159
  let bad = [];
@@ -32958,8 +33173,10 @@ var init_implement = __esm(() => {
32958
33173
  exit = "killed";
32959
33174
  } else if (session.markers.specConflict) {
32960
33175
  exit = "spec_conflict";
32961
- } else if (session.markers.alreadyDone) {
33176
+ } else if (session.markers.alreadyDone && treeIsEmpty(ctx)) {
32962
33177
  exit = "already_done";
33178
+ } else if (session.markers.alreadyDone) {
33179
+ exit = "done";
32963
33180
  } else if (session.exit !== 0) {
32964
33181
  exit = "error";
32965
33182
  } else {
@@ -37580,12 +37797,12 @@ ${String(s.stderr ?? "")}`.slice(-16000);
37580
37797
  const allPass = Object.values(perUnit).every((v) => v === "pass");
37581
37798
  return res({ suiteExit, ...wallResults ? { wallResults } : {}, ok: allPass, ...allPass ? {} : { reason: "a unit failed its own run" } });
37582
37799
  }
37583
- var IDENT2, SUITE_ENV_KEYS, git8 = (dir, args) => safeGitSpawn(dir, [...IDENT2, ...args], { encoding: "utf8" });
37800
+ var IDENT3, SUITE_ENV_KEYS, git8 = (dir, args) => safeGitSpawn(dir, [...IDENT3, ...args], { encoding: "utf8" });
37584
37801
  var init_integrate = __esm(() => {
37585
37802
  init_wall();
37586
37803
  init_group_integrate();
37587
37804
  init_safe_git();
37588
- IDENT2 = ["-c", "user.name=loki-integrate", "-c", "user.email=integrate@loki.invalid", "-c", "commit.gpgSign=false"];
37805
+ IDENT3 = ["-c", "user.name=loki-integrate", "-c", "user.email=integrate@loki.invalid", "-c", "commit.gpgSign=false"];
37589
37806
  SUITE_ENV_KEYS = ["PATH", "HOME", "TMPDIR", "LANG", "LC_ALL", "CI", "LOKI_NO_BROWSER"];
37590
37807
  });
37591
37808
 
@@ -39095,6 +39312,7 @@ function decomposeBrief(slug, i, triageReason, outPath, note = "") {
39095
39312
  "a slice that depends on another is built on top of that slice's branch.",
39096
39313
  `Use at most ${MAX_SLICES} slices, and fewer when the issue allows. Prefer independent slices (empty depends_on) that can be built at the same time over a chain: add a dependency only when a slice cannot be built without the other's code. A long serial chain is a failure of the plan, because one failed slice skips everything after it.`,
39097
39314
  "Give a slice several dependencies only when they are already on one chain.",
39315
+ `When a criterion changes behavior an existing test asserts (for example replacing ILIKE search with full-text search), search the repository's tests for it, put that test file in the slice's files, and say in the criterion that the test is updated to the new behavior. Never write "existing tests still pass" for behavior the slice replaces: the implementer treats an unnamed existing test as read-only and stops on the contradiction.`,
39098
39316
  "Do not edit, create or delete any repository file. You may read the repository to judge scope.",
39099
39317
  `Write exactly one JSON object to the file ${outPath} and nothing else to that file, in this form:`,
39100
39318
  '{"slices":[{"id":"s1","title":"<short title>","acceptance":["<checkable criterion>"],"depends_on":[],"files":["<path if known>"]}]}',
@@ -89944,11 +90162,11 @@ ${CONFLICT_CORRECTION}`, ...sid ? { resumeSessionId: sid } : {} });
89944
90162
  const durationS = firstSession.durationS + session.durationS;
89945
90163
  return { session: { ...terminal ? session : firstSession, durationS }, iterationId };
89946
90164
  }
89947
- async function resumeAfterEmptyDone(ctx, first, firstSession) {
89948
- const iterationId = `${first.iterationId}-e`, sid = ctx.provider === "claude" ? readSessionId(ctx.repoDir, first.iterationId) : null;
89949
- const session = await ctx.sessions.run({ ...first, iterationId, brief: sid ? EMPTY_DONE_CORRECTION : `${first.brief}
90165
+ async function resumeWith(ctx, first, firstSession, correction, suffix) {
90166
+ const iterationId = `${first.iterationId}${suffix}`, sid = ctx.provider === "claude" ? readSessionId(ctx.repoDir, first.iterationId) : null;
90167
+ const session = await ctx.sessions.run({ ...first, iterationId, brief: sid ? correction : `${first.brief}
89950
90168
 
89951
- ${EMPTY_DONE_CORRECTION}`, ...sid ? { resumeSessionId: sid } : {} });
90169
+ ${correction}`, ...sid ? { resumeSessionId: sid } : {} });
89952
90170
  const terminal = !session.killed && (session.markers.done || session.markers.alreadyDone !== null || session.markers.specConflict !== null);
89953
90171
  return { session: { ...terminal ? session : firstSession, durationS: firstSession.durationS + session.durationS }, iterationId };
89954
90172
  }
@@ -90275,7 +90493,7 @@ async function deliverOverWallConflict(o, repoDir, reverify, emit, opts = {}) {
90275
90493
  o.implement = { ...o.implement, exit: "done", conflict_delivered: files };
90276
90494
  return files;
90277
90495
  }
90278
- var refereeModel = (ctx) => capToRunTier(wallPinModel(), ctx.model, ["LOKI_E10_WALL_TIER", "LOKI_MODEL_OVERRIDE"]), AFTER_PLAN, FROM_PLAN, CONFLICT_CORRECTION, RESUME_MIN_LEFT_S = 60, EMPTY_DONE_CORRECTION, oneLine4 = (s) => s.replace(/[\u0000-\u001f\u007f]+/g, " ").trim().slice(0, 200), REFEREE_PER_CHECK = 1, REFEREE_PER_RUN = 2, wallRefereeEnabled = (env = process.env) => !["0", "off", "false"].includes((env.LOKI_E10_WALL_REFEREE ?? "").toLowerCase()), defaultRunCheck = (dir, ref) => {
90496
+ var refereeModel = (ctx) => capToRunTier(wallPinModel(), ctx.model, ["LOKI_E10_WALL_TIER", "LOKI_MODEL_OVERRIDE"]), AFTER_PLAN, FROM_PLAN, CONFLICT_CORRECTION, RESUME_MIN_LEFT_S = 60, EMPTY_DONE_HEAD = "Your session finished with LOKI_DONE but the working tree has no change against the base. Make the change the task asks for, or if the task is already satisfied finish with LOKI_ALREADY_DONE: <file:line evidence>, or if the task itself conflicts finish with LOKI_SPEC_CONFLICT: <reason; cite test as path:line>. ", EMPTY_DONE_CORRECTION, CHALLENGE_STEP = "A task's example code can encode the current, wrong behaviour (expected lines commented out, or asserting today's output), so passing it is not evidence. Reproduce the problem the task's prose describes with a check of the behaviour it asks for. If that check fails on the current code, make the change and finish with LOKI_DONE. Only if the described behaviour already holds, finish with LOKI_ALREADY_DONE: <file:line evidence of that behaviour>. ", ALREADY_DONE_CHALLENGE, REDO_CHALLENGE, EMPTY_DONE_CHALLENGED, resumeAfterEmptyDone = (ctx, first, firstSession, challenge = false) => resumeWith(ctx, first, firstSession, challenge ? EMPTY_DONE_CHALLENGED : EMPTY_DONE_CORRECTION, "-e"), resumeAfterAlreadyDone = (ctx, first, firstSession) => resumeWith(ctx, first, firstSession, ALREADY_DONE_CHALLENGE, "-a"), oneLine4 = (s) => s.replace(/[\u0000-\u001f\u007f]+/g, " ").trim().slice(0, 200), REFEREE_PER_CHECK = 1, REFEREE_PER_RUN = 2, wallRefereeEnabled = (env = process.env) => !["0", "off", "false"].includes((env.LOKI_E10_WALL_REFEREE ?? "").toLowerCase()), defaultRunCheck = (dir, ref) => {
90279
90497
  const r = new RealBaseTestRunner(undefined, undefined, { PYTHONDONTWRITEBYTECODE: "1" }).run(dir, [ref]);
90280
90498
  return r.fail > 0 ? "fail" : r.pass > 0 && (r.not_run ?? 0) === 0 ? "pass" : "not_run";
90281
90499
  }, readJson9 = (p) => {
@@ -90313,7 +90531,10 @@ var init_conflict_resume = __esm(() => {
90313
90531
  AFTER_PLAN = ["implement", "fix", "verify", "commit", "seal", "pr"];
90314
90532
  FROM_PLAN = ["plan", ...AFTER_PLAN];
90315
90533
  CONFLICT_CORRECTION = "Loki imposes no file or test limits on you. If your conflict is only about Loki's own rules, finish the task. If the task itself conflicts, restate the conflict. " + FINISH_LINE;
90316
- EMPTY_DONE_CORRECTION = "Your session finished with LOKI_DONE but the working tree has no change against the base. Make the change the task asks for, or if the task is already satisfied finish with LOKI_ALREADY_DONE: <file:line evidence>, or if the task itself conflicts finish with LOKI_SPEC_CONFLICT: <reason; cite test as path:line>. " + FINISH_LINE;
90534
+ EMPTY_DONE_CORRECTION = EMPTY_DONE_HEAD + FINISH_LINE;
90535
+ ALREADY_DONE_CHALLENGE = "You finished with LOKI_ALREADY_DONE without changing anything. " + CHALLENGE_STEP + FINISH_LINE;
90536
+ REDO_CHALLENGE = "An earlier session claimed LOKI_ALREADY_DONE without changing anything. Before you claim it too: " + CHALLENGE_STEP + FINISH_LINE;
90537
+ EMPTY_DONE_CHALLENGED = EMPTY_DONE_HEAD + "Before you claim LOKI_ALREADY_DONE: " + CHALLENGE_STEP + FINISH_LINE;
90317
90538
  });
90318
90539
 
90319
90540
  // ../../loki-ts/src/util/run_outputs.ts
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
3
  "name": "loki-mode",
4
4
  "displayName": "Loki Mode",
5
- "version": "11.127.0",
5
+ "version": "11.128.1",
6
6
  "description": "Autonomous spec-to-product build system with a built-in trust layer (RARV-C closure loop, 8 quality gates, completion council). Ships Loki's spec-hardening, drift-detection, and deterministic PR verification commands plus the Loki MCP server.",
7
7
  "author": {
8
8
  "name": "Autonomi",
@@ -1,4 +1,4 @@
1
- import{c as L,r as x,j as e,w as re,Z as ne,m as le,h as ie,p as P,F as ye,U as I,X as ce,L as de,x as oe,M as Ae,T as Z,S as we,l as xe,k as me,y as Ce,E as Fe,a0 as Se,a as U,a2 as he}from"./index-Nrc84uca.js";import{B as C}from"./Button-B2-mrb3C.js";import{T as $e}from"./trending-up-CfGRGEXJ.js";import{C as z}from"./clock-BfTPBqE_.js";import{A as Be,U as ue,M as De}from"./Avatar-QBOiE61Q.js";import{A as J}from"./activity-DTaR8f_c.js";import{R as pe}from"./refresh-cw-Bq5kDx5g.js";import{G as ze}from"./globe-SQIq4mlt.js";import{C as Le}from"./chevron-left-Dnw3FUfv.js";import{C as je}from"./check-qAOmxxI-.js";import{D as Y}from"./dollar-sign-Cg8vSzut.js";import{U as Te}from"./user-BxZEq1F9.js";import{D as Me}from"./database-DnFRHe25.js";import{L as Ue}from"./lock-TPRS1m2Y.js";import{S as Re}from"./scroll-text-Bz2BxifR.js";import{S as Ie}from"./shield-alert-C_x87oIm.js";/**
1
+ import{c as L,r as x,j as e,w as re,Z as ne,m as le,h as ie,p as P,F as ye,U as I,X as ce,L as de,x as oe,M as Ae,T as Z,S as we,l as xe,k as me,y as Ce,E as Fe,a0 as Se,a as U,a2 as he}from"./index-8TqwI_NF.js";import{B as C}from"./Button-dbsRjgbK.js";import{T as $e}from"./trending-up-M8yk4S0A.js";import{C as z}from"./clock-C5XlY5gQ.js";import{A as Be,U as ue,M as De}from"./Avatar-8tZOYCzr.js";import{A as J}from"./activity-kKs9rNVl.js";import{R as pe}from"./refresh-cw-MCFH-IYf.js";import{G as ze}from"./globe-2vq90XD6.js";import{C as Le}from"./chevron-left-z43N9oQm.js";import{C as je}from"./check-b7nwLuDG.js";import{D as Y}from"./dollar-sign-DYcrnk0S.js";import{U as Te}from"./user-DP41l_sQ.js";import{D as Me}from"./database-BL7633cr.js";import{L as Ue}from"./lock-BokWI7Bq.js";import{S as Re}from"./scroll-text-AlMeqOJW.js";import{S as Ie}from"./shield-alert-QMLIe6EO.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as l,j as s}from"./index-Nrc84uca.js";/**
1
+ import{c as l,j as s}from"./index-8TqwI_NF.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as e}from"./index-Nrc84uca.js";import{C as r}from"./clock-BfTPBqE_.js";import{C as a}from"./circle-alert-0YuABQsp.js";import{C as l}from"./check-qAOmxxI-.js";const i={completed:"bg-[#1FC5A8]/10 text-[#1FC5A8]",running:"bg-[#553DE9]/10 text-[#553DE9]",failed:"bg-[#C45B5B]/10 text-[#C45B5B]",started:"bg-[#D4A03C]/10 text-[#D4A03C]",empty:"bg-[#F8F4F0] text-[#6B6960]",version:"bg-[#553DE9]/10 text-[#553DE9]"};function o({status:t}){switch(t){case"completed":return e.jsx(l,{size:12});case"running":return e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping motion-reduce:animate-none absolute inline-flex h-full w-full rounded-full bg-current opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-current"})]});case"failed":return e.jsx(a,{size:12});case"started":return e.jsx(r,{size:12});default:return null}}function f({status:t,children:n,className:s=""}){return e.jsxs("span",{className:["inline-flex items-center gap-1 rounded-btn px-2.5 py-0.5 text-xs font-semibold",i[t],s].filter(Boolean).join(" "),children:[e.jsx(o,{status:t}),n]})}export{f as B};
1
+ import{j as e}from"./index-8TqwI_NF.js";import{C as r}from"./clock-C5XlY5gQ.js";import{C as a}from"./circle-alert-CFXh7q4_.js";import{C as l}from"./check-b7nwLuDG.js";const i={completed:"bg-[#1FC5A8]/10 text-[#1FC5A8]",running:"bg-[#553DE9]/10 text-[#553DE9]",failed:"bg-[#C45B5B]/10 text-[#C45B5B]",started:"bg-[#D4A03C]/10 text-[#D4A03C]",empty:"bg-[#F8F4F0] text-[#6B6960]",version:"bg-[#553DE9]/10 text-[#553DE9]"};function o({status:t}){switch(t){case"completed":return e.jsx(l,{size:12});case"running":return e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping motion-reduce:animate-none absolute inline-flex h-full w-full rounded-full bg-current opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-current"})]});case"failed":return e.jsx(a,{size:12});case"started":return e.jsx(r,{size:12});default:return null}}function f({status:t,children:n,className:s=""}){return e.jsxs("span",{className:["inline-flex items-center gap-1 rounded-btn px-2.5 py-0.5 text-xs font-semibold",i[t],s].filter(Boolean).join(" "),children:[e.jsx(o,{status:t}),n]})}export{f as B};
@@ -1 +1 @@
1
- import{r as p,j as t}from"./index-Nrc84uca.js";const m={primary:"bg-[#553DE9] text-white hover:bg-[#4432c4] shadow-button rounded-btn",secondary:"border border-[#553DE9] text-[#553DE9] hover:bg-[#E8E4FD] bg-transparent rounded-btn",ghost:"text-[#36342E] hover:bg-[#F8F4F0] rounded-btn",danger:"bg-[#C45B5B]/10 text-[#C45B5B] border border-[#C45B5B]/20 hover:bg-[#C45B5B]/20 rounded-btn"},b={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},u={sm:14,md:16,lg:18};function h({size:e}){return t.jsxs("svg",{className:"animate-spin",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}const B=p.forwardRef(({variant:e="primary",size:o="md",icon:n,iconRight:i,loading:r=!1,disabled:a,className:c="",children:l,...x},d)=>{const s=u[o];return t.jsxs("button",{ref:d,disabled:a||r,className:["inline-flex items-center justify-center gap-2 font-medium transition-colors",m[e],b[o],(a||r)&&"opacity-60 cursor-not-allowed",c].filter(Boolean).join(" "),...x,children:[r?t.jsx(h,{size:s}):n?t.jsx(n,{size:s}):null,l,i&&!r&&t.jsx(i,{size:s})]})});B.displayName="Button";export{B};
1
+ import{r as p,j as t}from"./index-8TqwI_NF.js";const m={primary:"bg-[#553DE9] text-white hover:bg-[#4432c4] shadow-button rounded-btn",secondary:"border border-[#553DE9] text-[#553DE9] hover:bg-[#E8E4FD] bg-transparent rounded-btn",ghost:"text-[#36342E] hover:bg-[#F8F4F0] rounded-btn",danger:"bg-[#C45B5B]/10 text-[#C45B5B] border border-[#C45B5B]/20 hover:bg-[#C45B5B]/20 rounded-btn"},b={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},u={sm:14,md:16,lg:18};function h({size:e}){return t.jsxs("svg",{className:"animate-spin",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}const B=p.forwardRef(({variant:e="primary",size:o="md",icon:n,iconRight:i,loading:r=!1,disabled:a,className:c="",children:l,...x},d)=>{const s=u[o];return t.jsxs("button",{ref:d,disabled:a||r,className:["inline-flex items-center justify-center gap-2 font-medium transition-colors",m[e],b[o],(a||r)&&"opacity-60 cursor-not-allowed",c].filter(Boolean).join(" "),...x,children:[r?t.jsx(h,{size:s}):n?t.jsx(n,{size:s}):null,l,i&&!r&&t.jsx(i,{size:s})]})});B.displayName="Button";export{B};
@@ -1,4 +1,4 @@
1
- import{c as $,r as l,j as e,G as we,Q as Se,F as Ce,h as Re,T as U,Z as Ee,a as S,V as Me,S as $e,Y as Te,X as Pe,P as ie,i as Ae,g as ze,C as Ie,l as Le,N as I,J as _e,K as De,O as Fe,u as Oe}from"./index-Nrc84uca.js";import{P as K,S as He,E as Be}from"./ErrorBoundary-BOKHLzbP.js";import{C as qe,F as Ge,M as Ue,H as Ke,a as We,G as Ve,T as Qe}from"./thumbs-up-3W29s5do.js";import{C as oe}from"./check-qAOmxxI-.js";import{C as Ye}from"./clock-BfTPBqE_.js";import{D as Xe}from"./dollar-sign-Cg8vSzut.js";import{U as Ze}from"./upload-DJ3iWPcy.js";import{L as V}from"./loader-circle-DrknPciC.js";/**
1
+ import{c as $,r as l,j as e,G as we,Q as Se,F as Ce,h as Re,T as U,Z as Ee,a as S,V as Me,S as $e,Y as Te,X as Pe,P as ie,i as Ae,g as ze,C as Ie,l as Le,N as I,J as _e,K as De,O as Fe,u as Oe}from"./index-8TqwI_NF.js";import{P as K,S as He,E as Be}from"./ErrorBoundary-KGmneVKo.js";import{C as qe,F as Ge,M as Ue,H as Ke,a as We,G as Ve,T as Qe}from"./thumbs-up-CH-iPy2L.js";import{C as oe}from"./check-b7nwLuDG.js";import{C as Ye}from"./clock-C5XlY5gQ.js";import{D as Xe}from"./dollar-sign-DYcrnk0S.js";import{U as Ze}from"./upload-EHu6t2yj.js";import{L as V}from"./loader-circle-B6seK0mv.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.