loki-mode 11.157.0 → 11.158.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/autonomy/route.sh +1 -1
- package/dashboard/__init__.py +1 -1
- package/docs/CLI-REFERENCE.md +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/docs/dev/architecture-reference.md +10 -0
- package/loki-ts/dist/loki.js +1901 -1891
- package/mcp/__init__.py +1 -1
- package/package.json +2 -2
- package/packages/control-plane/dist/server.js +232 -21
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/web-app/dist/assets/{AdminPage-Dtr9qXAr.js → AdminPage-CWaUcwDm.js} +1 -1
- package/web-app/dist/assets/{Avatar-Bbd5nIIQ.js → Avatar-6lc2wVW0.js} +1 -1
- package/web-app/dist/assets/{Badge-KlCR8eBL.js → Badge-CkD9JQpc.js} +1 -1
- package/web-app/dist/assets/{Button-CuvgSS4G.js → Button-DkEbiW6A.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-DoEOdgP2.js → CockpitPage-Ct-s4z5S.js} +1 -1
- package/web-app/dist/assets/{ComparePage-kHjdfoWo.js → ComparePage-Dt4FX5rV.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-Cdm7nC6_.js → ErrorBoundary-BSovh9AG.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-Cy4gJTfN.js → EvidenceReceiptPanel-LXcAwiHD.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-CoaeSXOe.js → GitHubIssuesPanel-CnaU29SV.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-CQJCoIz_.js → GitHubPRsPanel-CBFOuOkd.js} +1 -1
- package/web-app/dist/assets/{HomePage-3XZPfCSJ.js → HomePage-CtKACBsT.js} +2 -2
- package/web-app/dist/assets/{LoginPage-BNSbxeMm.js → LoginPage-BSXNrDnS.js} +1 -1
- package/web-app/dist/assets/{MagicPage-WWH7SwfZ.js → MagicPage-BWOdNxoN.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-Cjvh-jSf.js → MetricsPage-D50EAlFS.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-CgL4EF3d.js → NotFoundPage-ByLCS4wh.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-B2y6gBfZ.js → ProjectPage-DU2grO7_.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-BTagWO2i.js → ProjectsPage-bN76CTu1.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-WmRElM3E.js → SettingsPage-2ZNwlRdJ.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-wQ-VZyW1.js → ShowcasePage-DEg3BDY_.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-CkoLiTvO.js → SystemSettingsPage-CT7sCrKI.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-D-LHZsn9.js → TeamsPage-CQhc0kCr.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-DuRKmn-s.js → TemplatesPage-W0SPAMsx.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-2PXo3eS2.js → TerminalOutput-BebfZZ7M.js} +1 -1
- package/web-app/dist/assets/{activity-D3TUBclR.js → activity-j4l9Gk8R.js} +1 -1
- package/web-app/dist/assets/{bell-BDl1J6X-.js → bell-DZGCYZy6.js} +1 -1
- package/web-app/dist/assets/{bot-CHoQ0cL1.js → bot-OYnVB94o.js} +1 -1
- package/web-app/dist/assets/{check-BuGreETS.js → check-C6t5iHbP.js} +1 -1
- package/web-app/dist/assets/{chevron-left-Dkf6mFUB.js → chevron-left-DM35O0gQ.js} +1 -1
- package/web-app/dist/assets/{circle-alert-WFj2TQ9c.js → circle-alert-LuDQClnV.js} +1 -1
- package/web-app/dist/assets/{clock-Bn6QW9zr.js → clock-9Po9qHu3.js} +1 -1
- package/web-app/dist/assets/{cloud-Yzjfx2Bv.js → cloud-CL7KrQ2p.js} +1 -1
- package/web-app/dist/assets/{code-xml-CtpDC2I8.js → code-xml-ZUDjmgxq.js} +1 -1
- package/web-app/dist/assets/{database-Datydoc-.js → database-Dy2MM-4L.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-BCJkxKs6.js → dollar-sign-CmoA7igV.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-gbgUZQ60.js → file-code-corner-BWTCMGKu.js} +1 -1
- package/web-app/dist/assets/{file-plus-B-Ah_CpZ.js → file-plus-D01cDOfJ.js} +1 -1
- package/web-app/dist/assets/{globe-Bst-IJOg.js → globe-BQER6rv6.js} +1 -1
- package/web-app/dist/assets/{hammer-CcKIK3jL.js → hammer-CUVQzryJ.js} +1 -1
- package/web-app/dist/assets/{index-DtmaWxTZ.js → index-C1IZi7yQ.js} +3 -3
- package/web-app/dist/assets/{layers-BAdGUPGI.js → layers-BS7Z9vCF.js} +1 -1
- package/web-app/dist/assets/{loader-circle-CzTwEeEV.js → loader-circle-7kYLdqEF.js} +1 -1
- package/web-app/dist/assets/{lock-B5s3sYxt.js → lock-4YHCWMTQ.js} +1 -1
- package/web-app/dist/assets/{package-BwP9xtUT.js → package-C_sd1CDA.js} +1 -1
- package/web-app/dist/assets/{plus-BkTkRvnl.js → plus-DdcBLEHW.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-vZWSQT4C.js → refresh-cw-D0RISUjF.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-BfiOpKkJ.js → rotate-ccw-DcVMUgYT.js} +1 -1
- package/web-app/dist/assets/{scroll-text-0F2pJrT7.js → scroll-text-DDR9GrS9.js} +1 -1
- package/web-app/dist/assets/{server-DKTp6Lsg.js → server-C-PyculS.js} +1 -1
- package/web-app/dist/assets/{shield-alert-DpL3knlY.js → shield-alert-mjamZyn0.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-CRr5J1fb.js → thumbs-up-D3YmttiS.js} +1 -1
- package/web-app/dist/assets/{trash-2-MhZJBf3n.js → trash-2-BBHz7Oec.js} +1 -1
- package/web-app/dist/assets/{trending-down-DL8xT5IX.js → trending-down-BmTUQZwa.js} +1 -1
- package/web-app/dist/assets/{trending-up-Ciy20G6q.js → trending-up-iLoyGfUy.js} +1 -1
- package/web-app/dist/assets/{upload-BlJIPegj.js → upload-BwEBbYzZ.js} +1 -1
- package/web-app/dist/assets/{usePolling-CxQ0uJJk.js → usePolling-kDnBK0Gl.js} +1 -1
- package/web-app/dist/assets/{user-C0ktPCL2.js → user-BZ4d4Ur5.js} +1 -1
- package/web-app/dist/index.html +1 -1
package/mcp/__init__.py
CHANGED
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.
|
|
4
|
+
"version": "11.158.0",
|
|
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": "
|
|
164
|
+
"gitHead": "e349b1fbf9605ae43f3ce7cf75fd590636e80e4a"
|
|
165
165
|
}
|
|
@@ -41886,6 +41886,7 @@ __export(exports_pr, {
|
|
|
41886
41886
|
runPr: () => runPr,
|
|
41887
41887
|
resolvePrAuthor: () => resolvePrAuthor,
|
|
41888
41888
|
prTitle: () => prTitle,
|
|
41889
|
+
prScopeGate: () => prScopeGate,
|
|
41889
41890
|
prChildTimeoutMs: () => prChildTimeoutMs,
|
|
41890
41891
|
partialHead: () => partialHead,
|
|
41891
41892
|
lokiLabelFor: () => lokiLabelFor,
|
|
@@ -42160,6 +42161,20 @@ function failedHead(verdict, failing, notProven2) {
|
|
|
42160
42161
|
`) + `
|
|
42161
42162
|
`;
|
|
42162
42163
|
}
|
|
42164
|
+
function prScopeGate(ctx, sealed, sealedNotes, sealMeasured) {
|
|
42165
|
+
const b = stackBase(process.env), o = ctx.outputs();
|
|
42166
|
+
const baseSha = String(o.intake?.base_sha ?? ctx.baseSha ?? "");
|
|
42167
|
+
const scope = prScope(ctx.repoDir, { target: b === null ? null : prTargetRef(ctx.repoDir, b), baseSha, head: `refs/heads/${ctx.branch}` });
|
|
42168
|
+
const line2 = `
|
|
42169
|
+
${prScopeLine(scope)}
|
|
42170
|
+
`;
|
|
42171
|
+
if (scope.ok)
|
|
42172
|
+
return { verdict: sealed, notProven: [], line: line2, scope };
|
|
42173
|
+
const capped = sealed === "VERIFIED", after = capped && sealMeasured;
|
|
42174
|
+
const reason = after ? `${scope.reason}; the receipt was sealed before the target or the branch changed, so the label is not carried and this is a draft` : scope.reason;
|
|
42175
|
+
return { verdict: capped ? "PARTIAL" : sealed, notProven: sealedNotes.includes(scope.reason) ? [] : [reason], line: after ? `${line2}The receipt was sealed before the pull request's target or branch changed: its label describes ${scope.measured_files ?? "an unknown number of"} files, not what this pull request would merge.
|
|
42176
|
+
` : line2, scope };
|
|
42177
|
+
}
|
|
42163
42178
|
async function runPr(ctx, signal, opts = {}) {
|
|
42164
42179
|
if (signal.aborted)
|
|
42165
42180
|
return { status: "failed", data: {}, reason: "aborted before pr started" };
|
|
@@ -42167,8 +42182,15 @@ async function runPr(ctx, signal, opts = {}) {
|
|
|
42167
42182
|
if (!pinnedOrigin)
|
|
42168
42183
|
return { status: "failed", data: {}, reason: "no pinned origin: refusing to push (Rule of Two)" };
|
|
42169
42184
|
const seal = ctx.outputs().seal ?? {};
|
|
42170
|
-
const
|
|
42171
|
-
|
|
42185
|
+
const scopeGate = prScopeGate(ctx, seal.verdict ?? "PARTIAL", seal.not_proven ?? [], (() => {
|
|
42186
|
+
try {
|
|
42187
|
+
return !!seal.receipt_path && "pr_base" in JSON.parse(readFileSync99(seal.receipt_path, "utf8"));
|
|
42188
|
+
} catch {
|
|
42189
|
+
return false;
|
|
42190
|
+
}
|
|
42191
|
+
})());
|
|
42192
|
+
const verdict = scopeGate.verdict;
|
|
42193
|
+
const notProven2 = collapseNotProven([...scopeGate.notProven, ...seal.not_proven ?? []]);
|
|
42172
42194
|
const capHit = ctx.capHit?.() ?? false;
|
|
42173
42195
|
const draft = verdict !== "VERIFIED" || capHit || process.env.LOKI_PR_DRAFT === "1" || ctx.draft === true;
|
|
42174
42196
|
const base = stackBase(process.env);
|
|
@@ -42224,7 +42246,7 @@ async function runPr(ctx, signal, opts = {}) {
|
|
|
42224
42246
|
const stopNote = stopSection(verdict, sealedOk, capHit, `if the cost cap was hit, loki start --max-cost <higher>, then ${rerun}; if the time cap, ${rerun} with more time`);
|
|
42225
42247
|
const reviewerBody = lead + acceptanceHead(verdict, sealedReceipt) + partialHead(verdict, notProven2, sealedReceipt?.["prove"]) + (lead ? "" : failedHead(verdict, failing, notProven2)) + stopNote + renderReviewerBody({ verdict, draftReason: draftReason(verdict, capHit), notProven: notProven2, receiptPath: seal.receipt_path ?? null, receiptSha256: seal.receipt_sha256 ?? null, signed: typeof seal.signed === "boolean" ? seal.signed : null, runId: ctx.runId, outputs: ctx.outputs(), sealAccuracy: sealAccuracyOfFile(seal.receipt_path ?? null), receipt: sealedReceipt });
|
|
42226
42248
|
const tpl = readPrTemplate(ctx.repoDir), shaped = tpl === null ? reviewerBody : applyPrTemplate(reviewerBody, tpl, receiptProof(verdict, ctx.outputs(), seal.receipt_sha256 ?? null));
|
|
42227
|
-
writeFileSync55(bodyFile, withAiMarker(withSealRoute(shaped, process.env, seal), aiMarkerLine({ runId: ctx.runId, provider: ctx.provider, model: ctx.model })) + intentSection(ctx.outputs().plan) + specPrLine(process.env) + triagePrLine(ctx.outputs().intake) + evidenceSection(seal.receipt_path) + briefSection(ctx) + beforeAfter + (seal.mutation_line ? `
|
|
42249
|
+
writeFileSync55(bodyFile, withAiMarker(withSealRoute(shaped, process.env, seal), aiMarkerLine({ runId: ctx.runId, provider: ctx.provider, model: ctx.model })) + intentSection(ctx.outputs().plan) + specPrLine(process.env) + triagePrLine(ctx.outputs().intake) + scopeGate.line + evidenceSection(seal.receipt_path) + briefSection(ctx) + beforeAfter + (seal.mutation_line ? `
|
|
42228
42250
|
${seal.mutation_line}
|
|
42229
42251
|
` : "") + link + stackSection(process.env, base, link !== "", ctx.repoDir) + (ctx.handoffMd ?? ""), "utf8");
|
|
42230
42252
|
const title = prTitle(verdict, ctx.runDir, String(ctx.outputs().intake?.task ?? ""), failing);
|
|
@@ -42272,7 +42294,9 @@ ${seal.mutation_line}
|
|
|
42272
42294
|
notProvenOut.push(commentMiss);
|
|
42273
42295
|
if (verdict !== "SPEC_CONFLICT")
|
|
42274
42296
|
await (await Promise.resolve().then(() => (init_writeback(), exports_writeback))).writeBack({ phase: verdict === "FAILED" ? "failed" : "done", ...verdict === "FAILED" ? { reason: `failing: ${failing.join(", ") || "see the receipt"}` } : {}, verdict, prUrl: url, receiptSha256: seal.receipt_sha256 ?? null, task: String(ctx.outputs().intake?.task ?? "") });
|
|
42275
|
-
|
|
42297
|
+
if (scopeGate.notProven.length)
|
|
42298
|
+
notProvenOut.unshift(...scopeGate.notProven);
|
|
42299
|
+
return { status: "completed", data: { pr_url: url, draft, existing, pr_scope: scopeGate.scope, ...notProvenOut.length ? { not_proven: notProvenOut } : {} } };
|
|
42276
42300
|
}
|
|
42277
42301
|
var DEFAULT_PUSH_SH, PR_URL_RE, DEFAULT_PUSH_GITLAB_SH, MR_URL_RE, isGitlabOrigin = (o) => /^(?:https:\/\/gitlab\.com\/|git@gitlab\.com:|ssh:\/\/git@gitlab\.com\/)/i.test(o), SHA_RE, TITLE_MAX = 100, LOKI_LABELS, lokiLabelFor = (verdict) => verdict === "VERIFIED" ? LOKI_LABELS.safe : LOKI_LABELS.needs, stage4;
|
|
42278
42302
|
var init_pr = __esm(() => {
|
|
@@ -42289,6 +42313,7 @@ var init_pr = __esm(() => {
|
|
|
42289
42313
|
init_spec_file();
|
|
42290
42314
|
init_triage();
|
|
42291
42315
|
init_paths();
|
|
42316
|
+
init_base_guard();
|
|
42292
42317
|
init_safe_git();
|
|
42293
42318
|
init_term_width();
|
|
42294
42319
|
init_run_outputs();
|
|
@@ -44024,7 +44049,7 @@ ${wallTail}` : brief0;
|
|
|
44024
44049
|
let extraRounds = 0;
|
|
44025
44050
|
let noopSig = null;
|
|
44026
44051
|
const suiteSkip = suiteFixSkipEnabled() && !fatal && !capHit && outputs.implement?.exit === "done" && hasFailures(outputs.verify) && suiteOnlyRed(outputs.verify);
|
|
44027
|
-
const indepSkip =
|
|
44052
|
+
const indepSkip = !fatal && !capHit && hasFailures(outputs.verify) && fixGateOf(outputs.verify, `${String(outputs.implement?.model ?? "")} ${ctx.model}`).startsWith("closed");
|
|
44028
44053
|
if (indepSkip) {
|
|
44029
44054
|
outputs.verify = { ...outputs.verify, fix_gate: "haiku: no independent check failed, no fix round" };
|
|
44030
44055
|
ctx.emit("loop.repeat", "fix", { reason: "haiku: no independent check failed (LOKI_E10_HAIKU_INDEP_FIX)", round: 0, skipped: true });
|
|
@@ -44144,7 +44169,7 @@ var FLOW, TAIL, USAGE_LIMIT_STOP = "usage_limit", UsageLimitCut, harnessOnlyFail
|
|
|
44144
44169
|
const red = new Set(Array.isArray(d?.base_red_checks) ? d.base_red_checks.map(String) : []), pre = new Set(Array.isArray(d?.pre_red_checks) ? d.pre_red_checks.map(String) : []);
|
|
44145
44170
|
const live2 = (Array.isArray(d?.checks) ? d.checks : []).filter((c) => c?.result === "fail" && !pre.has(String(c.name)));
|
|
44146
44171
|
return red.size > 0 && live2.length > 0 && live2.every((c) => red.has(String(c.name)));
|
|
44147
|
-
}, PRE_EXISTING_CLAIM, BASE_RED_CONFLICT = "a fix round stopped saying the remaining failures pre-exist on base; every failing id is red on base and no failure names a changed file or symbol, so they are excused as pre-existing (error text not compared, not proven unrelated to this change)", onlyFullSuiteRed = (d) => Array.isArray(d?.failures_grouped) && d.failures_grouped.length > 0 && d.failures_grouped.every((g) => String(g.signature ?? "").startsWith("full suite") || environmentShaped([{ signature: String(g.signature ?? ""), sample: String(g.sample ?? "") }])), FRESH_BASE_NOTE = "Wall base run used a fresh checkout of the base commit (the pre-implement snapshot was unavailable): untracked and ignored files, such as built artifacts, were not there",
|
|
44172
|
+
}, PRE_EXISTING_CLAIM, BASE_RED_CONFLICT = "a fix round stopped saying the remaining failures pre-exist on base; every failing id is red on base and no failure names a changed file or symbol, so they are excused as pre-existing (error text not compared, not proven unrelated to this change)", onlyFullSuiteRed = (d) => Array.isArray(d?.failures_grouped) && d.failures_grouped.length > 0 && d.failures_grouped.every((g) => String(g.signature ?? "").startsWith("full suite") || environmentShaped([{ signature: String(g.signature ?? ""), sample: String(g.sample ?? "") }])), FRESH_BASE_NOTE = "Wall base run used a fresh checkout of the base commit (the pre-implement snapshot was unavailable): untracked and ignored files, such as built artifacts, were not there", suiteFixSkipEnabled = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_SUITE_FIX_SKIP"] ?? "").trim()), SUITE_FIX_SKIP_NOTE = "fix round skipped: only full-suite failures remained while the change's own targeted tests passed, so those failures are NOT PROVEN unrelated to the change (LOKI_E10_SUITE_FIX_SKIP=0 runs the round)", suiteOnlyRed = (d) => {
|
|
44148
44173
|
const checks2 = Array.isArray(d?.checks) ? d.checks : [], changed = (Array.isArray(d?.changed_files) ? d.changed_files : []).map(String).filter((f) => f && !f.startsWith(".loki/"));
|
|
44149
44174
|
const namesChanged = checks2.some((c) => c?.result === "fail" && String(c.name ?? "").startsWith("full suite") && (Array.isArray(c.ids) ? c.ids : []).some((i) => changed.some((f) => String(i).includes(f))));
|
|
44150
44175
|
return onlyFullSuiteRed(d) && !namesChanged && !(Number(d?.holdout_failed ?? 0) > 0) && checks2.some((c) => c?.result === "pass" && typeof c.n === "number" && c.n > 0 && !/^(full suite|lint:|security scan|select-tests|holdout)/.test(String(c.name ?? "")));
|
|
@@ -44177,6 +44202,8 @@ var init_machine = __esm(() => {
|
|
|
44177
44202
|
init_prove();
|
|
44178
44203
|
init_run_cap();
|
|
44179
44204
|
init_budget_cap();
|
|
44205
|
+
init_verify();
|
|
44206
|
+
init_verify();
|
|
44180
44207
|
FLOW = [
|
|
44181
44208
|
"intake",
|
|
44182
44209
|
["plan", "wall"],
|
|
@@ -44982,16 +45009,19 @@ __export(exports_verify, {
|
|
|
44982
45009
|
runCheck: () => runCheck,
|
|
44983
45010
|
ran: () => ran,
|
|
44984
45011
|
ownTests: () => ownTests,
|
|
45012
|
+
ownLintOf: () => ownLintOf,
|
|
44985
45013
|
ownByPathOn: () => ownByPathOn,
|
|
44986
45014
|
noTestFallbackOn: () => noTestFallbackOn,
|
|
44987
45015
|
lintUntouchedOn: () => lintUntouchedOn,
|
|
44988
45016
|
lintMissingDiscloseOn: () => lintMissingDiscloseOn,
|
|
44989
45017
|
lintFallbacks: () => lintFallbacks,
|
|
45018
|
+
haikuIndepFixOn: () => haikuIndepFixOn,
|
|
44990
45019
|
goStreamGreen: () => goStreamGreen,
|
|
44991
45020
|
goPackagePassed: () => goPackagePassed,
|
|
44992
45021
|
goFileStream: () => goFileStream,
|
|
44993
45022
|
goBatchable: () => goBatchable,
|
|
44994
45023
|
goBatchOn: () => goBatchOn,
|
|
45024
|
+
fixGateOf: () => fixGateOf,
|
|
44995
45025
|
firstError: () => firstError,
|
|
44996
45026
|
feedsFixRound: () => feedsFixRound,
|
|
44997
45027
|
errorsById: () => errorsById,
|
|
@@ -45010,6 +45040,8 @@ __export(exports_verify, {
|
|
|
45010
45040
|
TIMEOUT_CARRY_NOTE: () => TIMEOUT_CARRY_NOTE,
|
|
45011
45041
|
SUITE_MARGIN_MS: () => SUITE_MARGIN_MS,
|
|
45012
45042
|
QUIET_RED: () => QUIET_RED,
|
|
45043
|
+
OWN_TYPECHECK: () => OWN_TYPECHECK,
|
|
45044
|
+
OWN_LINT: () => OWN_LINT,
|
|
45013
45045
|
NO_ID_BASE_REASON: () => NO_ID_BASE_REASON,
|
|
45014
45046
|
LINT_UNTOUCHED_NOTE: () => LINT_UNTOUCHED_NOTE,
|
|
45015
45047
|
KILL_AFTER_MS: () => KILL_AFTER_MS,
|
|
@@ -45432,6 +45464,16 @@ function uncausedRed(c, changed, symbols, excerpt2) {
|
|
|
45432
45464
|
}
|
|
45433
45465
|
return changed.length > 0 && changed.every((f) => INERT_FILE.test(f) || isTestFile(f));
|
|
45434
45466
|
}
|
|
45467
|
+
function fixGateOf(v, models, failing = true, env = process.env) {
|
|
45468
|
+
if (!failing)
|
|
45469
|
+
return "none: no failing check feeds a fix round";
|
|
45470
|
+
const reds = Array.isArray(v?.independent_reds) ? v.independent_reds.map(String) : [];
|
|
45471
|
+
if (!/haiku/i.test(models))
|
|
45472
|
+
return "open: not a Haiku run";
|
|
45473
|
+
if (!haikuIndepFixOn(env))
|
|
45474
|
+
return "open: LOKI_E10_HAIKU_INDEP_FIX=0";
|
|
45475
|
+
return v?.independent_fail === false ? "closed: haiku: no independent check failed (LOKI_E10_HAIKU_INDEP_FIX)" : `open: independent check failed${reds.length ? `: ${reds.slice(0, 5).join(", ")}` : ""}`;
|
|
45476
|
+
}
|
|
45435
45477
|
function goPackagePassed(out2) {
|
|
45436
45478
|
let pass = false;
|
|
45437
45479
|
for (const l of out2.split(`
|
|
@@ -46187,9 +46229,10 @@ async function runVerify(ctx, signal, bt) {
|
|
|
46187
46229
|
const covered = (f) => [...ctx.tests.impacted(map, [f]), ...tests === tests0 ? [] : [...mochaTargets(ctx.repoDir, [f]), ...avaTargets(ctx.repoDir, [f])]].some((t) => checks2.some((c) => c.name === testCheckName(t) && hasExecutedProof([c])));
|
|
46188
46230
|
const uncoveredChanged = changed.filter((f) => CODE_FILE_EXT.test(f) && !isTestFile(f) && !wallPaths.has(f) && !cfgChanged.includes(f) && !covered(f));
|
|
46189
46231
|
const flaky = checks2.filter((c) => c.result === "flaky").map((c) => isHold(c) ? "holdout" : c.name);
|
|
46190
|
-
const
|
|
46232
|
+
const ownLintNames = checks2.filter((c) => ownLintOf(c, preRed, changed, symbols, excerpts.get(c) ?? "")).map((c) => c.name), ownTypeNames = checks2.filter((c) => ownLintOf(c, preRed, changed, symbols, excerpts.get(c) ?? "", OWN_TYPECHECK)).map((c) => c.name);
|
|
46233
|
+
const indepNames = new Set([...wallNames0, ...[...changedTestFiles, ...impacted, ...own].map(testCheckName), ...attr.introducedChecks, ...ownLintNames, ...ownTypeNames]);
|
|
46191
46234
|
const uncaused = uncausedOn() ? checks2.filter((c) => feedsFixRound(c, preRed) && !indepNames.has(c.name) && uncausedRed(c, changed, symbols, excerpts.get(c) ?? "")).map((c) => c.name) : [];
|
|
46192
|
-
const independentFail = checks2.some((c) => c.result === "fail" && indepNames.has(c.name) && !preRed.names.includes(c.name));
|
|
46235
|
+
const independentFail = checks2.some((c) => c.result === "fail" && indepNames.has(c.name) && !preRed.names.includes(c.name)), independentReds = checks2.filter((c) => c.result === "fail" && indepNames.has(c.name) && !preRed.names.includes(c.name)).map((c) => c.name);
|
|
46193
46236
|
const { groups: failuresGrouped, names: blockingNames } = briefGroups(checks2.filter((c) => !uncaused.includes(c.name)).filter((c) => feedsFixRound(c, preRed) || fixRounds === 0 && collateralSame.includes(c.name) && !collateralBase.includes(c.name)), (c) => excerpts.get(c) ?? "", (c) => suites.has(c), EXCERPT_TOTAL_CAP, qs && !complete ? { prev: ctx.outputs().verify, ran: new Set(checks2.map((c) => c.name)) } : undefined);
|
|
46194
46237
|
const pub = checks2.map((c) => isHold(c) ? pubHold(c) : c), holdoutFailed = checks2.filter((c) => c.result === "fail" && isHold(c) && !preRed.names.includes(c.name)).length;
|
|
46195
46238
|
const inBase = (f) => {
|
|
@@ -46217,7 +46260,7 @@ async function runVerify(ctx, signal, bt) {
|
|
|
46217
46260
|
await settleNrd(ctx);
|
|
46218
46261
|
if (touchedExcused.length)
|
|
46219
46262
|
attr.line = [attr.line, ...touchedExcused.map((n3) => `${TOUCHED_RED}: ${n3}`)].filter(Boolean).join("; ") || null;
|
|
46220
|
-
return { status: "completed", data: { checks: pub, flaky, verify_scope: complete ? "complete" : "quick", ...ntf ? { no_test_fallback: true } : {}, ...uncaused.length ? { uncaused_reds: uncaused } : {}, ...lintUntouchedNames.length ? { lint_untouched: lintUntouchedNames } : {}, independent_fail: independentFail, file_hashes: hashes, blocking_checks: blockingNames, ...wallFailTail ? { wall_failure_tail: wallFailTail } : {}, ...wallPassed === undefined ? {} : { wall_passed: wallPassed }, failures_grouped: [...failuresGrouped, ...nrdGroupsFor(ctx.outputs().implement, fixRounds)], holdout_failed: holdoutFailed, changed_files: changed, ...depNames.size ? { dependent_checks: [...depNames] } : {}, not_proven: notProven2, ...fullNotProven.size || depsNotes.na.length ? { not_applicable: [...[...fullNotProven].filter(naNote).map(naText), ...depsNotes.na] } : {}, pre_red: preRed.ids, pre_red_checks: preRed.names, ...notExcused.length ? { not_excused: notExcused } : {}, ...preRed.knownRed.length ? { known_red_checks: preRed.knownRed } : {}, ...preRed.sameError.length ? { known_red_same_error: preRed.sameError } : {}, ...baseRed.length ? { base_red_checks: baseRed } : {}, skipped_on_base: preRed.zero, ...collateralSame.length && fixRounds === 0 ? { collateral_same_error: collateralSame } : {}, ...attr.line ? { baseline_line: attr.line, introduced_checks: attr.introducedChecks } : {}, test_counts: testCounts, uncovered_changed: uncoveredChanged, target_checks: checks2.filter((c) => c.result === "pass" && targetNames.has(c.name)).map((c) => isHold(c) ? "holdout" : c.name), risk } };
|
|
46263
|
+
return { status: "completed", data: { checks: pub, flaky, verify_scope: complete ? "complete" : "quick", ...ntf ? { no_test_fallback: true } : {}, ...uncaused.length ? { uncaused_reds: uncaused } : {}, ...lintUntouchedNames.length ? { lint_untouched: lintUntouchedNames } : {}, ...ownLintNames.length ? { own_lint: ownLintNames } : {}, independent_fail: independentFail, ...independentReds.length ? { independent_reds: independentReds } : {}, fix_gate: fixGateOf({ independent_fail: independentFail, independent_reds: independentReds }, `${String(ctx.outputs().implement?.model ?? "")} ${ctx.model}`, failuresGrouped.length > 0), file_hashes: hashes, blocking_checks: blockingNames, ...wallFailTail ? { wall_failure_tail: wallFailTail } : {}, ...wallPassed === undefined ? {} : { wall_passed: wallPassed }, failures_grouped: [...failuresGrouped, ...nrdGroupsFor(ctx.outputs().implement, fixRounds)], holdout_failed: holdoutFailed, changed_files: changed, ...depNames.size ? { dependent_checks: [...depNames] } : {}, not_proven: notProven2, ...fullNotProven.size || depsNotes.na.length ? { not_applicable: [...[...fullNotProven].filter(naNote).map(naText), ...depsNotes.na] } : {}, pre_red: preRed.ids, pre_red_checks: preRed.names, ...notExcused.length ? { not_excused: notExcused } : {}, ...preRed.knownRed.length ? { known_red_checks: preRed.knownRed } : {}, ...preRed.sameError.length ? { known_red_same_error: preRed.sameError } : {}, ...baseRed.length ? { base_red_checks: baseRed } : {}, skipped_on_base: preRed.zero, ...collateralSame.length && fixRounds === 0 ? { collateral_same_error: collateralSame } : {}, ...attr.line ? { baseline_line: attr.line, introduced_checks: attr.introducedChecks } : {}, test_counts: testCounts, uncovered_changed: uncoveredChanged, target_checks: checks2.filter((c) => c.result === "pass" && targetNames.has(c.name)).map((c) => isHold(c) ? "holdout" : c.name), risk } };
|
|
46221
46264
|
}
|
|
46222
46265
|
}
|
|
46223
46266
|
var timeoutCarryOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_TIMEOUT_CARRY"] ?? "").trim()), TIMEOUT_CARRY_NOTE = "carried from an earlier verify of this run, not rerun (untouched file)", KILL_AFTER_MS = 5000, NO_ID_BASE_REASON = "the test command does not run in this checkout: it fails the same way with the change removed", rootless = (out2, roots2) => {
|
|
@@ -46232,7 +46275,7 @@ var timeoutCarryOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LO
|
|
|
46232
46275
|
for (const r of [...new Set(all)].filter((x) => x.length > 1).sort((a, b) => b.length - a.length))
|
|
46233
46276
|
o = o.split(r).join("<repo>");
|
|
46234
46277
|
return o;
|
|
46235
|
-
}, SUITE_MARGIN_MS = 5000, CHECK_TIMEOUT_MS = 60000, excerpts, checkExcerpt = (c) => excerpts.get(c) ?? "", suites, failTails, tscOut, crashSigs, baseCrashEnvOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_BASE_CRASH_ENV"] ?? "").trim()), BCE_REASON = "fails the same way on base, so its result cannot be read: the environment, not the change", noIdOut, headErrors, WALL_FAILURE_TAIL_CAP = 16384, wallTailOf = (out2, repoDir) => redactSecrets(stripAnsi(out2).replace(/\r/g, "").split(repoDir.replace(/\/+$/, "") + "/").join("")).slice(-WALL_FAILURE_TAIL_CAP), isHold = (c) => isHoldoutCheck(c.name), pubHold = (c) => ({ name: "holdout", cmd: "holdout", result: c.result, duration_s: c.duration_s, ...c.n !== undefined ? { n: c.n } : {}, ...c.sk !== undefined ? { sk: c.sk } : {}, ...c.owner ? { owner: c.owner, reason: "holdout infrastructure failure" } : {} }), testCheckName = (t) => `${t.runner}:${t.path}`, QUIET_RED = "excused as red on base although its error text differs from base by noise only (the same error shapes; no changed file or symbol appears in the failure)", COLLATERAL_RED = "relevant test already failing on base, still failing the same tests (it imports a file the task names; capped, not blocking)", noTestFallbackOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_NO_TEST_FALLBACK"] ?? "").trim()), ownByPathOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_OWN_BY_PATH"] ?? "").trim()), TEST_TITLE_RE, dedupeTests = (tests) => [...new Map(tests.map((t) => [`${t.runner}:${t.path}`, t])).values()], verifyBatchOn = (env = process.env) => env["LOKI_E10_VERIFY_BATCH"] !== "0", BATCH_MIN = 2, UNHANDLED_RE, batchTimeoutMs = (files) => Math.max(CHECK_TIMEOUT_MS, Math.min(300000, files * 5000)), vitestFile = (t, c) => t.runner === "vitest" && c.cmd === "npx" && c.args.length === 4 && c.args[0] === "--no-install" && c.args[1] === "vitest" && c.args[2] === "run", goBatchOn = (env = process.env) => verifyBatchOn(env) && env["LOKI_E10_GO_BATCH"] !== "0", goFileCmd = (t, c) => t.runner === "go" && c.cmd === "go" && c.args.length === 5 && c.args[0] === "test" && c.args[1] === "-json" && c.args[2] === "-run" && /^\^\([A-Za-z0-9_|]+\)\$$/.test(c.args[3]), goBatchable = (t, targets, changed, env = process.env) => goBatchOn(env) && t.runner === "go" && !targets.has(testCheckName(t)) && !changed.includes(t.path), uncausedOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_UNCAUSED_NO_FIX"] ?? "").trim()), LINT_CONFIG, INERT_FILE, feedsFixRound = (c, pre) => c.result === "fail" && !pre.names.includes(c.name) && !pre.sameError.includes(c.name) && !isHoldoutCheck(c.name), baseMemoOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_BASE_MEMO"] ?? "").trim()), ESLINT_CONFIGS, excuseLint = (ctx, signal, c, tool, cmd, prefix, cwd, rel, opts) => c.result !== "fail" || signal.aborted ? Promise.resolve(false) : staticPreExisting(tool, prefix, rel, { run: async (a, stdin) => {
|
|
46278
|
+
}, SUITE_MARGIN_MS = 5000, CHECK_TIMEOUT_MS = 60000, excerpts, checkExcerpt = (c) => excerpts.get(c) ?? "", suites, failTails, tscOut, crashSigs, baseCrashEnvOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_BASE_CRASH_ENV"] ?? "").trim()), BCE_REASON = "fails the same way on base, so its result cannot be read: the environment, not the change", noIdOut, headErrors, WALL_FAILURE_TAIL_CAP = 16384, wallTailOf = (out2, repoDir) => redactSecrets(stripAnsi(out2).replace(/\r/g, "").split(repoDir.replace(/\/+$/, "") + "/").join("")).slice(-WALL_FAILURE_TAIL_CAP), isHold = (c) => isHoldoutCheck(c.name), pubHold = (c) => ({ name: "holdout", cmd: "holdout", result: c.result, duration_s: c.duration_s, ...c.n !== undefined ? { n: c.n } : {}, ...c.sk !== undefined ? { sk: c.sk } : {}, ...c.owner ? { owner: c.owner, reason: "holdout infrastructure failure" } : {} }), testCheckName = (t) => `${t.runner}:${t.path}`, QUIET_RED = "excused as red on base although its error text differs from base by noise only (the same error shapes; no changed file or symbol appears in the failure)", COLLATERAL_RED = "relevant test already failing on base, still failing the same tests (it imports a file the task names; capped, not blocking)", noTestFallbackOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_NO_TEST_FALLBACK"] ?? "").trim()), ownByPathOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_OWN_BY_PATH"] ?? "").trim()), TEST_TITLE_RE, dedupeTests = (tests) => [...new Map(tests.map((t) => [`${t.runner}:${t.path}`, t])).values()], verifyBatchOn = (env = process.env) => env["LOKI_E10_VERIFY_BATCH"] !== "0", BATCH_MIN = 2, UNHANDLED_RE, batchTimeoutMs = (files) => Math.max(CHECK_TIMEOUT_MS, Math.min(300000, files * 5000)), vitestFile = (t, c) => t.runner === "vitest" && c.cmd === "npx" && c.args.length === 4 && c.args[0] === "--no-install" && c.args[1] === "vitest" && c.args[2] === "run", goBatchOn = (env = process.env) => verifyBatchOn(env) && env["LOKI_E10_GO_BATCH"] !== "0", goFileCmd = (t, c) => t.runner === "go" && c.cmd === "go" && c.args.length === 5 && c.args[0] === "test" && c.args[1] === "-json" && c.args[2] === "-run" && /^\^\([A-Za-z0-9_|]+\)\$$/.test(c.args[3]), goBatchable = (t, targets, changed, env = process.env) => goBatchOn(env) && t.runner === "go" && !targets.has(testCheckName(t)) && !changed.includes(t.path), uncausedOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_UNCAUSED_NO_FIX"] ?? "").trim()), LINT_CONFIG, INERT_FILE, OWN_LINT, OWN_TYPECHECK, haikuIndepFixOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_HAIKU_INDEP_FIX"] ?? "").trim()), ownLintOf = (c, pre, changed, symbols, excerpt2, re = OWN_LINT) => re.test(c.name) && feedsFixRound(c, pre) && !uncausedRed(c, changed, symbols, excerpt2), feedsFixRound = (c, pre) => c.result === "fail" && !pre.names.includes(c.name) && !pre.sameError.includes(c.name) && !isHoldoutCheck(c.name), baseMemoOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_BASE_MEMO"] ?? "").trim()), ESLINT_CONFIGS, excuseLint = (ctx, signal, c, tool, cmd, prefix, cwd, rel, opts) => c.result !== "fail" || signal.aborted ? Promise.resolve(false) : staticPreExisting(tool, prefix, rel, { run: async (a, stdin) => {
|
|
46236
46279
|
if (signal.aborted)
|
|
46237
46280
|
return null;
|
|
46238
46281
|
const r = await runOnce3(cmd, a, cwd, AbortSignal.any([signal, AbortSignal.timeout(opts.timeoutMs ?? CHECK_TIMEOUT_MS)]), { ...opts, ...stdin !== undefined ? { stdin } : {} });
|
|
@@ -46297,6 +46340,8 @@ var init_verify = __esm(() => {
|
|
|
46297
46340
|
UNHANDLED_RE = /Unhandled (?:Errors?|Rejection)\b/;
|
|
46298
46341
|
LINT_CONFIG = /(?:^|\/)(?:tsconfig[^/]*\.json|jsconfig\.json|\.eslintrc[^/]*|eslint\.config\.[cm]?[jt]s|biome\.jsonc?|\.?ruff\.toml|pyproject\.toml|setup\.cfg|mypy\.ini|\.flake8|tox\.ini|package\.json|\.golangci\.ya?ml|clippy\.toml|Cargo\.toml)$/;
|
|
46299
46342
|
INERT_FILE = /\.(?:md|mdx|rst|txt|adoc)$|\.d\.[cm]?ts$|(?:^|\/)(?:changelog\.d|changes|newsfragments|\.changeset)\/|(?:^|\/)(?:CHANGELOG|HISTORY|NEWS)[^/]*$/i;
|
|
46343
|
+
OWN_LINT = /^lint:(?:eslint|ruff|shellcheck)(?::|$)/;
|
|
46344
|
+
OWN_TYPECHECK = /^lint:(?:tsc|bash-n)(?::|$)/;
|
|
46300
46345
|
ESLINT_CONFIGS = [".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.cjs", "eslint.config.js", "eslint.config.mjs", "eslint.config.cjs"];
|
|
46301
46346
|
TSC_LOCAL = new Set(["TS6133", "TS6138", "TS6192", "TS6196", "TS6198", "TS6199", "TS6205"]);
|
|
46302
46347
|
TSC_DIAG = /^(\S.*?)(?:\(\d+,\d+\)|:\d+:\d+)\s*(?::|-)\s*error (TS\d+)/gm;
|
|
@@ -48244,7 +48289,11 @@ async function evaluateSeal(ctx, signal) {
|
|
|
48244
48289
|
}
|
|
48245
48290
|
}, (await codeSymbols(ctx, rawDiff, head)).all) : [];
|
|
48246
48291
|
const wpAll = publishableWall(ctx.repoDir, ctx.runDir, o, process.env, loadTaskText(ctx, str3(o.intake?.task) ?? undefined));
|
|
48247
|
-
const
|
|
48292
|
+
const ownLint = new Set(strs2(o.verify?.own_lint)), openLint = live2.filter((c) => c.result === "fail" && ownLint.has(c.name));
|
|
48293
|
+
const lintOnly = openLint.length > 0 && live2.every((c) => c.result !== "fail" || ownLint.has(c.name)) && live2.some((c) => c.result === "pass" && !c.name.startsWith("lint:"));
|
|
48294
|
+
const liveV = lintOnly ? live2.map((c) => openLint.includes(c) ? { ...c, result: "not_run" } : c) : live2;
|
|
48295
|
+
const lintOpenNotes = lintOnly ? openLint.map((c) => `lint error the change introduced, still failing after the fix rounds: ${c.name}: ${String((Array.isArray(o.verify?.checks) ? o.verify.checks : []).find((x) => x.name === c.name)?.first_error ?? "see the check output").slice(0, 200)} (every test passed; the label is held at PARTIAL)`) : [];
|
|
48296
|
+
const verdict0 = capGroupVerdict(verdictOf2(o, liveV, !diffOk || diff.stdout === "", capVerify.some((n3) => !pinDropped.has(n3)) || weakTests.length > 0 || capRc.length > 0, wallGreenOnBase, proof, targetProofOf(o.verify), uncoveredAfterLimit, [...leanGap, ...pubGap, ...specGap], wpAll.notes, wpAll.clauseGap), grp);
|
|
48248
48297
|
const supply = await supplyGuard(ctx.repoDir, rawDiff.filter((_, i) => i % 2 === 1), readDeclared(ctx.repoDir), process.env);
|
|
48249
48298
|
const verdict1 = sealOnlyPass() && verdict0 === "VERIFIED" ? "PARTIAL" : supplyVerdict(verdict0, supply);
|
|
48250
48299
|
const xr = await crossReview(ctx, verdict1, head, signal), verdict2 = minVerdict(verdict1, xr);
|
|
@@ -48279,7 +48328,8 @@ async function evaluateSeal(ctx, signal) {
|
|
|
48279
48328
|
const noSecond = !!lineCheck?.not_reviewed;
|
|
48280
48329
|
const twoReaders = (xr?.notes ?? []).filter(isUnmetNote).filter((n3) => noSecond || issueAsks.some((line2, i) => advisory?.[i]?.status === "unmet" && n3.toLowerCase().includes(line2.toLowerCase().slice(0, 60)))).map((n3) => noSecond ? `${n3} (the acceptance check did not answer, ${lineCheck.not_reviewed}, so nothing contradicts the review and the count does not carry this line)` : `${n3} (the acceptance check also reads this line as not delivered: two readers agree, so the count does not carry it)`);
|
|
48281
48330
|
const unusedNotes = issueAsks.length ? (await unusedNewFiles(ctx.repoDir, ctx.baseSha, head)).map(unusedNewFileNote) : [];
|
|
48282
|
-
const
|
|
48331
|
+
const prScopeSeal = sealPrScope(ctx.repoDir, o.intake, ctx.baseSha, head);
|
|
48332
|
+
const openNotes = [...prScopeSeal.notes, ...issueNotes, ...proofNotes, ...neverStopNotes(o.implement), ...allLinesMet ? [] : unfinished, ...proveNotes(ctx.provider, o, process.env, ctx.runDir), ...allLinesMet && proofRun?.exit === 0 ? twoReaders : (xr?.notes ?? []).filter(isUnmetNote), ...openDecisionNotes(o), ...namedOpen.filter((s) => s.why === null).map(namedUnchangedNote)], verdict3 = openNotes.length > 0 && verdict3a === "VERIFIED" ? "PARTIAL" : verdict3a;
|
|
48283
48333
|
const deepG = deepGaps(o.verify?.risk, vraw, Array.isArray(o.deep?.checks) ? o.deep.checks : [], modelReviewRan(xr)), notProven2 = new Set([...sealOnlyPass() ? [TIME_RAN_OUT_NOTE] : [], ...deepG.notProven, ...supply.notProven, ...grp.notProven, ...xr?.notes ?? [], ...reviewReceipt(ctx.provider, xr).notProven, ...openNotes]);
|
|
48284
48334
|
const reasons2 = [], rz = (kind, xs) => {
|
|
48285
48335
|
for (const d of xs)
|
|
@@ -48437,6 +48487,8 @@ async function evaluateSeal(ctx, signal) {
|
|
|
48437
48487
|
notProven2.add(`pre red: ${id}`);
|
|
48438
48488
|
if (typeof o.verify?.baseline_line === "string" && strs2(o.verify?.pre_red).length)
|
|
48439
48489
|
notProven2.add(o.verify.baseline_line);
|
|
48490
|
+
for (const n3 of lintOpenNotes)
|
|
48491
|
+
notProven2.add(n3);
|
|
48440
48492
|
for (const n3 of strs2(o.verify?.lint_untouched))
|
|
48441
48493
|
notProven2.add(`lint red only in files the change did not touch (disclosed, not blocking): ${n3}`);
|
|
48442
48494
|
for (const n3 of strs2(o.verify?.not_excused))
|
|
@@ -48516,6 +48568,7 @@ async function evaluateSeal(ctx, signal) {
|
|
|
48516
48568
|
...grp.section ? { group: grp.section } : {},
|
|
48517
48569
|
...ctx.failovers && ctx.failovers().length > 0 ? { failover: ctx.failovers() } : {},
|
|
48518
48570
|
...str3(o.implement?.spec_conflict_reason) !== null ? { spec_conflict_reason: sanitizeReason(str3(o.implement?.spec_conflict_reason)) } : {},
|
|
48571
|
+
...prScopeSeal.receipt,
|
|
48519
48572
|
evidence: strs2(o.intake?.evidence),
|
|
48520
48573
|
...strs2(o.intake?.assumptions).length > 0 ? { assumptions: strs2(o.intake?.assumptions) } : {},
|
|
48521
48574
|
...o.intake?.preexisting_dirty ? { pre_existing_dirty: Object.keys(o.intake.preexisting_dirty) } : {},
|
|
@@ -57609,6 +57662,8 @@ async function main3(args) {
|
|
|
57609
57662
|
resume = true;
|
|
57610
57663
|
else if (a === "--fresh")
|
|
57611
57664
|
fresh = true;
|
|
57665
|
+
else if (a === "--base-current")
|
|
57666
|
+
process.env.LOKI_BASE_CURRENT = "1";
|
|
57612
57667
|
else if (a === "--label") {
|
|
57613
57668
|
const v = args[i + 1];
|
|
57614
57669
|
if (v === undefined || v === "" || v.startsWith("-")) {
|
|
@@ -57636,7 +57691,7 @@ async function main3(args) {
|
|
|
57636
57691
|
eoo = true;
|
|
57637
57692
|
else if (!eoo && /^--?[A-Za-z][\w-]*(=\S*)?$/.test(a)) {
|
|
57638
57693
|
process.stderr.write(`engine10: unknown flag ${a}
|
|
57639
|
-
usage: loki "<task>" [--no-pr] [--deep] [--verified] [--json] [--verbose] [--quiet] [--max-cost N] [--provider P] [--spec F] [--seal-existing PATCH] [--resume] [--fresh] [-- <task>]
|
|
57694
|
+
usage: loki "<task>" [--no-pr] [--deep] [--verified] [--json] [--verbose] [--quiet] [--max-cost N] [--provider P] [--spec F] [--seal-existing PATCH] [--resume] [--fresh] [--base-current] [-- <task>]
|
|
57640
57695
|
`);
|
|
57641
57696
|
noteRefusal("unsupported_flag");
|
|
57642
57697
|
return 2;
|
|
@@ -57900,11 +57955,40 @@ usage: loki "<goal>" (or: loki start <prd.md | owner/repo#N>)
|
|
|
57900
57955
|
if (costEst)
|
|
57901
57956
|
env.LOKI_E10_COST_ESTIMATE = costEst;
|
|
57902
57957
|
const downgrades = modelDowngrades(provider);
|
|
57958
|
+
for (const e of [env, process.env]) {
|
|
57959
|
+
delete e.LOKI_E10_START_FROM;
|
|
57960
|
+
delete e.LOKI_E10_PR_TARGET;
|
|
57961
|
+
}
|
|
57962
|
+
const prPlan = noPr || sealPatch !== null ? null : prBasePlan(repoDir, { baseCurrent: process.env.LOKI_BASE_CURRENT === "1" });
|
|
57963
|
+
if (prPlan?.action === "refuse") {
|
|
57964
|
+
process.stderr.write(`loki: ${prPlan.line}
|
|
57965
|
+
`);
|
|
57966
|
+
noteRefusal("other");
|
|
57967
|
+
return 2;
|
|
57968
|
+
}
|
|
57969
|
+
if (prPlan?.target)
|
|
57970
|
+
env.LOKI_E10_PR_TARGET = prPlan.target;
|
|
57971
|
+
if (prPlan?.start_sha)
|
|
57972
|
+
env.LOKI_E10_START_FROM = prPlan.start_sha;
|
|
57973
|
+
if (prPlan?.pr_base)
|
|
57974
|
+
process.env.LOKI_PR_BASE = env.LOKI_PR_BASE = prPlan.pr_base;
|
|
57975
|
+
const downLine = downgrades.length ? `downgrade: ${downgrades.map((d) => `${d.stage} ${d.model} (${d.reason})`).join(", ")}` : "";
|
|
57976
|
+
const headLines = [
|
|
57977
|
+
`${START_LINE}, ${prPlan?.header ?? baseLine(repoDir)}`,
|
|
57978
|
+
modelWhy ? `model ${model} (${modelWhy})` : "",
|
|
57979
|
+
[cap.usd > 0 ? capNote(cap.usd, cap.source) : "", costEst ? startText(JSON.parse(costEst), cap.usd) : "", verifiedOn(env) ? verifiedHeader(env) : ""].filter(Boolean).join("; "),
|
|
57980
|
+
routeStart2 ? [routeStart2, downLine].filter(Boolean).join("; ") : "",
|
|
57981
|
+
verbose ? [cap.usd > 0 ? "" : capNote(cap.usd, cap.source), routeStart2 ? "" : downLine].filter(Boolean).join("; ") : ""
|
|
57982
|
+
].filter(Boolean);
|
|
57903
57983
|
if (!json2)
|
|
57904
|
-
process.stdout.write(`${
|
|
57984
|
+
process.stdout.write(`${headLines.join(`
|
|
57985
|
+
`)}
|
|
57905
57986
|
`);
|
|
57906
57987
|
if (verbose && !json2 && cap.source === "subscription")
|
|
57907
57988
|
process.stdout.write(`${SUBSCRIPTION_NOTE}
|
|
57989
|
+
`);
|
|
57990
|
+
if (prPlan?.line)
|
|
57991
|
+
(json2 ? process.stderr : process.stdout).write(`${prPlan.line}
|
|
57908
57992
|
`);
|
|
57909
57993
|
if (costEst && process.env.LOKI_COST_CONFIRM === "1" && process.stdin.isTTY && !json2 && !await (await Promise.resolve().then(() => (init_issues_run(), exports_issues_run))).askYesNo("Proceed with this run? [y/N] ")) {
|
|
57910
57994
|
process.stdout.write(`Run cancelled before start (LOKI_COST_CONFIRM).
|
|
@@ -58895,7 +58979,17 @@ async function runIntakeBody(ctx, signal, opts, held) {
|
|
|
58895
58979
|
return null;
|
|
58896
58980
|
}
|
|
58897
58981
|
})();
|
|
58898
|
-
|
|
58982
|
+
const startFrom = /^[0-9a-f]{40}$/.test(process.env.LOKI_E10_START_FROM ?? "") ? process.env.LOKI_E10_START_FROM : null;
|
|
58983
|
+
if (startFrom) {
|
|
58984
|
+
try {
|
|
58985
|
+
safeGit(ctx.repoDir, ["checkout", "-b", ctx.branch, startFrom], { repoDrivers: true });
|
|
58986
|
+
baseSha = startFrom;
|
|
58987
|
+
ctx.baseSha = baseSha;
|
|
58988
|
+
} catch {
|
|
58989
|
+
return { status: "failed", data: { blocker: "base_not_in_target" }, reason: startFromRefusal(process.env.LOKI_E10_PR_TARGET ?? startFrom, startBranch, ctx.repoDir) };
|
|
58990
|
+
}
|
|
58991
|
+
}
|
|
58992
|
+
let stacked = startFrom ? null : stackedOnLokiRun(ctx.repoDir);
|
|
58899
58993
|
if (stacked) {
|
|
58900
58994
|
try {
|
|
58901
58995
|
ensureBranch(ctx.repoDir, ctx.branch, stacked.base_sha);
|
|
@@ -58907,7 +59001,7 @@ async function runIntakeBody(ctx, signal, opts, held) {
|
|
|
58907
59001
|
`);
|
|
58908
59002
|
}
|
|
58909
59003
|
}
|
|
58910
|
-
if (!stacked)
|
|
59004
|
+
if (!stacked && !startFrom)
|
|
58911
59005
|
ensureBranch(ctx.repoDir, ctx.branch);
|
|
58912
59006
|
const tree = git13(ctx.repoDir, ["rev-parse", "HEAD^{tree}"]);
|
|
58913
59007
|
excludeLokiDir(ctx.repoDir);
|
|
@@ -58940,7 +59034,7 @@ async function runIntakeBody(ctx, signal, opts, held) {
|
|
|
58940
59034
|
const origin = readOriginUrl(ctx.repoDir);
|
|
58941
59035
|
const evidence = hooks.runtimeEvidence?.(task) ?? null;
|
|
58942
59036
|
const asks = source === "issue" || workRoadOn() ? issueAcceptance(task) : [];
|
|
58943
|
-
const common2 = { ...asks.length ? { issue_acceptance: asks } : {}, ...evidence ? { runtime_evidence: evidence } : {}, ...stacked ? { stacked_loki_skip: stacked } : {}, task, title: task.split(`
|
|
59037
|
+
const common2 = { ...intakePrBase(ctx.repoDir, process.env, startBranch, startFrom !== null), ...asks.length ? { issue_acceptance: asks } : {}, ...evidence ? { runtime_evidence: evidence } : {}, ...stacked ? { stacked_loki_skip: stacked } : {}, task, title: task.split(`
|
|
58944
59038
|
`)[0].slice(0, 72), repo: githubRepoFromUrl(origin) ?? origin, resumed: false, contract_snapshot: snapshotContract(ctx.repoDir), preexisting_untracked: untrackedAtIntake(ctx.repoDir), preexisting_untracked_blobs: snapshotUntracked(ctx.repoDir), ...Object.keys(preexisting).length > 0 ? { preexisting_dirty: preexisting } : {} };
|
|
58945
59039
|
if (alreadySatisfied2) {
|
|
58946
59040
|
return { status: "completed", data: { ...common2, ignore_snapshot: ignoreSnapshot(ctx.repoDir), task_sha256: taskSha256, source, base_sha: baseSha, tree, branch: ctx.branch, already_satisfied: true } };
|
|
@@ -63220,17 +63314,24 @@ __export(exports_base_guard, {
|
|
|
63220
63314
|
unmergedEvidence: () => unmergedEvidence,
|
|
63221
63315
|
sweepRunBranches: () => sweepRunBranches,
|
|
63222
63316
|
stashMadeOn: () => stashMadeOn,
|
|
63317
|
+
startFromRefusal: () => startFromRefusal,
|
|
63223
63318
|
stackedOnLokiRun: () => stackedOnLokiRun,
|
|
63224
63319
|
splitDeclaredAdvisories: () => splitDeclaredAdvisories,
|
|
63320
|
+
sealPrScope: () => sealPrScope,
|
|
63225
63321
|
returnToRunBranch: () => returnToRunBranch,
|
|
63226
63322
|
resolveBase: () => resolveBase,
|
|
63227
63323
|
removeOwnWallFiles: () => removeOwnWallFiles,
|
|
63228
63324
|
recoverRunWork: () => recoverRunWork,
|
|
63229
63325
|
recordStashBaseline: () => recordStashBaseline,
|
|
63326
|
+
prTargetRef: () => prTargetRef,
|
|
63327
|
+
prScopeLine: () => prScopeLine,
|
|
63328
|
+
prScope: () => prScope,
|
|
63329
|
+
prBasePlan: () => prBasePlan,
|
|
63230
63330
|
noteOf: () => noteOf,
|
|
63231
63331
|
lazyZeroBaseline: () => lazyZeroBaseline,
|
|
63232
63332
|
keepRunBranch: () => keepRunBranch,
|
|
63233
63333
|
isZeroRun: () => isZeroRun,
|
|
63334
|
+
intakePrBase: () => intakePrBase,
|
|
63234
63335
|
finishRunBranch: () => finishRunBranch,
|
|
63235
63336
|
finishDeferredRun: () => finishDeferredRun,
|
|
63236
63337
|
envChangedSince: () => envChangedSince,
|
|
@@ -63340,6 +63441,110 @@ function baseLine(repoDir) {
|
|
|
63340
63441
|
const same = !sk && t && /^loki\//.test(b) && git14(repoDir, ["rev-parse", "-q", "--verify", "HEAD^{commit}"]) === git14(repoDir, ["rev-parse", "-q", "--verify", `${t.ref}^{commit}`]);
|
|
63341
63442
|
return `PR target: ${t ? t.ref : "unresolved"}, base: ${sk ? `${sk.target} (${sk.message})` : same ? t.ref : b}`;
|
|
63342
63443
|
}
|
|
63444
|
+
function checkoutCollisions(repoDir, target) {
|
|
63445
|
+
const added = git14(repoDir, ["diff", "--name-only", "--no-renames", "--diff-filter=A", "HEAD", target]);
|
|
63446
|
+
if (added === null)
|
|
63447
|
+
return null;
|
|
63448
|
+
return added.split(`
|
|
63449
|
+
`).filter((p) => p !== "" && (() => {
|
|
63450
|
+
try {
|
|
63451
|
+
lstatSync33(join155(repoDir, p));
|
|
63452
|
+
return true;
|
|
63453
|
+
} catch {
|
|
63454
|
+
return false;
|
|
63455
|
+
}
|
|
63456
|
+
})());
|
|
63457
|
+
}
|
|
63458
|
+
function prTargetRef(repoDir, prBase, fetchRemote = true) {
|
|
63459
|
+
if (!prBase)
|
|
63460
|
+
return resolveBase(repoDir, "", fetchRemote)?.ref ?? null;
|
|
63461
|
+
if (fetchRemote && process.env.LOKI_E10_NO_FETCH !== "1" && git14(repoDir, ["remote", "get-url", "origin"]) !== null)
|
|
63462
|
+
git14(repoDir, ["fetch", "-q", "origin", prBase], 1e4, { GIT_TERMINAL_PROMPT: "0", GIT_SSH_COMMAND: "ssh -o BatchMode=yes" });
|
|
63463
|
+
return exists2(repoDir, `origin/${prBase}`) ? `origin/${prBase}` : exists2(repoDir, prBase) ? prBase : null;
|
|
63464
|
+
}
|
|
63465
|
+
function prBasePlan(repoDir, o) {
|
|
63466
|
+
const env = o.env ?? process.env, keep = (target, line2 = null) => ({ action: "keep", target, start_sha: null, pr_base: null, line: line2, header: null });
|
|
63467
|
+
const anc = (ref) => ok(repoDir, ["merge-base", "--is-ancestor", "HEAD", ref]);
|
|
63468
|
+
if (env.LOKI_PR_BASE)
|
|
63469
|
+
return keep(prTargetRef(repoDir, env.LOKI_PR_BASE, false));
|
|
63470
|
+
let t = resolveBase(repoDir, "", false);
|
|
63471
|
+
if (!t || !t.ref.startsWith("origin/"))
|
|
63472
|
+
return keep(null);
|
|
63473
|
+
if (anc(t.ref))
|
|
63474
|
+
return keep(t.ref);
|
|
63475
|
+
t = resolveBase(repoDir, "") ?? t;
|
|
63476
|
+
if (!t.ref.startsWith("origin/"))
|
|
63477
|
+
return keep(null);
|
|
63478
|
+
if (anc(t.ref) || stackedOnLokiRun(repoDir, t))
|
|
63479
|
+
return keep(t.ref);
|
|
63480
|
+
const branch = git14(repoDir, ["symbolic-ref", "-q", "--short", "HEAD"]) || null, head = git14(repoDir, ["rev-parse", "HEAD"]), tname = t.ref.replace(/^origin\//, "");
|
|
63481
|
+
const n3 = Number(git14(repoDir, ["rev-list", "--count", `${t.ref}..HEAD`]) ?? "0") || 0, commits = (k) => `${k} other commit${k === 1 ? "" : "s"}`;
|
|
63482
|
+
const refuse = (why, cmds) => ({ action: "refuse", target: t.ref, start_sha: null, pr_base: null, header: null, line: `${why}. Nothing was run. Either: ${cmds[0]}; or: ${cmds[1]}` });
|
|
63483
|
+
const stackCmd = branch ? `git push -u origin ${branch}, then rerun with --base-current (pull request into ${branch})` : `git switch -c <branch>, git push -u origin <branch>, then rerun with --base-current`;
|
|
63484
|
+
const wtCmd = `git worktree add ../${basename45(repoDir)}-${tname.replace(/[^A-Za-z0-9._-]+/g, "-")} ${t.ref}, then rerun there (pull request into ${tname})`;
|
|
63485
|
+
if (o.baseCurrent) {
|
|
63486
|
+
if (!branch)
|
|
63487
|
+
return refuse(`--base-current needs a branch, and HEAD is detached at ${short(head)}: a pull request into ${tname} would carry ${commits(n3)}`, [stackCmd, wtCmd]);
|
|
63488
|
+
if (git14(repoDir, ["remote", "get-url", "origin"]) !== null && env.LOKI_E10_NO_FETCH !== "1")
|
|
63489
|
+
git14(repoDir, ["fetch", "-q", "origin", branch], 1e4, { GIT_TERMINAL_PROMPT: "0", GIT_SSH_COMMAND: "ssh -o BatchMode=yes" });
|
|
63490
|
+
const remote = `origin/${branch}`;
|
|
63491
|
+
if (exists2(repoDir, remote) && anc(remote))
|
|
63492
|
+
return { action: "current-branch", target: remote, start_sha: null, pr_base: branch, header: `PR target: ${remote}, base: ${branch}`, line: `building on your branch ${branch}: the pull request targets ${branch}, not ${tname} (stacked pull request)` };
|
|
63493
|
+
const un = exists2(repoDir, remote) ? Number(git14(repoDir, ["rev-list", "--count", `${remote}..HEAD`]) ?? "0") || 0 : n3;
|
|
63494
|
+
return refuse(exists2(repoDir, remote) ? `your branch ${branch} has ${un} commit${un === 1 ? "" : "s"} that origin/${branch} does not, so the pull request would carry ${commits(un)}` : `your branch ${branch} is not on origin, so the pull request would go into ${tname} and carry ${commits(n3)}`, [stackCmd, `rerun without --base-current to start from ${t.ref} (pull request into ${tname}, this change only)`]);
|
|
63495
|
+
}
|
|
63496
|
+
if (!branch)
|
|
63497
|
+
return keep(t.ref, `detached HEAD ${short(head)} is not in ${t.ref}: the pull request would carry ${commits(n3)}, so the label is held at PARTIAL and the pull request opens as a draft (check out a branch, or pass --no-pr)`);
|
|
63498
|
+
const dirt = trackedDirt(repoDir);
|
|
63499
|
+
if (dirt === null)
|
|
63500
|
+
return refuse(`cannot read the working tree state, so the run cannot safely start from ${t.ref} instead of your branch ${branch}`, [stackCmd, wtCmd]);
|
|
63501
|
+
if (dirt.length > 0) {
|
|
63502
|
+
const { blocking } = splitDirty(repoDir, dirt);
|
|
63503
|
+
return blocking.length > 0 ? keep(t.ref) : refuse(`your branch ${branch} is not in ${t.ref} and the working tree has uncommitted changes (${dirt.map((l) => l.slice(3)).slice(0, 3).join(", ")}), so the run cannot start from ${t.ref} without touching them`, [stackCmd, wtCmd]);
|
|
63504
|
+
}
|
|
63505
|
+
const hit2 = checkoutCollisions(repoDir, t.ref), sha6 = git14(repoDir, ["rev-parse", "--verify", "-q", `${t.ref}^{commit}`]);
|
|
63506
|
+
if (hit2 === null || !sha6 || !/^[0-9a-f]{40}$/.test(sha6))
|
|
63507
|
+
return refuse(`${t.ref} cannot be read, so the run cannot start from it instead of your branch ${branch}`, [stackCmd, wtCmd]);
|
|
63508
|
+
if (hit2.length > 0)
|
|
63509
|
+
return refuse(`your branch ${branch} is not in ${t.ref}, and starting from ${t.ref} would overwrite ${hit2.length} file${hit2.length === 1 ? "" : "s"} in your working tree that ${branch} does not track (${hit2.slice(0, 3).join(", ")}${hit2.length > 3 ? `, +${hit2.length - 3} more` : ""})`, [stackCmd, wtCmd]);
|
|
63510
|
+
return { action: "target-tip", target: t.ref, start_sha: sha6, pr_base: null, header: `PR target: ${t.ref}, base: ${t.ref}`, line: `starting from ${t.ref}, not from your branch ${branch}, so the pull request holds only this change (use --base-current to build on your branch)` };
|
|
63511
|
+
}
|
|
63512
|
+
function prScope(repoDir, a) {
|
|
63513
|
+
const headRef = a.head ?? "HEAD", target = a.target ?? "unresolved", base2 = a.baseSha ?? "";
|
|
63514
|
+
const none = { target, target_sha: null, merge_base: null, base_sha: base2, head_sha: null, pr_files: null, measured_files: null, pr_commits: null, measured_commits: null, unmeasured_files: 0, ok: false, reason: `the pull request target ${target} could not be read, so what it would merge was not compared with what the label measured` };
|
|
63515
|
+
if (!a.target || !/^[0-9a-f]{40}$/.test(base2))
|
|
63516
|
+
return a.target ? { ...none, reason: "the run recorded no base commit, so what the pull request would merge was not compared with what the label measured" } : none;
|
|
63517
|
+
const tsha = git14(repoDir, ["rev-parse", "--verify", "-q", `${a.target}^{commit}`]), head = git14(repoDir, ["rev-parse", "--verify", "-q", `${headRef}^{commit}`]);
|
|
63518
|
+
if (!tsha || !head)
|
|
63519
|
+
return none;
|
|
63520
|
+
const mb = git14(repoDir, ["merge-base", tsha, head]);
|
|
63521
|
+
const list = (args) => {
|
|
63522
|
+
const o = git14(repoDir, args);
|
|
63523
|
+
return o === null ? null : o.split(`
|
|
63524
|
+
`).filter((l) => l !== "");
|
|
63525
|
+
};
|
|
63526
|
+
const files = (from) => list(["diff", "--name-only", "--no-renames", from, head, "--", ".", ":(exclude).loki"]);
|
|
63527
|
+
const prF = mb ? files(mb) : null, mF = files(base2), prC = list(["rev-list", `${tsha}..${head}`]), mC = list(["rev-list", `${base2}..${head}`]);
|
|
63528
|
+
if (!mb || !prF || !mF || !prC || !mC)
|
|
63529
|
+
return { ...none, target_sha: tsha, head_sha: head, merge_base: mb };
|
|
63530
|
+
const measured2 = new Set(mF), mine = new Set(mC), extraF = prF.filter((f) => !measured2.has(f)).length, extraC = prC.filter((c) => !mine.has(c)).length;
|
|
63531
|
+
const same = extraF === 0 && extraC === 0 && prF.length === mF.length && prC.length === mC.length;
|
|
63532
|
+
const reason = same ? null : extraF > 0 ? `the pull request would merge ${extraF} file${extraF === 1 ? "" : "s"} the label did not measure (${prF.length} files and ${prC.length} commits into ${target}; the label measured ${mF.length} files and ${mC.length} commits from ${short(base2)})` : `the pull request into ${target} would not hold what the label measured (${prF.length} files and ${prC.length} commits, ${extraC} of them not this run's; the label measured ${mF.length} files and ${mC.length} commits from ${short(base2)})`;
|
|
63533
|
+
return { target, target_sha: tsha, merge_base: mb, base_sha: base2, head_sha: head, pr_files: prF.length, measured_files: mF.length, pr_commits: prC.length, measured_commits: mC.length, unmeasured_files: extraF, ok: same, reason };
|
|
63534
|
+
}
|
|
63535
|
+
function intakePrBase(repoDir, env, startBranch, fromTarget) {
|
|
63536
|
+
const target = env.LOKI_E10_PR_TARGET;
|
|
63537
|
+
if (!target || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,250}$/.test(target))
|
|
63538
|
+
return {};
|
|
63539
|
+
return { pr_base: { target, target_sha: git14(repoDir, ["rev-parse", "--verify", "-q", `${target}^{commit}`]), start_branch: startBranch, mode: fromTarget ? "target-tip" : env.LOKI_PR_BASE ? "current-branch" : "head" } };
|
|
63540
|
+
}
|
|
63541
|
+
function sealPrScope(repoDir, intake, baseSha, head) {
|
|
63542
|
+
const pb = intake?.["pr_base"];
|
|
63543
|
+
if (!pb || typeof pb.target !== "string")
|
|
63544
|
+
return { notes: [], receipt: {} };
|
|
63545
|
+
const s = prScope(repoDir, { target: pb.target, baseSha, head });
|
|
63546
|
+
return { notes: s.ok ? [] : [s.reason], receipt: { pr_base: { target: s.target, target_sha: s.target_sha, merge_base: s.merge_base, base_sha: s.base_sha, pr_files: s.pr_files, measured_files: s.measured_files, pr_commits: s.pr_commits, measured_commits: s.measured_commits, mode: typeof pb.mode === "string" ? pb.mode : "head", start_branch: typeof pb.start_branch === "string" ? pb.start_branch : null, line: prScopeLine(s) } } };
|
|
63547
|
+
}
|
|
63343
63548
|
function noteOf(intake) {
|
|
63344
63549
|
const m = intake?.["unmerged_loki_work"]?.message ?? intake?.["stacked_loki_skip"]?.message;
|
|
63345
63550
|
return typeof m === "string" && m !== "" ? m : null;
|
|
@@ -63799,9 +64004,10 @@ function finishRunBranch(repoDir, runId2, end, env = process.env) {
|
|
|
63799
64004
|
try {
|
|
63800
64005
|
if (end.deferred && tip) {
|
|
63801
64006
|
mkdirSync81(runDir, { recursive: true });
|
|
63802
|
-
|
|
64007
|
+
const detachedAt = !end.orig && end.baseSha && /^[0-9a-f]{40}$/.test(end.baseSha) ? end.baseSha : null;
|
|
64008
|
+
writeFileSync82(join155(runDir, "branch.json"), JSON.stringify({ branch, head_sha: tip, pushed: end.pushed, bundle: null, orig_branch: end.orig, deferred: true, ...detachedAt ? { start_sha: detachedAt } : {} }, null, 2) + `
|
|
63803
64009
|
`);
|
|
63804
|
-
return `engine10: the checkout stays on ${branch} while the background deep verify runs, then returns to ${end.orig ?? "the starting branch"}
|
|
64010
|
+
return `engine10: the checkout stays on ${branch} while the background deep verify runs, then returns to ${end.orig ?? (detachedAt ? `commit ${detachedAt.slice(0, 7)}, detached` : "the starting branch")}
|
|
63805
64011
|
`;
|
|
63806
64012
|
}
|
|
63807
64013
|
removeRunWorktrees(repoDir, end.baseSha);
|
|
@@ -63832,7 +64038,7 @@ function finishDeferredRun(repoDir, runId2, env = process.env) {
|
|
|
63832
64038
|
if (!rec2?.deferred || rec2.branch !== `loki/${runId2}`)
|
|
63833
64039
|
return "";
|
|
63834
64040
|
const tip = tipOf(repoDir, `refs/heads/${rec2.branch}`);
|
|
63835
|
-
return finishRunBranch(repoDir, runId2, { orig: rec2.orig_branch ?? null, pushed: rec2.pushed === true && tip === rec2.head_sha }, env);
|
|
64041
|
+
return finishRunBranch(repoDir, runId2, { orig: rec2.orig_branch ?? null, pushed: rec2.pushed === true && tip === rec2.head_sha, ...!rec2.orig_branch && typeof rec2.start_sha === "string" && /^[0-9a-f]{40}$/.test(rec2.start_sha) ? { baseSha: rec2.start_sha } : {} }, env);
|
|
63836
64042
|
}
|
|
63837
64043
|
function sweepRunBranches(repoDir, env = process.env, skipRunId) {
|
|
63838
64044
|
if (keepRunBranch(env))
|
|
@@ -64088,7 +64294,11 @@ function workRecoveryNotes(runDir, repoDir, unverified = []) {
|
|
|
64088
64294
|
}
|
|
64089
64295
|
return [...new Set(out3)];
|
|
64090
64296
|
}
|
|
64091
|
-
var exists2 = (repoDir, ref) => git14(repoDir, ["rev-parse", "--verify", "-q", `${ref}^{commit}`]) !== null, ok = (repoDir, args) => git14(repoDir, args) !== null,
|
|
64297
|
+
var exists2 = (repoDir, ref) => git14(repoDir, ["rev-parse", "--verify", "-q", `${ref}^{commit}`]) !== null, ok = (repoDir, args) => git14(repoDir, args) !== null, short = (sha6) => (sha6 ?? "").slice(0, 7), trackedDirt = (repoDir) => {
|
|
64298
|
+
const o = git14(repoDir, ["status", "--porcelain", "--untracked-files=no"]);
|
|
64299
|
+
return o === null ? null : o.split(`
|
|
64300
|
+
`).filter((l) => l !== "" && !/^.{0,2} "?\.loki\//.test(l));
|
|
64301
|
+
}, startFromRefusal = (target, branch, repoDir) => `cannot start from ${target}: git could not create the run branch there without touching your working tree. Nothing was run. Either: ${branch ? `git push -u origin ${branch}, then rerun with --base-current (pull request into ${branch})` : "check out a branch and rerun with --base-current"}; or: git worktree add ../${basename45(repoDir)}-base ${target}, then rerun there`, prScopeLine = (s) => `Base and target: built from ${short(s.base_sha) || "an unrecorded base"}, pull request into ${s.target.replace(/^origin\//, "")}${s.target_sha ? ` at ${short(s.target_sha)}` : ""}; ${s.pr_files ?? "unknown"} file${s.pr_files === 1 ? "" : "s"} and ${s.pr_commits ?? "unknown"} commit${s.pr_commits === 1 ? "" : "s"} against that target, ${s.measured_files ?? "unknown"} file${s.measured_files === 1 ? "" : "s"} measured.`, WALK_BOUND = 50000, REPO_LINK_FILE, IGNORED_CAP = 5000, RUNNER_CACHE_DIRS, TOOL_OUTPUT_FILE, VIEW_WALK_BOUND = 1500000, VIEW_WALK_MS = 5000, ADVISORY_PATH, E10_BRANCH_RE, RUN_TMP_WORKTREE_RE, NOT_ELSEWHERE, tipOf = (repoDir, ref) => {
|
|
64092
64302
|
try {
|
|
64093
64303
|
return safeGit(repoDir, ["rev-parse", "--verify", "-q", `${ref}^{commit}`], { stdio: ["ignore", "pipe", "ignore"] }).trim() || null;
|
|
64094
64304
|
} catch {
|
|
@@ -64140,6 +64350,7 @@ var init_base_guard = __esm(() => {
|
|
|
64140
64350
|
init_lock_ecosystems();
|
|
64141
64351
|
init_test_file_text();
|
|
64142
64352
|
init_stop_restore();
|
|
64353
|
+
init_preexisting_dirty();
|
|
64143
64354
|
REPO_LINK_FILE = /\.pth$|\.egg-link$|^direct_url\.json$|^__editable___.*_finder\.py$/;
|
|
64144
64355
|
RUNNER_CACHE_DIRS = [".vite", ".vite-temp", ".vitest", ".vitest-cache", ".cache", "__pycache__", ".pytest_cache"];
|
|
64145
64356
|
TOOL_OUTPUT_FILE = /(?:^|\/)(?:[^/]*\.tsbuildinfo|\.eslintcache|\.stylelintcache|\.DS_Store|next-env\.d\.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.
|
|
5
|
+
"version": "11.158.0",
|
|
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-
|
|
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-C1IZi7yQ.js";import{B as C}from"./Button-DkEbiW6A.js";import{T as $e}from"./trending-up-iLoyGfUy.js";import{C as z}from"./clock-9Po9qHu3.js";import{A as Be,U as ue,M as De}from"./Avatar-6lc2wVW0.js";import{A as J}from"./activity-j4l9Gk8R.js";import{R as pe}from"./refresh-cw-D0RISUjF.js";import{G as ze}from"./globe-BQER6rv6.js";import{C as Le}from"./chevron-left-DM35O0gQ.js";import{C as je}from"./check-C6t5iHbP.js";import{D as Y}from"./dollar-sign-CmoA7igV.js";import{U as Te}from"./user-BZ4d4Ur5.js";import{D as Me}from"./database-Dy2MM-4L.js";import{L as Ue}from"./lock-4YHCWMTQ.js";import{S as Re}from"./scroll-text-DDR9GrS9.js";import{S as Ie}from"./shield-alert-mjamZyn0.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-
|
|
1
|
+
import{j as e}from"./index-C1IZi7yQ.js";import{C as r}from"./clock-9Po9qHu3.js";import{C as a}from"./circle-alert-LuDQClnV.js";import{C as l}from"./check-C6t5iHbP.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-
|
|
1
|
+
import{r as p,j as t}from"./index-C1IZi7yQ.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};
|