loki-mode 11.86.0 → 11.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +2 -2
- package/VERSION +1 -1
- package/dashboard/__init__.py +1 -1
- package/docs/CLI-REFERENCE.md +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/loki-ts/dist/loki.js +1222 -1220
- package/mcp/__init__.py +1 -1
- package/package.json +2 -2
- package/packages/control-plane/dist/server.js +183 -78
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/web-app/dist/assets/{AdminPage-CXRvxMO_.js → AdminPage-BZSZH480.js} +1 -1
- package/web-app/dist/assets/{Avatar-Bk9K6OnI.js → Avatar-Cyg5y96f.js} +1 -1
- package/web-app/dist/assets/{Badge-CDePJKKg.js → Badge-CWOFDg-f.js} +1 -1
- package/web-app/dist/assets/{Button-DMzR-FT4.js → Button-BpXB4zdp.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-Cfh42owC.js → CockpitPage-ofnfFbFu.js} +1 -1
- package/web-app/dist/assets/{ComparePage-Oft34xnR.js → ComparePage-CbChKWXQ.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-DlXBbQDo.js → ErrorBoundary-BqJ-8-Qn.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-C0LKef5y.js → EvidenceReceiptPanel-Bigp3AwY.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-CyqsExTP.js → GitHubIssuesPanel-Dnr57aE8.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-BC7ExtnE.js → GitHubPRsPanel-CASv_g39.js} +1 -1
- package/web-app/dist/assets/{HomePage-CmYisyjJ.js → HomePage-BIFq2V8N.js} +2 -2
- package/web-app/dist/assets/{LoginPage-Cunt-wYH.js → LoginPage-DfTMhcjt.js} +1 -1
- package/web-app/dist/assets/{MagicPage-lvGAbDEv.js → MagicPage-iMux51iv.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-DPvRVQU7.js → MetricsPage-Cy4HOgOL.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-DDGT6teS.js → NotFoundPage-CJfVBBqH.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-Bf6fTvjD.js → ProjectPage-BCPurCC3.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-DL2gvN_V.js → ProjectsPage-BM3e1Fs8.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-DV-X99VB.js → SettingsPage-DWNxV-1s.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-B3eyQWQJ.js → ShowcasePage-D3Mo3u_7.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-DIUT7aYr.js → SystemSettingsPage-DLezOP9j.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-BJpeWszJ.js → TeamsPage-ZKttKSUe.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-Cqo6IMUO.js → TemplatesPage-ieAW8_gO.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-B7NsTAYn.js → TerminalOutput-D7iu52ze.js} +1 -1
- package/web-app/dist/assets/{activity-Bpy5MefF.js → activity-DBV3YevX.js} +1 -1
- package/web-app/dist/assets/{bell-BwXuuFea.js → bell-DgYWo05P.js} +1 -1
- package/web-app/dist/assets/{bot-Cij-5kEZ.js → bot-B4dV6E76.js} +1 -1
- package/web-app/dist/assets/{check-YWtXU6Zo.js → check-16fhGkgk.js} +1 -1
- package/web-app/dist/assets/{chevron-left-MxOda7Z9.js → chevron-left-CKO7l0Eq.js} +1 -1
- package/web-app/dist/assets/{circle-alert-w9za8rUy.js → circle-alert-D8VR7J0Q.js} +1 -1
- package/web-app/dist/assets/{clock-Bp3AU4Nx.js → clock-DDPXWWrU.js} +1 -1
- package/web-app/dist/assets/{cloud-BFuxyAYb.js → cloud-CZWk2ewo.js} +1 -1
- package/web-app/dist/assets/{code-xml-B3jPToQW.js → code-xml-DwMfntBZ.js} +1 -1
- package/web-app/dist/assets/{database-D85Q7ufb.js → database-BnCpkPvi.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-C0hEZ3BL.js → dollar-sign-D-2P_Mnf.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-DeMr0sSL.js → file-code-corner-D1rEZSlN.js} +1 -1
- package/web-app/dist/assets/{file-plus-BtBan_QU.js → file-plus-DoI4ReAv.js} +1 -1
- package/web-app/dist/assets/{globe-DLHflM3B.js → globe-CYZzu63y.js} +1 -1
- package/web-app/dist/assets/{hammer-BLoZn0OU.js → hammer-BSbG-hyh.js} +1 -1
- package/web-app/dist/assets/{index-q6GEQ6U8.js → index-CT5FeqwQ.js} +3 -3
- package/web-app/dist/assets/{layers-Cac5ZHvD.js → layers-BV8xM9Qx.js} +1 -1
- package/web-app/dist/assets/{loader-circle-C7UMl5I-.js → loader-circle-fp4YjxgQ.js} +1 -1
- package/web-app/dist/assets/{lock-BC3v0P7Z.js → lock-CV7GrGTs.js} +1 -1
- package/web-app/dist/assets/{package-CFsriyik.js → package-DNCuUc4t.js} +1 -1
- package/web-app/dist/assets/{plus-CSi88k0-.js → plus-C8QWqZV6.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-BBBOc6SY.js → refresh-cw-BEezcsJd.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-D_dHBG_h.js → rotate-ccw-CKjQEvAp.js} +1 -1
- package/web-app/dist/assets/{scroll-text-z4CcL8tu.js → scroll-text-CdthLmiS.js} +1 -1
- package/web-app/dist/assets/{server-Dsl-ujtv.js → server-CyS-SXDQ.js} +1 -1
- package/web-app/dist/assets/{shield-alert-CXuzPi9-.js → shield-alert-DC8MKtLh.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-CNkCfkkx.js → thumbs-up-ByWHn4xc.js} +1 -1
- package/web-app/dist/assets/{trash-2-rCtL1tv8.js → trash-2-DNLIig_Q.js} +1 -1
- package/web-app/dist/assets/{trending-down-0wlGANoa.js → trending-down-95KgPrlE.js} +1 -1
- package/web-app/dist/assets/{trending-up-C9iCihGe.js → trending-up-BKyrvrmW.js} +1 -1
- package/web-app/dist/assets/{upload-DdKjc6-R.js → upload-D7Adz-97.js} +1 -1
- package/web-app/dist/assets/{usePolling-Dyqa_HZa.js → usePolling-u5NswsG0.js} +1 -1
- package/web-app/dist/assets/{user-D1NeTikp.js → user-TGfzfMIB.js} +1 -1
- package/web-app/dist/index.html +1 -1
|
@@ -63952,10 +63952,11 @@ function findInterrupted(repoDir, runId, includeCancelled = false, why) {
|
|
|
63952
63952
|
if (!top)
|
|
63953
63953
|
return null;
|
|
63954
63954
|
const events2 = readEvents(join76(repoDir, eventsRelPath(top.id)));
|
|
63955
|
-
const
|
|
63955
|
+
const doneAt = events2.findLastIndex((e10) => e10.type === "run.completed"), tail2 = events2.slice(doneAt + 1 + (events2[doneAt + 1]?.type === "log.sealed" ? 1 : 0));
|
|
63956
|
+
const cancelDone = doneAt >= 0 && isCancelDone(events2[doneAt]), cancelled2 = cancelDone && tail2.length === 0;
|
|
63956
63957
|
if (cancelled2 && !includeCancelled)
|
|
63957
63958
|
return null;
|
|
63958
|
-
const phase = phaseOf(
|
|
63959
|
+
const phase = phaseOf(events2.filter((e10) => !isCancelDone(e10)));
|
|
63959
63960
|
if (phase === "done" || isDiscarded(root, top.id) || runOwnerAlive(join76(root, top.id)) || events2.length === 0)
|
|
63960
63961
|
return null;
|
|
63961
63962
|
const foreign = events2.find((e10) => e10.run !== top.id);
|
|
@@ -64017,7 +64018,7 @@ function resumePoint(events2, rawLog) {
|
|
|
64017
64018
|
if (bad)
|
|
64018
64019
|
return { ok: false, reason: `event log failed its seal check (${bad})` };
|
|
64019
64020
|
}
|
|
64020
|
-
if (events2.some((e10) => e10.type === "run.completed"))
|
|
64021
|
+
if (events2.some((e10) => e10.type === "run.completed" && !isCancelDone(e10)))
|
|
64021
64022
|
return { ok: false, reason: "run already completed; nothing to resume" };
|
|
64022
64023
|
const intake = events2.findLast((e10) => e10.type === "stage.completed" && e10.stage === "intake");
|
|
64023
64024
|
if (intake && typeof intake.data["base_sha"] !== "string")
|
|
@@ -64083,7 +64084,7 @@ async function resumeFlag(runId, noPr = false, deps = {}) {
|
|
|
64083
64084
|
return 2;
|
|
64084
64085
|
}
|
|
64085
64086
|
const id2 = runId && /^e10-[A-Za-z0-9-]+$/.test(runId) ? runId : undefined;
|
|
64086
|
-
const why = {}, it2 = findInterrupted(repoDir, id2,
|
|
64087
|
+
const why = {}, it2 = findInterrupted(repoDir, id2, true, why);
|
|
64087
64088
|
if (!it2) {
|
|
64088
64089
|
out3(`engine10: --resume: no interrupted engine10 run${why.reason ? ` (${plainLine(why.reason, 400)})` : ""}
|
|
64089
64090
|
`);
|
|
@@ -64095,6 +64096,12 @@ async function resumeFlag(runId, noPr = false, deps = {}) {
|
|
|
64095
64096
|
} catch {
|
|
64096
64097
|
return cannotResume(out3, it2.runId, "its event log is unreadable");
|
|
64097
64098
|
}
|
|
64099
|
+
const tailBad = it2.phase === "publish" ? null : cancelTailProblem(it2.events);
|
|
64100
|
+
if (tailBad) {
|
|
64101
|
+
out3(`engine10: --resume refused: run ${it2.runId} holds ${tailBad}
|
|
64102
|
+
`);
|
|
64103
|
+
return 2;
|
|
64104
|
+
}
|
|
64098
64105
|
const rp = resumePoint(it2.events, raw2);
|
|
64099
64106
|
if (!rp.ok && /^event log (is torn|ends in a torn)/.test(rp.reason))
|
|
64100
64107
|
return cannotResume(out3, it2.runId, `its ${rp.reason}`);
|
|
@@ -64337,18 +64344,38 @@ function parseRecoveryChoice(raw2, resumable) {
|
|
|
64337
64344
|
return "details";
|
|
64338
64345
|
return resumable && ["r", "resume"].includes(a) ? "resume" : null;
|
|
64339
64346
|
}
|
|
64340
|
-
function nextStepText(runId, phase,
|
|
64347
|
+
function nextStepText(runId, phase, resumable, hasBranch) {
|
|
64341
64348
|
const kept = hasBranch ? `old work stays on loki/${runId}` : "no run branch was created";
|
|
64342
|
-
return
|
|
64349
|
+
return resumable ? `next loki start with the same task offers to ${phase === "publish" ? "finish its pull request step" : "resume it from its settled stages"} (run ${runId}) or start fresh` : `next loki start offers to start fresh; ${kept}`;
|
|
64350
|
+
}
|
|
64351
|
+
function cancelTailProblem(events2) {
|
|
64352
|
+
const at2 = events2.findLastIndex((e10) => e10.type === "log.sealed");
|
|
64353
|
+
return at2 >= 0 && at2 < events2.length - 1 ? `${events2.length - 1 - at2} event(s) after its last log.sealed (${events2[at2 + 1].type}); they are unauthenticated` : null;
|
|
64354
|
+
}
|
|
64355
|
+
function stagesResumable(repoDir, runId, events2) {
|
|
64356
|
+
if (!branchExists(repoDir, runId) || cancelTailProblem(events2))
|
|
64357
|
+
return false;
|
|
64358
|
+
try {
|
|
64359
|
+
const rp = resumePoint(events2, readFileSync68(join76(repoDir, eventsRelPath(runId)), "utf8"));
|
|
64360
|
+
if (!rp.ok || rp.skip.length === 0)
|
|
64361
|
+
return false;
|
|
64362
|
+
const base = events2.findLast((e10) => e10.type === "stage.completed" && e10.stage === "intake")?.data["base_sha"];
|
|
64363
|
+
if (typeof base === "string" && /^[0-9a-f]{40}([0-9a-f]{24})?$/.test(base))
|
|
64364
|
+
safeGit(repoDir, ["cat-file", "-e", `${base}^{commit}`]);
|
|
64365
|
+
return true;
|
|
64366
|
+
} catch {
|
|
64367
|
+
return false;
|
|
64368
|
+
}
|
|
64343
64369
|
}
|
|
64344
64370
|
function statusNextStep(repoDir, runsDir, runId, events2) {
|
|
64345
64371
|
const cancelled2 = events2.findLast((e10) => e10.type === "run.completed")?.data["cancelled"] === true;
|
|
64346
64372
|
if (events2.some((e10) => e10.type === "run.completed") && !cancelled2)
|
|
64347
64373
|
return null;
|
|
64348
|
-
const phase = phaseOf(
|
|
64374
|
+
const phase = phaseOf(events2.filter((e10) => !isCancelDone(e10)));
|
|
64349
64375
|
if (phase === "done" || events2.length === 0 || isDiscarded(runsDir, runId) || runOwnerAlive(join76(runsDir, runId)))
|
|
64350
64376
|
return null;
|
|
64351
|
-
|
|
64377
|
+
const hasBranch = branchExists(repoDir, runId);
|
|
64378
|
+
return nextStepText(runId, phase, phase === "publish" ? hasBranch && taskOf(events2) !== null : stagesResumable(repoDir, runId, events2), hasBranch);
|
|
64352
64379
|
}
|
|
64353
64380
|
function discardRun(repoDir, runId) {
|
|
64354
64381
|
if (!/^e10-[A-Za-z0-9-]+$/.test(runId))
|
|
@@ -64378,18 +64405,30 @@ async function startRecovery(repoDir, task, noPr, deps = {}) {
|
|
|
64378
64405
|
process.stderr.write(s);
|
|
64379
64406
|
});
|
|
64380
64407
|
const hasBranch = branchExists(repoDir, it2.runId), t = task.trim();
|
|
64381
|
-
const
|
|
64408
|
+
const sameTask = it2.task !== null && (t === "" || it2.task === t), publish = it2.phase === "publish";
|
|
64409
|
+
const resumable = sameTask && (publish ? !noPr && hasBranch && readOriginUrl(repoDir) !== null && !("deny" in prGate(repoDir)) && publishStateOk(join76(repoDir, ".loki", "runs", it2.runId), it2) : stagesResumable(repoDir, it2.runId, it2.events));
|
|
64382
64410
|
const kept = hasBranch ? `old work is kept on loki/${it2.runId}` : "no run branch was created", was = it2.cancelled ? "cancelled" : "interrupted";
|
|
64383
64411
|
const interactive = (deps.tty ?? (process.stdin.isTTY === true && process.stderr.isTTY === true)) && process.env["LOKI_NONINTERACTIVE"] !== "1";
|
|
64384
|
-
|
|
64385
|
-
|
|
64412
|
+
let began = false;
|
|
64413
|
+
const go2 = async () => publish ? resumePublish(repoDir, it2, deps) : resumeFlag(it2.runId, noPr, { ...deps, supervise: async (o) => {
|
|
64414
|
+
began = true;
|
|
64415
|
+
return (deps.supervise ?? (async (x3) => (await Promise.resolve().then(() => (init_supervisor(), exports_supervisor))).runSupervisor(x3)))(o);
|
|
64416
|
+
} });
|
|
64417
|
+
if (resumable && !interactive) {
|
|
64418
|
+
const rc2 = await go2();
|
|
64419
|
+
if (publish || began || rc2 === 0)
|
|
64420
|
+
return rc2;
|
|
64421
|
+
note(`note: run ${it2.runId} could not be resumed; starting a new run, ${kept}.
|
|
64422
|
+
`);
|
|
64423
|
+
return null;
|
|
64424
|
+
}
|
|
64386
64425
|
if (!interactive || t === "" && !resumable) {
|
|
64387
64426
|
note(`note: run ${it2.runId} was ${was} in phase ${it2.phase}; ${t === "" ? `give a task to start a new run (loki start <task>); ${kept}` : `starting a new run, ${kept}`}.
|
|
64388
64427
|
`);
|
|
64389
64428
|
return null;
|
|
64390
64429
|
}
|
|
64391
64430
|
const ask = deps.ask ?? askLine, discardItem = "Discard old run (not offered again; nothing is deleted)";
|
|
64392
|
-
const menu = resumable ? ["Resume (finish the pull request step)", `Start fresh (${kept})`, discardItem, "Show details"] : [`Start fresh (${kept})`, discardItem, "Show details"];
|
|
64431
|
+
const menu = resumable ? [publish ? "Resume (finish the pull request step)" : "Resume (continue from the settled stages)", `Start fresh (${kept})`, discardItem, "Show details"] : [`Start fresh (${kept})`, discardItem, "Show details"];
|
|
64393
64432
|
note(`loki: run ${it2.runId} was ${was} in phase ${it2.phase}${it2.task ? ` (task: ${it2.task.replace(/\s+/g, " ").slice(0, 80)})` : ""}.
|
|
64394
64433
|
`);
|
|
64395
64434
|
for (let tries = 0;tries < 5; tries++) {
|
|
@@ -64409,12 +64448,12 @@ async function startRecovery(repoDir, task, noPr, deps = {}) {
|
|
|
64409
64448
|
continue;
|
|
64410
64449
|
}
|
|
64411
64450
|
if (c === "details") {
|
|
64412
|
-
note(` run ${it2.runId}: ${it2.events.length} events, last seq ${fold(it2.events).lastSeq}, phase ${it2.phase}, ${was}; ${kept}; ${resumable ?
|
|
64451
|
+
note(` run ${it2.runId}: ${it2.events.length} events, last seq ${fold(it2.events).lastSeq}, phase ${it2.phase}, ${was}; ${kept}; ${resumable ? `resumable (same task, ${publish ? "publish phase" : "settled stages kept"})` : "not resumable here (different task, --no-pr, or the branch, base commit, log or a settled stage is missing)"}
|
|
64413
64452
|
`);
|
|
64414
64453
|
continue;
|
|
64415
64454
|
}
|
|
64416
64455
|
if (c === "resume")
|
|
64417
|
-
return
|
|
64456
|
+
return go2();
|
|
64418
64457
|
note(c === "discard" ? discardRun(repoDir, it2.runId) ? `Discarded run ${it2.runId}: it will not be offered again; ${kept}.
|
|
64419
64458
|
` : `Could not mark run ${it2.runId} as discarded; starting fresh.
|
|
64420
64459
|
` : `Starting fresh; ${kept}.
|
|
@@ -66197,7 +66236,8 @@ var init_wall_cases = __esm(() => {
|
|
|
66197
66236
|
});
|
|
66198
66237
|
|
|
66199
66238
|
// ../../loki-ts/src/features/runner_config.ts
|
|
66200
|
-
import {
|
|
66239
|
+
import { createHash as createHash27 } from "crypto";
|
|
66240
|
+
import { readdirSync as readdirSync30, readFileSync as readFileSync74 } from "fs";
|
|
66201
66241
|
import { dirname as dirname33, join as join83, normalize as normalize5 } from "path";
|
|
66202
66242
|
function tomlKey2(s, i = 0, eq3 = true) {
|
|
66203
66243
|
const parts = [], ws2 = () => {
|
|
@@ -66536,6 +66576,59 @@ function runnerConfigNotes(repoDir, baseSha, head, changed, signal) {
|
|
|
66536
66576
|
}
|
|
66537
66577
|
return [...notes];
|
|
66538
66578
|
}
|
|
66579
|
+
function pipRecorded(repoDir, site, rel, sha5, memo4) {
|
|
66580
|
+
let s = memo4.get(site);
|
|
66581
|
+
if (!s) {
|
|
66582
|
+
s = new Set;
|
|
66583
|
+
try {
|
|
66584
|
+
for (const d of readdirSync30(join83(repoDir, site)))
|
|
66585
|
+
if (d.endsWith(".dist-info"))
|
|
66586
|
+
try {
|
|
66587
|
+
for (const l of readFileSync74(join83(repoDir, site, d, "RECORD"), "utf8").split(/\r?\n/)) {
|
|
66588
|
+
const m = /^"?(.*?)"?,sha256=([\w-]+),/.exec(l);
|
|
66589
|
+
if (m)
|
|
66590
|
+
s.add(`${m[1]}\x00${m[2]}`);
|
|
66591
|
+
}
|
|
66592
|
+
} catch {}
|
|
66593
|
+
} catch {}
|
|
66594
|
+
memo4.set(site, s);
|
|
66595
|
+
}
|
|
66596
|
+
return s.has(`${rel}\x00${Buffer.from(sha5, "hex").toString("base64url")}`);
|
|
66597
|
+
}
|
|
66598
|
+
function hiddenRunnerConfigs(repoDir) {
|
|
66599
|
+
const out3 = {}, memo4 = new Map;
|
|
66600
|
+
for (const f of gitOut(repoDir, ["-c", "core.quotePath=false", "ls-files", "-o", "-z", "--", ":(exclude,glob)**/node_modules/**"]).split("\x00")) {
|
|
66601
|
+
const site = SITE.exec(f);
|
|
66602
|
+
if (!f || f.startsWith(".loki/") || (site ? !HOOK.test(site[2]) : DEP_TREE.test(f) || PY_LOADED_TREE.test(f) && !/(^|\/)conftest\.py$/i.test(f) || !RUNNER_CONFIGS.some((s) => s.re.test(f))))
|
|
66603
|
+
continue;
|
|
66604
|
+
let b;
|
|
66605
|
+
try {
|
|
66606
|
+
b = readFileSync74(join83(repoDir, f));
|
|
66607
|
+
} catch {
|
|
66608
|
+
out3[f] = "!unreadable";
|
|
66609
|
+
continue;
|
|
66610
|
+
}
|
|
66611
|
+
const h10 = createHash27("sha256").update(b).digest("hex"), t = site ? b.toString("utf8") : "", stock = site?.[2] === "_virtualenv.pth" && /^import _virtualenv\r?\n?$/.test(t);
|
|
66612
|
+
if (stock || site?.[2].endsWith("/entry_points.txt") && !/^\s*\[pytest11\]\s*$/m.test(t))
|
|
66613
|
+
continue;
|
|
66614
|
+
if (!site || !pipRecorded(repoDir, site[1], site[2], h10, memo4))
|
|
66615
|
+
out3[f] = h10;
|
|
66616
|
+
}
|
|
66617
|
+
return out3;
|
|
66618
|
+
}
|
|
66619
|
+
function hiddenConfigChanged(repoDir, snap) {
|
|
66620
|
+
let now2;
|
|
66621
|
+
try {
|
|
66622
|
+
now2 = hiddenRunnerConfigs(repoDir);
|
|
66623
|
+
} catch {
|
|
66624
|
+
return ["untracked runner configs (listing failed)"];
|
|
66625
|
+
}
|
|
66626
|
+
if (!snap || typeof snap !== "object")
|
|
66627
|
+
return Object.keys(now2).length ? ["untracked runner configs (no intake snapshot to compare)"] : [];
|
|
66628
|
+
const was = snap;
|
|
66629
|
+
const d = [...new Set([...Object.keys(now2), ...Object.keys(was)])].filter((f) => now2[f] !== was[f]).sort();
|
|
66630
|
+
return d.length > 5 ? [...d.slice(0, 5), `(+${d.length - 5} more)`] : d;
|
|
66631
|
+
}
|
|
66539
66632
|
var PKG_KEYS, RAW_CONFIGS, RUNNER_CONFIGS, DEP_MAPS, RUNNER_DEP, LOCAL_SPEC, depGuard = (j10) => DEP_MAPS.map((m) => Object.entries(j10[m] ?? {}).filter(([k3, v3]) => RUNNER_DEP.test(k3) || LOCAL_SPEC.test(String(v3)))), KW2, lines = (t) => t.split(`
|
|
66540
66633
|
`).map((l) => l.trim()).filter((l) => l && !l.startsWith("#")), ESC, unesc2 = (s) => s.replace(/\\(?:u([0-9a-fA-F]{4})|U([0-9a-fA-F]{8})|([\s\S]))/g, (_m2, u10, U10, c) => {
|
|
66541
66634
|
if (c !== undefined) {
|
|
@@ -66560,14 +66653,15 @@ var PKG_KEYS, RAW_CONFIGS, RUNNER_CONFIGS, DEP_MAPS, RUNNER_DEP, LOCAL_SPEC, dep
|
|
|
66560
66653
|
} catch {
|
|
66561
66654
|
return "";
|
|
66562
66655
|
}
|
|
66563
|
-
}, REFS, MAPPER, ROOT_DIR, QUOTED, EXT, gitOut = (dir, args, signal) => safeGit(dir, args, { timeout: 20000, maxBuffer: 64 << 20, ...signal ? { signal } : {} }), NON_SOURCE;
|
|
66656
|
+
}, REFS, MAPPER, ROOT_DIR, QUOTED, EXT, gitOut = (dir, args, signal) => safeGit(dir, args, { timeout: 20000, maxBuffer: 64 << 20, ...signal ? { signal } : {} }), NON_SOURCE, DEP_TREE, PY_LOADED_TREE, SITE, HOOK;
|
|
66564
66657
|
var init_runner_config = __esm(() => {
|
|
66565
66658
|
init_safe_git();
|
|
66566
66659
|
PKG_KEYS = ["scripts", "jest", "overrides", "resolutions", "imports", "pnpm", "mocha", "vitest", "ava", "c8", "nyc", "babel", "bun", "patchedDependencies"];
|
|
66567
66660
|
RAW_CONFIGS = [
|
|
66568
|
-
{ re: /(^|\/)(conftest\.py|tox\.ini|bunfig\.toml|\.?pytest\.(ini|toml)|\.mocharc[\w.]*)$/ },
|
|
66661
|
+
{ re: /(^|\/)(conftest\.py|(site|user)customize\.py|tox\.ini|bunfig\.toml|\.?pytest\.(ini|toml)|\.mocharc[\w.]*)$/ },
|
|
66569
66662
|
{ re: /(^|\/)(vitest|vite|jest)\.(config|workspace)\.[\w.]+$/ },
|
|
66570
66663
|
{ re: /(^|\/)\.cargo\/config(\.toml)?$/ },
|
|
66664
|
+
{ re: /(^|\/)(site|dist)-packages\/[^/]+\.pth$/ },
|
|
66571
66665
|
{ re: /(^|\/)(babel\.config\.[\w.]+|\.babelrc(\.[\w]+)?|\.pnpmfile\.(cjs|mjs))$/ },
|
|
66572
66666
|
{ re: /(^|\/)package\.json$/, shared: PKG_KEYS },
|
|
66573
66667
|
{ re: /(^|\/)(pnpm-workspace\.yaml|\.yarnrc\.yml|\.npmrc)$/ },
|
|
@@ -66592,6 +66686,10 @@ var init_runner_config = __esm(() => {
|
|
|
66592
66686
|
QUOTED = /["']([^"'\n]+)["']/g;
|
|
66593
66687
|
EXT = ["", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".json", ".py", "/index.ts", "/index.js"];
|
|
66594
66688
|
NON_SOURCE = /(^|\/)(tests?|__tests__|spec|\.loki)\/|\.(test|spec)\.[\w.]+$|(^|\/)test_[^/]*\.py$|_test\.(go|py)$/;
|
|
66689
|
+
DEP_TREE = /(^|\/)node_modules\//;
|
|
66690
|
+
PY_LOADED_TREE = /(^|\/)(bower_components|vendor)\//;
|
|
66691
|
+
SITE = /^((?:.*\/)?(?:site|dist)-packages)\/(.+)$/;
|
|
66692
|
+
HOOK = /^([^/]+\.pth|(site|user)customize\.py|[^/]+\.dist-info\/entry_points\.txt)$/;
|
|
66595
66693
|
});
|
|
66596
66694
|
|
|
66597
66695
|
// ../../loki-ts/src/e10ext/assert_delta.ts
|
|
@@ -67498,7 +67596,7 @@ var init_run_control = __esm(() => {
|
|
|
67498
67596
|
});
|
|
67499
67597
|
|
|
67500
67598
|
// ../../loki-ts/src/project_model/conventions.ts
|
|
67501
|
-
import { existsSync as existsSync61, readdirSync as
|
|
67599
|
+
import { existsSync as existsSync61, readdirSync as readdirSync31, readFileSync as readFileSync80 } from "fs";
|
|
67502
67600
|
import { basename as basename26, dirname as dirname36, isAbsolute as isAbsolute15, join as join89, relative as relative18, resolve as resolve29 } from "path";
|
|
67503
67601
|
function parseJsonc(text3) {
|
|
67504
67602
|
let out3 = "", i = 0;
|
|
@@ -67540,7 +67638,7 @@ function moduleOf(file, depth = 0) {
|
|
|
67540
67638
|
function readPackageConventions(pkgDir, runner = null) {
|
|
67541
67639
|
let names = [];
|
|
67542
67640
|
try {
|
|
67543
|
-
names =
|
|
67641
|
+
names = readdirSync31(pkgDir).filter((f) => f.endsWith(".json")).sort((x3, y) => x3.length - y.length || x3.localeCompare(y));
|
|
67544
67642
|
} catch {
|
|
67545
67643
|
return null;
|
|
67546
67644
|
}
|
|
@@ -67662,7 +67760,7 @@ function nearestPackageRoot(testDir, repoDir, fileName) {
|
|
|
67662
67760
|
return siteFor(api, repoDir, relative18(repoDir, join89(testDir, fileName)))?.cwd ?? repoDir;
|
|
67663
67761
|
const shaped = (d) => {
|
|
67664
67762
|
try {
|
|
67665
|
-
return
|
|
67763
|
+
return readdirSync31(d).some((f) => {
|
|
67666
67764
|
if (!f.endsWith(".json"))
|
|
67667
67765
|
return false;
|
|
67668
67766
|
const j10 = readJson6(join89(d, f));
|
|
@@ -67884,7 +67982,7 @@ var init_conventions = __esm(() => {
|
|
|
67884
67982
|
import { existsSync as existsSync62, mkdirSync as mkdirSync43, mkdtempSync as mkdtempSync11, readFileSync as readFileSync81, rmSync as rmSync23, writeFileSync as writeFileSync42 } from "fs";
|
|
67885
67983
|
import { homedir as homedir10, tmpdir as tmpdir14 } from "os";
|
|
67886
67984
|
import { dirname as dirname37, join as join90 } from "path";
|
|
67887
|
-
import { createHash as
|
|
67985
|
+
import { createHash as createHash28 } from "crypto";
|
|
67888
67986
|
function loadLessons(repoDir) {
|
|
67889
67987
|
const p = lessonsPath(repoDir);
|
|
67890
67988
|
if (!existsSync62(p))
|
|
@@ -67948,7 +68046,7 @@ function retrieveLessons(repoDir, task, limit = 3) {
|
|
|
67948
68046
|
}).filter((x3) => x3.n > 0).sort((a, b) => b.n - a.n || lessonConfidence(b.l) - lessonConfidence(a.l)).slice(0, limit).map((x3) => x3.l);
|
|
67949
68047
|
}
|
|
67950
68048
|
function appendReceiptFact(repoDir, f, now2 = () => new Date) {
|
|
67951
|
-
const id2 = `rcp-${
|
|
68049
|
+
const id2 = `rcp-${createHash28("sha256").update(f.runId).digest("hex").slice(0, 12)}`;
|
|
67952
68050
|
const lessons = loadLessons(repoDir);
|
|
67953
68051
|
if (lessons.some((l) => l.id === id2))
|
|
67954
68052
|
return false;
|
|
@@ -68784,7 +68882,7 @@ var init_plan = __esm(() => {
|
|
|
68784
68882
|
});
|
|
68785
68883
|
|
|
68786
68884
|
// ../../loki-ts/src/util/conflict_resume.ts
|
|
68787
|
-
import { createHash as
|
|
68885
|
+
import { createHash as createHash29 } from "crypto";
|
|
68788
68886
|
import { existsSync as existsSync66, mkdtempSync as mkdtempSync12, readFileSync as readFileSync86, rmSync as rmSync25, writeFileSync as writeFileSync46 } from "fs";
|
|
68789
68887
|
import { tmpdir as tmpdir15 } from "os";
|
|
68790
68888
|
import { basename as basename27, join as join95, relative as relative20 } from "path";
|
|
@@ -68840,7 +68938,7 @@ async function adjudicateWallConflict(ctx, first, firstSession, wall) {
|
|
|
68840
68938
|
writeFileSync46(f.path, next, "utf8");
|
|
68841
68939
|
const sf2 = o.wall?.files?.find((x3) => x3.path === f.path);
|
|
68842
68940
|
if (sf2)
|
|
68843
|
-
sf2.sha256 =
|
|
68941
|
+
sf2.sha256 = createHash29("sha256").update(next).digest("hex");
|
|
68844
68942
|
}
|
|
68845
68943
|
const defect = { file: a.file, line: a.line, reason: oneLine3(reason), action: rewritten ? "reauthored" : "dropped" };
|
|
68846
68944
|
if (rewritten) {
|
|
@@ -70451,7 +70549,7 @@ var init_verify = __esm(() => {
|
|
|
70451
70549
|
ctx.emit("test.result", "verify", { ...pubHold(k3) });
|
|
70452
70550
|
}
|
|
70453
70551
|
const targetNames = new Set([...[...wallTests, ...relevant2].map(testCheckName), ...checks.filter(isHold).map((c) => c.name)]);
|
|
70454
|
-
const cfgChanged = testConfigChanged(ctx.repoDir, ctx.baseSha, changed);
|
|
70552
|
+
const cfgChanged = [...new Set([...testConfigChanged(ctx.repoDir, ctx.baseSha, changed), ...hiddenConfigChanged(ctx.repoDir, ctx.outputs().intake?.hidden_cfg)])];
|
|
70455
70553
|
const preRed = await subtractBase(ctx, api, checks, tests, changed, new Set(wallTests.map(testCheckName)), new Set(relevant2.map(testCheckName)), signal, cfgChanged.length === 0, new Set(ctx.outputs().intake?.zero_baseline?.zero ?? []), depNames);
|
|
70456
70554
|
const attr = attribute(ctx.repoDir, ctx.baseSha, checks.filter((c) => c.result === "fail" && !preRed.names.includes(c.name)).map((c) => ({ name: c.name, ids: c.ids, eligible: !targetNames.has(c.name) && !changed.includes(c.name.slice(c.name.indexOf(":") + 1)) })));
|
|
70457
70555
|
attr.introducedChecks = [...new Set(attr.introducedChecks.map((n10) => isHoldoutCheck(n10) ? "holdout" : n10))];
|
|
@@ -70555,7 +70653,7 @@ __export(exports_wall, {
|
|
|
70555
70653
|
BASE_RUN_TIMEOUT_MS: () => BASE_RUN_TIMEOUT_MS
|
|
70556
70654
|
});
|
|
70557
70655
|
import { spawnSync as spawnSync11 } from "child_process";
|
|
70558
|
-
import { existsSync as existsSync71, mkdirSync as mkdirSync51, mkdtempSync as mkdtempSync15, readFileSync as readFileSync90, readdirSync as
|
|
70656
|
+
import { existsSync as existsSync71, mkdirSync as mkdirSync51, mkdtempSync as mkdtempSync15, readFileSync as readFileSync90, readdirSync as readdirSync32, rmSync as rmSync30, writeFileSync as writeFileSync50 } from "fs";
|
|
70559
70657
|
import { tmpdir as tmpdir18 } from "os";
|
|
70560
70658
|
import { dirname as dirname40, join as join101, relative as relative24 } from "path";
|
|
70561
70659
|
|
|
@@ -70696,14 +70794,14 @@ async function wallAuthor(ctx, signal, retry) {
|
|
|
70696
70794
|
return done({ status: "failed", data: { iteration_ids: [iterationId], model }, reason: casesBad });
|
|
70697
70795
|
}
|
|
70698
70796
|
const planText = typeof prior.plan?.plan === "string" ? prior.plan.plan : null, repoFiles = repoMap?.files ?? [];
|
|
70699
|
-
const oor = () =>
|
|
70797
|
+
const oor = () => readdirSync32(cwd).filter((f) => f.startsWith(WALL_PREFIX)).flatMap((name) => {
|
|
70700
70798
|
const text3 = readFileSync90(join101(cwd, name), "utf8"), why = outOfRepoTarget(text3) ?? vacuousCheck(name, text3) ?? phantomReason(phantomRepoPaths(text3, name, targetDir, ctx.repoDir, planText), repoFiles, relative24(ctx.repoDir, targetDir), pkg?.root ?? "");
|
|
70701
70799
|
return why ? [{ name, why }] : [];
|
|
70702
70800
|
});
|
|
70703
70801
|
const bad1 = oor();
|
|
70704
70802
|
if (bad1.length > 0 && !wallCasesRunner(runners) && !signal.aborted && !ctx.overCap?.())
|
|
70705
70803
|
await ctx.sessions.run({ stage: "wall", brief: withStagePrefix(outOfRepoReask("Rewrite these Wall files in place, keeping the same names and acceptance coverage.", bad1)), tier: "development", model, iterationId: `${iterationId}-oor`, limitS: wallLimitS(sz2.size), maxOutputTokens: wallOutputCap(), signal, cwd });
|
|
70706
|
-
const oorBad = new Map(oor().map((b) => [b.name, b.why])), all =
|
|
70804
|
+
const oorBad = new Map(oor().map((b) => [b.name, b.why])), all = readdirSync32(cwd).filter((f) => f.startsWith(WALL_PREFIX)), held = stashHoldout({ runId: ctx.runId, repoDir: ctx.repoDir, srcDir: cwd, targetDir, names: all.filter((n10) => !oorBad.has(n10) && !conventionViolation(conv2, n10, readFileSync90(join101(cwd, n10), "utf8"))), runnerOf: (n10) => guessRunner(n10, runners) }), generated = all.filter((n10) => !held?.names.has(n10));
|
|
70707
70805
|
const sealedDir = sealStageDir(ctx.runId, ctx.repoDir);
|
|
70708
70806
|
rmSync30(sealedDir, { recursive: true, force: true });
|
|
70709
70807
|
if (generated.length > 0)
|
|
@@ -70976,7 +71074,7 @@ var init_scope2 = __esm(() => {
|
|
|
70976
71074
|
});
|
|
70977
71075
|
|
|
70978
71076
|
// ../../loki-ts/src/council/role_agents.ts
|
|
70979
|
-
import { existsSync as existsSync72, readdirSync as
|
|
71077
|
+
import { existsSync as existsSync72, readdirSync as readdirSync33, readFileSync as readFileSync92 } from "fs";
|
|
70980
71078
|
import { homedir as homedir11 } from "os";
|
|
70981
71079
|
import { join as join103 } from "path";
|
|
70982
71080
|
function agentDirs(repoDir, env = process.env) {
|
|
@@ -71001,7 +71099,7 @@ function loadRoleAgent(repoDir, role, env = process.env) {
|
|
|
71001
71099
|
continue;
|
|
71002
71100
|
let names;
|
|
71003
71101
|
try {
|
|
71004
|
-
names =
|
|
71102
|
+
names = readdirSync33(d).filter((n10) => n10.endsWith(".md") && !n10.startsWith(".")).sort();
|
|
71005
71103
|
} catch {
|
|
71006
71104
|
continue;
|
|
71007
71105
|
}
|
|
@@ -71347,7 +71445,7 @@ __export(exports_contract, {
|
|
|
71347
71445
|
import { existsSync as existsSync73, lstatSync as lstatSync28, mkdirSync as mkdirSync53, readFileSync as readFileSync93, rmSync as rmSync31, writeFileSync as writeFileSync52 } from "fs";
|
|
71348
71446
|
import { spawnSync as spawnSync12 } from "child_process";
|
|
71349
71447
|
import { dirname as dirname43, join as join105 } from "path";
|
|
71350
|
-
import { createHash as
|
|
71448
|
+
import { createHash as createHash30 } from "crypto";
|
|
71351
71449
|
function contractEnabled(env = process.env) {
|
|
71352
71450
|
return env["LOKI_CONTRACT"] !== "0";
|
|
71353
71451
|
}
|
|
@@ -71498,7 +71596,7 @@ function readContract(repoDir) {
|
|
|
71498
71596
|
} catch {
|
|
71499
71597
|
return { contract: null, notes: ["contract unreadable: read failed"], sha256: null };
|
|
71500
71598
|
}
|
|
71501
|
-
const sha2563 =
|
|
71599
|
+
const sha2563 = createHash30("sha256").update(raw2).digest("hex");
|
|
71502
71600
|
let j10;
|
|
71503
71601
|
try {
|
|
71504
71602
|
j10 = JSON.parse(raw2.toString("utf8"));
|
|
@@ -71787,8 +71885,8 @@ var init_contract = __esm(() => {
|
|
|
71787
71885
|
});
|
|
71788
71886
|
|
|
71789
71887
|
// ../../loki-ts/src/features/speed/seal_group.ts
|
|
71790
|
-
import { createHash as
|
|
71791
|
-
import { existsSync as existsSync74, mkdirSync as mkdirSync54, readdirSync as
|
|
71888
|
+
import { createHash as createHash31 } from "crypto";
|
|
71889
|
+
import { existsSync as existsSync74, mkdirSync as mkdirSync54, readdirSync as readdirSync34, readFileSync as readFileSync94, renameSync as renameSync21, statSync as statSync27, writeFileSync as writeFileSync53 } from "fs";
|
|
71792
71890
|
import { dirname as dirname44, join as join106 } from "path";
|
|
71793
71891
|
function sealGroup(runDir, rh) {
|
|
71794
71892
|
const manifestPath = join106(runDir, "group", "manifest.json");
|
|
@@ -71929,7 +72027,7 @@ function compositeVerdict(childVerdicts) {
|
|
|
71929
72027
|
const failed2 = childVerdicts.filter((v3) => v3 === "FAILED" || !["VERIFIED", "ALREADY_SATISFIED", "PARTIAL", "SPEC_CONFLICT"].includes(v3)).length;
|
|
71930
72028
|
return capGroupVerdict(base, { section: undefined, notProven: [], problems: failed2, allUnitsPass: childVerdicts.every((v3) => PASSING.has(v3)) });
|
|
71931
72029
|
}
|
|
71932
|
-
var ID_RE, PASSING, sha5 = (b) =>
|
|
72030
|
+
var ID_RE, PASSING, sha5 = (b) => createHash31("sha256").update(b).digest("hex"), isObj10 = (v3) => v3 !== null && typeof v3 === "object" && !Array.isArray(v3), text3 = (v3, cap) => typeof v3 === "string" ? v3.replace(/[\x00-\x1f\x7f]+/g, " ").trim().slice(0, cap) : "", num4 = (v3) => typeof v3 === "number" && Number.isFinite(v3) && v3 >= 0 ? v3 : 0, unitsDir = (runDir) => join106(runDir, "group", "units"), readJson7 = (p) => {
|
|
71933
72031
|
try {
|
|
71934
72032
|
return JSON.parse(readFileSync94(p, "utf8"));
|
|
71935
72033
|
} catch {
|
|
@@ -71937,7 +72035,7 @@ var ID_RE, PASSING, sha5 = (b) => createHash30("sha256").update(b).digest("hex")
|
|
|
71937
72035
|
}
|
|
71938
72036
|
}, dirNames = (d) => {
|
|
71939
72037
|
try {
|
|
71940
|
-
return
|
|
72038
|
+
return readdirSync34(d).filter((n10) => !n10.startsWith(".")).sort();
|
|
71941
72039
|
} catch {
|
|
71942
72040
|
return null;
|
|
71943
72041
|
}
|
|
@@ -72216,8 +72314,8 @@ __export(exports_seal, {
|
|
|
72216
72314
|
EXTERNAL_DIFF_NOT_ISOLATED: () => EXTERNAL_DIFF_NOT_ISOLATED,
|
|
72217
72315
|
AGENT_ONLY_REASON: () => AGENT_ONLY_REASON
|
|
72218
72316
|
});
|
|
72219
|
-
import { createHash as
|
|
72220
|
-
import { existsSync as existsSync76, readdirSync as
|
|
72317
|
+
import { createHash as createHash32 } from "crypto";
|
|
72318
|
+
import { existsSync as existsSync76, readdirSync as readdirSync35, mkdirSync as mkdirSync55, readFileSync as readFileSync96 } from "fs";
|
|
72221
72319
|
import { basename as basename31, isAbsolute as isAbsolute20, join as join108, relative as relative26 } from "path";
|
|
72222
72320
|
async function leanSymbolGap(ctx, o, rawDiff, head, vraw) {
|
|
72223
72321
|
if (externalRun(o) || Array.isArray(o.wall?.files) && o.wall.files.length > 0 || o.intake?.already_satisfied === true || o.implement?.exit === "already_done")
|
|
@@ -72321,7 +72419,7 @@ function renderReceiptMd(r) {
|
|
|
72321
72419
|
].join(`
|
|
72322
72420
|
`);
|
|
72323
72421
|
}
|
|
72324
|
-
var 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) =>
|
|
72422
|
+
var 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) => createHash32("sha256").update(s).digest("hex"), str3 = (v3) => typeof v3 === "string" && v3 !== "" ? v3 : 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 = (v3) => Array.isArray(v3) ? v3.filter((x3) => typeof x3 === "string" && x3 !== "") : [], g = (ctx) => (a) => git9(ctx, a), receiptRel = (ctx) => {
|
|
72325
72423
|
const r = relative26(ctx.repoDir, join108(ctx.runDir, "receipt.json"));
|
|
72326
72424
|
return r.startsWith("..") || isAbsolute20(r) ? `.loki/runs/${ctx.runId}/receipt.json` : r;
|
|
72327
72425
|
}, commitStage, wallGreenOnBaseOf = (o) => {
|
|
@@ -72464,7 +72562,7 @@ var init_seal = __esm(() => {
|
|
|
72464
72562
|
if (wallNotRun > 0) {
|
|
72465
72563
|
try {
|
|
72466
72564
|
const kept = new Set((Array.isArray(o.wall?.files) ? o.wall.files : []).map((f) => basename31(String(f.path))));
|
|
72467
|
-
for (const n10 of
|
|
72565
|
+
for (const n10 of readdirSync35(join108(ctx.runDir, "wall")).sort())
|
|
72468
72566
|
if (!kept.has(n10))
|
|
72469
72567
|
notProven.add(`wall test discarded: ${n10} (not_run)`);
|
|
72470
72568
|
} catch {}
|
|
@@ -73283,7 +73381,7 @@ var init_capability = __esm(() => {
|
|
|
73283
73381
|
var init_raster = () => {};
|
|
73284
73382
|
|
|
73285
73383
|
// ../../loki-ts/src/commands/doctor.ts
|
|
73286
|
-
import { appendFileSync as appendFileSync11, writeFileSync as writeFileSync57, mkdirSync as mkdirSync56, accessSync as accessSync3, constants as fsConstants3, existsSync as existsSync77, lstatSync as lstatSync29, readdirSync as
|
|
73384
|
+
import { appendFileSync as appendFileSync11, writeFileSync as writeFileSync57, mkdirSync as mkdirSync56, accessSync as accessSync3, constants as fsConstants3, existsSync as existsSync77, lstatSync as lstatSync29, readdirSync as readdirSync36, readFileSync as readFileSync97, readlinkSync as readlinkSync6, realpathSync as realpathSync32, statSync as statSync30, statfsSync } from "fs";
|
|
73287
73385
|
import { spawnSync as spawnSync13 } from "child_process";
|
|
73288
73386
|
import { homedir as homedir12, tmpdir as tmpdir19 } from "os";
|
|
73289
73387
|
import { join as join110, resolve as resolve31 } from "path";
|
|
@@ -73438,13 +73536,13 @@ __export(exports_first_run_repo, {
|
|
|
73438
73536
|
initEmptyRepo: () => initEmptyRepo,
|
|
73439
73537
|
NOT_A_REPO: () => NOT_A_REPO
|
|
73440
73538
|
});
|
|
73441
|
-
import { readdirSync as
|
|
73539
|
+
import { readdirSync as readdirSync37 } from "fs";
|
|
73442
73540
|
async function initEmptyRepo(dir, env) {
|
|
73443
73541
|
if (env["LOKI_AUTO_GIT_INIT"] === "0")
|
|
73444
73542
|
return { fatal: NOT_A_REPO(dir) };
|
|
73445
73543
|
let empty = false;
|
|
73446
73544
|
try {
|
|
73447
|
-
empty =
|
|
73545
|
+
empty = readdirSync37(dir).every((f) => OS_METADATA.has(f));
|
|
73448
73546
|
} catch {}
|
|
73449
73547
|
if (!empty)
|
|
73450
73548
|
return { fatal: NON_EMPTY_FIX(dir) };
|
|
@@ -74219,8 +74317,8 @@ __export(exports_run_group, {
|
|
|
74219
74317
|
groupCostLine: () => groupCostLine,
|
|
74220
74318
|
NOT_PROVEN: () => NOT_PROVEN
|
|
74221
74319
|
});
|
|
74222
|
-
import { cpSync as cpSync3, existsSync as existsSync78, mkdirSync as mkdirSync58, readdirSync as
|
|
74223
|
-
import { createHash as
|
|
74320
|
+
import { cpSync as cpSync3, existsSync as existsSync78, mkdirSync as mkdirSync58, readdirSync as readdirSync38, readFileSync as readFileSync98, rmSync as rmSync33, statSync as statSync31 } from "fs";
|
|
74321
|
+
import { createHash as createHash33 } from "crypto";
|
|
74224
74322
|
import { spawn as spawn12 } from "child_process";
|
|
74225
74323
|
import { join as join112, resolve as resolve32 } from "path";
|
|
74226
74324
|
function scopedEnv(env) {
|
|
@@ -74289,7 +74387,7 @@ function findResumable(repoDir, specSha, unitIds) {
|
|
|
74289
74387
|
const root = join112(repoDir, ".loki", "groups");
|
|
74290
74388
|
let names = [];
|
|
74291
74389
|
try {
|
|
74292
|
-
names =
|
|
74390
|
+
names = readdirSync38(root);
|
|
74293
74391
|
} catch {
|
|
74294
74392
|
return null;
|
|
74295
74393
|
}
|
|
@@ -74667,7 +74765,7 @@ var NOT_PROVEN = 4, ENV_KEEP, defaultLauncher = (argv, env, cwd, onOut) => new P
|
|
|
74667
74765
|
}), git11 = (dir, args) => {
|
|
74668
74766
|
const r = safeGitSpawn(dir, args, { encoding: "utf8" });
|
|
74669
74767
|
return r.status === 0 ? String(r.stdout).trim() : "";
|
|
74670
|
-
}, SLUG_RE, originSlug = (repoDir) => SLUG_RE.exec(git11(repoDir, ["remote", "get-url", "origin"]))?.[1], sha2563 = (s) =>
|
|
74768
|
+
}, SLUG_RE, originSlug = (repoDir) => SLUG_RE.exec(git11(repoDir, ["remote", "get-url", "origin"]))?.[1], sha2563 = (s) => createHash33("sha256").update(s).digest("hex"), UNIT_ID_RE, GID_RE, readJson8 = (p) => {
|
|
74671
74769
|
try {
|
|
74672
74770
|
const v3 = JSON.parse(readFileSync98(p, "utf8"));
|
|
74673
74771
|
return v3 !== null && typeof v3 === "object" && !Array.isArray(v3) ? v3 : null;
|
|
@@ -74928,7 +75026,7 @@ var init_forecast = __esm(() => {
|
|
|
74928
75026
|
});
|
|
74929
75027
|
|
|
74930
75028
|
// ../../loki-ts/src/commands/queue.ts
|
|
74931
|
-
import { existsSync as existsSync80, mkdirSync as mkdirSync60, readFileSync as readFileSync101, readdirSync as
|
|
75029
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync60, readFileSync as readFileSync101, readdirSync as readdirSync39, renameSync as renameSync22, statSync as statSync32, writeFileSync as writeFileSync59 } from "fs";
|
|
74932
75030
|
import { join as join114, resolve as resolve34 } from "path";
|
|
74933
75031
|
function normalizeRef(raw2) {
|
|
74934
75032
|
const m = URL_RE2.exec(raw2);
|
|
@@ -75170,7 +75268,7 @@ function newestRecord(lokiDir2, since) {
|
|
|
75170
75268
|
const dir = join114(lokiDir2, sub2);
|
|
75171
75269
|
let best = null;
|
|
75172
75270
|
try {
|
|
75173
|
-
for (const name of
|
|
75271
|
+
for (const name of readdirSync39(dir)) {
|
|
75174
75272
|
const p = join114(dir, name, file);
|
|
75175
75273
|
if (!existsSync80(p))
|
|
75176
75274
|
continue;
|
|
@@ -76053,7 +76151,7 @@ __export(exports_supervisor, {
|
|
|
76053
76151
|
BACKSTOP_GRACE_S: () => BACKSTOP_GRACE_S
|
|
76054
76152
|
});
|
|
76055
76153
|
import { spawn as spawn13, spawnSync as spawnSync17 } from "child_process";
|
|
76056
|
-
import { createHash as
|
|
76154
|
+
import { createHash as createHash34, createPublicKey as createPublicKey4, sign as sign3 } from "crypto";
|
|
76057
76155
|
import { existsSync as existsSync82, mkdirSync as mkdirSync63, readFileSync as readFileSync102, writeFileSync as writeFileSync61 } from "fs";
|
|
76058
76156
|
import { dirname as dirname47, join as join117, relative as relative28, resolve as resolve36 } from "path";
|
|
76059
76157
|
async function slackEvent(...a) {
|
|
@@ -76084,7 +76182,7 @@ class SupervisorLog {
|
|
|
76084
76182
|
this.path = path;
|
|
76085
76183
|
this.runId = runId2;
|
|
76086
76184
|
this.log = new EventLog(path, runId2);
|
|
76087
|
-
this.hash =
|
|
76185
|
+
this.hash = createHash34("sha256");
|
|
76088
76186
|
try {
|
|
76089
76187
|
this.hash.update(readFileSync102(path));
|
|
76090
76188
|
} catch {}
|
|
@@ -76151,7 +76249,7 @@ class SupervisorLog {
|
|
|
76151
76249
|
const expected = this.hash.copy().digest("hex");
|
|
76152
76250
|
let actual = "";
|
|
76153
76251
|
try {
|
|
76154
|
-
actual =
|
|
76252
|
+
actual = createHash34("sha256").update(readFileSync102(this.path)).digest("hex");
|
|
76155
76253
|
} catch {}
|
|
76156
76254
|
if (actual === expected)
|
|
76157
76255
|
return true;
|
|
@@ -77132,7 +77230,7 @@ __export(exports_warm, {
|
|
|
77132
77230
|
dirtyHash: () => dirtyHash,
|
|
77133
77231
|
WarmEngine: () => WarmEngine
|
|
77134
77232
|
});
|
|
77135
|
-
import { createHash as
|
|
77233
|
+
import { createHash as createHash35 } from "crypto";
|
|
77136
77234
|
import { existsSync as existsSync84, mkdirSync as mkdirSync64, readFileSync as readFileSync105, statSync as statSync33, unlinkSync as unlinkSync11 } from "fs";
|
|
77137
77235
|
import { createServer as createServer2 } from "net";
|
|
77138
77236
|
import { dirname as dirname48, resolve as resolve37 } from "path";
|
|
@@ -77154,7 +77252,7 @@ function dirtyHash(repoDir) {
|
|
|
77154
77252
|
const out3 = git12(repoDir, ["status", "--porcelain", "-uall"]);
|
|
77155
77253
|
if (out3 === null || out3.trim() === "")
|
|
77156
77254
|
return "";
|
|
77157
|
-
const h10 =
|
|
77255
|
+
const h10 = createHash35("sha256");
|
|
77158
77256
|
for (const line2 of out3.split(`
|
|
77159
77257
|
`).filter(Boolean).sort()) {
|
|
77160
77258
|
h10.update(line2 + `
|
|
@@ -77563,7 +77661,13 @@ async function runIntakeBody(ctx, signal, opts, held) {
|
|
|
77563
77661
|
if (stale)
|
|
77564
77662
|
process.stderr.write(`engine10: ${stale.lokiOwn ? unmergedEvidenceNote(stale) : `evidence for the task is on ${stale.branch ?? "HEAD"} but not on ${stale.target}; implementing`}
|
|
77565
77663
|
`);
|
|
77566
|
-
const data = { ...base, ...stale?.lokiOwn ? { unmerged_loki_work: { branch: stale.branch, target: stale.target, commits: stale.commits, message: unmergedEvidenceNote(stale) } } : {}, ...await intakeProjectModel(ctx, signal, t02), ...await intakeDeps(ctx, signal, testmap.runners), zero_baseline: await probeZeroChecks(ctx.repoDir, testmap.tests, signal),
|
|
77664
|
+
const data = { ...base, ...stale?.lokiOwn ? { unmerged_loki_work: { branch: stale.branch, target: stale.target, commits: stale.commits, message: unmergedEvidenceNote(stale) } } : {}, ...await intakeProjectModel(ctx, signal, t02), ...await intakeDeps(ctx, signal, testmap.runners), zero_baseline: await probeZeroChecks(ctx.repoDir, testmap.tests, signal), hidden_cfg: (() => {
|
|
77665
|
+
try {
|
|
77666
|
+
return hiddenRunnerConfigs(ctx.repoDir);
|
|
77667
|
+
} catch {
|
|
77668
|
+
return null;
|
|
77669
|
+
}
|
|
77670
|
+
})(), repomap_ref: repomapRef, testmap, already_satisfied: false };
|
|
77567
77671
|
if (speedEnabled())
|
|
77568
77672
|
deferAlreadyDone(ctx, signal, task, repoMap, testmap, (a) => {
|
|
77569
77673
|
if (unmergedEvidence(ctx.repoDir, a.paths, startBranch))
|
|
@@ -77588,6 +77692,7 @@ var init_intake = __esm(() => {
|
|
|
77588
77692
|
init_seal();
|
|
77589
77693
|
init_preexisting_dirty();
|
|
77590
77694
|
init_safe_git();
|
|
77695
|
+
init_runner_config();
|
|
77591
77696
|
init_repo_profile();
|
|
77592
77697
|
stage8 = {
|
|
77593
77698
|
name: "intake",
|
|
@@ -78088,7 +78193,7 @@ __export(exports_dashboard, {
|
|
|
78088
78193
|
modernizeRoute: () => modernizeRoute,
|
|
78089
78194
|
listModernizeIds: () => listModernizeIds
|
|
78090
78195
|
});
|
|
78091
|
-
import { existsSync as existsSync86, readdirSync as
|
|
78196
|
+
import { existsSync as existsSync86, readdirSync as readdirSync40 } from "fs";
|
|
78092
78197
|
import { join as join123 } from "path";
|
|
78093
78198
|
function modernizeDir(repoDir) {
|
|
78094
78199
|
return join123(repoDir, ".loki", "modernize");
|
|
@@ -78097,7 +78202,7 @@ function listModernizeIds(repoDir) {
|
|
|
78097
78202
|
const dir = modernizeDir(repoDir);
|
|
78098
78203
|
if (!existsSync86(dir))
|
|
78099
78204
|
return [];
|
|
78100
|
-
return
|
|
78205
|
+
return readdirSync40(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort();
|
|
78101
78206
|
}
|
|
78102
78207
|
function summarizeModernize(repoDir, mid) {
|
|
78103
78208
|
const events2 = readModernizeEvents(repoDir, mid);
|
|
@@ -78717,7 +78822,7 @@ var init_codemod = __esm(() => {
|
|
|
78717
78822
|
});
|
|
78718
78823
|
|
|
78719
78824
|
// ../../loki-ts/src/engine10/modernize/oracle/seal.ts
|
|
78720
|
-
import { createHash as
|
|
78825
|
+
import { createHash as createHash36 } from "crypto";
|
|
78721
78826
|
import { existsSync as existsSync87, mkdirSync as mkdirSync67, readFileSync as readFileSync109, writeFileSync as writeFileSync63 } from "fs";
|
|
78722
78827
|
import { join as join126 } from "path";
|
|
78723
78828
|
function normalizersSha(n10) {
|
|
@@ -78853,7 +78958,7 @@ function verifySeal(repoDir, mid, unit) {
|
|
|
78853
78958
|
}
|
|
78854
78959
|
return { ok: true };
|
|
78855
78960
|
}
|
|
78856
|
-
var sha2564 = (s) =>
|
|
78961
|
+
var sha2564 = (s) => createHash36("sha256").update(s).digest("hex"), DEFAULT_NORMALIZERS, HELD_OUT_FRACTION = 0.2, COVERAGE_FLOOR_PCT = 80, MIN_CASES_FOR_HELD_OUT = 2;
|
|
78857
78962
|
var init_seal2 = __esm(() => {
|
|
78858
78963
|
init_holdout();
|
|
78859
78964
|
init_log();
|
|
@@ -80078,8 +80183,8 @@ var init_presealed_wall = __esm(() => {
|
|
|
80078
80183
|
|
|
80079
80184
|
// ../../loki-ts/src/engine10/modernize/unit.ts
|
|
80080
80185
|
import { spawnSync as spawnSync20 } from "child_process";
|
|
80081
|
-
import { createHash as
|
|
80082
|
-
import { lstatSync as lstatSync30, readFileSync as readFileSync115, readdirSync as
|
|
80186
|
+
import { createHash as createHash37 } from "crypto";
|
|
80187
|
+
import { lstatSync as lstatSync30, readFileSync as readFileSync115, readdirSync as readdirSync41, readlinkSync as readlinkSync7, realpathSync as realpathSync34, rmSync as rmSync37 } from "fs";
|
|
80083
80188
|
import { tmpdir as tmpdir23 } from "os";
|
|
80084
80189
|
import { join as join132, sep as sep21 } from "path";
|
|
80085
80190
|
function isSealedName(rel) {
|
|
@@ -80089,7 +80194,7 @@ function purgePycache(dir) {
|
|
|
80089
80194
|
const walk = (d) => {
|
|
80090
80195
|
let ents;
|
|
80091
80196
|
try {
|
|
80092
|
-
ents =
|
|
80197
|
+
ents = readdirSync41(d, { withFileTypes: true });
|
|
80093
80198
|
} catch {
|
|
80094
80199
|
return;
|
|
80095
80200
|
}
|
|
@@ -80120,7 +80225,7 @@ function outsideTargetDigest(dir, full) {
|
|
|
80120
80225
|
}
|
|
80121
80226
|
if (real3 === root || real3.startsWith(root + sep21))
|
|
80122
80227
|
return "inside";
|
|
80123
|
-
const h10 =
|
|
80228
|
+
const h10 = createHash37("sha256");
|
|
80124
80229
|
let budget = 20000;
|
|
80125
80230
|
const walk = (p) => {
|
|
80126
80231
|
if (budget-- <= 0) {
|
|
@@ -80145,7 +80250,7 @@ function outsideTargetDigest(dir, full) {
|
|
|
80145
80250
|
if (st2.isDirectory()) {
|
|
80146
80251
|
let names = [];
|
|
80147
80252
|
try {
|
|
80148
|
-
names =
|
|
80253
|
+
names = readdirSync41(p).sort();
|
|
80149
80254
|
} catch {
|
|
80150
80255
|
h10.update("unreadable");
|
|
80151
80256
|
}
|
|
@@ -80172,7 +80277,7 @@ function conformanceHashes(dir) {
|
|
|
80172
80277
|
const walk = (sub2, inSkip) => {
|
|
80173
80278
|
let ents;
|
|
80174
80279
|
try {
|
|
80175
|
-
ents =
|
|
80280
|
+
ents = readdirSync41(join132(dir, sub2), { withFileTypes: true });
|
|
80176
80281
|
} catch {
|
|
80177
80282
|
return;
|
|
80178
80283
|
}
|
|
@@ -80214,7 +80319,7 @@ function conformanceHashes(dir) {
|
|
|
80214
80319
|
} catch {
|
|
80215
80320
|
continue;
|
|
80216
80321
|
}
|
|
80217
|
-
out3[rel] =
|
|
80322
|
+
out3[rel] = createHash37("sha256").update(data).digest("hex");
|
|
80218
80323
|
}
|
|
80219
80324
|
return out3;
|
|
80220
80325
|
}
|
|
@@ -80755,7 +80860,7 @@ var init_modernize_unit = __esm(() => {
|
|
|
80755
80860
|
});
|
|
80756
80861
|
|
|
80757
80862
|
// ../../loki-ts/src/util/modernize_coordinator.ts
|
|
80758
|
-
import { createHash as
|
|
80863
|
+
import { createHash as createHash38 } from "crypto";
|
|
80759
80864
|
import { existsSync as existsSync92, mkdtempSync as mkdtempSync20, readFileSync as readFileSync118, rmSync as rmSync39 } from "fs";
|
|
80760
80865
|
import { tmpdir as tmpdir25 } from "os";
|
|
80761
80866
|
import { join as join135 } from "path";
|
|
@@ -81012,7 +81117,7 @@ function productionWaveDeps(o) {
|
|
|
81012
81117
|
}
|
|
81013
81118
|
};
|
|
81014
81119
|
}
|
|
81015
|
-
var productionReslice, sha2565 = (p) => existsSync92(p) ?
|
|
81120
|
+
var productionReslice, sha2565 = (p) => existsSync92(p) ? createHash38("sha256").update(readFileSync118(p)).digest("hex") : "n/a", MULTI_FILE_REASON = "multi-file unit: capture not supported (founder default)";
|
|
81016
81121
|
var init_modernize_coordinator = __esm(() => {
|
|
81017
81122
|
init_codemod();
|
|
81018
81123
|
init_search();
|
|
@@ -81265,7 +81370,7 @@ Targets: ${TARGETS2.join(", ")}
|
|
|
81265
81370
|
});
|
|
81266
81371
|
|
|
81267
81372
|
// ../../loki-ts/src/contrib/sarif.ts
|
|
81268
|
-
import { createHash as
|
|
81373
|
+
import { createHash as createHash39 } from "crypto";
|
|
81269
81374
|
function sarifUri(file, repoRoot2) {
|
|
81270
81375
|
let p = file.replace(/\\/g, "/");
|
|
81271
81376
|
if (repoRoot2) {
|
|
@@ -81326,7 +81431,7 @@ function toSarif(findings, toolVersion2 = "0.0.0", repoRoot2) {
|
|
|
81326
81431
|
]
|
|
81327
81432
|
};
|
|
81328
81433
|
}
|
|
81329
|
-
var RULES2, SCHEMA = "https://json.schemastore.org/sarif-2.1.0.json", sha6 = (s) =>
|
|
81434
|
+
var RULES2, SCHEMA = "https://json.schemastore.org/sarif-2.1.0.json", sha6 = (s) => createHash39("sha256").update(s).digest("hex");
|
|
81330
81435
|
var init_sarif = __esm(() => {
|
|
81331
81436
|
init_redact();
|
|
81332
81437
|
RULES2 = {
|
|
@@ -81576,7 +81681,7 @@ function outcomeOf(verdict, capHit, stop, tampered = false, sealed = false) {
|
|
|
81576
81681
|
function reasonOf(ev2, tampered, stop, outcome) {
|
|
81577
81682
|
const done = (s) => ev2.findLast((e10) => e10.type === "stage.completed" && e10.stage === s)?.data, v3 = done("verify"), checks = v3?.checks ?? [], pre2 = v3?.pre_red_checks ?? [], bad = checks.find((c) => isBlockingFail(c, pre2));
|
|
81578
81683
|
const authCause = stop === "fatal:auth" ? String(ev2.findLast((e10) => e10.type === "session.ended" && typeof e10.data?.provider_error === "string" && e10.data.provider_error !== "")?.data.provider_error ?? "") : "";
|
|
81579
|
-
const r = EXIT[outcome] === 0 ? "" : tampered ? "event log modified outside the engine" : outcome === "CANCELLED" ? `cancelled by signal; usage recorded so far is kept; next loki start offers to start fresh (any work is on loki/${ev2[0]?.run ?? "<id>"})` : stop?.startsWith("fatal:") ? { "fatal:quota_exhausted": "provider credit exhausted", "fatal:auth": `provider authentication failed${authCause ? `: ${authCause}` : ""}` }[stop] ?? stop : outcome === "BLOCKED" ? `spec conflict: ${conflictReasonOf(ev2) ?? "see the receipt"}` : stop === "stalled" ? "stalled: same failure 3 times" : bad ? `${bad.name} failed${bad.first_error ? `: ${bad.first_error}` : ""}${bad.anchor ? ` (at ${bad.anchor})` : ""}` : (ev2.some((e10) => e10.type === "cap.hit") ? "cost/time cap reached" : undefined) ?? ev2.find((e10) => e10.type === "stage.failed")?.data.reason ?? (v3 && !checks.length ? "no tests to run" : stop ?? (ev2.some((e10) => e10.type === "receipt.sealed") ? "" : "engine ended before sealing a receipt"));
|
|
81684
|
+
const r = EXIT[outcome] === 0 ? "" : tampered ? "event log modified outside the engine" : outcome === "CANCELLED" ? `cancelled by signal; usage recorded so far is kept; next loki start offers to ${ev2.some((e10) => e10.type === "stage.completed" && e10.stage === "intake") ? "resume it (settled stages are kept) or start fresh" : "start fresh"} (any work is on loki/${ev2[0]?.run ?? "<id>"})` : stop?.startsWith("fatal:") ? { "fatal:quota_exhausted": "provider credit exhausted", "fatal:auth": `provider authentication failed${authCause ? `: ${authCause}` : ""}` }[stop] ?? stop : outcome === "BLOCKED" ? `spec conflict: ${conflictReasonOf(ev2) ?? "see the receipt"}` : stop === "stalled" ? "stalled: same failure 3 times" : bad ? `${bad.name} failed${bad.first_error ? `: ${bad.first_error}` : ""}${bad.anchor ? ` (at ${bad.anchor})` : ""}` : (ev2.some((e10) => e10.type === "cap.hit") ? "cost/time cap reached" : undefined) ?? ev2.find((e10) => e10.type === "stage.failed")?.data.reason ?? (v3 && !checks.length ? "no tests to run" : stop ?? (ev2.some((e10) => e10.type === "receipt.sealed") ? "" : "engine ended before sealing a receipt"));
|
|
81580
81685
|
return plainLine(r) || undefined;
|
|
81581
81686
|
}
|
|
81582
81687
|
function preModelTiming(events2, startMs) {
|
|
@@ -81818,7 +81923,7 @@ var init_undo = __esm(() => {
|
|
|
81818
81923
|
});
|
|
81819
81924
|
|
|
81820
81925
|
// ../../loki-ts/src/commands/run_status.ts
|
|
81821
|
-
import { existsSync as existsSync95, readdirSync as
|
|
81926
|
+
import { existsSync as existsSync95, readdirSync as readdirSync42, readFileSync as readFileSync121, statSync as statSync37 } from "fs";
|
|
81822
81927
|
import { basename as basename35, dirname as dirname53, join as join137, resolve as resolve39 } from "path";
|
|
81823
81928
|
function runsRoot(env, repoDir) {
|
|
81824
81929
|
return env.LOKI_DIR ? join137(resolve39(repoDir, env.LOKI_DIR), "runs") : join137(repoDir, ".loki", "runs");
|
|
@@ -81826,7 +81931,7 @@ function runsRoot(env, repoDir) {
|
|
|
81826
81931
|
function listRunIds(root) {
|
|
81827
81932
|
if (!existsSync95(root))
|
|
81828
81933
|
return [];
|
|
81829
|
-
return
|
|
81934
|
+
return readdirSync42(root, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort();
|
|
81830
81935
|
}
|
|
81831
81936
|
function latestRunId(root) {
|
|
81832
81937
|
const ids = listRunIds(root);
|
|
@@ -82050,7 +82155,7 @@ __export(exports_verify_cmd, {
|
|
|
82050
82155
|
});
|
|
82051
82156
|
import { existsSync as existsSync97, readFileSync as readFileSync123, renameSync as renameSync24, statSync as statSync38, writeFileSync as writeFileSync70 } from "fs";
|
|
82052
82157
|
import { basename as basename37, dirname as dirname55, join as join139 } from "path";
|
|
82053
|
-
import { createHash as
|
|
82158
|
+
import { createHash as createHash40, verify as verify5 } from "crypto";
|
|
82054
82159
|
function checkAttestation(jwt, expectedHash, given) {
|
|
82055
82160
|
const bad = (reason) => ({ status: "tampered", reason });
|
|
82056
82161
|
const [h10, p, s, ...rest] = jwt.split(".");
|
|
@@ -82081,7 +82186,7 @@ function wallTamperProblem(receiptPath, receipt) {
|
|
|
82081
82186
|
const copy = join139(wallDir, basename37(f.path));
|
|
82082
82187
|
let cur;
|
|
82083
82188
|
try {
|
|
82084
|
-
cur =
|
|
82189
|
+
cur = createHash40("sha256").update(readFileSync123(copy)).digest("hex");
|
|
82085
82190
|
} catch {
|
|
82086
82191
|
if (haveWallDir)
|
|
82087
82192
|
return `sealed Wall file ${basename37(f.path)} is missing from the run's wall directory: it was deleted after the seal`;
|
|
@@ -82103,7 +82208,7 @@ function checkEventLog(receiptPath, receipt) {
|
|
|
82103
82208
|
}
|
|
82104
82209
|
if (typeof bound !== "string")
|
|
82105
82210
|
return null;
|
|
82106
|
-
if (bound ===
|
|
82211
|
+
if (bound === createHash40("sha256").digest("hex")) {
|
|
82107
82212
|
const st2 = receipt["time"]?.stages;
|
|
82108
82213
|
const claims = st2 !== null && typeof st2 === "object" && Object.keys(st2).length > 0;
|
|
82109
82214
|
return claims ? "the receipt records stages but binds the empty-log hash, so no events.jsonl can back it (missing, empty or non-empty); the receipt is forged or was sealed without a log. Re-run the task to produce a fresh receipt" : null;
|
|
@@ -82122,7 +82227,7 @@ function checkEventLog(receiptPath, receipt) {
|
|
|
82122
82227
|
return "events.jsonl has bytes the engine never writes (a blank line or stray whitespace); it was appended to after the seal";
|
|
82123
82228
|
if (events2.some((e10) => e10.type === "tamper.detected"))
|
|
82124
82229
|
return "the supervisor detected events.jsonl being modified during the run";
|
|
82125
|
-
const h10 =
|
|
82230
|
+
const h10 = createHash40("sha256");
|
|
82126
82231
|
for (const l of lines2) {
|
|
82127
82232
|
if (h10.copy().digest("hex") === bound)
|
|
82128
82233
|
return null;
|
|
@@ -82151,7 +82256,7 @@ function checkLogSeal(receiptPath, hash, kid, given) {
|
|
|
82151
82256
|
if (!d)
|
|
82152
82257
|
return { verdict: "TAMPERED", reason: "events.jsonl has no signed log.sealed line after run.completed" };
|
|
82153
82258
|
const lines2 = readFileSync123(path, "utf8").split(`
|
|
82154
|
-
`).filter((l) => l.trim() !== ""), sha7 =
|
|
82259
|
+
`).filter((l) => l.trim() !== ""), sha7 = createHash40("sha256").update(lines2.slice(0, done + 1).join(`
|
|
82155
82260
|
`) + `
|
|
82156
82261
|
`).digest("hex");
|
|
82157
82262
|
const pub = d["kid"] === kid ? pubFor(kid, given) : undefined;
|