loki-mode 11.152.0 → 11.154.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 +1891 -1889
- package/mcp/__init__.py +1 -1
- package/package.json +2 -2
- package/packages/control-plane/dist/server.js +611 -527
- package/packages/control-plane/src/server/repos.ts +8 -0
- package/packages/control-plane/src/server/routes/start.ts +11 -1
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/web-app/dist/assets/{AdminPage-PE4AZL7D.js → AdminPage-DiYv9QX3.js} +1 -1
- package/web-app/dist/assets/{Avatar-DSKSMtms.js → Avatar-D8xgDhXi.js} +1 -1
- package/web-app/dist/assets/{Badge-B7MenaNC.js → Badge-B9uBTN7K.js} +1 -1
- package/web-app/dist/assets/{Button-w1Dkly6r.js → Button-BJkNLiWh.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-BDzgc_cw.js → CockpitPage-DG23RV4T.js} +1 -1
- package/web-app/dist/assets/{ComparePage-C1lxtIqD.js → ComparePage-CY9mcXyY.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-CIUKkW3v.js → ErrorBoundary-COHsdbJf.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-3irfwXn0.js → EvidenceReceiptPanel-B4PseFey.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-8-YcImUk.js → GitHubIssuesPanel-D0KfNlW2.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-CYFJPXlS.js → GitHubPRsPanel-CDPAE9fn.js} +1 -1
- package/web-app/dist/assets/{HomePage-CHmilgoW.js → HomePage-aKEHtjps.js} +2 -2
- package/web-app/dist/assets/{LoginPage-B4iVxWhF.js → LoginPage-Dz3tkjNe.js} +1 -1
- package/web-app/dist/assets/{MagicPage-Ds1hWKs_.js → MagicPage-CwX7Qveh.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-CSmj9i-9.js → MetricsPage-BPn1kGrY.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-BwYGtThw.js → NotFoundPage-yN4E_E9L.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-CQcyfWrI.js → ProjectPage-DGozzUjl.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-BofiyP0N.js → ProjectsPage-CKfZ9HqL.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-yBZ6gtRW.js → SettingsPage-CZwkXq9s.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-CAQ2Eyxi.js → ShowcasePage-DMT87b7c.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-C7oyc5yv.js → SystemSettingsPage-DXQECr0D.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-CmEMd8pi.js → TeamsPage-BToX86gg.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-DHDNJt4B.js → TemplatesPage-BOsPainh.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-CvVB75WD.js → TerminalOutput-BpUH2T2I.js} +1 -1
- package/web-app/dist/assets/{activity-YWe5HHl1.js → activity-3fblzNUj.js} +1 -1
- package/web-app/dist/assets/{bell-S1cFZU3e.js → bell-mA0pgtzl.js} +1 -1
- package/web-app/dist/assets/{bot-DFLqlRci.js → bot-vQONIYoS.js} +1 -1
- package/web-app/dist/assets/{check-CMSz_WCA.js → check-BrEJZqtS.js} +1 -1
- package/web-app/dist/assets/{chevron-left-D0OYlQoM.js → chevron-left-50IJvv4C.js} +1 -1
- package/web-app/dist/assets/{circle-alert-Cpkys85L.js → circle-alert-D9syjc3B.js} +1 -1
- package/web-app/dist/assets/{clock-aWGlxAfo.js → clock-BboMPS77.js} +1 -1
- package/web-app/dist/assets/{cloud-BoQ1ukGN.js → cloud-DDEp4yUM.js} +1 -1
- package/web-app/dist/assets/{code-xml-DE1cQQY-.js → code-xml-CAtMXik8.js} +1 -1
- package/web-app/dist/assets/{database-0mNn2gEZ.js → database-CAOqYM1E.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-DhVHLdXn.js → dollar-sign-DOdmdqOB.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-Kdhlthsx.js → file-code-corner-BPAksle-.js} +1 -1
- package/web-app/dist/assets/{file-plus-DC8Ol12M.js → file-plus-CBmhCe_9.js} +1 -1
- package/web-app/dist/assets/{globe-Dc20I0TQ.js → globe-ZsWZvCkr.js} +1 -1
- package/web-app/dist/assets/{hammer-bQSO5V22.js → hammer-SbKfTPb3.js} +1 -1
- package/web-app/dist/assets/{index-qo4plPi9.js → index-C74Su7jP.js} +3 -3
- package/web-app/dist/assets/{layers-Cpg61897.js → layers-Cv_FErq-.js} +1 -1
- package/web-app/dist/assets/{loader-circle-CWrV4VSZ.js → loader-circle-dIPyEfsE.js} +1 -1
- package/web-app/dist/assets/{lock-BUAbIFbd.js → lock-CGAxTxO5.js} +1 -1
- package/web-app/dist/assets/{package-D9crdKwa.js → package-CgvIF1Ku.js} +1 -1
- package/web-app/dist/assets/{plus-DQ47s2Pu.js → plus-_3FKv0NS.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-BpPNEb-w.js → refresh-cw-Bnb0_V6n.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-BlGqvWmT.js → rotate-ccw-ZLvlePsk.js} +1 -1
- package/web-app/dist/assets/{scroll-text-CdoJqUVY.js → scroll-text-BPFgZCbN.js} +1 -1
- package/web-app/dist/assets/{server-DAeMHIWE.js → server-H0O63Cgk.js} +1 -1
- package/web-app/dist/assets/{shield-alert-Nog-1UpV.js → shield-alert-DZ91-CiS.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-aKWWv11P.js → thumbs-up-DPoDpxQt.js} +1 -1
- package/web-app/dist/assets/{trash-2-CdLQoGGx.js → trash-2-Da4bSFuC.js} +1 -1
- package/web-app/dist/assets/{trending-down-CHMgoZbL.js → trending-down-CcnmOjB2.js} +1 -1
- package/web-app/dist/assets/{trending-up-CE85XyXv.js → trending-up-NzCUunlQ.js} +1 -1
- package/web-app/dist/assets/{upload-7eXHbK2F.js → upload-Cy_koNIe.js} +1 -1
- package/web-app/dist/assets/{usePolling-DJo4_OMt.js → usePolling-CgA0f7-y.js} +1 -1
- package/web-app/dist/assets/{user-DvywwLv_.js → user-DkwhGZ5j.js} +1 -1
- package/web-app/dist/index.html +1 -1
|
@@ -9824,7 +9824,7 @@ var init_retry_class = __esm(() => {
|
|
|
9824
9824
|
// ../../loki-ts/src/runner/worker_proc.ts
|
|
9825
9825
|
import { spawn as spawn7, spawnSync as spawnSync2 } from "child_process";
|
|
9826
9826
|
import { createInterface } from "readline";
|
|
9827
|
-
import { join as join32, resolve as
|
|
9827
|
+
import { join as join32, resolve as resolve10 } from "path";
|
|
9828
9828
|
import { accessSync, chmodSync as chmodSync4, constants as fsConstants2, existsSync as existsSync17, mkdirSync as mkdirSync11, mkdtempSync as mkdtempSync4, readdirSync as readdirSync14, readFileSync as readFileSync24, readlinkSync, realpathSync as realpathSync14, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "fs";
|
|
9829
9829
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
9830
9830
|
import { tmpdir as tmpdir6 } from "os";
|
|
@@ -9882,7 +9882,7 @@ function pinBashShellEnv(env, canExec = isExecutable) {
|
|
|
9882
9882
|
env["SHELL"] = POSIX_BASH;
|
|
9883
9883
|
}
|
|
9884
9884
|
function envWithPwd(env, cwd) {
|
|
9885
|
-
return cwd === undefined ? env : { ...env, PWD:
|
|
9885
|
+
return cwd === undefined ? env : { ...env, PWD: resolve10(cwd) };
|
|
9886
9886
|
}
|
|
9887
9887
|
function ulimitArgv(argv, env) {
|
|
9888
9888
|
const set = ULIMIT_KNOBS.filter(([name]) => env[name] !== undefined && env[name] !== "");
|
|
@@ -9900,16 +9900,16 @@ function ulimitArgv(argv, env) {
|
|
|
9900
9900
|
return [LIMIT_SHELL, "-c", script, "sh", ...values, ...argv];
|
|
9901
9901
|
}
|
|
9902
9902
|
function spawnWorker(argv, env, cwd, backstopMs, escalateMs, onLine, onStopped = () => {}) {
|
|
9903
|
-
return new Promise((
|
|
9903
|
+
return new Promise((resolve11) => {
|
|
9904
9904
|
if (!argv[0])
|
|
9905
|
-
return
|
|
9905
|
+
return resolve11({ code: null, killed: false });
|
|
9906
9906
|
let wrapped;
|
|
9907
9907
|
try {
|
|
9908
9908
|
wrapped = ulimitArgv(argv, env);
|
|
9909
9909
|
} catch (e) {
|
|
9910
9910
|
process.stderr.write(`${e.message}
|
|
9911
9911
|
`);
|
|
9912
|
-
return
|
|
9912
|
+
return resolve11({ code: ULIMIT_REFUSED_EXIT, killed: false });
|
|
9913
9913
|
}
|
|
9914
9914
|
const [cmd, ...args] = wrapped;
|
|
9915
9915
|
const child = spawn7(cmd, args, { cwd, env: envWithPwd(env, cwd), stdio: ["ignore", "pipe", "inherit"], detached: true });
|
|
@@ -9946,7 +9946,7 @@ function spawnWorker(argv, env, cwd, backstopMs, escalateMs, onLine, onStopped =
|
|
|
9946
9946
|
child.stdout?.destroy();
|
|
9947
9947
|
killGroup2(child.pid, "SIGKILL");
|
|
9948
9948
|
onStopped(cancelled2 !== undefined);
|
|
9949
|
-
|
|
9949
|
+
resolve11({ code, killed, ...cancelled2 ? { cancelled: cancelled2 } : {} });
|
|
9950
9950
|
};
|
|
9951
9951
|
timers.push(setTimeout(() => {
|
|
9952
9952
|
killed = true;
|
|
@@ -10970,7 +10970,7 @@ var init_stack_tools = __esm(() => {
|
|
|
10970
10970
|
|
|
10971
10971
|
// ../../loki-ts/src/util/dotnet_test.ts
|
|
10972
10972
|
import { existsSync as existsSync21, readFileSync as readFileSync29 } from "fs";
|
|
10973
|
-
import { basename as
|
|
10973
|
+
import { basename as basename9, join as join37 } from "path";
|
|
10974
10974
|
function dotnetSummary(text2) {
|
|
10975
10975
|
const ls2 = text2.split(`
|
|
10976
10976
|
`).map((l) => l.trimEnd());
|
|
@@ -11031,7 +11031,7 @@ function dotnetClasses(file) {
|
|
|
11031
11031
|
text2 = readFileSync29(file, "utf8");
|
|
11032
11032
|
} catch {}
|
|
11033
11033
|
const found = [...new Set([...text2.matchAll(/\bclass\s+([A-Za-z_]\w*)/g)].map((m) => m[1]))];
|
|
11034
|
-
return found.length ? found : [
|
|
11034
|
+
return found.length ? found : [basename9(file, ".cs")];
|
|
11035
11035
|
}
|
|
11036
11036
|
function dotnetTestCmd(repoDir, testRel) {
|
|
11037
11037
|
const proj = dotnetProjectOf(repoDir, testRel) ?? dotnetTarget(repoDir), filter = dotnetClasses(join37(repoDir, testRel)).map((c) => `FullyQualifiedName~${c}`).join("|");
|
|
@@ -11066,12 +11066,12 @@ var init_wall_knobs = __esm(() => {
|
|
|
11066
11066
|
// ../../loki-ts/src/util/producer_fingerprint.ts
|
|
11067
11067
|
import { createHash as createHash7 } from "crypto";
|
|
11068
11068
|
import { readdirSync as readdirSync17, readFileSync as readFileSync30 } from "fs";
|
|
11069
|
-
import { relative as relative2, resolve as
|
|
11069
|
+
import { relative as relative2, resolve as resolve11 } from "path";
|
|
11070
11070
|
function sourceFingerprint(root) {
|
|
11071
11071
|
const h = createHash7("sha256");
|
|
11072
11072
|
const walk = (dir) => {
|
|
11073
11073
|
for (const e of readdirSync17(dir, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : 1)) {
|
|
11074
|
-
const p =
|
|
11074
|
+
const p = resolve11(dir, e.name);
|
|
11075
11075
|
if (e.isDirectory()) {
|
|
11076
11076
|
if (e.name !== "node_modules")
|
|
11077
11077
|
walk(p);
|
|
@@ -11082,7 +11082,7 @@ function sourceFingerprint(root) {
|
|
|
11082
11082
|
walk(root);
|
|
11083
11083
|
return h.digest("hex");
|
|
11084
11084
|
}
|
|
11085
|
-
function computeProducerFingerprint(root =
|
|
11085
|
+
function computeProducerFingerprint(root = resolve11(import.meta.dir, ".."), injected = globalThis.__LOKI_PRODUCER_FP__) {
|
|
11086
11086
|
if (typeof injected === "string" && /^[0-9a-f]{64}$/.test(injected))
|
|
11087
11087
|
return injected;
|
|
11088
11088
|
try {
|
|
@@ -11099,17 +11099,17 @@ var init_producer_fingerprint = () => {};
|
|
|
11099
11099
|
|
|
11100
11100
|
// ../../loki-ts/src/engine10/cache.ts
|
|
11101
11101
|
import { createHash as createHash8 } from "crypto";
|
|
11102
|
-
import { chmodSync as chmodSync5, existsSync as existsSync22, mkdirSync as mkdirSync14, readdirSync as readdirSync18, readFileSync as readFileSync31, renameSync as renameSync6, statSync as
|
|
11103
|
-
import { basename as
|
|
11102
|
+
import { chmodSync as chmodSync5, existsSync as existsSync22, mkdirSync as mkdirSync14, readdirSync as readdirSync18, readFileSync as readFileSync31, renameSync as renameSync6, statSync as statSync15, unlinkSync as unlinkSync4, writeFileSync as writeFileSync15 } from "fs";
|
|
11103
|
+
import { basename as basename10, resolve as resolve12 } from "path";
|
|
11104
11104
|
function repoKey(originUrl, repoDir) {
|
|
11105
|
-
const basis = originUrl && originUrl.trim() !== "" ? originUrl :
|
|
11105
|
+
const basis = originUrl && originUrl.trim() !== "" ? originUrl : resolve12(repoDir);
|
|
11106
11106
|
return createHash8("sha256").update(basis).digest("hex");
|
|
11107
11107
|
}
|
|
11108
11108
|
function defaultCacheRoot() {
|
|
11109
|
-
return
|
|
11109
|
+
return resolve12(homeLokiDir(), "cache", "v10");
|
|
11110
11110
|
}
|
|
11111
11111
|
function repoCacheDir(key, cacheRoot = defaultCacheRoot()) {
|
|
11112
|
-
return
|
|
11112
|
+
return resolve12(cacheRoot, key);
|
|
11113
11113
|
}
|
|
11114
11114
|
function readJson3(path, isValid = (_v) => true) {
|
|
11115
11115
|
if (!existsSync22(path))
|
|
@@ -11145,15 +11145,15 @@ function writeJson(path, dir, data) {
|
|
|
11145
11145
|
function pruneCache(dir, prefix, keepPath, keep = prefix === "slice-" ? 500 : 5) {
|
|
11146
11146
|
const mt = (f) => {
|
|
11147
11147
|
try {
|
|
11148
|
-
return
|
|
11148
|
+
return statSync15(resolve12(dir, f)).mtimeMs;
|
|
11149
11149
|
} catch {
|
|
11150
11150
|
return 0;
|
|
11151
11151
|
}
|
|
11152
11152
|
};
|
|
11153
11153
|
try {
|
|
11154
|
-
readdirSync18(dir).filter((f) => f.startsWith(prefix) && f.endsWith(".json") && f !==
|
|
11154
|
+
readdirSync18(dir).filter((f) => f.startsWith(prefix) && f.endsWith(".json") && f !== basename10(keepPath)).sort((x, y) => mt(y) - mt(x) || (x < y ? 1 : -1)).slice(keep - 1).forEach((f) => {
|
|
11155
11155
|
try {
|
|
11156
|
-
unlinkSync4(
|
|
11156
|
+
unlinkSync4(resolve12(dir, f));
|
|
11157
11157
|
} catch {}
|
|
11158
11158
|
});
|
|
11159
11159
|
} catch {}
|
|
@@ -11176,10 +11176,10 @@ var tmpSeq = 0, LEGACY_PREFIX, writeAndPrune = (path, dir, prefix, data) => {
|
|
|
11176
11176
|
const old = LEGACY_PREFIX[prefix];
|
|
11177
11177
|
if (old)
|
|
11178
11178
|
pruneCache(dir, old, path, 1);
|
|
11179
|
-
}, cacheFileName = (kind, tree, fp = producerFingerprint()) => `${kind}-${fp.slice(0, 16)}-${tree}.json`, readRepoMapCache = (dir, tree, fp = producerFingerprint()) => readJson3(
|
|
11179
|
+
}, cacheFileName = (kind, tree, fp = producerFingerprint()) => `${kind}-${fp.slice(0, 16)}-${tree}.json`, readRepoMapCache = (dir, tree, fp = producerFingerprint()) => readJson3(resolve12(dir, cacheFileName("repomap", tree, fp)), isRepoMap), writeRepoMapCache = (dir, tree, map, fp = producerFingerprint()) => writeAndPrune(resolve12(dir, cacheFileName("repomap", tree, fp)), dir, "repomap-", map), readTestMapCache = (dir, tree, fp = producerFingerprint()) => readJson3(resolve12(dir, cacheFileName("testmap", tree, fp)), isTestMap), writeTestMapCache = (dir, tree, map, fp = producerFingerprint()) => writeAndPrune(resolve12(dir, cacheFileName("testmap", tree, fp)), dir, "testmap-", map), cacheStats, cachedRepoMap = (dir, tree, build, fp = producerFingerprint()) => viaCache(readRepoMapCache(dir, tree, fp), build, (m) => writeRepoMapCache(dir, tree, m, fp)), sliceKey = (card, baseSha) => createHash8("sha256").update(`${card.length}:${card}\x00${baseSha}`).digest("hex"), isJournalEntry = (v) => {
|
|
11180
11180
|
const e = v;
|
|
11181
11181
|
return typeof e === "object" && e !== null && typeof e.gid === "string" && typeof e.id === "string" && typeof e.head === "string" && Number.isInteger(e.n);
|
|
11182
|
-
}, readSliceJournal = (dir, key) => readJson3(
|
|
11182
|
+
}, readSliceJournal = (dir, key) => readJson3(resolve12(dir, `slice-${key}.json`), isJournalEntry), writeSliceJournal = (dir, key, entry) => writeAndPrune(resolve12(dir, `slice-${key}.json`), dir, "slice-", entry);
|
|
11183
11183
|
var init_cache = __esm(() => {
|
|
11184
11184
|
init_paths();
|
|
11185
11185
|
init_producer_fingerprint();
|
|
@@ -11189,7 +11189,7 @@ var init_cache = __esm(() => {
|
|
|
11189
11189
|
|
|
11190
11190
|
// ../../loki-ts/src/util/lock_ecosystems.ts
|
|
11191
11191
|
import { existsSync as existsSync23, readdirSync as readdirSync19, readFileSync as readFileSync32 } from "fs";
|
|
11192
|
-
import { basename as
|
|
11192
|
+
import { basename as basename11, dirname as dirname11, join as join38 } from "path";
|
|
11193
11193
|
function isYarnBerry(dir) {
|
|
11194
11194
|
if (existsSync23(join38(dir, ".yarnrc.yml")))
|
|
11195
11195
|
return true;
|
|
@@ -11239,7 +11239,7 @@ function declaredPythonDeps(repoDir, manifests) {
|
|
|
11239
11239
|
} catch {
|
|
11240
11240
|
continue;
|
|
11241
11241
|
}
|
|
11242
|
-
const base =
|
|
11242
|
+
const base = basename11(f), lines = t.split(`
|
|
11243
11243
|
`);
|
|
11244
11244
|
if (base.endsWith(".txt")) {
|
|
11245
11245
|
for (const l of lines)
|
|
@@ -11427,7 +11427,7 @@ function exportsDiverge(x) {
|
|
|
11427
11427
|
return "import" in o && "require" in o && JSON.stringify(o["import"]) !== JSON.stringify(o["require"]) || Object.values(o).some(exportsDiverge);
|
|
11428
11428
|
}
|
|
11429
11429
|
function addedManifestOk(f, c, wall, esc, notes) {
|
|
11430
|
-
if (
|
|
11430
|
+
if (basename11(f) !== "package.json" || dirname11(f) === "." || !c.wallPassedN)
|
|
11431
11431
|
return false;
|
|
11432
11432
|
const dir = dirname11(f), g = (a) => {
|
|
11433
11433
|
try {
|
|
@@ -11476,7 +11476,7 @@ function addedManifestOk(f, c, wall, esc, notes) {
|
|
|
11476
11476
|
if (all === null)
|
|
11477
11477
|
return false;
|
|
11478
11478
|
const baseManifests = all.split(`
|
|
11479
|
-
`).filter((p) =>
|
|
11479
|
+
`).filter((p) => basename11(p) === "package.json" && !p.split("/").includes("node_modules"));
|
|
11480
11480
|
if (baseManifests.length > MAX_BASE_MANIFESTS)
|
|
11481
11481
|
return false;
|
|
11482
11482
|
const baseNames = new Set, baseDeps = new Set;
|
|
@@ -11951,9 +11951,9 @@ var init_runner_boot = __esm(() => {
|
|
|
11951
11951
|
});
|
|
11952
11952
|
|
|
11953
11953
|
// ../../loki-ts/src/util/test_file_text.ts
|
|
11954
|
-
import { basename as
|
|
11954
|
+
import { basename as basename12, dirname as dirname12 } from "path";
|
|
11955
11955
|
function isTestFile(rel) {
|
|
11956
|
-
const name =
|
|
11956
|
+
const name = basename12(rel);
|
|
11957
11957
|
return JS_TEST_RE.test(name) || PY_TEST_RE.test(name) || GO_TEST_RE.test(name) || RS_TEST_RE.test(rel) || SH_TEST_RE.test(rel) || /^test[-_].+\.(sh|bash)$/.test(name) || JAVA_TEST_RE.test(rel) || CS_TEST_RE.test(rel);
|
|
11958
11958
|
}
|
|
11959
11959
|
function detectFromPackageJson(text3, rel, mark) {
|
|
@@ -12007,7 +12007,7 @@ function referencedBasenames(text3) {
|
|
|
12007
12007
|
return out2;
|
|
12008
12008
|
}
|
|
12009
12009
|
function coveredStem(testPath) {
|
|
12010
|
-
const name =
|
|
12010
|
+
const name = basename12(testPath);
|
|
12011
12011
|
if (JS_TEST_RE.test(name))
|
|
12012
12012
|
return name.replace(JS_TEST_RE, "");
|
|
12013
12013
|
if (/\.(?:java|cs)$/.test(name))
|
|
@@ -12017,7 +12017,7 @@ function coveredStem(testPath) {
|
|
|
12017
12017
|
return name.replace(/_test\.(py|go)$/, "");
|
|
12018
12018
|
}
|
|
12019
12019
|
function scopeRunnersByPackage(files, evidence, jsText, api, order2, read, marks) {
|
|
12020
|
-
const roots = [...new Set([".", ...api?.packages().map((p) => p.root) ?? [], ...files.filter((f) =>
|
|
12020
|
+
const roots = [...new Set([".", ...api?.packages().map((p) => p.root) ?? [], ...files.filter((f) => basename12(f) === "package.json").map((f) => dirname12(f))])];
|
|
12021
12021
|
const ownerRoot = (file) => api?.packageRootOf(file) ?? roots.filter((p) => p === "." || file.startsWith(`${p}/`)).sort((a, b) => b.length - a.length)[0] ?? ".";
|
|
12022
12022
|
const packageRunners = new Map;
|
|
12023
12023
|
for (const pkgRoot of roots) {
|
|
@@ -12098,7 +12098,7 @@ var init_test_file_text = __esm(() => {
|
|
|
12098
12098
|
});
|
|
12099
12099
|
|
|
12100
12100
|
// ../../loki-ts/src/util/context_pack.ts
|
|
12101
|
-
import { closeSync as closeSync8, openSync as openSync8, readdirSync as readdirSync20, readFileSync as readFileSync34, readSync as readSync7, statSync as
|
|
12101
|
+
import { closeSync as closeSync8, openSync as openSync8, readdirSync as readdirSync20, readFileSync as readFileSync34, readSync as readSync7, statSync as statSync16 } from "fs";
|
|
12102
12102
|
import { join as join41 } from "path";
|
|
12103
12103
|
function langOf(path) {
|
|
12104
12104
|
if (/\.[cm]?[jt]sx?$/.test(path))
|
|
@@ -13174,10 +13174,10 @@ __export(exports_claude_model, {
|
|
|
13174
13174
|
DEFAULT_SESSION_MODEL: () => DEFAULT_SESSION_MODEL
|
|
13175
13175
|
});
|
|
13176
13176
|
import { readFileSync as readFileSync35 } from "fs";
|
|
13177
|
-
import { resolve as
|
|
13177
|
+
import { resolve as resolve13 } from "path";
|
|
13178
13178
|
function resolveClaudeModel(want) {
|
|
13179
13179
|
try {
|
|
13180
|
-
const path = process.env["LOKI_MODEL_CATALOG"] ||
|
|
13180
|
+
const path = process.env["LOKI_MODEL_CATALOG"] || resolve13(REPO_ROOT, "providers/model_catalog.json");
|
|
13181
13181
|
return JSON.parse(readFileSync35(path, "utf8")).providers?.claude?.cli_aliases?.[want] ?? want;
|
|
13182
13182
|
} catch {
|
|
13183
13183
|
return want;
|
|
@@ -13188,7 +13188,7 @@ function isUnresolvedClaudeAlias(model) {
|
|
|
13188
13188
|
}
|
|
13189
13189
|
function claudeTierRank(model) {
|
|
13190
13190
|
try {
|
|
13191
|
-
const path = process.env["LOKI_MODEL_CATALOG"] ||
|
|
13191
|
+
const path = process.env["LOKI_MODEL_CATALOG"] || resolve13(REPO_ROOT, "providers/model_catalog.json");
|
|
13192
13192
|
const models = JSON.parse(readFileSync35(path, "utf8")).providers?.claude?.models;
|
|
13193
13193
|
if (!Array.isArray(models))
|
|
13194
13194
|
return null;
|
|
@@ -13206,7 +13206,7 @@ function claudeTierRank(model) {
|
|
|
13206
13206
|
}
|
|
13207
13207
|
function claudeEffortLevels(model) {
|
|
13208
13208
|
try {
|
|
13209
|
-
const path = process.env["LOKI_MODEL_CATALOG"] ||
|
|
13209
|
+
const path = process.env["LOKI_MODEL_CATALOG"] || resolve13(REPO_ROOT, "providers/model_catalog.json");
|
|
13210
13210
|
const models = JSON.parse(readFileSync35(path, "utf8")).providers?.claude?.models;
|
|
13211
13211
|
if (!Array.isArray(models))
|
|
13212
13212
|
return null;
|
|
@@ -13219,7 +13219,7 @@ function claudeEffortLevels(model) {
|
|
|
13219
13219
|
}
|
|
13220
13220
|
function claudeThinkingSpec(model) {
|
|
13221
13221
|
try {
|
|
13222
|
-
const path = process.env["LOKI_MODEL_CATALOG"] ||
|
|
13222
|
+
const path = process.env["LOKI_MODEL_CATALOG"] || resolve13(REPO_ROOT, "providers/model_catalog.json");
|
|
13223
13223
|
const models = JSON.parse(readFileSync35(path, "utf8")).providers?.claude?.models;
|
|
13224
13224
|
if (!Array.isArray(models))
|
|
13225
13225
|
return null;
|
|
@@ -13540,7 +13540,7 @@ var init_watchdog = __esm(() => {
|
|
|
13540
13540
|
|
|
13541
13541
|
// ../../loki-ts/src/util/anti_loop.ts
|
|
13542
13542
|
import { createHash as createHash9 } from "crypto";
|
|
13543
|
-
import { readFileSync as readFileSync36, statSync as
|
|
13543
|
+
import { readFileSync as readFileSync36, statSync as statSync17 } from "fs";
|
|
13544
13544
|
import { join as join43 } from "path";
|
|
13545
13545
|
function treeFingerprint(repoDir, baseSha) {
|
|
13546
13546
|
try {
|
|
@@ -13550,7 +13550,7 @@ function treeFingerprint(repoDir, baseSha) {
|
|
|
13550
13550
|
for (const f of fresh) {
|
|
13551
13551
|
h.update(`\x00${f}\x00`);
|
|
13552
13552
|
const path = join43(repoDir, f);
|
|
13553
|
-
if (
|
|
13553
|
+
if (statSync17(path).size > MAX_BUFFER)
|
|
13554
13554
|
return null;
|
|
13555
13555
|
h.update(readFileSync36(path));
|
|
13556
13556
|
}
|
|
@@ -13592,7 +13592,7 @@ function diffSignature(cwd, stat, untrackedRaw = untrackedList(cwd)) {
|
|
|
13592
13592
|
if (n3++ >= 1000)
|
|
13593
13593
|
return;
|
|
13594
13594
|
try {
|
|
13595
|
-
const st =
|
|
13595
|
+
const st = statSync17(join43(dir, f));
|
|
13596
13596
|
bytes += st.size;
|
|
13597
13597
|
if (st.mtimeMs > newest)
|
|
13598
13598
|
newest = st.mtimeMs;
|
|
@@ -13614,7 +13614,7 @@ var init_anti_loop = __esm(() => {
|
|
|
13614
13614
|
|
|
13615
13615
|
// ../../loki-ts/src/runner/session_resume.ts
|
|
13616
13616
|
import { existsSync as existsSync24, mkdirSync as mkdirSync15, readdirSync as readdirSync21, readFileSync as readFileSync37, renameSync as renameSync7, rmSync as rmSync8, writeFileSync as writeFileSync16 } from "fs";
|
|
13617
|
-
import { basename as
|
|
13617
|
+
import { basename as basename13, dirname as dirname13, join as join44 } from "path";
|
|
13618
13618
|
function readFirstTurnTokens(repoDir, iterationId) {
|
|
13619
13619
|
try {
|
|
13620
13620
|
const v = JSON.parse(readFileSync37(join44(repoDir, ".loki", "metrics", `result-cost-${iterationId}.json`), "utf8")).first_turn_prompt_tokens;
|
|
@@ -13660,7 +13660,7 @@ function migrateSessionFiles(repoDir, isLive = () => false) {
|
|
|
13660
13660
|
}
|
|
13661
13661
|
for (const name of names) {
|
|
13662
13662
|
const iter = name.slice("e10-session-".length, -".json".length), from = legacySessionPath(repoDir, iter), dest = sessionFilePath(repoDir, iter), destDir = dirname13(dest);
|
|
13663
|
-
if (
|
|
13663
|
+
if (basename13(dirname13(destDir)) === "runs" && isLive(destDir))
|
|
13664
13664
|
continue;
|
|
13665
13665
|
try {
|
|
13666
13666
|
mkdirSync15(destDir, { recursive: true });
|
|
@@ -13795,7 +13795,7 @@ var init_session_resume = __esm(() => {
|
|
|
13795
13795
|
});
|
|
13796
13796
|
|
|
13797
13797
|
// ../../loki-ts/src/project_model/schema.ts
|
|
13798
|
-
import { existsSync as existsSync25, lstatSync as lstatSync8, realpathSync as realpathSync15, statSync as
|
|
13798
|
+
import { existsSync as existsSync25, lstatSync as lstatSync8, realpathSync as realpathSync15, statSync as statSync18 } from "fs";
|
|
13799
13799
|
import { isAbsolute, join as join45, normalize, sep as sep10 } from "path";
|
|
13800
13800
|
function safeRel(p) {
|
|
13801
13801
|
const n3 = normalize(p.trim()).split(sep10).join("/").replace(/\/$/, "");
|
|
@@ -13819,7 +13819,7 @@ function checkCitation(repoDir, raw2) {
|
|
|
13819
13819
|
if (rel === null)
|
|
13820
13820
|
return `citation "${raw2}" is not a repo-relative path`;
|
|
13821
13821
|
const abs = join45(repoDir, rel);
|
|
13822
|
-
if (!existsSync25(abs) || !
|
|
13822
|
+
if (!existsSync25(abs) || !statSync18(abs).isFile() || !insideRepo(repoDir, rel))
|
|
13823
13823
|
return `citation "${raw2}" names a file that does not exist`;
|
|
13824
13824
|
return null;
|
|
13825
13825
|
}
|
|
@@ -13859,7 +13859,7 @@ function checkDir(repoDir, v, where, errs) {
|
|
|
13859
13859
|
return ".";
|
|
13860
13860
|
}
|
|
13861
13861
|
const abs = join45(repoDir, rel);
|
|
13862
|
-
if (!existsSync25(abs) || !
|
|
13862
|
+
if (!existsSync25(abs) || !statSync18(abs).isDirectory() || !insideRepo(repoDir, rel))
|
|
13863
13863
|
errs.push(`${where}: directory "${rel}" does not exist`);
|
|
13864
13864
|
return rel;
|
|
13865
13865
|
}
|
|
@@ -13988,10 +13988,10 @@ __export(exports_receipt_signer, {
|
|
|
13988
13988
|
DEPLOY_SCHEMA: () => DEPLOY_SCHEMA
|
|
13989
13989
|
});
|
|
13990
13990
|
import { createHash as createHash10, randomBytes as randomBytes4, createPrivateKey, createPublicKey as createPublicKey2, generateKeyPairSync, sign, verify as verify2 } from "crypto";
|
|
13991
|
-
import { chmodSync as chmodSync6, linkSync, mkdirSync as mkdirSync16, readdirSync as readdirSync22, readFileSync as readFileSync38, renameSync as renameSync8, statSync as
|
|
13991
|
+
import { chmodSync as chmodSync6, linkSync, mkdirSync as mkdirSync16, readdirSync as readdirSync22, readFileSync as readFileSync38, renameSync as renameSync8, statSync as statSync19, unlinkSync as unlinkSync5, writeFileSync as writeFileSync17 } from "fs";
|
|
13992
13992
|
import { homedir as homedir10 } from "os";
|
|
13993
13993
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
13994
|
-
import { basename as
|
|
13994
|
+
import { basename as basename14, dirname as dirname14, join as join46 } from "path";
|
|
13995
13995
|
function jsonTooDeep(v) {
|
|
13996
13996
|
const stack = [[v, 1]];
|
|
13997
13997
|
while (stack.length > 0) {
|
|
@@ -14036,7 +14036,7 @@ function loadSigningKey(generate = true) {
|
|
|
14036
14036
|
pem = readFileSync38(file);
|
|
14037
14037
|
if (!given) {
|
|
14038
14038
|
for (const [f, m] of [[file, 384], [dirname14(file), 448]])
|
|
14039
|
-
if (
|
|
14039
|
+
if (statSync19(f).mode & 63)
|
|
14040
14040
|
chmodSync6(f, m);
|
|
14041
14041
|
}
|
|
14042
14042
|
} catch (e) {
|
|
@@ -14046,7 +14046,7 @@ function loadSigningKey(generate = true) {
|
|
|
14046
14046
|
return null;
|
|
14047
14047
|
mkdirSync16(dirname14(dirname14(file)), { recursive: true, mode: 448 });
|
|
14048
14048
|
mkdirSync16(dirname14(file), { recursive: true, mode: 448 });
|
|
14049
|
-
sweepStaleTmp(dirname14(file), new RegExp(`${escapeRegex(
|
|
14049
|
+
sweepStaleTmp(dirname14(file), new RegExp(`${escapeRegex(basename14(file))}\\.[0-9a-f]{12}\\.tmp`));
|
|
14050
14050
|
const tmp = `${file}.${randomBytes4(6).toString("hex")}.tmp`;
|
|
14051
14051
|
writeFileSync17(tmp, generateKeyPairSync("ed25519").privateKey.export({ type: "pkcs8", format: "pem" }), { flag: "wx", mode: 384 });
|
|
14052
14052
|
try {
|
|
@@ -14374,7 +14374,7 @@ async function deployAttestCmd(args, env) {
|
|
|
14374
14374
|
return null;
|
|
14375
14375
|
let rec;
|
|
14376
14376
|
try {
|
|
14377
|
-
if (
|
|
14377
|
+
if (statSync19(file).size > 1e6)
|
|
14378
14378
|
return null;
|
|
14379
14379
|
rec = JSON.parse(readFileSync38(file, "utf8"));
|
|
14380
14380
|
} catch {
|
|
@@ -14448,7 +14448,7 @@ var init_receipt_signer = __esm(() => {
|
|
|
14448
14448
|
|
|
14449
14449
|
// ../../loki-ts/src/runner/router/history_store.ts
|
|
14450
14450
|
import { existsSync as existsSync26, mkdirSync as mkdirSync17, readFileSync as readFileSync39, renameSync as renameSync9, rmSync as rmSync9, writeFileSync as writeFileSync18 } from "fs";
|
|
14451
|
-
import { resolve as
|
|
14451
|
+
import { resolve as resolve14 } from "path";
|
|
14452
14452
|
function validRun(v) {
|
|
14453
14453
|
if (typeof v !== "object" || v === null)
|
|
14454
14454
|
return false;
|
|
@@ -14456,7 +14456,7 @@ function validRun(v) {
|
|
|
14456
14456
|
return typeof r["shape"] === "string" && typeof r["executor"] === "string" && EXECUTORS2.includes(r["executor"]) && typeof r["verdict"] === "string" && VERDICTS.includes(r["verdict"]) && (r["owner"] === null || typeof r["owner"] === "string" && OWNERS.includes(r["owner"])) && typeof r["escalated"] === "boolean" && typeof r["usd"] === "number" && Number.isFinite(r["usd"]) && typeof r["wallS"] === "number" && Number.isFinite(r["wallS"]);
|
|
14457
14457
|
}
|
|
14458
14458
|
function historyPath(key, cacheRoot) {
|
|
14459
|
-
return
|
|
14459
|
+
return resolve14(repoCacheDir(key, cacheRoot), HISTORY_FILE);
|
|
14460
14460
|
}
|
|
14461
14461
|
function readRunHistory(key, cacheRoot) {
|
|
14462
14462
|
const path = historyPath(key, cacheRoot);
|
|
@@ -14731,7 +14731,7 @@ var init_engine_origin = __esm(() => {
|
|
|
14731
14731
|
|
|
14732
14732
|
// ../../loki-ts/src/runner/router/history.ts
|
|
14733
14733
|
import { existsSync as existsSync28, readFileSync as readFileSync42 } from "fs";
|
|
14734
|
-
import { dirname as dirname16, join as join49, resolve as
|
|
14734
|
+
import { dirname as dirname16, join as join49, resolve as resolve15 } from "path";
|
|
14735
14735
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
14736
14736
|
function shapeKey(model) {
|
|
14737
14737
|
if (!model || model.status !== "ok")
|
|
@@ -14821,7 +14821,7 @@ var init_history = __esm(() => {
|
|
|
14821
14821
|
init_cache();
|
|
14822
14822
|
init_engine_origin();
|
|
14823
14823
|
init_history_store();
|
|
14824
|
-
SHAPE_DEFAULTS_FILE =
|
|
14824
|
+
SHAPE_DEFAULTS_FILE = resolve15(dirname16(fileURLToPath2(import.meta.url)), "..", "..", "..", "data", "router-shape-defaults.json");
|
|
14825
14825
|
});
|
|
14826
14826
|
|
|
14827
14827
|
// ../../loki-ts/src/runner/router/unit_model.ts
|
|
@@ -14941,7 +14941,7 @@ var init_session_route = __esm(() => {
|
|
|
14941
14941
|
});
|
|
14942
14942
|
|
|
14943
14943
|
// ../../loki-ts/src/providers/mcp_config.ts
|
|
14944
|
-
import { existsSync as existsSync29, readFileSync as readFileSync44, mkdirSync as mkdirSync18, statSync as
|
|
14944
|
+
import { existsSync as existsSync29, readFileSync as readFileSync44, mkdirSync as mkdirSync18, statSync as statSync20, renameSync as renameSync10 } from "fs";
|
|
14945
14945
|
import { resolve as resolvePath, join as join50, delimiter as delimiter3 } from "path";
|
|
14946
14946
|
function detectLsp() {
|
|
14947
14947
|
const pathEnv = process.env["PATH"] ?? "";
|
|
@@ -14952,7 +14952,7 @@ function detectLsp() {
|
|
|
14952
14952
|
for (const dir of dirs) {
|
|
14953
14953
|
const candidate = join50(dir, bin);
|
|
14954
14954
|
try {
|
|
14955
|
-
const s =
|
|
14955
|
+
const s = statSync20(candidate);
|
|
14956
14956
|
if (s.isFile())
|
|
14957
14957
|
return true;
|
|
14958
14958
|
} catch {}
|
|
@@ -15011,7 +15011,7 @@ function userMcpConfigPath() {
|
|
|
15011
15011
|
if (!existsSync29(p))
|
|
15012
15012
|
return null;
|
|
15013
15013
|
try {
|
|
15014
|
-
const s =
|
|
15014
|
+
const s = statSync20(p);
|
|
15015
15015
|
if (!s.isFile())
|
|
15016
15016
|
return null;
|
|
15017
15017
|
if (s.size > 1024 * 1024) {
|
|
@@ -16797,7 +16797,7 @@ import {
|
|
|
16797
16797
|
readFileSync as readFileSync49,
|
|
16798
16798
|
readdirSync as readdirSync23,
|
|
16799
16799
|
renameSync as renameSync12,
|
|
16800
|
-
statSync as
|
|
16800
|
+
statSync as statSync21,
|
|
16801
16801
|
unlinkSync as unlinkSync6,
|
|
16802
16802
|
writeFileSync as writeFileSync22
|
|
16803
16803
|
} from "fs";
|
|
@@ -16965,7 +16965,7 @@ __export(exports_repo_profile, {
|
|
|
16965
16965
|
import { createHash as createHash14 } from "crypto";
|
|
16966
16966
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
16967
16967
|
import { existsSync as existsSync35, lstatSync as lstatSync12, readFileSync as readFileSync50, mkdirSync as mkdirSync22, readdirSync as readdirSync24, realpathSync as realpathSync16, renameSync as renameSync13, rmSync as rmSync11, writeFileSync as writeFileSync23 } from "fs";
|
|
16968
|
-
import { basename as
|
|
16968
|
+
import { basename as basename15, dirname as dirname19, join as join57, relative as relative3, resolve as resolve16, isAbsolute as isAbsolute2 } from "path";
|
|
16969
16969
|
function num5(env, name, fallback) {
|
|
16970
16970
|
const raw2 = env[name];
|
|
16971
16971
|
if (raw2 === undefined || raw2 === "")
|
|
@@ -16979,15 +16979,15 @@ function profileEnabled(env = process.env) {
|
|
|
16979
16979
|
function redactEvidence(path, repoRoot) {
|
|
16980
16980
|
if (!isAbsolute2(path))
|
|
16981
16981
|
return path;
|
|
16982
|
-
const root =
|
|
16983
|
-
const abs =
|
|
16982
|
+
const root = resolve16(repoRoot);
|
|
16983
|
+
const abs = resolve16(path);
|
|
16984
16984
|
if (abs.startsWith(root + "/"))
|
|
16985
16985
|
return abs.slice(root.length + 1);
|
|
16986
|
-
return
|
|
16986
|
+
return basename15(abs);
|
|
16987
16987
|
}
|
|
16988
16988
|
function extractFacts(repoRoot) {
|
|
16989
16989
|
const facts = [];
|
|
16990
|
-
const pkgPath =
|
|
16990
|
+
const pkgPath = resolve16(repoRoot, "package.json");
|
|
16991
16991
|
if (existsSync35(pkgPath)) {
|
|
16992
16992
|
try {
|
|
16993
16993
|
const pkg = JSON.parse(readFileSync50(pkgPath, "utf8"));
|
|
@@ -17007,31 +17007,31 @@ function extractFacts(repoRoot) {
|
|
|
17007
17007
|
["go.mod", "language", "go"],
|
|
17008
17008
|
["Makefile", "build.system", "make"]
|
|
17009
17009
|
]) {
|
|
17010
|
-
if (existsSync35(
|
|
17010
|
+
if (existsSync35(resolve16(repoRoot, rel))) {
|
|
17011
17011
|
facts.push({ key, value, evidence: rel });
|
|
17012
17012
|
}
|
|
17013
17013
|
}
|
|
17014
17014
|
return facts;
|
|
17015
17015
|
}
|
|
17016
17016
|
function profilePath(lokiDirOverride) {
|
|
17017
|
-
return
|
|
17017
|
+
return resolve16(lokiDirOverride ?? lokiDir(), "profile", "repo-profile.json");
|
|
17018
17018
|
}
|
|
17019
17019
|
function buildProfile(opts, cacheKey = null) {
|
|
17020
|
-
const root =
|
|
17020
|
+
const root = resolve16(opts.repoRoot);
|
|
17021
17021
|
const facts = extractFacts(root).map((f) => ({
|
|
17022
17022
|
...f,
|
|
17023
17023
|
evidence: redactEvidence(f.evidence, root)
|
|
17024
17024
|
}));
|
|
17025
17025
|
const profile = {
|
|
17026
17026
|
schema_version: PROFILE_SCHEMA_VERSION,
|
|
17027
|
-
namespace:
|
|
17027
|
+
namespace: basename15(root),
|
|
17028
17028
|
content_hash: manifestHash(root),
|
|
17029
17029
|
generated_at: (opts.now ?? new Date).toISOString().replace(/\.\d{3}Z$/, "Z"),
|
|
17030
17030
|
...cacheKey !== null ? { cache_key: cacheKey } : {},
|
|
17031
17031
|
facts
|
|
17032
17032
|
};
|
|
17033
17033
|
const target = profilePath(opts.lokiDirOverride);
|
|
17034
|
-
mkdirSync22(
|
|
17034
|
+
mkdirSync22(resolve16(target, ".."), { recursive: true });
|
|
17035
17035
|
atomicWriteFileSync(target, JSON.stringify(profile, null, 2) + `
|
|
17036
17036
|
`);
|
|
17037
17037
|
return profile;
|
|
@@ -17048,7 +17048,7 @@ function repoCacheKey(root) {
|
|
|
17048
17048
|
}
|
|
17049
17049
|
}
|
|
17050
17050
|
function buildProfileCached(opts) {
|
|
17051
|
-
const key = repoCacheKey(
|
|
17051
|
+
const key = repoCacheKey(resolve16(opts.repoRoot));
|
|
17052
17052
|
if (key !== null) {
|
|
17053
17053
|
const r = readProfile(opts);
|
|
17054
17054
|
if (r.status === "fresh" && r.profile && r.profile.cache_key === key)
|
|
@@ -17058,7 +17058,7 @@ function buildProfileCached(opts) {
|
|
|
17058
17058
|
}
|
|
17059
17059
|
function readProfile(opts) {
|
|
17060
17060
|
const env = opts.env ?? process.env;
|
|
17061
|
-
const root =
|
|
17061
|
+
const root = resolve16(opts.repoRoot);
|
|
17062
17062
|
const target = profilePath(opts.lokiDirOverride);
|
|
17063
17063
|
if (!existsSync35(target))
|
|
17064
17064
|
return { status: "absent", profile: null };
|
|
@@ -17235,7 +17235,7 @@ function manifestModel(repoDir) {
|
|
|
17235
17235
|
}
|
|
17236
17236
|
})();
|
|
17237
17237
|
const wsPats = [...pkgWorkspaces(repoDir), ...pnpmWorkspaces(repoDir)];
|
|
17238
|
-
const manifestDirs = [...new Set(tracked.filter((p) => PKG_MANIFESTS.includes(
|
|
17238
|
+
const manifestDirs = [...new Set(tracked.filter((p) => PKG_MANIFESTS.includes(basename15(p))).map((p) => dirname19(p)))];
|
|
17239
17239
|
const trackedDirs = new Set;
|
|
17240
17240
|
for (const p of tracked)
|
|
17241
17241
|
for (let d = dirname19(p);d !== "." && !trackedDirs.has(d); d = dirname19(d))
|
|
@@ -17271,7 +17271,7 @@ function manifestModel(repoDir) {
|
|
|
17271
17271
|
const boot = uiDep && typeof scripts["dev"] === "string" ? { cmd: `${pm} run dev`, cwd: d, cite: [at(d, "package.json")] } : uiDep && typeof scripts["start"] === "string" ? { cmd: `${pm} start`, cwd: d, cite: [at(d, "package.json")] } : null;
|
|
17272
17272
|
const js = d === "." || isMember ? pj ? { dependsOn: [...new Set(deps.map((x) => nameToRoot.get(x)).filter((r) => r !== undefined && r !== d))] } : {} : {};
|
|
17273
17273
|
return {
|
|
17274
|
-
name: typeof pj?.["name"] === "string" && pj["name"] ? pj["name"] : d === "." ?
|
|
17274
|
+
name: typeof pj?.["name"] === "string" && pj["name"] ? pj["name"] : d === "." ? basename15(resolve16(repoDir)) : d,
|
|
17275
17275
|
root: d,
|
|
17276
17276
|
runner: null,
|
|
17277
17277
|
cite: own.length ? own : [cmds[0] ? at(d, cmds[0].source) : at(d, "package.json")],
|
|
@@ -17548,11 +17548,13 @@ function attribute(repoDir, baseSha, failing) {
|
|
|
17548
17548
|
const p = loadProfile(repoDir), none = { preExistingChecks: [], preExistingIds: [], introducedChecks: failing.map((f) => f.name), line: null };
|
|
17549
17549
|
if (!p || p.revision !== baseSha || failing.length === 0)
|
|
17550
17550
|
return none;
|
|
17551
|
-
const root = p.baseline.attributable ? p.baseline.failing_ids : [], own = (name) =>
|
|
17552
|
-
|
|
17553
|
-
|
|
17551
|
+
const rec = (name) => name ? p.suites?.find((x) => x.name === name && x.ran && x.attributable) : undefined, root = p.baseline.attributable ? p.baseline.failing_ids : [], own = (name) => rec(name)?.failing_ids ?? root;
|
|
17552
|
+
const sameWay = (f) => {
|
|
17553
|
+
const be = rec(f.suite)?.failing_errors;
|
|
17554
|
+
return !!be && !!f.errors && sameErrors(f.errors instanceof Map ? f.errors : new Map(Object.entries(f.errors)), be, comparableIds(f.ids ?? []));
|
|
17554
17555
|
};
|
|
17555
|
-
const
|
|
17556
|
+
const absent = (f) => f.rerun === undefined && !!f.suite && (baseRedByIdOn() || !baseRedSuiteOff() && sameWay(f));
|
|
17557
|
+
const rows = failing.map((f) => ({ ...f, base: new Set(own(f.rerun === "same" || absent(f) ? f.suite : undefined)) })), known = new Set(rows.flatMap((r) => [...r.base]));
|
|
17556
17558
|
if (known.size === 0)
|
|
17557
17559
|
return none;
|
|
17558
17560
|
return split(rows, known.size);
|
|
@@ -17702,28 +17704,27 @@ function touchedRedOnBase(repoDir, baseSha, c, editedTitles) {
|
|
|
17702
17704
|
return false;
|
|
17703
17705
|
return redOnBaseProfile(p, ids, c.errors);
|
|
17704
17706
|
}
|
|
17705
|
-
function redOnBaseProfile(p, ids, errors2) {
|
|
17707
|
+
function redOnBaseProfile(p, ids, errors2, textOnly = false) {
|
|
17706
17708
|
const runs2 = [p.baseline, ...p.suites ?? []].filter((b) => b.ran && b.attributable && !b.timed_out && b.reason !== "baseline budget used up");
|
|
17707
17709
|
const baseIds = new Set(runs2.flatMap((b) => b.failing_ids)), baseErr = new Map;
|
|
17708
17710
|
for (const b of runs2)
|
|
17709
17711
|
for (const [k, v] of Object.entries(b.failing_errors ?? {}))
|
|
17710
17712
|
if (!baseErr.has(k))
|
|
17711
17713
|
baseErr.set(k, v);
|
|
17712
|
-
return ids.length > 0 && ids.every((i) => baseIds.has(i) || [...baseIds].some((b) => b.endsWith(` > ${i}`))) && (baseRedByIdOn() || sameErrors(errors2, baseErr, [...ids]));
|
|
17714
|
+
return ids.length > 0 && ids.every((i) => baseIds.has(i) || [...baseIds].some((b) => b.endsWith(` > ${i}`))) && (!textOnly && baseRedByIdOn() || sameErrors(errors2, baseErr, [...ids]));
|
|
17713
17715
|
}
|
|
17714
17716
|
function collateralOnBaseline(repoDir, baseSha, test, c, changed, stem) {
|
|
17715
17717
|
if (!collateralBaselineOn() || changed.includes(test))
|
|
17716
17718
|
return false;
|
|
17717
17719
|
const td = test.includes("/") ? test.slice(0, test.lastIndexOf("/")) : ".", sd = /(?:^|\/)(?:__tests__|tests|test)$/.test(td) ? td.includes("/") ? td.slice(0, td.lastIndexOf("/")) : "." : td;
|
|
17718
|
-
|
|
17720
|
+
const paired = changed.some((f) => {
|
|
17719
17721
|
const fd = f.includes("/") ? f.slice(0, f.lastIndexOf("/")) : ".";
|
|
17720
17722
|
return (fd === sd || fd === td) && f.slice(f.lastIndexOf("/") + 1).replace(/\.[^.]+$/, "") === stem;
|
|
17721
|
-
})
|
|
17722
|
-
return false;
|
|
17723
|
+
});
|
|
17723
17724
|
const p = loadProfile(repoDir);
|
|
17724
17725
|
if (!p || p.revision !== baseSha || !c.errors)
|
|
17725
17726
|
return false;
|
|
17726
|
-
return redOnBaseProfile(p, comparableIds(c.ids ?? []), c.errors);
|
|
17727
|
+
return redOnBaseProfile(p, comparableIds(c.ids ?? []), c.errors, paired);
|
|
17727
17728
|
}
|
|
17728
17729
|
function whyFullSuiteNotExcused(repoDir, baseSha, full, changed, excused, blocked = [], shownIds = new Set) {
|
|
17729
17730
|
const p = loadProfile(repoDir), out2 = [];
|
|
@@ -17960,7 +17961,7 @@ ${r.stderr ?? ""}`), missing: r.status === 127 };
|
|
|
17960
17961
|
} catch {
|
|
17961
17962
|
return "";
|
|
17962
17963
|
}
|
|
17963
|
-
}, SAME_RED_NOTE = "excused as red on base in the identical kind (same command, same exit code, the same unparseable output shape; no failing id could be compared)", baseRedByIdOn = (env = process.env) =>
|
|
17964
|
+
}, SAME_RED_NOTE = "excused as red on base in the identical kind (same command, same exit code, the same unparseable output shape; no failing id could be compared)", baseRedByIdOn = (env = process.env) => /^(1|on|true|yes)$/i.test((env["LOKI_E10_BASE_RED_BY_ID"] ?? "").trim()), baseRedSuiteOff = (env = process.env) => /^(0|off|false|no)$/i.test((env["LOKI_E10_BASE_RED_BY_ID"] ?? "").trim()), touchedBaseRedOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_TOUCHED_BASE_RED"] ?? "").trim()), collateralBaselineOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_COLLATERAL_BASELINE"] ?? "").trim()), TOUCHED_RED = "edited test file red on base by every failing id with the same errors; the cases the change added or edited pass (excused, not blocking)", STATIC_DIAG, STATIC_NOISE, STATIC_SUMMARY, readinessLines = (r) => [` Readiness: ${r.score}/100 (${r.grade})`, ...r.findings.length ? [" Fix:", ...r.findings.map((f) => ` - ${f.fix}`)] : []];
|
|
17964
17965
|
var init_repo_profile = __esm(() => {
|
|
17965
17966
|
init_failures();
|
|
17966
17967
|
init_check_result();
|
|
@@ -18034,7 +18035,7 @@ var init_runner_errors = __esm(() => {
|
|
|
18034
18035
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
18035
18036
|
import { mkdtempSync as mkdtempSync6, realpathSync as realpathSync17, rmSync as rmSync12 } from "fs";
|
|
18036
18037
|
import { tmpdir as tmpdir9 } from "os";
|
|
18037
|
-
import { basename as
|
|
18038
|
+
import { basename as basename16, extname as extname2, join as join58 } from "path";
|
|
18038
18039
|
function changedFilesNamed(out2, repoDir, changed) {
|
|
18039
18040
|
return changed.filter((f) => {
|
|
18040
18041
|
if (out2.includes(f) || out2.includes(join58(repoDir, f)))
|
|
@@ -18044,7 +18045,7 @@ function changedFilesNamed(out2, repoDir, changed) {
|
|
|
18044
18045
|
return true;
|
|
18045
18046
|
if (extname2(f) === ".go" && segs.length > 1 && suffixes(segs.slice(0, -1), 1).some((d) => new RegExp(`(?<=[\\w-])/${escapeRegex(d)}(?![\\w./-])`).test(out2)))
|
|
18046
18047
|
return true;
|
|
18047
|
-
const stem =
|
|
18048
|
+
const stem = basename16(f, extname2(f));
|
|
18048
18049
|
if (stem.length < 2 || stem === "index" || stem === "__init__")
|
|
18049
18050
|
return false;
|
|
18050
18051
|
return new RegExp(`(?<![\\w-])${escapeRegex(stem)}(?![\\w-])`).test(out2);
|
|
@@ -18493,12 +18494,12 @@ async function groupGone(pid) {
|
|
|
18493
18494
|
await new Promise((r) => setTimeout(r, 50));
|
|
18494
18495
|
}
|
|
18495
18496
|
function runDetached(cmd, cwd, env, signal, timeoutMs) {
|
|
18496
|
-
return new Promise((
|
|
18497
|
+
return new Promise((resolve17) => {
|
|
18497
18498
|
let child;
|
|
18498
18499
|
try {
|
|
18499
18500
|
child = spawn8("bash", ["-c", cmd], { cwd, env, detached: true, stdio: ["ignore", "pipe", "pipe"] });
|
|
18500
18501
|
} catch (e) {
|
|
18501
|
-
|
|
18502
|
+
resolve17({ code: null, cut: null, err: String(e), tail: "" });
|
|
18502
18503
|
return;
|
|
18503
18504
|
}
|
|
18504
18505
|
const pid = child.pid;
|
|
@@ -18525,7 +18526,7 @@ function runDetached(cmd, cwd, env, signal, timeoutMs) {
|
|
|
18525
18526
|
await groupGone(pid);
|
|
18526
18527
|
child.stdout?.destroy();
|
|
18527
18528
|
child.stderr?.destroy();
|
|
18528
|
-
|
|
18529
|
+
resolve17({ ...r, tail: tail2 });
|
|
18529
18530
|
};
|
|
18530
18531
|
const onAbort = () => {
|
|
18531
18532
|
cut = "abort";
|
|
@@ -18874,7 +18875,7 @@ var init_install = __esm(() => {
|
|
|
18874
18875
|
|
|
18875
18876
|
// ../../loki-ts/src/e10ext/commit_filter.ts
|
|
18876
18877
|
import { existsSync as existsSync38, lstatSync as lstatSync14, mkdirSync as mkdirSync23, readFileSync as readFileSync53, rmSync as rmSync13, writeFileSync as writeFileSync24 } from "fs";
|
|
18877
|
-
import { basename as
|
|
18878
|
+
import { basename as basename17, dirname as dirname21, join as join61 } from "path";
|
|
18878
18879
|
function dropSet(repoDir, staged, preexistingDirty, env = process.env, installCreated, untrackedBlobs, baseSha, task) {
|
|
18879
18880
|
const owned = installOwned(repoDir, installCreated, env), made = installCreated?.files ?? {}, tc = toolchainOutputs(repoDir, staged.filter(({ st }) => st === "A").map(({ f }) => f), baseSha);
|
|
18880
18881
|
const art = buildArtifactDropEnabled(env) ? buildArtifacts(repoDir, staged.filter(({ st }) => st === "A").map(({ f }) => f), baseSha, task) : new Set;
|
|
@@ -18898,7 +18899,7 @@ function buildArtifacts(repoDir, added, baseSha, task = "") {
|
|
|
18898
18899
|
const out2 = new Set;
|
|
18899
18900
|
if (added.length === 0)
|
|
18900
18901
|
return out2;
|
|
18901
|
-
const named = (f) => task.includes(f) || new RegExp(`(?<![\\w./-])${escapeRegex(
|
|
18902
|
+
const named = (f) => task.includes(f) || new RegExp(`(?<![\\w./-])${escapeRegex(basename17(f))}(?![\\w-])`).test(task);
|
|
18902
18903
|
let ignored = new Set;
|
|
18903
18904
|
try {
|
|
18904
18905
|
const r = safeGitSpawn(repoDir, ["check-ignore", "--no-index", "--stdin", "-z"], { input: added.join("\x00") + "\x00", encoding: "utf8", timeout: 20000 });
|
|
@@ -18931,7 +18932,7 @@ function buildArtifacts(repoDir, added, baseSha, task = "") {
|
|
|
18931
18932
|
return out2;
|
|
18932
18933
|
}
|
|
18933
18934
|
function runOutputs(repoDir, added, baseSha, task = "") {
|
|
18934
|
-
const out2 = new Set, named = (f) => task.includes(f) || new RegExp(`(?<![\\w./-])${escapeRegex(
|
|
18935
|
+
const out2 = new Set, named = (f) => task.includes(f) || new RegExp(`(?<![\\w./-])${escapeRegex(basename17(f))}(?![\\w-])`).test(task);
|
|
18935
18936
|
const tracked = new Map, dirTracked = (d) => {
|
|
18936
18937
|
if (!tracked.has(d)) {
|
|
18937
18938
|
try {
|
|
@@ -19053,7 +19054,7 @@ function needDrops(staged, task, read2, scopeOutside, env = process.env) {
|
|
|
19053
19054
|
const asksFormat = /\b(?:format(?:ting|ter)?|re-?format|prettier|black|ruff format|gofmt|rustfmt|whitespace|indent(?:ation)?)\b/i.test(task), asksLint = /\b(?:lint(?:er|ing)?|noqa|eslint|suppress(?:ion)?|warnings?|type:\s*ignore|ts-ignore)\b/i.test(task);
|
|
19054
19055
|
const out2 = [];
|
|
19055
19056
|
for (const { st, f } of staged) {
|
|
19056
|
-
if (st !== "M" || f.startsWith(".loki/") || task.includes(f) || task.includes(
|
|
19057
|
+
if (st !== "M" || f.startsWith(".loki/") || task.includes(f) || task.includes(basename17(f)))
|
|
19057
19058
|
continue;
|
|
19058
19059
|
const { base, head } = read2(f);
|
|
19059
19060
|
if (base === null || head === null)
|
|
@@ -19147,13 +19148,13 @@ function commitUnsealedWork(intact, repoDir, workerEnv, runId, intake) {
|
|
|
19147
19148
|
var WALL_FILE, parseStaged = (out2) => out2.split("\x00").reduce((a, t, i, all) => i % 2 === 0 && t ? [...a, { st: t, f: all[i + 1] }] : a, []), MANIFEST, manifestChanged = (staged, lock) => {
|
|
19148
19149
|
const d = dirname21(lock);
|
|
19149
19150
|
return staged.some(({ f: m }) => MANIFEST.test(m) && (d === "." || dirname21(m) === d || dirname21(m).startsWith(`${d}/`)));
|
|
19150
|
-
}, taskWantsLockChange = (task, lock) => !!task && (task.includes(lock) || task.includes(
|
|
19151
|
+
}, taskWantsLockChange = (task, lock) => !!task && (task.includes(lock) || task.includes(basename17(lock)) || /\bCVE-\d{4}-\d+/i.test(task) || /\b(?:update|upgrade|bump)\b[^.\n]{0,60}\b(?:dependenc\w*|packages?|lockfile|lock file|version)\b/i.test(task) || /\b(?:refresh|regenerate|re-generate|sync|rebuild)\b[^.\n]{0,40}\b(?:lockfile|lock file|lock-file)\b/i.test(task) || /\b(?:bump|upgrade)\s+[@\w./-]+\s+(?:to|from)\s+v?\d/i.test(task) || /\bpin\s+[@\w./-]+\s+(?:to|at)\s+v?\d/i.test(task) || /\b(?:lock-?file|lock file)\s+(?:merge\s+)?conflicts?\b/i.test(task) || /\bconflicts?\b[^.\n]{0,20}\b(?:in|on|of)\s+(?:the\s+)?(?:lock-?file|lock file)(?![\w-])/i.test(task) || /\bre-?install\b[^.\n]{0,30}\b(?:fix|repair)\b[^.\n]{0,30}\b(?:lock-?file|lock file)(?![\w-])/i.test(task) || /\b(?:fix|repair)\s+(?:the\s+|our\s+)?(?:lock-?file|lock file)(?![\w-])/i.test(task)), buildArtifactDropEnabled = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_BUILD_ARTIFACT_DROP"] ?? "").trim()), BYTECODE, CACHE_DIR, OUT_DIR, PKG_MANIFEST, runOutputDropEnabled = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_RUN_OUTPUT_DROP"] ?? "").trim()), RUN_DIR, RUN_FILE, regenDropOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_REGEN_DROP"] ?? "").trim()), REGEN_FILE = "regenerated.json", regeneratedPaths = (runDir) => {
|
|
19151
19152
|
try {
|
|
19152
19153
|
return JSON.parse(readFileSync53(join61(runDir, REGEN_FILE), "utf8")).paths ?? [];
|
|
19153
19154
|
} catch {
|
|
19154
19155
|
return [];
|
|
19155
19156
|
}
|
|
19156
|
-
}, taskNamesPath = (task, f) => task.includes(f) || task.includes(
|
|
19157
|
+
}, taskNamesPath = (task, f) => task.includes(f) || task.includes(basename17(f)), regenDropNote = (f) => `rewritten only by Loki's own check run, not by the change, and left out of the commit: ${f}`, regenKeptNote = (f) => `rewritten by Loki's own check run and kept: a targeted test fails without it: ${f}`, diffNeedOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_DIFF_NEED"] ?? "").trim()), WS_SIGNIFICANT, SUPPRESS, suppressionOnly = (base, head) => base !== head && base.replace(SUPPRESS, "").replace(/[ \t]+$/gm, "").replace(/\n{2,}/g, `
|
|
19157
19158
|
`) === head.replace(SUPPRESS, "").replace(/[ \t]+$/gm, "").replace(/\n{2,}/g, `
|
|
19158
19159
|
`), needDropNote = (d) => `${d.why} left out of the delivered diff: ${d.f}`, buildArtifactNotes = (repoDir, droppedAdded, baseSha, task) => {
|
|
19159
19160
|
const s = new Set([...buildArtifactDropEnabled() ? buildArtifacts(repoDir, droppedAdded, baseSha, task) : [], ...runOutputDropEnabled() ? runOutputs(repoDir, droppedAdded, baseSha, task) : []]);
|
|
@@ -19180,11 +19181,11 @@ var init_commit_filter = __esm(() => {
|
|
|
19180
19181
|
});
|
|
19181
19182
|
|
|
19182
19183
|
// ../../loki-ts/src/util/config_paths.ts
|
|
19183
|
-
import { basename as
|
|
19184
|
+
import { basename as basename18 } from "path";
|
|
19184
19185
|
function taskNamesFenced(task, rel) {
|
|
19185
19186
|
if (!task)
|
|
19186
19187
|
return false;
|
|
19187
|
-
const t = task.toLowerCase(), bn =
|
|
19188
|
+
const t = task.toLowerCase(), bn = basename18(rel).toLowerCase(), stem = bn.replace(/\.[^.]*$/, "").replace(/^\./, "");
|
|
19188
19189
|
if (LOCKFILE_RE.test(rel))
|
|
19189
19190
|
return taskWantsLockChange(task, rel) || DEP_TASK.test(task);
|
|
19190
19191
|
if (CONCEPTS.some(([c, w]) => c.test(rel) && w.test(task)))
|
|
@@ -19208,8 +19209,8 @@ var init_config_paths = __esm(() => {
|
|
|
19208
19209
|
});
|
|
19209
19210
|
|
|
19210
19211
|
// ../../loki-ts/src/util/config_fence.ts
|
|
19211
|
-
import { appendFileSync as appendFileSync5, existsSync as existsSync39, mkdirSync as mkdirSync24, readdirSync as readdirSync26, readFileSync as readFileSync54, rmSync as rmSync14, statSync as
|
|
19212
|
-
import { dirname as dirname22, isAbsolute as isAbsolute5, join as join62, relative as relative6, resolve as
|
|
19212
|
+
import { appendFileSync as appendFileSync5, existsSync as existsSync39, mkdirSync as mkdirSync24, readdirSync as readdirSync26, readFileSync as readFileSync54, rmSync as rmSync14, statSync as statSync22, writeFileSync as writeFileSync25 } from "fs";
|
|
19213
|
+
import { dirname as dirname22, isAbsolute as isAbsolute5, join as join62, relative as relative6, resolve as resolve17 } from "path";
|
|
19213
19214
|
function fenceTask(env = process.env, runDir) {
|
|
19214
19215
|
if (env["LOKI_E10_TASK_TEXT"])
|
|
19215
19216
|
return env["LOKI_E10_TASK_TEXT"].slice(0, FENCE_TASK_MAX);
|
|
@@ -19236,8 +19237,8 @@ function harnessOutputs(cwd, env = process.env) {
|
|
|
19236
19237
|
}
|
|
19237
19238
|
if (!Array.isArray(a))
|
|
19238
19239
|
return [];
|
|
19239
|
-
const root =
|
|
19240
|
-
return [...new Set(a.filter((p) => typeof p === "string" && isAbsolute5(p)).map((p) =>
|
|
19240
|
+
const root = resolve17(cwd, ".loki");
|
|
19241
|
+
return [...new Set(a.filter((p) => typeof p === "string" && isAbsolute5(p)).map((p) => resolve17(p)).filter((p) => {
|
|
19241
19242
|
const r = relative6(root, p);
|
|
19242
19243
|
return r !== "" && !r.startsWith("..") && !isAbsolute5(r) && !RUN_RECORD.test(r);
|
|
19243
19244
|
}))];
|
|
@@ -19245,14 +19246,14 @@ function harnessOutputs(cwd, env = process.env) {
|
|
|
19245
19246
|
function fenceDenied(tool, file, cwd, allow, state = false, onNewTestFile, outputs = []) {
|
|
19246
19247
|
if (!/^(Edit|Write|MultiEdit)$/.test(tool) || typeof file !== "string" || !file)
|
|
19247
19248
|
return null;
|
|
19248
|
-
const abs =
|
|
19249
|
+
const abs = resolve17(cwd, file), rel = relative6(resolve17(cwd), abs);
|
|
19249
19250
|
if (state && /^\.loki(\/|$)/.test(rel) && outputs.includes(abs))
|
|
19250
19251
|
return null;
|
|
19251
19252
|
if (state && /^\.loki(\/|$)/.test(rel))
|
|
19252
19253
|
return { rel, reason: `LOKI_RUN_STATE: ${rel} is the harness's own run state (the receipt and checkpoints are built from it), so the edit was denied. Nothing in the task needs it.` };
|
|
19253
19254
|
if (rel === "" || rel.startsWith("..") || isAbsolute5(rel) || !isFencedPath(rel) || allow(rel))
|
|
19254
19255
|
return null;
|
|
19255
|
-
if (TEST_DIR.test(rel) && !existsSync39(
|
|
19256
|
+
if (TEST_DIR.test(rel) && !existsSync39(resolve17(cwd, rel))) {
|
|
19256
19257
|
onNewTestFile?.(rel);
|
|
19257
19258
|
return null;
|
|
19258
19259
|
}
|
|
@@ -19376,7 +19377,7 @@ function fenceNotes(r, provenPass = false) {
|
|
|
19376
19377
|
};
|
|
19377
19378
|
}
|
|
19378
19379
|
function stateDenyRules(cwd, outputs = []) {
|
|
19379
|
-
const root =
|
|
19380
|
+
const root = resolve17(cwd, ".loki");
|
|
19380
19381
|
if (outputs.length === 0)
|
|
19381
19382
|
return [`Edit(/${root}/**)`];
|
|
19382
19383
|
const keep = new Set(outputs), chain = new Set([root]), rules = new Set;
|
|
@@ -19412,7 +19413,7 @@ function fencedDenyRules(cwd, env = process.env) {
|
|
|
19412
19413
|
} catch {}
|
|
19413
19414
|
const allow = allowFor(env["LOKI_E10_FENCE_TASK"] ?? fenceTask(env), allowed);
|
|
19414
19415
|
try {
|
|
19415
|
-
return scan(cwd).filter((rel) => isFencedPath(rel) && !allow(rel)).map((rel) => `Edit(/${
|
|
19416
|
+
return scan(cwd).filter((rel) => isFencedPath(rel) && !allow(rel)).map((rel) => `Edit(/${resolve17(cwd, rel)})`);
|
|
19416
19417
|
} catch {
|
|
19417
19418
|
return [];
|
|
19418
19419
|
}
|
|
@@ -19423,7 +19424,7 @@ var MAX_BYTES2, LIST_BUFFER, LIST_TIMEOUT_MS = 60000, FENCE_TASK_MAX = 8000, FEN
|
|
|
19423
19424
|
return (rel) => a.has(rel) || taskNamesFenced(task, rel);
|
|
19424
19425
|
}, HARNESS_OUTPUTS_ENV = "LOKI_E10_WRITE_OUTPUTS", RUN_RECORD, scan = (cwd) => safeGit(cwd, ["ls-files", "-z", "-c", "-o", "--exclude-standard"], { maxBuffer: LIST_BUFFER, timeout: LIST_TIMEOUT_MS }).split("\x00").filter((f) => f && !/(^|\/)node_modules\//.test(f)), readSmall = (p) => {
|
|
19425
19426
|
try {
|
|
19426
|
-
return
|
|
19427
|
+
return statSync22(p).size <= MAX_BYTES2 ? readFileSync54(p) : null;
|
|
19427
19428
|
} catch {
|
|
19428
19429
|
return null;
|
|
19429
19430
|
}
|
|
@@ -19471,7 +19472,7 @@ var init_config_fence = __esm(() => {
|
|
|
19471
19472
|
|
|
19472
19473
|
// ../../loki-ts/src/runner/host_guard.ts
|
|
19473
19474
|
import { appendFileSync as appendFileSync6, mkdirSync as mkdirSync25, realpathSync as realpathSync19 } from "fs";
|
|
19474
|
-
import { isAbsolute as isAbsolute6, join as join63, resolve as
|
|
19475
|
+
import { isAbsolute as isAbsolute6, join as join63, resolve as resolve18, sep as sep11 } from "path";
|
|
19475
19476
|
function hookTimeoutSeconds(env = process.env) {
|
|
19476
19477
|
const raw2 = env["LOKI_HOOK_TIMEOUT"] ?? "";
|
|
19477
19478
|
return /^[1-9][0-9]{0,4}$/.test(raw2) ? Number(raw2) : HOOK_TIMEOUT_DEFAULT_S;
|
|
@@ -19662,7 +19663,7 @@ var init_host_guard = __esm(() => {
|
|
|
19662
19663
|
init_worker_proc();
|
|
19663
19664
|
init_claude_flags();
|
|
19664
19665
|
init_config_fence();
|
|
19665
|
-
HOST_GUARD_SCRIPT =
|
|
19666
|
+
HOST_GUARD_SCRIPT = resolve18(REPO_ROOT, "autonomy", "hooks", "validate-bash.sh");
|
|
19666
19667
|
ALLOW = { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "allow" } };
|
|
19667
19668
|
PY_BLANK = new RegExp(`^${PY_SPACE}*$`);
|
|
19668
19669
|
CONTINUATION = /(?<!\\)((?:\\\\)*)\\\r?\n/g;
|
|
@@ -19774,7 +19775,7 @@ var init_scope = __esm(() => {
|
|
|
19774
19775
|
});
|
|
19775
19776
|
|
|
19776
19777
|
// ../../loki-ts/src/util/python.ts
|
|
19777
|
-
import { accessSync as accessSync2, constants, existsSync as existsSync40, mkdtempSync as mkdtempSync7, readFileSync as readFileSync55, realpathSync as realpathSync20, rmSync as rmSync15, statSync as
|
|
19778
|
+
import { accessSync as accessSync2, constants, existsSync as existsSync40, mkdtempSync as mkdtempSync7, readFileSync as readFileSync55, realpathSync as realpathSync20, rmSync as rmSync15, statSync as statSync23 } from "fs";
|
|
19778
19779
|
import { isAbsolute as isAbsolute7, join as join64, relative as relative7 } from "path";
|
|
19779
19780
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
19780
19781
|
import { tmpdir as tmpdir10 } from "os";
|
|
@@ -19813,7 +19814,7 @@ function resolvePython3() {
|
|
|
19813
19814
|
const cand = `${dir}/python3`;
|
|
19814
19815
|
try {
|
|
19815
19816
|
accessSync2(cand, constants.X_OK);
|
|
19816
|
-
if (
|
|
19817
|
+
if (statSync23(cand).isFile())
|
|
19817
19818
|
return cand;
|
|
19818
19819
|
} catch {}
|
|
19819
19820
|
}
|
|
@@ -20214,7 +20215,7 @@ __export(exports_testmap, {
|
|
|
20214
20215
|
});
|
|
20215
20216
|
import { existsSync as existsSync41, lstatSync as lstatSync15, readdirSync as readdirSync27, readFileSync as readFileSync56 } from "fs";
|
|
20216
20217
|
import { spawnSync as spawnSync8 } from "child_process";
|
|
20217
|
-
import { basename as
|
|
20218
|
+
import { basename as basename19, dirname as dirname23, extname as extname3, join as join65, sep as sep12 } from "path";
|
|
20218
20219
|
function untestableReason(runners, files, env = process.env, root) {
|
|
20219
20220
|
if (root && repoTestCommand(root) || harnessRunners(runners, files, env, root).length > 0)
|
|
20220
20221
|
return null;
|
|
@@ -20244,7 +20245,7 @@ function buildTestMap(root) {
|
|
|
20244
20245
|
const api = loadProjectApi(root);
|
|
20245
20246
|
let pyCfg = false;
|
|
20246
20247
|
for (const rel of files) {
|
|
20247
|
-
const name =
|
|
20248
|
+
const name = basename19(rel);
|
|
20248
20249
|
const full = join65(root, rel);
|
|
20249
20250
|
if (JS_TEST_RE.test(name)) {
|
|
20250
20251
|
const text3 = readText(full);
|
|
@@ -20297,7 +20298,7 @@ function buildTestMap(root) {
|
|
|
20297
20298
|
const tests = [];
|
|
20298
20299
|
const testPackages = Object.create(null);
|
|
20299
20300
|
for (const rel of files) {
|
|
20300
|
-
const name =
|
|
20301
|
+
const name = basename19(rel), pkgRoot = ownerRoot(rel);
|
|
20301
20302
|
const scope = packageRunners.get(pkgRoot) ?? packageRunners.get(".") ?? [];
|
|
20302
20303
|
let jr;
|
|
20303
20304
|
const jsRunner = JS_TEST_RE.test(name) ? importedRunners(jsText.get(rel) ?? "")[0] ?? ["vitest", "jest", "bun", "node"].find((r) => scope.includes(r)) : undefined;
|
|
@@ -20319,7 +20320,7 @@ function buildTestMap(root) {
|
|
|
20319
20320
|
}
|
|
20320
20321
|
}
|
|
20321
20322
|
const sourceRefs = Object.create(null);
|
|
20322
|
-
const goMods = files.filter((f) =>
|
|
20323
|
+
const goMods = files.filter((f) => basename19(f) === "go.mod").map((f) => ({ dir: dirname23(f), path: /^module\s+(\S+)/m.exec(readText(join65(root, f)))?.[1] })).filter((m) => !!m.path).sort((a, b) => b.path.length - a.path.length);
|
|
20323
20324
|
const goImportDir = (imp) => {
|
|
20324
20325
|
const m = goMods.find((x) => imp === x.path || imp.startsWith(`${x.path}/`));
|
|
20325
20326
|
if (!m)
|
|
@@ -20371,11 +20372,11 @@ function impactedRefs(map, changedFiles) {
|
|
|
20371
20372
|
add3(self2);
|
|
20372
20373
|
continue;
|
|
20373
20374
|
}
|
|
20374
|
-
const stem =
|
|
20375
|
+
const stem = basename19(rel, extname3(rel));
|
|
20375
20376
|
const stems = [stem];
|
|
20376
20377
|
const entry2 = stem === "index" || stem === "__init__" || stem === "mod" && extname3(rel) === ".rs";
|
|
20377
20378
|
if (entry2 && dirname23(rel) !== ".")
|
|
20378
|
-
stems.push(
|
|
20379
|
+
stems.push(basename19(dirname23(rel)));
|
|
20379
20380
|
for (const s of stems)
|
|
20380
20381
|
for (const p of sourceRefs[s] ?? [])
|
|
20381
20382
|
add3(map.tests.find((t) => t.path === p));
|
|
@@ -20424,7 +20425,7 @@ function avaTargets(root, changed, env = process.env) {
|
|
|
20424
20425
|
if (!existsSync41(join65(root, dir, "package.json")) || !avaDeclared(join65(root, dir)))
|
|
20425
20426
|
continue;
|
|
20426
20427
|
const inPkg = dir === "." ? rel : rel.slice(dir.length + 1), at = (p) => dir === "." ? p : `${dir}/${p}`;
|
|
20427
|
-
const stem =
|
|
20428
|
+
const stem = basename19(inPkg).replace(/\.[^.]+$/, "").replace(/\.(?:test|spec)$/, "");
|
|
20428
20429
|
const cands = AVA_TEST_DIRS.includes(inPkg.split("/")[0]) ? [inPkg] : AVA_TEST_DIRS.flatMap((d) => AVA_EXT.map((e) => `${d}/${stem}${e}`));
|
|
20429
20430
|
for (const c of cands)
|
|
20430
20431
|
if (isFile(join65(root, at(c))) && !out2.includes(at(c)))
|
|
@@ -20517,7 +20518,7 @@ import {
|
|
|
20517
20518
|
unlinkSync as unlinkSync7,
|
|
20518
20519
|
writeFileSync as writeFileSync26
|
|
20519
20520
|
} from "fs";
|
|
20520
|
-
import { dirname as dirname24, isAbsolute as isAbsolute8, join as join66, relative as relative9, resolve as
|
|
20521
|
+
import { dirname as dirname24, isAbsolute as isAbsolute8, join as join66, relative as relative9, resolve as resolve19, sep as sep13 } from "path";
|
|
20521
20522
|
function git2(root, args) {
|
|
20522
20523
|
return safeGit(root, args);
|
|
20523
20524
|
}
|
|
@@ -20551,7 +20552,7 @@ function safeJoin(root, relPath) {
|
|
|
20551
20552
|
const segments = relPath.split("/").filter((s) => s.length > 0);
|
|
20552
20553
|
if (relPath.startsWith("/") || segments.includes("..") || segments.includes(".") || segments.length === 0)
|
|
20553
20554
|
throw new TreeSwapUnsafePathError(`unsafe path ${relPath}`);
|
|
20554
|
-
const rootAbs =
|
|
20555
|
+
const rootAbs = resolve19(root);
|
|
20555
20556
|
let cur = rootAbs;
|
|
20556
20557
|
for (let i = 0;i < segments.length; i++) {
|
|
20557
20558
|
const segment = segments[i];
|
|
@@ -20574,8 +20575,8 @@ function safeJoin(root, relPath) {
|
|
|
20574
20575
|
function assertSymlinkWithinRoot(root, relPath, target) {
|
|
20575
20576
|
if (isAbsolute8(target))
|
|
20576
20577
|
throw new TreeSwapUnsafePathError(`symlink ${relPath} has an absolute target`);
|
|
20577
|
-
const resolvedTarget =
|
|
20578
|
-
const rel = relative9(
|
|
20578
|
+
const resolvedTarget = resolve19(dirname24(join66(resolve19(root), relPath)), target);
|
|
20579
|
+
const rel = relative9(resolve19(root), resolvedTarget);
|
|
20579
20580
|
if (rel === ".." || rel.startsWith(`..${"/"}`) || isAbsolute8(rel)) {
|
|
20580
20581
|
throw new TreeSwapUnsafePathError(`symlink ${relPath} escapes tree root`);
|
|
20581
20582
|
}
|
|
@@ -20690,7 +20691,7 @@ function trackedChanges(root, excludes) {
|
|
|
20690
20691
|
return out2;
|
|
20691
20692
|
}
|
|
20692
20693
|
function gitPath(root, name) {
|
|
20693
|
-
return
|
|
20694
|
+
return resolve19(root, git2(root, ["rev-parse", "--git-path", name]).trim());
|
|
20694
20695
|
}
|
|
20695
20696
|
function swapAttemptIntoWorkingTree(opts) {
|
|
20696
20697
|
const excludes = opts.excludes ?? DEFAULT_EXCLUDES;
|
|
@@ -20812,9 +20813,9 @@ import { execFileSync as execFileSync5 } from "child_process";
|
|
|
20812
20813
|
import { mkdtempSync as mkdtempSync8, readFileSync as readFileSync58, rmSync as rmSync17 } from "fs";
|
|
20813
20814
|
import { tmpdir as tmpdir11 } from "os";
|
|
20814
20815
|
import { join as join67 } from "path";
|
|
20815
|
-
import { basename as
|
|
20816
|
+
import { basename as basename20 } from "path";
|
|
20816
20817
|
function classifyAssertDelta(inp) {
|
|
20817
|
-
const f =
|
|
20818
|
+
const f = basename20(inp.path);
|
|
20818
20819
|
if (!/^(test_.*|.*_test)\.py$/.test(f))
|
|
20819
20820
|
return WEAKENED;
|
|
20820
20821
|
if (inp.headCounts.run !== inp.baseCounts.run || inp.headCounts.skipped !== inp.baseCounts.skipped)
|
|
@@ -21192,6 +21193,37 @@ function excusedEdit(repoDir, baseSha, headSha, rel, base, head, task) {
|
|
|
21192
21193
|
const stem = p.replace(/\.(?:js|mjs|cjs|jsx)$/, "");
|
|
21193
21194
|
return [...new Set([p, ...["ts", "tsx", "js", "mjs", "cjs", "jsx", "mts", "cts"].map((x) => `${stem}.${x}`), ...["ts", "tsx", "js"].map((x) => `${stem}/index.${x}`)])];
|
|
21194
21195
|
};
|
|
21196
|
+
let addedImports = null;
|
|
21197
|
+
const subjectOf = () => {
|
|
21198
|
+
const low = (x) => x.toLowerCase(), up = dir.includes("/") ? dir.slice(0, dir.lastIndexOf("/")) : "", stem = (f) => low(f.slice(f.lastIndexOf("/") + 1)).replace(/\.(?:test|spec)(?=\.[^.]+$)/, "").replace(/\.[^.]+$/, "");
|
|
21199
|
+
const imported = new Set([...base.matchAll(/(?:\bfrom\s*|\brequire\(\s*|\bimport\s*\(?\s*)['"](\.{1,2}\/[^'"]+)['"]/g)].flatMap((m) => candidates2(m[1])).map(low));
|
|
21200
|
+
return (file) => !isTestFile(file) && (imported.has(low(file)) || (dir === "" ? [""] : [dir, up]).map(low).includes(low(file.includes("/") ? file.slice(0, file.lastIndexOf("/")) : "")) && stem(file) === stem(rel));
|
|
21201
|
+
};
|
|
21202
|
+
const newlyImported = (spec) => {
|
|
21203
|
+
if (/^(0|off|false|no)$/i.test((process.env["LOKI_E10_WEAK_MOCK_PKG"] ?? "").trim()) || spec.startsWith(".") || spec.startsWith("/"))
|
|
21204
|
+
return false;
|
|
21205
|
+
if (addedImports === null) {
|
|
21206
|
+
try {
|
|
21207
|
+
let file = "";
|
|
21208
|
+
const keep = [], subject = subjectOf();
|
|
21209
|
+
for (const l of safeGit(repoDir, ["diff", "-U0", "--no-color", baseSha, ...headSha ? [headSha] : []]).split(`
|
|
21210
|
+
`)) {
|
|
21211
|
+
if (l.startsWith("+++ "))
|
|
21212
|
+
file = l.startsWith("+++ b/") && subject(l.slice(6)) ? l.slice(6) : "";
|
|
21213
|
+
else if (l.startsWith("-") && !l.startsWith("---") && file)
|
|
21214
|
+
keep.push(`gone ${l.slice(1)}`);
|
|
21215
|
+
else if (l.startsWith("+") && !l.startsWith("+++") && file)
|
|
21216
|
+
keep.push(`new ${l.slice(1)}`);
|
|
21217
|
+
}
|
|
21218
|
+
addedImports = keep.join(`
|
|
21219
|
+
`);
|
|
21220
|
+
} catch {
|
|
21221
|
+
addedImports = "";
|
|
21222
|
+
}
|
|
21223
|
+
}
|
|
21224
|
+
const q = escapeRegex(spec), imp = (kind) => new RegExp(`^${kind} .*(?:\\bfrom\\s*|\\brequire\\(\\s*|\\bimport\\s*\\(?\\s*)['"]${q}['"]`, "m");
|
|
21225
|
+
return imp("new").test(addedImports) && !imp("gone").test(addedImports);
|
|
21226
|
+
};
|
|
21195
21227
|
let excused = 0;
|
|
21196
21228
|
for (const n3 of added) {
|
|
21197
21229
|
const line2 = hl[n3 - 1] ?? "";
|
|
@@ -21221,6 +21253,10 @@ function excusedEdit(repoDir, baseSha, headSha, rel, base, head, task) {
|
|
|
21221
21253
|
excused += hits;
|
|
21222
21254
|
continue;
|
|
21223
21255
|
}
|
|
21256
|
+
if (allAdded && newlyImported(spec)) {
|
|
21257
|
+
excused += hits;
|
|
21258
|
+
continue;
|
|
21259
|
+
}
|
|
21224
21260
|
return null;
|
|
21225
21261
|
}
|
|
21226
21262
|
if (HOOK_RE.test(line2)) {
|
|
@@ -21243,7 +21279,7 @@ function excusedEdit(repoDir, baseSha, headSha, rel, base, head, task) {
|
|
|
21243
21279
|
}
|
|
21244
21280
|
if (count2(SETUP_RE, head) - excused > count2(SETUP_RE, base))
|
|
21245
21281
|
return null;
|
|
21246
|
-
why.push("added setup only in describe blocks the change added, or mocks of modules new in the change");
|
|
21282
|
+
why.push("added setup only in describe blocks the change added, or mocks of modules new in the change or of a package the test's own subject starts importing");
|
|
21247
21283
|
}
|
|
21248
21284
|
return why.join("; ") || null;
|
|
21249
21285
|
}
|
|
@@ -21566,7 +21602,7 @@ __export(exports_unit_mode, {
|
|
|
21566
21602
|
});
|
|
21567
21603
|
import { createHash as createHash16 } from "crypto";
|
|
21568
21604
|
import { closeSync as closeSync13, constants as constants2, fstatSync as fstatSync6, lstatSync as lstatSync18, openSync as openSync13, readSync as readSync10, realpathSync as realpathSync22 } from "fs";
|
|
21569
|
-
import { isAbsolute as isAbsolute9, relative as relative10, resolve as
|
|
21605
|
+
import { isAbsolute as isAbsolute9, relative as relative10, resolve as resolve20 } from "path";
|
|
21570
21606
|
function readBounded(path) {
|
|
21571
21607
|
const l = lstatSync18(path);
|
|
21572
21608
|
if (l.isSymbolicLink() || !l.isFile() || l.size > MAX_SPEC_BYTES)
|
|
@@ -21668,7 +21704,7 @@ function unitIntake(env, repoDir, existingCapUsd) {
|
|
|
21668
21704
|
const bad = (why) => ({ ok: false, note: UNIT_NOT_PROVEN(why) });
|
|
21669
21705
|
let txt;
|
|
21670
21706
|
try {
|
|
21671
|
-
const real3 = realpathSync22(
|
|
21707
|
+
const real3 = realpathSync22(resolve20(path)), root = realpathSync22(repoDir), rel = relative10(root, real3);
|
|
21672
21708
|
if (!(rel === ".." || rel.startsWith("../") || isAbsolute9(rel)))
|
|
21673
21709
|
return bad("its spec file is inside the worktree where the agent could edit it");
|
|
21674
21710
|
txt = readBounded(real3);
|
|
@@ -21690,7 +21726,7 @@ var init_unit_mode = __esm(() => {
|
|
|
21690
21726
|
});
|
|
21691
21727
|
|
|
21692
21728
|
// ../../loki-ts/src/features/exec_spec.ts
|
|
21693
|
-
import { existsSync as existsSync43, mkdirSync as mkdirSync28, mkdtempSync as mkdtempSync9, readFileSync as readFileSync61, readdirSync as readdirSync28, rmSync as rmSync18, statSync as
|
|
21729
|
+
import { existsSync as existsSync43, mkdirSync as mkdirSync28, mkdtempSync as mkdtempSync9, readFileSync as readFileSync61, readdirSync as readdirSync28, rmSync as rmSync18, statSync as statSync24, writeFileSync as writeFileSync28 } from "fs";
|
|
21694
21730
|
import { tmpdir as tmpdir12 } from "os";
|
|
21695
21731
|
import { dirname as dirname25, join as join70, relative as relative11 } from "path";
|
|
21696
21732
|
function sections(task) {
|
|
@@ -21765,7 +21801,7 @@ function sourceFiles(dir, root = dir, out2 = []) {
|
|
|
21765
21801
|
const p = join70(dir, e);
|
|
21766
21802
|
let st;
|
|
21767
21803
|
try {
|
|
21768
|
-
st =
|
|
21804
|
+
st = statSync24(p);
|
|
21769
21805
|
} catch {
|
|
21770
21806
|
continue;
|
|
21771
21807
|
}
|
|
@@ -22661,8 +22697,8 @@ var init_exec_spec = __esm(() => {
|
|
|
22661
22697
|
});
|
|
22662
22698
|
|
|
22663
22699
|
// ../../loki-ts/src/project_model/conventions.ts
|
|
22664
|
-
import { existsSync as existsSync44, readdirSync as readdirSync29, readFileSync as readFileSync62, realpathSync as realpathSync23, renameSync as renameSync14, rmSync as rmSync19, statSync as
|
|
22665
|
-
import { basename as
|
|
22700
|
+
import { existsSync as existsSync44, readdirSync as readdirSync29, readFileSync as readFileSync62, realpathSync as realpathSync23, renameSync as renameSync14, rmSync as rmSync19, statSync as statSync25, writeFileSync as writeFileSync29 } from "fs";
|
|
22701
|
+
import { basename as basename21, dirname as dirname26, isAbsolute as isAbsolute10, join as join71, relative as relative12, resolve as resolve21, sep as sep14 } from "path";
|
|
22666
22702
|
function parseJsonc(text3) {
|
|
22667
22703
|
let out2 = "", i = 0;
|
|
22668
22704
|
while (i < text3.length) {
|
|
@@ -22806,11 +22842,11 @@ function changelogFileConvention(repoDir) {
|
|
|
22806
22842
|
files.push(d === "." ? n3 : `${d}/${n3}`);
|
|
22807
22843
|
} catch {}
|
|
22808
22844
|
}
|
|
22809
|
-
const g = guide.toLowerCase(), rank = (f) => f.includes("/") && g.includes(f.toLowerCase()) ? 0 : g.includes(
|
|
22845
|
+
const g = guide.toLowerCase(), rank = (f) => f.includes("/") && g.includes(f.toLowerCase()) ? 0 : g.includes(basename21(f).toLowerCase()) ? 1 : 2;
|
|
22810
22846
|
for (const f of [...files].sort((a, b) => rank(a) - rank(b))) {
|
|
22811
22847
|
let t = "";
|
|
22812
22848
|
try {
|
|
22813
|
-
if (!
|
|
22849
|
+
if (!statSync25(join71(repoDir, f)).isFile())
|
|
22814
22850
|
continue;
|
|
22815
22851
|
t = readFileSync62(join71(repoDir, f), "utf8");
|
|
22816
22852
|
} catch {
|
|
@@ -22937,10 +22973,10 @@ function releaseNoteProblems(repoDir, conv2, added, changed, task, env = process
|
|
|
22937
22973
|
for (const f of added.keys()) {
|
|
22938
22974
|
if (!f.startsWith(`${conv2.dir}/`))
|
|
22939
22975
|
continue;
|
|
22940
|
-
const n3 = /^(\d+)\./.exec(
|
|
22976
|
+
const n3 = /^(\d+)\./.exec(basename21(f))?.[1];
|
|
22941
22977
|
if (!n3 || nums.includes(n3))
|
|
22942
22978
|
continue;
|
|
22943
|
-
out2.push(nums.length ? `${f} is numbered ${n3}, but the task gives #${nums.join(", #")}` : `${f} is numbered ${n3}, a number the task never gives${p ? `; rename it to the orphan form ${conv2.dir}/${p}<short-slug>${
|
|
22979
|
+
out2.push(nums.length ? `${f} is numbered ${n3}, but the task gives #${nums.join(", #")}` : `${f} is numbered ${n3}, a number the task never gives${p ? `; rename it to the orphan form ${conv2.dir}/${p}<short-slug>${basename21(f).slice(n3.length)}` : ""}`);
|
|
22944
22980
|
}
|
|
22945
22981
|
}
|
|
22946
22982
|
return out2;
|
|
@@ -22988,7 +23024,7 @@ function towncrierTypes(repoDir) {
|
|
|
22988
23024
|
function towncrierExample(repoDir, dir) {
|
|
22989
23025
|
const types = towncrierTypes(repoDir);
|
|
22990
23026
|
try {
|
|
22991
|
-
const frags = readdirSync29(join71(repoDir, dir)).filter((n3) => /^\+?[\w-]+\.[a-z]+(?:\.[a-z]+)?$/.test(n3) && types.includes(n3.split(".")[1])).map((n3) => ({ n: n3, ext: n3.split(".").slice(2).join("."), t:
|
|
23027
|
+
const frags = readdirSync29(join71(repoDir, dir)).filter((n3) => /^\+?[\w-]+\.[a-z]+(?:\.[a-z]+)?$/.test(n3) && types.includes(n3.split(".")[1])).map((n3) => ({ n: n3, ext: n3.split(".").slice(2).join("."), t: statSync25(join71(repoDir, dir, n3)).mtimeMs }));
|
|
22992
23028
|
const count3 = new Map;
|
|
22993
23029
|
for (const f2 of frags)
|
|
22994
23030
|
count3.set(f2.ext, (count3.get(f2.ext) ?? 0) + 1);
|
|
@@ -23032,13 +23068,13 @@ function towncrierOrphansAllowed(repoDir) {
|
|
|
23032
23068
|
function renameInventedFragment(repoDir, conv2, f, task, env = process.env) {
|
|
23033
23069
|
if (!orphanRenameOn(env) || conv2.kind !== "towncrier" || !f.startsWith(`${conv2.dir}/`) || taskNumbers(task).length)
|
|
23034
23070
|
return null;
|
|
23035
|
-
const n3 = /^(\d+)\./.exec(
|
|
23071
|
+
const n3 = /^(\d+)\./.exec(basename21(f))?.[1], p = towncrierOrphanPrefix(repoDir, conv2.dir);
|
|
23036
23072
|
if (!n3 || !p)
|
|
23037
23073
|
return null;
|
|
23038
23074
|
const slug = fragmentTitle(task).toLowerCase().replace(/[`'"]/g, "").split(/[^a-z0-9]+/).filter(Boolean).slice(0, 6).join("-") || "change";
|
|
23039
|
-
let to = `${conv2.dir}/${p}${slug}${
|
|
23075
|
+
let to = `${conv2.dir}/${p}${slug}${basename21(f).slice(n3.length)}`;
|
|
23040
23076
|
for (let i = 2;existsSync44(join71(repoDir, to)); i++)
|
|
23041
|
-
to = `${conv2.dir}/${p}${slug}-${i}${
|
|
23077
|
+
to = `${conv2.dir}/${p}${slug}-${i}${basename21(f).slice(n3.length)}`;
|
|
23042
23078
|
try {
|
|
23043
23079
|
renameSync14(join71(repoDir, f), join71(repoDir, to));
|
|
23044
23080
|
} catch {
|
|
@@ -23478,7 +23514,7 @@ function topLevelSymbols2(src) {
|
|
|
23478
23514
|
function misplacedNamedNotes(task, rawDiff, repoDir, head) {
|
|
23479
23515
|
const named = taskNamedPaths(task), added = rawDiff.flatMap((m, i) => i % 2 === 0 && m.trim().split(" ").pop() === "A" && rawDiff[i + 1] ? [rawDiff[i + 1]] : []), changed = new Set(rawDiff.filter((_, i) => i % 2 === 1));
|
|
23480
23516
|
return named.filter((x) => !x.includes("/") && !TEST_NAME.test(x)).flatMap((x) => {
|
|
23481
|
-
const hit = added.find((f) => f.includes("/") &&
|
|
23517
|
+
const hit = added.find((f) => f.includes("/") && basename21(f) === x && TEST_DIR2.test(f.split("/")[0]));
|
|
23482
23518
|
if (!hit || named.some((p) => p.endsWith(`/${x}`)) || taskNamesDir(task, dirname26(hit)))
|
|
23483
23519
|
return [];
|
|
23484
23520
|
const root = safeGitSpawn(repoDir, ["show", `${head}:${x}`], { timeout: 5000, encoding: "utf8" });
|
|
@@ -23558,7 +23594,7 @@ function phantomRepoPaths(content, fileName, testDir, repoDir, planText, task =
|
|
|
23558
23594
|
return join71(testDir, "__self__");
|
|
23559
23595
|
const url = /^fileURLToPath\(new URL\((["'])([^"']*)\1\s*,\s*import\.meta\.url\)\)$/.exec(e);
|
|
23560
23596
|
if (url)
|
|
23561
|
-
return
|
|
23597
|
+
return resolve21(testDir, url[2]);
|
|
23562
23598
|
const lit = /^(["'`])((?:\\.|(?!\1)[^\\])*)\1$/.exec(e);
|
|
23563
23599
|
if (lit)
|
|
23564
23600
|
return lit[2].includes("${") ? null : lit[2];
|
|
@@ -23572,7 +23608,7 @@ function phantomRepoPaths(content, fileName, testDir, repoDir, planText, task =
|
|
|
23572
23608
|
return null;
|
|
23573
23609
|
if (call[1] === "dirname")
|
|
23574
23610
|
return dirname26(args[0]);
|
|
23575
|
-
const out2 =
|
|
23611
|
+
const out2 = resolve21(...args);
|
|
23576
23612
|
const first = parts.slice(1).map((a) => /^\s*["'`]([^"'`]*)["'`]\s*$/.exec(a)?.[1]).find((x) => x), viaWalk = !!first && walk.has(parts[0].trim()) && [pkg, repoDir].some((d) => existsSync44(join71(d, first.split("/").filter(Boolean)[0] ?? "\x00")));
|
|
23577
23613
|
if (report && (viaWalk || !parts.some((a) => walk.has(a.trim()) || taint.has(a.trim())) && (relative12(testDir, out2).startsWith("..") || strayInTestDir(out2) || namedStray(out2))) && parts.some((a) => /^\s*["'`]/.test(a)))
|
|
23578
23614
|
reports.set(`${ln}|${e}`, { out: out2, rel: relative12(repoDir, out2), tail: viaWalk ? join71(...args.slice(1)) : undefined });
|
|
@@ -23677,7 +23713,7 @@ function phantomReason(miss, repoFiles, testDir = "", pkgRoot = "", task = null)
|
|
|
23677
23713
|
};
|
|
23678
23714
|
const own = miss.map((m) => [m, at(m) ?? (beside(m) ? `the task names ${beside(m)} at the repo path ${beside(m)}, not beside the test file` : null)]), loc = own.filter(([, w]) => w).map(([, w]) => w), rest = own.filter(([, w]) => !w).map(([m]) => m);
|
|
23679
23715
|
const hint = (m) => {
|
|
23680
|
-
const n3 =
|
|
23716
|
+
const n3 = basename21(m), near = [...new Set(repoFiles.flatMap((f) => {
|
|
23681
23717
|
const s = f.split("/"), k = s.indexOf(n3);
|
|
23682
23718
|
return k >= 0 && s.slice(0, k + 1).join("/") !== m ? [s.slice(0, k + 1).join("/")] : [];
|
|
23683
23719
|
}))].slice(0, 3);
|
|
@@ -23695,7 +23731,7 @@ var readJson4 = (p) => {
|
|
|
23695
23731
|
}
|
|
23696
23732
|
}, newestIn = (abs, rel, pat) => {
|
|
23697
23733
|
try {
|
|
23698
|
-
const f = readdirSync29(abs).filter((n3) => pat.test(n3) && !/^readme/i.test(n3)).map((n3) => ({ n: n3, t:
|
|
23734
|
+
const f = readdirSync29(abs).filter((n3) => pat.test(n3) && !/^readme/i.test(n3)).map((n3) => ({ n: n3, t: statSync25(join71(abs, n3)).mtimeMs })).sort((a, b) => b.t - a.t || b.n.localeCompare(a.n))[0];
|
|
23699
23735
|
return f ? `${rel}/${f.n}` : null;
|
|
23700
23736
|
} catch {
|
|
23701
23737
|
return null;
|
|
@@ -23764,7 +23800,7 @@ var init_conventions = __esm(() => {
|
|
|
23764
23800
|
|
|
23765
23801
|
// ../../loki-ts/src/e10ext/scope.ts
|
|
23766
23802
|
import { existsSync as existsSync45, readFileSync as readFileSync63 } from "fs";
|
|
23767
|
-
import { basename as
|
|
23803
|
+
import { basename as basename22, dirname as dirname27, join as join72 } from "path";
|
|
23768
23804
|
function contractText(o) {
|
|
23769
23805
|
const c = o.intake?.contract_snapshot?.contract;
|
|
23770
23806
|
return Array.isArray(c?.criteria) ? c.criteria.map((x) => typeof x?.text === "string" ? x.text : "").join(`
|
|
@@ -23778,7 +23814,7 @@ function outsideScope(o, staged, planFiles = []) {
|
|
|
23778
23814
|
const text3 = `${plan}
|
|
23779
23815
|
${typeof o.intake?.task === "string" ? o.intake.task : ""}
|
|
23780
23816
|
${contractText(o)}`, pre = o.intake?.preexisting_dirty ?? {};
|
|
23781
|
-
const kept = (f) => isTestFile(f) || Object.hasOwn(pre, f) || mentions(text3, f) || mentions(text3,
|
|
23817
|
+
const kept = (f) => isTestFile(f) || Object.hasOwn(pre, f) || mentions(text3, f) || mentions(text3, basename22(f));
|
|
23782
23818
|
if (planFiles.length > 0)
|
|
23783
23819
|
return staged.filter(({ st, f }) => st !== "A" && !kept(f) && !planFiles.includes(f)).map(({ f }) => f);
|
|
23784
23820
|
const toks = surfaceTokens(text3), plannedDirs = new Set(rel.map((r) => dirname27(r)).filter((d) => d !== "."));
|
|
@@ -23788,7 +23824,7 @@ function anchoredPlanScope(files, task, repoDir, env = process.env) {
|
|
|
23788
23824
|
if (!files.length || !planScopeAnchorEnabled(env) || !task.trim())
|
|
23789
23825
|
return files;
|
|
23790
23826
|
const syms = [...new Set(extractSpecAtoms(task).filter((a) => a.kind === "site").map((a) => a.text.split(".").pop()).filter(Boolean))];
|
|
23791
|
-
const namesFile = (f) => mentions(task, f) || mentions(task,
|
|
23827
|
+
const namesFile = (f) => mentions(task, f) || mentions(task, basename22(f));
|
|
23792
23828
|
const defines = (f) => {
|
|
23793
23829
|
if (!repoDir || !syms.length)
|
|
23794
23830
|
return false;
|
|
@@ -23824,14 +23860,14 @@ function briefChangelog(repoDir, env = process.env) {
|
|
|
23824
23860
|
function ownerOf(repoDir, f) {
|
|
23825
23861
|
if (f.endsWith(".go")) {
|
|
23826
23862
|
const d = dirname27(f);
|
|
23827
|
-
return { dir: d, name:
|
|
23863
|
+
return { dir: d, name: basename22(d) };
|
|
23828
23864
|
}
|
|
23829
23865
|
if (!JS_EXT.test(f))
|
|
23830
23866
|
return null;
|
|
23831
23867
|
for (let d = dirname27(f);; d = dirname27(d)) {
|
|
23832
23868
|
const pj = join72(repoDir, d, "package.json");
|
|
23833
23869
|
if (existsSync45(pj)) {
|
|
23834
|
-
let name =
|
|
23870
|
+
let name = basename22(d === "." ? repoDir : d);
|
|
23835
23871
|
try {
|
|
23836
23872
|
const n3 = JSON.parse(readFileSync63(pj, "utf8")).name;
|
|
23837
23873
|
if (typeof n3 === "string")
|
|
@@ -23857,7 +23893,7 @@ function crossPackageTestEdits(repoDir, staged, task, tracked) {
|
|
|
23857
23893
|
const o = ownerOf(repoDir, f);
|
|
23858
23894
|
if (!o || srcOwners.has(o.dir))
|
|
23859
23895
|
return false;
|
|
23860
|
-
if (mentions(task, f) || mentions(task,
|
|
23896
|
+
if (mentions(task, f) || mentions(task, basename22(f)) || o.dir !== "." && (mentions(task, o.dir) || mentions(task, basename22(o.dir))) || mentions(task, o.name))
|
|
23861
23897
|
return false;
|
|
23862
23898
|
if (testReachEnabled() && exercisesChange(repoDir, f, src.map(({ f: s }) => s)))
|
|
23863
23899
|
return false;
|
|
@@ -23913,7 +23949,7 @@ var init_scope2 = __esm(() => {
|
|
|
23913
23949
|
// ../../loki-ts/src/features/attempts.ts
|
|
23914
23950
|
import { existsSync as existsSync46, lstatSync as lstatSync19, mkdtempSync as mkdtempSync10, readFileSync as readFileSync64, realpathSync as realpathSync24, rmSync as rmSync20, symlinkSync as symlinkSync2 } from "fs";
|
|
23915
23951
|
import { tmpdir as tmpdir13 } from "os";
|
|
23916
|
-
import { basename as
|
|
23952
|
+
import { basename as basename23, dirname as dirname28, join as join73 } from "path";
|
|
23917
23953
|
function attemptsTotal(model, env = process.env) {
|
|
23918
23954
|
const raw2 = (env.LOKI_E10_ATTEMPTS ?? "").trim().toLowerCase() || (attemptsEarly(env) && /haiku/i.test(model ?? "") ? "on" : "");
|
|
23919
23955
|
if (["on", "true", "yes"].includes(raw2))
|
|
@@ -23925,7 +23961,7 @@ function cascadeWallTail(runDir, v) {
|
|
|
23925
23961
|
if (!wallFailedOf(v))
|
|
23926
23962
|
return null;
|
|
23927
23963
|
try {
|
|
23928
|
-
const t = readFileSync64(join73(runDir,
|
|
23964
|
+
const t = readFileSync64(join73(runDir, basename23(String(v.wall_failure_tail))), "utf8").trim();
|
|
23929
23965
|
return t ? t.slice(-6000) : null;
|
|
23930
23966
|
} catch {
|
|
23931
23967
|
return null;
|
|
@@ -24039,7 +24075,7 @@ function removeAttemptTrees(primary, root, dirs) {
|
|
|
24039
24075
|
safeGit(primary, ["worktree", "prune"]);
|
|
24040
24076
|
} catch {}
|
|
24041
24077
|
try {
|
|
24042
|
-
if (
|
|
24078
|
+
if (basename23(root).startsWith(ATTEMPTS_TMP_PREFIX) && dirname28(realpathSync24(root)) === realpathSync24(tmpdir13()) && !lstatSync19(root).isSymbolicLink())
|
|
24043
24079
|
rmSync20(root, { recursive: true, force: true });
|
|
24044
24080
|
} catch {}
|
|
24045
24081
|
}
|
|
@@ -24294,10 +24330,10 @@ var init_attempts = __esm(() => {
|
|
|
24294
24330
|
});
|
|
24295
24331
|
|
|
24296
24332
|
// ../../loki-ts/src/util/secure_scan.ts
|
|
24297
|
-
import { copyFileSync as copyFileSync3, existsSync as existsSync47, lstatSync as lstatSync20, mkdirSync as mkdirSync29, mkdtempSync as mkdtempSync11, readFileSync as readFileSync65, realpathSync as realpathSync25, rmSync as rmSync21, statSync as
|
|
24333
|
+
import { copyFileSync as copyFileSync3, existsSync as existsSync47, lstatSync as lstatSync20, mkdirSync as mkdirSync29, mkdtempSync as mkdtempSync11, readFileSync as readFileSync65, realpathSync as realpathSync25, rmSync as rmSync21, statSync as statSync26, writeFileSync as writeFileSync30 } from "fs";
|
|
24298
24334
|
import { randomBytes as randomBytes5 } from "crypto";
|
|
24299
24335
|
import { tmpdir as tmpdir14 } from "os";
|
|
24300
|
-
import { basename as
|
|
24336
|
+
import { basename as basename24, dirname as dirname29, join as join74, resolve as resolve22, sep as sep15 } from "path";
|
|
24301
24337
|
function fail(error) {
|
|
24302
24338
|
return { ok: false, findings: [], error };
|
|
24303
24339
|
}
|
|
@@ -24496,7 +24532,7 @@ async function scanAddedLines(repoDir, opts = {}) {
|
|
|
24496
24532
|
const skipped = [];
|
|
24497
24533
|
for (const p of untracked3.split("\x00").filter(Boolean)) {
|
|
24498
24534
|
try {
|
|
24499
|
-
const st =
|
|
24535
|
+
const st = statSync26(join74(repoDir, p));
|
|
24500
24536
|
if (!st.isFile())
|
|
24501
24537
|
continue;
|
|
24502
24538
|
if (st.size > MAX_ADDED_FILE_BYTES) {
|
|
@@ -24520,14 +24556,14 @@ async function scanAddedLines(repoDir, opts = {}) {
|
|
|
24520
24556
|
return { ok: true, findings: skipped };
|
|
24521
24557
|
const mirror = mkdtempSync11(join74(tmpdir14(), "loki-secure-added-"));
|
|
24522
24558
|
try {
|
|
24523
|
-
const root =
|
|
24559
|
+
const root = resolve22(mirror) + sep15;
|
|
24524
24560
|
const chunkMap = new Map;
|
|
24525
24561
|
const chunkRoot = `.loki-chunks-${randomBytes5(6).toString("hex")}`;
|
|
24526
24562
|
let chunkSeq = 0;
|
|
24527
24563
|
for (const [p, lines] of added) {
|
|
24528
24564
|
if (lines.size === 0)
|
|
24529
24565
|
continue;
|
|
24530
|
-
const dest =
|
|
24566
|
+
const dest = resolve22(mirror, p);
|
|
24531
24567
|
if (!dest.startsWith(root))
|
|
24532
24568
|
continue;
|
|
24533
24569
|
let max = 0;
|
|
@@ -24564,8 +24600,8 @@ async function scanAddedLines(repoDir, opts = {}) {
|
|
|
24564
24600
|
chunks.push(cur);
|
|
24565
24601
|
const whole = chunks.length === 1;
|
|
24566
24602
|
for (const c of chunks) {
|
|
24567
|
-
const rel = whole ? p : join74(chunkRoot, String(chunkSeq++),
|
|
24568
|
-
const out2 = whole ? dest :
|
|
24603
|
+
const rel = whole ? p : join74(chunkRoot, String(chunkSeq++), basename24(p));
|
|
24604
|
+
const out2 = whole ? dest : resolve22(mirror, rel);
|
|
24569
24605
|
if (!out2.startsWith(root))
|
|
24570
24606
|
break;
|
|
24571
24607
|
chunkMap.set(rel, { file: p, lines: c.orig });
|
|
@@ -25817,7 +25853,7 @@ var init_tournament = __esm(() => {
|
|
|
25817
25853
|
import { execFileSync as execFileSync6, spawnSync as spawnSync9 } from "child_process";
|
|
25818
25854
|
import { cpSync as cpSync2, lstatSync as lstatSync21, mkdirSync as mkdirSync31, mkdtempSync as mkdtempSync12, readFileSync as readFileSync67, realpathSync as realpathSync27, rmSync as rmSync23, writeFileSync as writeFileSync32 } from "fs";
|
|
25819
25855
|
import { tmpdir as tmpdir15 } from "os";
|
|
25820
|
-
import { basename as
|
|
25856
|
+
import { basename as basename25, dirname as dirname31, join as join76 } from "path";
|
|
25821
25857
|
function goStringLiterals(body) {
|
|
25822
25858
|
const out2 = [];
|
|
25823
25859
|
for (const m of body.matchAll(/"((?:[^"\\\n]|\\.)*)"/g)) {
|
|
@@ -26177,7 +26213,7 @@ function makeScratch(repoDir, baseSha, skip, userUntracked = [], diff) {
|
|
|
26177
26213
|
const root = mkdtempSync12(join76(tmpdir15(), SCRATCH_PREFIX)), base = join76(root, "base"), patched = join76(root, "patched"), replay = join76(root, "replay");
|
|
26178
26214
|
const dispose = () => {
|
|
26179
26215
|
try {
|
|
26180
|
-
if (
|
|
26216
|
+
if (basename25(root).startsWith(SCRATCH_PREFIX) && dirname31(realpathSync27(root)) === realpathSync27(tmpdir15()) && !lstatSync21(root).isSymbolicLink())
|
|
26181
26217
|
rmSync23(root, { recursive: true, force: true });
|
|
26182
26218
|
} catch {}
|
|
26183
26219
|
};
|
|
@@ -27160,7 +27196,7 @@ var init_wall_owned = __esm(() => {
|
|
|
27160
27196
|
import { createHash as createHash18 } from "crypto";
|
|
27161
27197
|
import { appendFileSync as appendFileSync7, copyFileSync as copyFileSync4, cpSync as cpSync3, existsSync as existsSync49, mkdirSync as mkdirSync32, readFileSync as readFileSync71, rmSync as rmSync24, writeFileSync as writeFileSync33 } from "fs";
|
|
27162
27198
|
import { tmpdir as tmpdir16 } from "os";
|
|
27163
|
-
import { basename as
|
|
27199
|
+
import { basename as basename26, join as join81, relative as relative14 } from "path";
|
|
27164
27200
|
function wallHoldoutRatio(env = process.env) {
|
|
27165
27201
|
if (env["LOKI_WALL_HOLDOUT"]?.trim() === "0")
|
|
27166
27202
|
return 0;
|
|
@@ -27216,7 +27252,7 @@ function stageHoldout(dir, repoDir) {
|
|
|
27216
27252
|
man = JSON.parse(readFileSync71(join81(dir, MANIFEST2), "utf8"));
|
|
27217
27253
|
} catch {}
|
|
27218
27254
|
if (!man)
|
|
27219
|
-
return { tests, missing: [`holdout store unreadable: ${
|
|
27255
|
+
return { tests, missing: [`holdout store unreadable: ${basename26(dir)}`], cleanup: () => {} };
|
|
27220
27256
|
mkdirSync32(man.targetDir, { recursive: true });
|
|
27221
27257
|
man.files.forEach((f, i) => {
|
|
27222
27258
|
const src = join81(dir, f.name);
|
|
@@ -27494,7 +27530,7 @@ var init_colors = __esm(() => {
|
|
|
27494
27530
|
});
|
|
27495
27531
|
|
|
27496
27532
|
// ../../loki-ts/src/util/run_summary.ts
|
|
27497
|
-
import { existsSync as existsSync50, mkdirSync as mkdirSync33, readFileSync as readFileSync72, renameSync as renameSync16, statSync as
|
|
27533
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync33, readFileSync as readFileSync72, renameSync as renameSync16, statSync as statSync27, writeFileSync as writeFileSync34 } from "fs";
|
|
27498
27534
|
import { join as join82 } from "path";
|
|
27499
27535
|
function resultOf(outcome) {
|
|
27500
27536
|
if (outcome === "VERIFIED" || outcome === "ALREADY_SATISFIED")
|
|
@@ -27596,7 +27632,7 @@ function diffStat(repoDir, base, head = "HEAD") {
|
|
|
27596
27632
|
function readRiskRecord(repoDir, sinceMs = 0) {
|
|
27597
27633
|
try {
|
|
27598
27634
|
const p = join82(repoDir, ".loki", "state", "risk-tier.json");
|
|
27599
|
-
if (
|
|
27635
|
+
if (statSync27(p).mtimeMs < sinceMs)
|
|
27600
27636
|
return null;
|
|
27601
27637
|
const r = JSON.parse(readFileSync72(p, "utf8"));
|
|
27602
27638
|
return r && typeof r === "object" ? r : null;
|
|
@@ -27732,7 +27768,7 @@ function composeHandoff(f) {
|
|
|
27732
27768
|
if (count3 === null) {
|
|
27733
27769
|
try {
|
|
27734
27770
|
const p = join82(f.repoDir, ".loki", "state", "interventions.json");
|
|
27735
|
-
const r =
|
|
27771
|
+
const r = statSync27(p).mtimeMs < (f.sinceMs ?? 0) ? null : JSON.parse(readFileSync72(p, "utf8"));
|
|
27736
27772
|
const nn = (v) => typeof v === "number" && Number.isInteger(v) && v >= 0 ? v : null;
|
|
27737
27773
|
if (r && nn(r.count) !== null) {
|
|
27738
27774
|
count3 = nn(r.count);
|
|
@@ -28477,7 +28513,7 @@ var init_fetch_issue = __esm(() => {
|
|
|
28477
28513
|
});
|
|
28478
28514
|
|
|
28479
28515
|
// ../../loki-ts/src/features/spec_ambiguity.ts
|
|
28480
|
-
import { mkdirSync as mkdirSync35, readFileSync as readFileSync75, statSync as
|
|
28516
|
+
import { mkdirSync as mkdirSync35, readFileSync as readFileSync75, statSync as statSync28, writeFileSync as writeFileSync38 } from "fs";
|
|
28481
28517
|
import { join as join86 } from "path";
|
|
28482
28518
|
function scoreAmbiguity(task) {
|
|
28483
28519
|
const hits = [];
|
|
@@ -28596,7 +28632,7 @@ function corpus(repoDir) {
|
|
|
28596
28632
|
} catch {}
|
|
28597
28633
|
for (const f of tracked.filter((p) => TEST_DOC.test(p)).slice(0, 600)) {
|
|
28598
28634
|
try {
|
|
28599
|
-
if (
|
|
28635
|
+
if (statSync28(join86(repoDir, f)).size <= 200000)
|
|
28600
28636
|
out2.push({ path: f, text: readFileSync75(join86(repoDir, f), "utf8").replace(/\s+/g, "") });
|
|
28601
28637
|
} catch {}
|
|
28602
28638
|
}
|
|
@@ -28654,7 +28690,7 @@ function precedentFor(c, repoDir) {
|
|
|
28654
28690
|
for (const f of tracked) {
|
|
28655
28691
|
let lines2;
|
|
28656
28692
|
try {
|
|
28657
|
-
if (
|
|
28693
|
+
if (statSync28(join86(repoDir, f)).size > 200000)
|
|
28658
28694
|
continue;
|
|
28659
28695
|
lines2 = readFileSync75(join86(repoDir, f), "utf8").split(`
|
|
28660
28696
|
`);
|
|
@@ -29075,9 +29111,9 @@ var init_triage = __esm(() => {
|
|
|
29075
29111
|
});
|
|
29076
29112
|
|
|
29077
29113
|
// ../../loki-ts/src/util/steer.ts
|
|
29078
|
-
import { appendFileSync as appendFileSync8, closeSync as closeSync14, constants as constants3, fstatSync as fstatSync7, readdirSync as readdirSync31, lstatSync as lstatSync22, mkdirSync as mkdirSync36, linkSync as linkSync2, openSync as openSync14, readFileSync as readFileSync76, readSync as readSync11, renameSync as renameSync17, statSync as
|
|
29114
|
+
import { appendFileSync as appendFileSync8, closeSync as closeSync14, constants as constants3, fstatSync as fstatSync7, readdirSync as readdirSync31, lstatSync as lstatSync22, mkdirSync as mkdirSync36, linkSync as linkSync2, openSync as openSync14, readFileSync as readFileSync76, readSync as readSync11, renameSync as renameSync17, statSync as statSync29, lutimesSync, rmSync as rmSync25, unlinkSync as unlinkSync8, writeFileSync as writeFileSync39, existsSync as existsSync53 } from "fs";
|
|
29079
29115
|
import { createHash as createHash20, randomBytes as randomBytes6 } from "crypto";
|
|
29080
|
-
import { basename as
|
|
29116
|
+
import { basename as basename27, join as join87 } from "path";
|
|
29081
29117
|
function archiveTo(logs, prefix, src, link = linkSync2, onLinked) {
|
|
29082
29118
|
for (let i = 0;; i++) {
|
|
29083
29119
|
const name = i === 0 ? `${prefix}.md` : `${prefix}-${i}.md`;
|
|
@@ -29109,7 +29145,7 @@ function orphanAlreadyArchived(logs, claim) {
|
|
|
29109
29145
|
if (!/^human-input-.*\.md$/.test(a))
|
|
29110
29146
|
continue;
|
|
29111
29147
|
try {
|
|
29112
|
-
const s =
|
|
29148
|
+
const s = statSync29(join87(logs, a));
|
|
29113
29149
|
if (s.ino !== c.ino || s.dev !== c.dev)
|
|
29114
29150
|
continue;
|
|
29115
29151
|
if (/^human-input-(ORPHAN|REJECTED)-/.test(a) || existsSync53(appliedMarker(logs, a)))
|
|
@@ -29146,7 +29182,7 @@ function sweepOrphans(logs, stamp2, unapplied, link, nowMs = Date.now()) {
|
|
|
29146
29182
|
if (alive2) {
|
|
29147
29183
|
let ageMs = 0;
|
|
29148
29184
|
try {
|
|
29149
|
-
ageMs = nowMs -
|
|
29185
|
+
ageMs = nowMs - statSync29(join87(logs, n3)).mtimeMs;
|
|
29150
29186
|
} catch {
|
|
29151
29187
|
continue;
|
|
29152
29188
|
}
|
|
@@ -29274,7 +29310,7 @@ function consumeSteer(repoDir, env = process.env, now2 = () => new Date, sink, h
|
|
|
29274
29310
|
archiveTo(join87(repoDir, ".loki", "logs"), `human-input-${now2().toISOString().replace(/[-:]/g, "").replace(/\..*/, "")}`, claimed, hooks2?.link);
|
|
29275
29311
|
unapplied("logs dir unwritable or file unreadable");
|
|
29276
29312
|
} catch {
|
|
29277
|
-
unapplied(`steer stranded at .loki/logs/${
|
|
29313
|
+
unapplied(`steer stranded at .loki/logs/${basename27(claimed)}`);
|
|
29278
29314
|
}
|
|
29279
29315
|
} else
|
|
29280
29316
|
try {
|
|
@@ -29393,7 +29429,7 @@ var init_steer = __esm(() => {
|
|
|
29393
29429
|
});
|
|
29394
29430
|
|
|
29395
29431
|
// ../../loki-ts/src/util/reviewer_brief.ts
|
|
29396
|
-
import { closeSync as closeSync15, existsSync as existsSync54, fstatSync as fstatSync8, lstatSync as lstatSync23, openSync as openSync15, readFileSync as readFileSync77, readSync as readSync12, readdirSync as readdirSync32, realpathSync as realpathSync29, statSync as
|
|
29432
|
+
import { closeSync as closeSync15, existsSync as existsSync54, fstatSync as fstatSync8, lstatSync as lstatSync23, openSync as openSync15, readFileSync as readFileSync77, readSync as readSync12, readdirSync as readdirSync32, realpathSync as realpathSync29, statSync as statSync30 } from "fs";
|
|
29397
29433
|
import { dirname as dirname35, join as join88, normalize as normalize4, sep as sep17 } from "path";
|
|
29398
29434
|
function reviewFlagLines(text3) {
|
|
29399
29435
|
const out2 = [];
|
|
@@ -29550,10 +29586,10 @@ function lcovFor(repoDir, changed) {
|
|
|
29550
29586
|
const p = LCOV_PATHS.map((r) => join88(repoDir, r)).find((x) => existsSync54(x));
|
|
29551
29587
|
if (!p)
|
|
29552
29588
|
return { reason: "no coverage report from an executed test run (coverage/lcov.info absent)" };
|
|
29553
|
-
const t =
|
|
29589
|
+
const t = statSync30(p).mtimeMs;
|
|
29554
29590
|
for (const f of changed) {
|
|
29555
29591
|
try {
|
|
29556
|
-
if (
|
|
29592
|
+
if (statSync30(join88(repoDir, f)).mtimeMs > t)
|
|
29557
29593
|
return { reason: `coverage report is older than ${f}` };
|
|
29558
29594
|
} catch {}
|
|
29559
29595
|
}
|
|
@@ -30086,7 +30122,7 @@ var init_mutation_proof = __esm(() => {
|
|
|
30086
30122
|
|
|
30087
30123
|
// ../../loki-ts/src/features/self_review.ts
|
|
30088
30124
|
import { existsSync as existsSync56, mkdirSync as mkdirSync38, readFileSync as readFileSync79, writeFileSync as writeFileSync41 } from "fs";
|
|
30089
|
-
import { basename as
|
|
30125
|
+
import { basename as basename29, dirname as dirname37, join as join90 } from "path";
|
|
30090
30126
|
function pyRegex(src, flags = "") {
|
|
30091
30127
|
let p = src.trim();
|
|
30092
30128
|
if (p.startsWith("(?x)"))
|
|
@@ -30232,7 +30268,7 @@ function selfReviewChecks(repoDir, baseSha, staged, task, outputs, env = process
|
|
|
30232
30268
|
}
|
|
30233
30269
|
})();
|
|
30234
30270
|
const fragDir = conv2 && conv2.kind !== "changelog" ? `${conv2.dir}/` : null;
|
|
30235
|
-
const stray = trackedDirs ? added.filter((f) => !art.includes(f) && !isTestFile3(f) && !(fragDir && f.startsWith(fragDir)) && !trackedDirs.has(dirname37(f)) && !task.includes(f) && !task.includes(
|
|
30271
|
+
const stray = trackedDirs ? added.filter((f) => !art.includes(f) && !isTestFile3(f) && !(fragDir && f.startsWith(fragDir)) && !trackedDirs.has(dirname37(f)) && !task.includes(f) && !task.includes(basename29(f))) : [];
|
|
30236
30272
|
items.push(stray.length ? { item: "stray_files", status: "flagged", detail: `new files outside every directory the repo tracks: ${stray.slice(0, 8).join(", ")}` } : art.length ? { item: "stray_files", status: "auto", detail: `build output the commit leaves out: ${art.slice(0, 8).join(", ")}` } : { item: "stray_files", status: "ok", detail: "no generated or stray file" });
|
|
30237
30273
|
items.push(src.length === 0 ? { item: "test", status: "ok", detail: "no source change" } : tests.length ? { item: "test", status: "ok", detail: `test changes: ${tests.slice(0, 5).join(", ")}` } : { item: "test", status: "flagged", detail: `source changed (${src.slice(0, 5).join(", ")}) and the diff has no test` });
|
|
30238
30274
|
const fmts = (() => {
|
|
@@ -30321,8 +30357,8 @@ function docEnumerations(repoDir, baseSha, live2) {
|
|
|
30321
30357
|
`))].filter((t) => !baseTok.has(t));
|
|
30322
30358
|
if (!added.length)
|
|
30323
30359
|
continue;
|
|
30324
|
-
const dir = dirname37(f), stems = new Set([
|
|
30325
|
-
const docs = tracked.filter((d) => /\.mdx?$/i.test(d) && !touched.has(d) && (dirname37(d) === dir || /(^|\/)docs?\//.test(d) && stems.has(
|
|
30360
|
+
const dir = dirname37(f), stems = new Set([basename29(dir), basename29(f).replace(/\.[^.]+$/, "")].filter((s) => s && s !== "." && s !== "index" && s !== "src" && s !== "lib"));
|
|
30361
|
+
const docs = tracked.filter((d) => /\.mdx?$/i.test(d) && !touched.has(d) && (dirname37(d) === dir || /(^|\/)docs?\//.test(d) && stems.has(basename29(d).replace(/\.mdx?$/i, ""))));
|
|
30326
30362
|
for (const d of docs) {
|
|
30327
30363
|
let text3 = "";
|
|
30328
30364
|
try {
|
|
@@ -31701,7 +31737,7 @@ var init_wall_manifest = __esm(() => {
|
|
|
31701
31737
|
|
|
31702
31738
|
// ../../loki-ts/src/features/wall_manifest_wire.ts
|
|
31703
31739
|
import { createHash as createHash21 } from "crypto";
|
|
31704
|
-
import { basename as
|
|
31740
|
+
import { basename as basename30, dirname as dirname38 } from "path";
|
|
31705
31741
|
function blobEntries(ls2) {
|
|
31706
31742
|
const out2 = [];
|
|
31707
31743
|
for (const raw2 of ls2.toString("latin1").split("\x00")) {
|
|
@@ -31731,12 +31767,12 @@ function wallManifestFor(repoDir, tree, task, env = process.env) {
|
|
|
31731
31767
|
return null;
|
|
31732
31768
|
const low = task.toLowerCase().replace(/\\/g, "/");
|
|
31733
31769
|
const token = (n3) => new RegExp(`(?<![A-Za-z0-9_])${escapeRegex(n3.toLowerCase())}(?![A-Za-z0-9_])`).test(low);
|
|
31734
|
-
const dirModule = (e) => /^(index|__init__|mod|main)\.[^.]+$/.test(
|
|
31735
|
-
const matched = all.filter((e) => SOURCE.test(e.path) && (token(
|
|
31770
|
+
const dirModule = (e) => /^(index|__init__|mod|main)\.[^.]+$/.test(basename30(e.path)) && e.path.includes("/") && token(dirname38(e.path));
|
|
31771
|
+
const matched = all.filter((e) => SOURCE.test(e.path) && (token(basename30(e.path)) || token(e.path) || token(basename30(e.path).replace(/\.[^.]*$/, "")) || dirModule(e)));
|
|
31736
31772
|
const spans = (p) => [...low.matchAll(new RegExp(`(?<![A-Za-z0-9_])${escapeRegex(p.toLowerCase())}(?![A-Za-z0-9_])`, "g"))].map((m) => [m.index, m.index + m[0].length]);
|
|
31737
31773
|
const occ = new Map(matched.map((e) => [e, spans(e.path)]));
|
|
31738
31774
|
const exact = (e) => occ.get(e).some(([s, t]) => !matched.some((o) => o !== e && o.path.length > e.path.length && occ.get(o).some(([s2, t2]) => s2 <= s && t <= t2)));
|
|
31739
|
-
const byPath2 = matched.filter(exact).sort((a, b) => b.path.length - a.path.length), byBase = matched.filter((e) => !byPath2.includes(e) && token(
|
|
31775
|
+
const byPath2 = matched.filter(exact).sort((a, b) => b.path.length - a.path.length), byBase = matched.filter((e) => !byPath2.includes(e) && token(basename30(e.path)));
|
|
31740
31776
|
const named = [...byPath2, ...byBase, ...matched.filter((e) => !byPath2.includes(e) && !byBase.includes(e))].slice(0, MAX_NAMED);
|
|
31741
31777
|
const tests = all.filter((e) => TESTISH.test(e.path)).slice(0, MAX_FILES), listed = tests.filter((e) => !SOURCE.test(e.path));
|
|
31742
31778
|
const want = [...new Set([...all.filter((e) => CONFIG.test(e.path)), ...tests.filter((e) => SOURCE.test(e.path)), ...named])];
|
|
@@ -32107,7 +32143,7 @@ __export(exports_wall, {
|
|
|
32107
32143
|
});
|
|
32108
32144
|
import { existsSync as existsSync58, mkdirSync as mkdirSync39, mkdtempSync as mkdtempSync14, readFileSync as readFileSync82, readdirSync as readdirSync35, realpathSync as realpathSync31, rmSync as rmSync28, writeFileSync as writeFileSync43 } from "fs";
|
|
32109
32145
|
import { tmpdir as tmpdir18 } from "os";
|
|
32110
|
-
import { basename as
|
|
32146
|
+
import { basename as basename31, dirname as dirname39, join as join93, relative as relative18 } from "path";
|
|
32111
32147
|
|
|
32112
32148
|
class RealBaseTestRunner {
|
|
32113
32149
|
api;
|
|
@@ -32355,8 +32391,8 @@ async function execSpecWall(ctx, signal, task, sizeName, runners, existingTests,
|
|
|
32355
32391
|
rmSync28(sealedDir, { recursive: true, force: true });
|
|
32356
32392
|
mkdirSync39(sealedDir, { recursive: true });
|
|
32357
32393
|
for (const f of sealedFiles)
|
|
32358
|
-
writeFileSync43(join93(sealedDir,
|
|
32359
|
-
return { kind: "authored", staged: true, execSpec: summary, model: execSpecModel(), iterationId, task, sizeName, runners: [out2.runner], targetDir: join93(ctx.repoDir, dirname39(sealedFiles[0].rel)), generated: sealedFiles.map((f) =>
|
|
32394
|
+
writeFileSync43(join93(sealedDir, basename31(f.rel)), f.text, "utf8");
|
|
32395
|
+
return { kind: "authored", staged: true, execSpec: summary, model: execSpecModel(), iterationId, task, sizeName, runners: [out2.runner], targetDir: join93(ctx.repoDir, dirname39(sealedFiles[0].rel)), generated: sealedFiles.map((f) => basename31(f.rel)), contents: new Map(sealedFiles.map((f) => [basename31(f.rel), f.text])), discarded: [] };
|
|
32360
32396
|
}
|
|
32361
32397
|
function wallInstallReject(repoDir, task, runners, afterImplement) {
|
|
32362
32398
|
if (!afterImplement || !runners.includes("cargo"))
|
|
@@ -32705,11 +32741,11 @@ import { spawnSync as spawnSync12 } from "child_process";
|
|
|
32705
32741
|
import { createHash as createHash22 } from "crypto";
|
|
32706
32742
|
import { chmodSync as chmodSync8, existsSync as existsSync59, mkdirSync as mkdirSync41, readFileSync as readFileSync84, realpathSync as realpathSync33, renameSync as renameSync19, writeFileSync as writeFileSync45 } from "fs";
|
|
32707
32743
|
import { homedir as homedir11 } from "os";
|
|
32708
|
-
import { dirname as dirname41, join as join95, resolve as
|
|
32744
|
+
import { dirname as dirname41, join as join95, resolve as resolve23 } from "path";
|
|
32709
32745
|
function repoName(repoDir) {
|
|
32710
32746
|
const u = (readOriginUrl(repoDir) ?? "").trim();
|
|
32711
32747
|
if (!u)
|
|
32712
|
-
return
|
|
32748
|
+
return resolve23(repoDir);
|
|
32713
32749
|
const m = /^(?:[a-z][a-z0-9+.-]*:\/\/)?(?:[^@/]+@)?([^/:]+)[:/](.+?)(?:\.git)?\/?$/i.exec(u);
|
|
32714
32750
|
return m && !u.startsWith("/") ? `${m[1].toLowerCase()}/${m[2]}` : u.replace(/\/+$/, "");
|
|
32715
32751
|
}
|
|
@@ -32823,9 +32859,9 @@ function extractSetup(script, repoDir) {
|
|
|
32823
32859
|
try {
|
|
32824
32860
|
return realpathSync33(repoDir);
|
|
32825
32861
|
} catch {
|
|
32826
|
-
return
|
|
32862
|
+
return resolve23(repoDir);
|
|
32827
32863
|
}
|
|
32828
|
-
})(), names = [...new Set([real3,
|
|
32864
|
+
})(), names = [...new Set([real3, resolve23(repoDir), real3.replace(/^\/private\//, "/")])].filter((d) => d.length > 5).sort((a, b) => b.length - a.length);
|
|
32829
32865
|
let swapped = false;
|
|
32830
32866
|
for (const d of names)
|
|
32831
32867
|
if (text3.includes(d)) {
|
|
@@ -33227,7 +33263,7 @@ var init_context = __esm(() => {
|
|
|
33227
33263
|
|
|
33228
33264
|
// ../../loki-ts/src/engine10/proof_rerun.ts
|
|
33229
33265
|
import { createHash as createHash23, randomBytes as randomBytes7 } from "crypto";
|
|
33230
|
-
import { copyFileSync as copyFileSync5, existsSync as existsSync60, mkdirSync as mkdirSync42, readdirSync as readdirSync36, readFileSync as readFileSync85, realpathSync as realpathSync34, rmSync as rmSync29, statfsSync, statSync as
|
|
33266
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync60, mkdirSync as mkdirSync42, readdirSync as readdirSync36, readFileSync as readFileSync85, realpathSync as realpathSync34, rmSync as rmSync29, statfsSync, statSync as statSync31, writeFileSync as writeFileSync46 } from "fs";
|
|
33231
33267
|
import { dirname as dirname42, join as join96, relative as relative20 } from "path";
|
|
33232
33268
|
function labelAsks(provider, intake, plan, repoDir, env = process.env) {
|
|
33233
33269
|
if (!issueAcceptanceCapOn(env))
|
|
@@ -33341,7 +33377,7 @@ function keepProofScript(scratchDir, runDir) {
|
|
|
33341
33377
|
const src = join96(scratchDir, PROOF_SCRIPT);
|
|
33342
33378
|
if (!existsSync60(src))
|
|
33343
33379
|
return false;
|
|
33344
|
-
const st =
|
|
33380
|
+
const st = statSync31(src);
|
|
33345
33381
|
if (!st.isFile() || st.size === 0 || st.size > MAX_SCRIPT_BYTES)
|
|
33346
33382
|
return false;
|
|
33347
33383
|
const real3 = (() => {
|
|
@@ -33358,7 +33394,7 @@ function keepProofScript(scratchDir, runDir) {
|
|
|
33358
33394
|
for (const f of HANDED) {
|
|
33359
33395
|
try {
|
|
33360
33396
|
const su = join96(scratchDir, f);
|
|
33361
|
-
if (existsSync60(su) &&
|
|
33397
|
+
if (existsSync60(su) && statSync31(su).size <= MAX_SCRIPT_BYTES) {
|
|
33362
33398
|
let t = readFileSync85(su, "utf8");
|
|
33363
33399
|
if (f === SETUP_FILE2)
|
|
33364
33400
|
for (const d of names)
|
|
@@ -34177,7 +34213,7 @@ async function issueLineCheck(ctx, asks2, head, checks, reply, facts = []) {
|
|
|
34177
34213
|
return { model, outcome: "no_diff", usd: null, calls: 0, input_chars: 0, diff_cut: [], diff_truncated: false, not_reviewed: "the diff could not be read" };
|
|
34178
34214
|
const cd = lineCheckDiff(d.stdout), prompt = lineCheckPrompt(asks2, cd.text, (n3?.stdout ?? "").split(`
|
|
34179
34215
|
`).filter(Boolean), checks, reply, facts);
|
|
34180
|
-
const call = lineCheckOverride ?? consultCallFor(model, join99(ctx.repoDir, ".loki"), process.env, 120000, { maxTokens:
|
|
34216
|
+
const call = lineCheckOverride ?? consultCallFor(model, join99(ctx.repoDir, ".loki"), process.env, 120000, { maxTokens: 8000, thinking: "off" });
|
|
34181
34217
|
let usd = null, calls = 0, outcome = "failed", parsed = null;
|
|
34182
34218
|
for (let i = 0;i < 2 && !parsed; i++) {
|
|
34183
34219
|
let r;
|
|
@@ -34325,7 +34361,7 @@ var init_implement_route = __esm(() => {
|
|
|
34325
34361
|
|
|
34326
34362
|
// ../../loki-ts/src/features/patch_protocol.ts
|
|
34327
34363
|
import { existsSync as existsSync63, lstatSync as lstatSync26, mkdirSync as mkdirSync45, readFileSync as readFileSync88, realpathSync as realpathSync35, rmSync as rmSync30, writeFileSync as writeFileSync49 } from "fs";
|
|
34328
|
-
import { basename as
|
|
34364
|
+
import { basename as basename32, dirname as dirname43, join as join100, normalize as normalize5, relative as relative21, sep as sep20 } from "path";
|
|
34329
34365
|
function buildPatchBrief(task, code, conventions, checkCmds) {
|
|
34330
34366
|
return [
|
|
34331
34367
|
PATCH_RULES,
|
|
@@ -34381,7 +34417,7 @@ function refusal(rules, rel, before, after) {
|
|
|
34381
34417
|
return "inside .git or .loki";
|
|
34382
34418
|
if (WALL_FILE.test(n3) || rules.readOnly.includes(n3))
|
|
34383
34419
|
return "a read-only Wall test";
|
|
34384
|
-
if (LOCKFILES.has(
|
|
34420
|
+
if (LOCKFILES.has(basename32(n3)) && !taskWantsLockChange(rules.task, n3))
|
|
34385
34421
|
return "a lockfile the task does not ask to change";
|
|
34386
34422
|
if (steersRunner(n3, before ?? "", after))
|
|
34387
34423
|
return "a test-runner or compiler config (it steers how tests run)";
|
|
@@ -35201,6 +35237,30 @@ ${r.session.summary}` };
|
|
|
35201
35237
|
let reviewedEarly = false, earlyReviewCost = null;
|
|
35202
35238
|
let proofFails = 0, lineTurns = 0;
|
|
35203
35239
|
const LINE_TURNS_MAX = 2;
|
|
35240
|
+
const reviewRound = async (tree) => {
|
|
35241
|
+
if (reviewedEarly || !reviewFixOn())
|
|
35242
|
+
return false;
|
|
35243
|
+
reviewedEarly = true;
|
|
35244
|
+
const xr = await crossReview(ctx, "VERIFIED", tree, signal, true);
|
|
35245
|
+
if (xr?.cost_iteration)
|
|
35246
|
+
earlyReviewCost = xr.cost_iteration;
|
|
35247
|
+
const found = xr && (xr.level === "block" || xr.level === "flag") ? xr.notes.filter((n3) => /^cross-review (block|flag) /.test(n3) || isUnmetNote(n3)).slice(0, 8) : [];
|
|
35248
|
+
ctx.emit("review.early", "implement", { level: xr?.level ?? "not_run", findings: found.length });
|
|
35249
|
+
if (!found.length)
|
|
35250
|
+
return false;
|
|
35251
|
+
const r3 = await resumeForProofScript(ctx, { ...unchained(), iterationId: ids[ids.length - 1] }, session, [`An independent reviewer read your whole change and found ${found.length} problem${found.length === 1 ? "" : "s"}:`, "", ...found.map((n3, i) => `${i + 1}. ${n3.replace(/^cross-review \w+ \([^)]*\):\s*/, "")}`), "", "Check each one against the code. Where the reviewer is right, fix the product (and the documentation when the two disagree), add a check for it to $LOKI_SCRATCH/loki-proof.sh under the acceptance item it belongs to, and run the proof again until it passes. Where the reviewer is wrong, say why in one line and change nothing for it. Do not remove or loosen an existing check. End with the same finish line as before."].join(`
|
|
35252
|
+
`));
|
|
35253
|
+
if (r3.iterationId !== ids[ids.length - 1])
|
|
35254
|
+
ids.push(r3.iterationId);
|
|
35255
|
+
else
|
|
35256
|
+
return false;
|
|
35257
|
+
if (r3.session.summary)
|
|
35258
|
+
session = { ...session, summary: `${session.summary ?? ""}
|
|
35259
|
+
|
|
35260
|
+
[after the independent review]
|
|
35261
|
+
${r3.session.summary}` };
|
|
35262
|
+
return true;
|
|
35263
|
+
};
|
|
35204
35264
|
for (let round2 = 0;proofFails < proofLoopMax() && scratch && proofRerunOn() && existsSync64(join101(scratch.dir, PROOF_SCRIPT)) && !signal.aborted && !session.killed && session.exit === 0 && !session.markers.specConflict && !session.markers.alreadyDone; round2++) {
|
|
35205
35265
|
if (!keepProofScript(scratch.dir, ctx.runDir))
|
|
35206
35266
|
break;
|
|
@@ -35217,8 +35277,14 @@ ${r.session.summary}` };
|
|
|
35217
35277
|
}
|
|
35218
35278
|
if (pr.exit === 0 && pr.failed === 0) {
|
|
35219
35279
|
const la = labelAsks(ctx.provider, prior.intake, prior.plan, ctx.repoDir);
|
|
35220
|
-
if (!la.asks.length
|
|
35280
|
+
if (!la.asks.length)
|
|
35281
|
+
break;
|
|
35282
|
+
if (lineTurns >= LINE_TURNS_MAX) {
|
|
35283
|
+
const t = await worktreeTree(ctx.repoDir);
|
|
35284
|
+
if (t && await reviewRound(t))
|
|
35285
|
+
continue;
|
|
35221
35286
|
break;
|
|
35287
|
+
}
|
|
35222
35288
|
const tree = await worktreeTree(ctx.repoDir);
|
|
35223
35289
|
if (!tree)
|
|
35224
35290
|
break;
|
|
@@ -35238,28 +35304,9 @@ ${r.session.summary}` };
|
|
|
35238
35304
|
lineRounds.push({ met: lc.marks?.met.length ?? 0, unmet: unmet.length, usd: lc.usd });
|
|
35239
35305
|
ctx.emit("acceptance.round", "implement", { round: round2 + 1, met: la.asks.length - lineUnmet, unmet: lineUnmet, ...empty.size ? { pass_on_base_too: empty.size } : {}, ...unmet.length > lineUnmet ? { unused_new_files: unmet.length - lineUnmet } : {} });
|
|
35240
35306
|
if (!unmet.length) {
|
|
35241
|
-
if (
|
|
35242
|
-
|
|
35243
|
-
|
|
35244
|
-
const xr = await crossReview(ctx, "VERIFIED", tree, signal, true);
|
|
35245
|
-
if (xr?.cost_iteration)
|
|
35246
|
-
earlyReviewCost = xr.cost_iteration;
|
|
35247
|
-
const found = xr && (xr.level === "block" || xr.notes.some(isUnmetNote)) ? xr.notes.filter((n3) => /^cross-review (block|flag) /.test(n3) || isUnmetNote(n3)).slice(0, 8) : [];
|
|
35248
|
-
ctx.emit("review.early", "implement", { level: xr?.level ?? "not_run", findings: found.length });
|
|
35249
|
-
if (!found.length)
|
|
35250
|
-
break;
|
|
35251
|
-
const r3 = await resumeForProofScript(ctx, { ...unchained(), iterationId: ids[ids.length - 1] }, session, [`An independent reviewer read your whole change and found ${found.length} problem${found.length === 1 ? "" : "s"}:`, "", ...found.map((n3, i) => `${i + 1}. ${n3.replace(/^cross-review \w+ \([^)]*\):\s*/, "")}`), "", "Check each one against the code. Where the reviewer is right, fix the product (and the documentation when the two disagree), add a check for it to $LOKI_SCRATCH/loki-proof.sh under the acceptance item it belongs to, and run the proof again until it passes. Where the reviewer is wrong, say why in one line and change nothing for it. Do not remove or loosen an existing check. End with the same finish line as before."].join(`
|
|
35252
|
-
`));
|
|
35253
|
-
if (r3.iterationId !== ids[ids.length - 1])
|
|
35254
|
-
ids.push(r3.iterationId);
|
|
35255
|
-
else
|
|
35256
|
-
break;
|
|
35257
|
-
if (r3.session.summary)
|
|
35258
|
-
session = { ...session, summary: `${session.summary ?? ""}
|
|
35259
|
-
|
|
35260
|
-
[after the independent review]
|
|
35261
|
-
${r3.session.summary}` };
|
|
35262
|
-
continue;
|
|
35307
|
+
if (await reviewRound(tree))
|
|
35308
|
+
continue;
|
|
35309
|
+
break;
|
|
35263
35310
|
}
|
|
35264
35311
|
const stray = Object.keys(pr.lines).filter((k) => Number(k) > la.asks.length || Number(k) < 1);
|
|
35265
35312
|
const r2 = await resumeForProofScript(ctx, { ...unchained(), iterationId: ids[ids.length - 1] }, session, unmetBrief(unmet, stray.length ? `Your proof script passes, but ${stray.length} of its check numbers (${stray.slice(0, 6).join(", ")}) are not acceptance item numbers, so those checks count for no item. The first argument of loki_http and loki_cmd is the item's number in $LOKI_SCRATCH/acceptance.txt (1 to ${la.asks.length}), never a line number of the script. Renumber them.` : ""));
|
|
@@ -35486,7 +35533,7 @@ var init_run_control = __esm(() => {
|
|
|
35486
35533
|
|
|
35487
35534
|
// ../../loki-ts/src/providers/provider_guard.ts
|
|
35488
35535
|
import { copyFileSync as copyFileSync6, existsSync as existsSync66, lstatSync as lstatSync27, mkdirSync as mkdirSync47, readFileSync as readFileSync91, readdirSync as readdirSync37, readlinkSync as readlinkSync4, realpathSync as realpathSync36, rmSync as rmSync32 } from "fs";
|
|
35489
|
-
import { dirname as dirname44, isAbsolute as isAbsolute16, join as join103, relative as relative23, resolve as
|
|
35536
|
+
import { dirname as dirname44, isAbsolute as isAbsolute16, join as join103, relative as relative23, resolve as resolve24 } from "path";
|
|
35490
35537
|
function providerSandboxFlags(provider) {
|
|
35491
35538
|
return [];
|
|
35492
35539
|
}
|
|
@@ -35509,7 +35556,7 @@ function isRepoDeletion(deleted, tracked) {
|
|
|
35509
35556
|
function escapesProject(root, linkPath) {
|
|
35510
35557
|
try {
|
|
35511
35558
|
const target = readlinkSync4(linkPath);
|
|
35512
|
-
const abs = isAbsolute16(target) ? target :
|
|
35559
|
+
const abs = isAbsolute16(target) ? target : resolve24(dirname44(linkPath), target);
|
|
35513
35560
|
const rel = relative23(realpathSync36(root), existsSync66(abs) ? realpathSync36(abs) : abs);
|
|
35514
35561
|
return rel.startsWith("..") || isAbsolute16(rel);
|
|
35515
35562
|
} catch {
|
|
@@ -35660,7 +35707,7 @@ var init_provider_guard = __esm(() => {
|
|
|
35660
35707
|
|
|
35661
35708
|
// ../../loki-ts/src/e10ext/budget_cap.ts
|
|
35662
35709
|
import { appendFileSync as appendFileSync9, existsSync as existsSync67, mkdirSync as mkdirSync48, readdirSync as readdirSync38, readFileSync as readFileSync92, writeFileSync as writeFileSync52 } from "fs";
|
|
35663
|
-
import { join as join104, resolve as
|
|
35710
|
+
import { join as join104, resolve as resolve25 } from "path";
|
|
35664
35711
|
function hasApiKey(env) {
|
|
35665
35712
|
return ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY", "LOKI_MODEL_API_KEY"].some((k) => (env[k] ?? "") !== "");
|
|
35666
35713
|
}
|
|
@@ -35702,11 +35749,11 @@ function groupEnv(env, capUsd, repoDir) {
|
|
|
35702
35749
|
const out2 = { ...env, LOKI_BUDGET_LIMIT: String(capUsd) };
|
|
35703
35750
|
if (repoDir && !out2.LOKI_BUDGET_LEDGER) {
|
|
35704
35751
|
try {
|
|
35705
|
-
const d = join104(
|
|
35752
|
+
const d = join104(resolve25(repoDir), ".loki", "runs");
|
|
35706
35753
|
mkdirSync48(d, { recursive: true });
|
|
35707
35754
|
out2.LOKI_BUDGET_LEDGER = join104(d, `group-${process.pid}-${Date.now()}.ledger`);
|
|
35708
35755
|
} catch (e) {
|
|
35709
|
-
out2.LOKI_BUDGET_LEDGER = join104(
|
|
35756
|
+
out2.LOKI_BUDGET_LEDGER = join104(resolve25(repoDir), ".loki", "runs", "unusable", "group.ledger");
|
|
35710
35757
|
process.stderr.write(`budget: cannot create the shared ledger dir (${e instanceof Error ? e.message : String(e)}); units will stop, failing closed
|
|
35711
35758
|
`);
|
|
35712
35759
|
}
|
|
@@ -35716,7 +35763,7 @@ function groupEnv(env, capUsd, repoDir) {
|
|
|
35716
35763
|
function capMeter(raw2, env, onBudget, childDelta) {
|
|
35717
35764
|
const capUsd = parseCapUsd(env.LOKI_E10_MAX_COST_USD) ?? 0, seed = Number(env.LOKI_E10_SPENT_USD);
|
|
35718
35765
|
const m = costMeter(capUsd, seed);
|
|
35719
|
-
const ledger2 = env.LOKI_BUDGET_LEDGER ?
|
|
35766
|
+
const ledger2 = env.LOKI_BUDGET_LEDGER ? resolve25(env.LOKI_BUDGET_LEDGER) : "";
|
|
35720
35767
|
let broken = false;
|
|
35721
35768
|
if (ledger2) {
|
|
35722
35769
|
try {
|
|
@@ -37230,7 +37277,7 @@ var init_prove = __esm(() => {
|
|
|
37230
37277
|
|
|
37231
37278
|
// ../../loki-ts/src/version.ts
|
|
37232
37279
|
import { readFileSync as readFileSync94 } from "fs";
|
|
37233
|
-
import { resolve as
|
|
37280
|
+
import { resolve as resolve26, dirname as dirname46 } from "path";
|
|
37234
37281
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
37235
37282
|
function getVersion() {
|
|
37236
37283
|
if (_version !== null)
|
|
@@ -37243,7 +37290,7 @@ function getVersion() {
|
|
|
37243
37290
|
try {
|
|
37244
37291
|
const here = dirname46(fileURLToPath4(import.meta.url));
|
|
37245
37292
|
const repoRoot = findRepoRootForVersion(here);
|
|
37246
|
-
_version = readFileSync94(
|
|
37293
|
+
_version = readFileSync94(resolve26(repoRoot, "VERSION"), "utf-8").trim();
|
|
37247
37294
|
} catch {
|
|
37248
37295
|
_version = "unknown";
|
|
37249
37296
|
}
|
|
@@ -38020,7 +38067,7 @@ var init_receipt_dsse = __esm(() => {
|
|
|
38020
38067
|
import { createPublicKey as createPublicKey4 } from "crypto";
|
|
38021
38068
|
import { cpSync as cpSync4, copyFileSync as copyFileSync7, existsSync as existsSync72, mkdirSync as mkdirSync53, readdirSync as readdirSync41, readFileSync as readFileSync97, renameSync as renameSync21, rmSync as rmSync35, writeFileSync as writeFileSync56 } from "fs";
|
|
38022
38069
|
import { homedir as homedir12 } from "os";
|
|
38023
|
-
import { basename as
|
|
38070
|
+
import { basename as basename33, dirname as dirname48, join as join109, normalize as normalize7 } from "path";
|
|
38024
38071
|
function publicJwk(pub) {
|
|
38025
38072
|
const { kty, crv, x } = pub.export({ format: "jwk" });
|
|
38026
38073
|
return JSON.stringify({ kty, crv, x, kid: kidOf2(pub), alg: "EdDSA", use: "sig" });
|
|
@@ -38047,7 +38094,7 @@ async function buildPassport(runDir, env = process.env) {
|
|
|
38047
38094
|
return { missing: "receipt holds local paths; passport not published (run loki proof bundle)" };
|
|
38048
38095
|
const envelope = JSON.stringify(signEnvelope(parsed, priv, kid)), jwk = publicJwk(pub);
|
|
38049
38096
|
if (envelope.length + jwk.length > PASSPORT_MAX)
|
|
38050
|
-
return { missing: `passport too large for a PR comment (${envelope.length + jwk.length} bytes); run loki proof bundle ${
|
|
38097
|
+
return { missing: `passport too large for a PR comment (${envelope.length + jwk.length} bytes); run loki proof bundle ${basename33(runDir)}` };
|
|
38051
38098
|
return { envelope, jwk, kid, head: String(parsed["head_sha"]) };
|
|
38052
38099
|
} catch (e) {
|
|
38053
38100
|
return { missing: `passport not issued: ${e instanceof Error ? e.message.split(`
|
|
@@ -38198,12 +38245,12 @@ var init_outbox = __esm(() => {
|
|
|
38198
38245
|
// ../../loki-ts/src/util/failure_memory.ts
|
|
38199
38246
|
import { createHash as createHash26 } from "crypto";
|
|
38200
38247
|
import { appendFileSync as appendFileSync10, existsSync as existsSync74, mkdirSync as mkdirSync55, readFileSync as readFileSync99, renameSync as renameSync23, writeFileSync as writeFileSync57 } from "fs";
|
|
38201
|
-
import { resolve as
|
|
38248
|
+
import { resolve as resolve27 } from "path";
|
|
38202
38249
|
function failureFingerprint(cls, name) {
|
|
38203
38250
|
return createHash26("sha256").update(`${cls}\x00${name}`).digest("hex").slice(0, 16);
|
|
38204
38251
|
}
|
|
38205
38252
|
function readFingerprints(dir) {
|
|
38206
|
-
const p =
|
|
38253
|
+
const p = resolve27(dir, "fingerprints.jsonl");
|
|
38207
38254
|
if (!existsSync74(p))
|
|
38208
38255
|
return [];
|
|
38209
38256
|
try {
|
|
@@ -38225,7 +38272,7 @@ function recordFingerprints(dir, runId, cls, names, tree = "") {
|
|
|
38225
38272
|
if (list.length === 0)
|
|
38226
38273
|
return list;
|
|
38227
38274
|
try {
|
|
38228
|
-
const p =
|
|
38275
|
+
const p = resolve27(dir, "fingerprints.jsonl");
|
|
38229
38276
|
mkdirSync55(dir, { recursive: true });
|
|
38230
38277
|
const ts = new Date().toISOString();
|
|
38231
38278
|
appendFileSync10(p, `${list.map((name) => JSON.stringify({ ts, run: runId, cls, fp: failureFingerprint(cls, name), name, ...tree !== "" ? { tree } : {} })).join(`
|
|
@@ -40321,7 +40368,7 @@ var init_contract = __esm(() => {
|
|
|
40321
40368
|
|
|
40322
40369
|
// ../../loki-ts/src/features/speed/seal_group.ts
|
|
40323
40370
|
import { createHash as createHash29 } from "crypto";
|
|
40324
|
-
import { existsSync as existsSync77, mkdirSync as mkdirSync59, readdirSync as readdirSync42, readFileSync as readFileSync103, renameSync as renameSync24, statSync as
|
|
40371
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync59, readdirSync as readdirSync42, readFileSync as readFileSync103, renameSync as renameSync24, statSync as statSync33, writeFileSync as writeFileSync61 } from "fs";
|
|
40325
40372
|
import { dirname as dirname51, join as join114 } from "path";
|
|
40326
40373
|
function sealGroup(runDir, rh) {
|
|
40327
40374
|
const manifestPath = join114(runDir, "group", "manifest.json");
|
|
@@ -40413,7 +40460,7 @@ async function verifyGroup(receiptPath, receipt, rh, verifyOne, deps = {}) {
|
|
|
40413
40460
|
return bad(`unit ${id} is out of order (index ${String(e["index"])} at position ${i})`);
|
|
40414
40461
|
let bytes;
|
|
40415
40462
|
try {
|
|
40416
|
-
if (!
|
|
40463
|
+
if (!statSync33(dir).isDirectory())
|
|
40417
40464
|
return bad(`unit ${id} is not a directory`);
|
|
40418
40465
|
bytes = readFileSync103(rp);
|
|
40419
40466
|
} catch {
|
|
@@ -40483,8 +40530,8 @@ var init_seal_group = __esm(() => {
|
|
|
40483
40530
|
});
|
|
40484
40531
|
|
|
40485
40532
|
// ../../loki-ts/src/supply/supply_guard.ts
|
|
40486
|
-
import { existsSync as existsSync78, readFileSync as readFileSync104, statSync as
|
|
40487
|
-
import { basename as
|
|
40533
|
+
import { existsSync as existsSync78, readFileSync as readFileSync104, statSync as statSync34 } from "fs";
|
|
40534
|
+
import { basename as basename34, join as join115 } from "path";
|
|
40488
40535
|
function supplyEnabled(env) {
|
|
40489
40536
|
return env["LOKI_SUPPLY_GUARD"] !== "0";
|
|
40490
40537
|
}
|
|
@@ -40496,14 +40543,14 @@ function supplyVerdict(verdict, r) {
|
|
|
40496
40543
|
return r.blocked && verdict === "VERIFIED" ? "FAILED" : verdict;
|
|
40497
40544
|
}
|
|
40498
40545
|
function isManifestPath(path) {
|
|
40499
|
-
return MANIFESTS3.test(
|
|
40546
|
+
return MANIFESTS3.test(basename34(path));
|
|
40500
40547
|
}
|
|
40501
40548
|
function readDeclared(repoDir) {
|
|
40502
40549
|
const p = join115(repoDir, ".loki", DECLARED_FILE);
|
|
40503
40550
|
if (!existsSync78(p))
|
|
40504
40551
|
return { deps: [], problem: null };
|
|
40505
40552
|
try {
|
|
40506
|
-
if (
|
|
40553
|
+
if (statSync34(p).size > MAX_FILE_BYTES)
|
|
40507
40554
|
return { deps: [], problem: "declaration file too large" };
|
|
40508
40555
|
const j = JSON.parse(readFileSync104(p, "utf8"));
|
|
40509
40556
|
if (!Array.isArray(j))
|
|
@@ -40712,7 +40759,7 @@ var MIN_AGE_DAYS = 7, DECLARED_FILE = "supply-declared.json", MAX_CHECKED = 50,
|
|
|
40712
40759
|
}
|
|
40713
40760
|
}, PUBLIC_HOSTS, hostOf = (u) => u.trim().toLowerCase().replace(/^[a-z][a-z0-9+.-]*:\/\//, "").replace(/^www\./, "").split(/[/?#\s]/)[0].replace(/^[^@]*@/, "").replace(/:\d+$/, ""), privateUrl = (u) => /[a-z0-9]/i.test(u) && !PUBLIC_HOSTS.has(hostOf(u)), readSmall2 = (p) => {
|
|
40714
40761
|
try {
|
|
40715
|
-
return
|
|
40762
|
+
return statSync34(p).size <= MAX_FILE_BYTES ? readFileSync104(p, "utf8") : "";
|
|
40716
40763
|
} catch {
|
|
40717
40764
|
return "";
|
|
40718
40765
|
}
|
|
@@ -40772,7 +40819,7 @@ __export(exports_seal, {
|
|
|
40772
40819
|
import { createHash as createHash30 } from "crypto";
|
|
40773
40820
|
import { execFileSync as execFileSync10 } from "child_process";
|
|
40774
40821
|
import { existsSync as existsSync79, readdirSync as readdirSync43, mkdirSync as mkdirSync60, readFileSync as readFileSync105, rmSync as rmSync38 } from "fs";
|
|
40775
|
-
import { basename as
|
|
40822
|
+
import { basename as basename35, isAbsolute as isAbsolute19, join as join116, relative as relative27 } from "path";
|
|
40776
40823
|
function missingLintChecks(vraw, env = process.env) {
|
|
40777
40824
|
if (/^(0|off|false|no)$/i.test((env["LOKI_E10_LINT_MISSING_DISCLOSE"] ?? "").trim()))
|
|
40778
40825
|
return [];
|
|
@@ -41298,7 +41345,8 @@ var init_seal = __esm(() => {
|
|
|
41298
41345
|
const issueSt = byRule ? byRule.map((r, i) => ({ ...r, ...advisory && advisory[i].status === "unmet" && r.status === "met" ? { note: `reviewer note: ${advisory[i].reason ?? ""}`.slice(0, 300) } : {} })) : advisory, issueNotes = !issueSt || verdict3a !== "VERIFIED" ? [] : !byRule && lineCheck?.not_reviewed ? [`acceptance not reviewed: ${lineCheck.not_reviewed}`] : notAddressedNotes(issueSt);
|
|
41299
41346
|
const allLinesMet = !!issueSt && (byRule ? true : !!lineCheck && !lineCheck.not_reviewed) && notAddressedNotes(issueSt).length === 0, unfinished = unfinishedNotes(o.implement);
|
|
41300
41347
|
const proofNotes = proofRun && proofRun.exit !== 0 ? [`Loki's own re-run of the session's proof script did not pass (exit ${proofRun.exit === null ? "none" : proofRun.exit}, ${proofRun.failed} FAILED line(s))`] : [];
|
|
41301
|
-
const
|
|
41348
|
+
const noSecond = !!lineCheck?.not_reviewed;
|
|
41349
|
+
const twoReaders = (xr?.notes ?? []).filter(isUnmetNote).filter((n3) => noSecond || issueAsks.some((line2, i) => advisory?.[i]?.status === "unmet" && n3.toLowerCase().includes(line2.toLowerCase().slice(0, 60)))).map((n3) => noSecond ? `${n3} (the acceptance check did not answer, ${lineCheck.not_reviewed}, so nothing contradicts the review and the count does not carry this line)` : `${n3} (the acceptance check also reads this line as not delivered: two readers agree, so the count does not carry it)`);
|
|
41302
41350
|
const unusedNotes = issueAsks.length ? (await unusedNewFiles(ctx.repoDir, ctx.baseSha, head)).map(unusedNewFileNote) : [];
|
|
41303
41351
|
const openNotes = [...issueNotes, ...proofNotes, ...neverStopNotes(o.implement), ...allLinesMet ? [] : unfinished, ...proveNotes(ctx.provider, o, process.env, ctx.runDir), ...allLinesMet && proofRun?.exit === 0 ? twoReaders : (xr?.notes ?? []).filter(isUnmetNote), ...openDecisionNotes(o), ...namedOpen.filter((s) => s.why === null).map(namedUnchangedNote)], verdict3 = openNotes.length > 0 && verdict3a === "VERIFIED" ? "PARTIAL" : verdict3a;
|
|
41304
41352
|
const deepG = deepGaps(o.verify?.risk, vraw, Array.isArray(o.deep?.checks) ? o.deep.checks : [], modelReviewRan(xr)), notProven2 = new Set([...sealOnlyPass() ? [TIME_RAN_OUT_NOTE] : [], ...deepG.notProven, ...supply.notProven, ...grp.notProven, ...xr?.notes ?? [], ...reviewReceipt(ctx.provider, xr).notProven, ...openNotes]);
|
|
@@ -41348,7 +41396,7 @@ var init_seal = __esm(() => {
|
|
|
41348
41396
|
for (const n3 of strs2(o.fix?.not_proven))
|
|
41349
41397
|
notProven2.add(n3);
|
|
41350
41398
|
if (typeof o.verify?.wall_failure_tail === "string" && o.verify.wall_passed === false) {
|
|
41351
|
-
const tailFile =
|
|
41399
|
+
const tailFile = basename35(o.verify.wall_failure_tail), rel = relative27(ctx.repoDir, join116(ctx.runDir, tailFile));
|
|
41352
41400
|
notProven2.add(`Wall failure output kept: ${rel.startsWith("..") || isAbsolute19(rel) ? `.loki/runs/${ctx.runId}/${tailFile}` : rel}`);
|
|
41353
41401
|
}
|
|
41354
41402
|
for (const x of Array.isArray(o.wall?.arbitrated) ? o.wall.arbitrated : [])
|
|
@@ -41361,7 +41409,7 @@ var init_seal = __esm(() => {
|
|
|
41361
41409
|
notProven2.add(`Wall test not executed: ${wallNotRun} file(s), no reason recorded`);
|
|
41362
41410
|
if (wallNotRun > 0) {
|
|
41363
41411
|
try {
|
|
41364
|
-
const kept = new Set((Array.isArray(o.wall?.files) ? o.wall.files : []).map((f) =>
|
|
41412
|
+
const kept = new Set((Array.isArray(o.wall?.files) ? o.wall.files : []).map((f) => basename35(String(f.path))));
|
|
41365
41413
|
for (const n3 of readdirSync43(sealedWallDir(ctx.runDir)).sort())
|
|
41366
41414
|
if (!kept.has(n3))
|
|
41367
41415
|
notProven2.add(`wall test discarded: ${n3} (not_run)`);
|
|
@@ -41615,7 +41663,7 @@ var init_seal = __esm(() => {
|
|
|
41615
41663
|
// ../../loki-ts/src/util/seal_drift.ts
|
|
41616
41664
|
import { createHash as createHash31, createPublicKey as createPublicKey5, sign as sign3, verify as verify4 } from "crypto";
|
|
41617
41665
|
import { existsSync as existsSync80, lstatSync as lstatSync30, readFileSync as readFileSync106, realpathSync as realpathSync39 } from "fs";
|
|
41618
|
-
import { basename as
|
|
41666
|
+
import { basename as basename36, dirname as dirname53, join as join117, relative as relative28 } from "path";
|
|
41619
41667
|
function tornTail(raw2) {
|
|
41620
41668
|
if (raw2 === "" || raw2.endsWith(`
|
|
41621
41669
|
`))
|
|
@@ -41721,7 +41769,7 @@ function currentTaskSha(runDir, source, env) {
|
|
|
41721
41769
|
}
|
|
41722
41770
|
function repoOf(receiptPath) {
|
|
41723
41771
|
const runs2 = dirname53(dirname53(receiptPath));
|
|
41724
|
-
return
|
|
41772
|
+
return basename36(runs2) === "runs" && basename36(dirname53(runs2)) === ".loki" ? dirname53(dirname53(runs2)) : null;
|
|
41725
41773
|
}
|
|
41726
41774
|
function overlap(repo, base2, sealedHead, head) {
|
|
41727
41775
|
if (typeof base2 !== "string" || !/^[0-9a-f]{40,64}$/.test(base2) || !/^[0-9a-f]{40,64}$/.test(sealedHead))
|
|
@@ -41747,7 +41795,7 @@ function onlyWallPublish(repo, r, sealedHead, head) {
|
|
|
41747
41795
|
} catch {
|
|
41748
41796
|
return x;
|
|
41749
41797
|
}
|
|
41750
|
-
}, rr = real4(repo), want = new Map(wall.map((w) => [relative28(rr, join117(real4(dirname53(String(w.path))),
|
|
41798
|
+
}, rr = real4(repo), want = new Map(wall.map((w) => [relative28(rr, join117(real4(dirname53(String(w.path))), basename36(String(w.path)))), String(w.sha256)]));
|
|
41751
41799
|
const commits = safeGit(repo, ["rev-list", "--reverse", "--topo-order", `${sealedHead}..${head}`]).split(`
|
|
41752
41800
|
`).filter(Boolean);
|
|
41753
41801
|
if (commits.length === 0 || safeGit(repo, ["rev-list", "--merges", "--count", `${sealedHead}..${head}`]).trim() !== "0")
|
|
@@ -41785,7 +41833,7 @@ function claimsWallPublish(repo, r, sealedHead, head) {
|
|
|
41785
41833
|
function sealDrift(given, r, env = process.env) {
|
|
41786
41834
|
let receiptPath = given;
|
|
41787
41835
|
try {
|
|
41788
|
-
receiptPath = join117(realpathSync39(dirname53(given)),
|
|
41836
|
+
receiptPath = join117(realpathSync39(dirname53(given)), basename36(given));
|
|
41789
41837
|
} catch {}
|
|
41790
41838
|
const fab = fabricatedPass(receiptPath, r);
|
|
41791
41839
|
if (fab)
|
|
@@ -43452,11 +43500,11 @@ var init_provider = __esm(() => {
|
|
|
43452
43500
|
|
|
43453
43501
|
// ../../loki-ts/src/util/funnel.ts
|
|
43454
43502
|
import { spawn as spawn10 } from "child_process";
|
|
43455
|
-
import { existsSync as existsSync82, readdirSync as readdirSync45, readFileSync as readFileSync109, statSync as
|
|
43456
|
-
import { join as join120, resolve as
|
|
43503
|
+
import { existsSync as existsSync82, readdirSync as readdirSync45, readFileSync as readFileSync109, statSync as statSync36 } from "fs";
|
|
43504
|
+
import { join as join120, resolve as resolve28 } from "path";
|
|
43457
43505
|
function emitFunnel(kind, key, extra = []) {
|
|
43458
43506
|
try {
|
|
43459
|
-
const script =
|
|
43507
|
+
const script = resolve28(REPO_ROOT, "autonomy", "telemetry.sh");
|
|
43460
43508
|
if (!existsSync82(script))
|
|
43461
43509
|
return;
|
|
43462
43510
|
const fn = kind === "first_run_blocked" ? 'loki_emit_first_run_blocked "$2"' : kind === "run_started" ? "loki_emit_run_started" : kind === "run_finished" ? 'loki_emit_run_finished "$2" "${@:3}"' : 'loki_emit_build_verified_enum VERIFIED "$2"';
|
|
@@ -44277,10 +44325,10 @@ __export(exports_doctor, {
|
|
|
44277
44325
|
CLAUDE_LOGIN_TTL_MS: () => CLAUDE_LOGIN_TTL_MS,
|
|
44278
44326
|
AUTH_PROVIDERS: () => AUTH_PROVIDERS
|
|
44279
44327
|
});
|
|
44280
|
-
import { appendFileSync as appendFileSync12, writeFileSync as writeFileSync65, mkdirSync as mkdirSync62, accessSync as accessSync3, constants as fsConstants3, existsSync as existsSync84, lstatSync as lstatSync31, readdirSync as readdirSync46, readFileSync as readFileSync111, readlinkSync as readlinkSync6, realpathSync as realpathSync40, statSync as
|
|
44328
|
+
import { appendFileSync as appendFileSync12, writeFileSync as writeFileSync65, mkdirSync as mkdirSync62, accessSync as accessSync3, constants as fsConstants3, existsSync as existsSync84, lstatSync as lstatSync31, readdirSync as readdirSync46, readFileSync as readFileSync111, readlinkSync as readlinkSync6, realpathSync as realpathSync40, statSync as statSync37, statfsSync as statfsSync2 } from "fs";
|
|
44281
44329
|
import { spawnSync as spawnSync17 } from "child_process";
|
|
44282
44330
|
import { homedir as homedir15, tmpdir as tmpdir22 } from "os";
|
|
44283
|
-
import { basename as
|
|
44331
|
+
import { basename as basename37, join as join122, resolve as resolve29 } from "path";
|
|
44284
44332
|
function loadRequirements(file = REQUIREMENTS_FILE) {
|
|
44285
44333
|
if (file === REQUIREMENTS_FILE && cached)
|
|
44286
44334
|
return cached;
|
|
@@ -44325,11 +44373,11 @@ function sdkSearchRoots(env, root = REPO_ROOT) {
|
|
|
44325
44373
|
const seam = env["LOKI_SDK_NODE_MODULES"];
|
|
44326
44374
|
if (seam)
|
|
44327
44375
|
return [seam];
|
|
44328
|
-
return [
|
|
44376
|
+
return [resolve29(root, "node_modules"), resolve29(root, "loki-ts/node_modules"), resolve29(root, ".."), resolve29(root, "../..")];
|
|
44329
44377
|
}
|
|
44330
44378
|
function sdkBinaryPath(env, root = REPO_ROOT) {
|
|
44331
44379
|
for (const nm of sdkSearchRoots(env, root)) {
|
|
44332
|
-
const scope =
|
|
44380
|
+
const scope = resolve29(nm, "@anthropic-ai");
|
|
44333
44381
|
if (!existsSync84(scope))
|
|
44334
44382
|
continue;
|
|
44335
44383
|
let names = [];
|
|
@@ -44341,7 +44389,7 @@ function sdkBinaryPath(env, root = REPO_ROOT) {
|
|
|
44341
44389
|
for (const n3 of names) {
|
|
44342
44390
|
if (!n3.startsWith("claude-agent-sdk-"))
|
|
44343
44391
|
continue;
|
|
44344
|
-
const bin =
|
|
44392
|
+
const bin = resolve29(scope, n3, "claude");
|
|
44345
44393
|
try {
|
|
44346
44394
|
accessSync3(bin, fsConstants3.X_OK);
|
|
44347
44395
|
return bin;
|
|
@@ -44567,7 +44615,7 @@ async function probeIntegrations(mfUrl) {
|
|
|
44567
44615
|
}
|
|
44568
44616
|
function loadClaudeCliRange(root = REPO_ROOT) {
|
|
44569
44617
|
try {
|
|
44570
|
-
const cat = JSON.parse(readFileSync111(
|
|
44618
|
+
const cat = JSON.parse(readFileSync111(resolve29(root, "providers/model_catalog.json"), "utf8"));
|
|
44571
44619
|
const cli = cat?.providers?.claude?.cli;
|
|
44572
44620
|
return cli && typeof cli === "object" ? cli : null;
|
|
44573
44621
|
} catch {
|
|
@@ -44588,9 +44636,9 @@ function _setClaudeVersionForTest(fn) {
|
|
|
44588
44636
|
}
|
|
44589
44637
|
function bundledClaudeCodeVersion() {
|
|
44590
44638
|
const rel = "node_modules/@anthropic-ai/claude-agent-sdk/manifest.json";
|
|
44591
|
-
for (const base2 of [
|
|
44639
|
+
for (const base2 of [resolve29(REPO_ROOT, "loki-ts"), REPO_ROOT]) {
|
|
44592
44640
|
try {
|
|
44593
|
-
const v = JSON.parse(readFileSync111(
|
|
44641
|
+
const v = JSON.parse(readFileSync111(resolve29(base2, rel), "utf8"))?.version;
|
|
44594
44642
|
if (typeof v === "string" && v !== "")
|
|
44595
44643
|
return v;
|
|
44596
44644
|
} catch {}
|
|
@@ -44629,9 +44677,9 @@ function checkSkills(selected) {
|
|
|
44629
44677
|
const effective = selected === undefined ? readEffectiveProvider() : selected;
|
|
44630
44678
|
const home = homedir15();
|
|
44631
44679
|
return SKILL_ENTRIES.map(({ name, dir, id }) => {
|
|
44632
|
-
const sdir =
|
|
44680
|
+
const sdir = resolve29(home, dir);
|
|
44633
44681
|
const shortPath = sdir;
|
|
44634
|
-
const skillFile =
|
|
44682
|
+
const skillFile = resolve29(sdir, "SKILL.md");
|
|
44635
44683
|
if (existsSync84(skillFile)) {
|
|
44636
44684
|
return { name, path: shortPath, status: "pass", detail: "", dangling: false };
|
|
44637
44685
|
}
|
|
@@ -44676,7 +44724,7 @@ async function runAllToolChecks() {
|
|
|
44676
44724
|
}));
|
|
44677
44725
|
}
|
|
44678
44726
|
function providerOfferScript() {
|
|
44679
|
-
const p =
|
|
44727
|
+
const p = resolve29(REPO_ROOT, "autonomy/provider-offer.sh");
|
|
44680
44728
|
return existsSync84(p) ? p : null;
|
|
44681
44729
|
}
|
|
44682
44730
|
function readProviderAvailability() {
|
|
@@ -44716,7 +44764,7 @@ async function checkSentrux() {
|
|
|
44716
44764
|
return { found, version: version2, status, required: "optional" };
|
|
44717
44765
|
}
|
|
44718
44766
|
async function checkMemoryHealth() {
|
|
44719
|
-
const { openSync: openSync17, statSync:
|
|
44767
|
+
const { openSync: openSync17, statSync: statSync38, readSync: readSync14, closeSync: closeSync17, existsSync: existsSync85 } = await import("fs");
|
|
44720
44768
|
const { join: join123 } = await import("path");
|
|
44721
44769
|
const TAIL_BYTES2 = 65536;
|
|
44722
44770
|
const lokiDir2 = process.env["LOKI_DIR"] ?? ".loki";
|
|
@@ -44726,7 +44774,7 @@ async function checkMemoryHealth() {
|
|
|
44726
44774
|
try {
|
|
44727
44775
|
if (existsSync85(logPath)) {
|
|
44728
44776
|
exists2 = true;
|
|
44729
|
-
const size =
|
|
44777
|
+
const size = statSync38(logPath).size;
|
|
44730
44778
|
const offset = Math.max(0, size - TAIL_BYTES2);
|
|
44731
44779
|
const len = size - offset;
|
|
44732
44780
|
const buf = Buffer.alloc(len);
|
|
@@ -44756,11 +44804,11 @@ async function checkMemoryHealth() {
|
|
|
44756
44804
|
};
|
|
44757
44805
|
}
|
|
44758
44806
|
function agentSdkFixText(root) {
|
|
44759
|
-
if (existsSync84(
|
|
44807
|
+
if (existsSync84(resolve29(root, "loki-ts/bun.lock")))
|
|
44760
44808
|
return "cd loki-ts && bun install";
|
|
44761
|
-
const parent =
|
|
44762
|
-
if (
|
|
44763
|
-
return
|
|
44809
|
+
const parent = resolve29(root, "..");
|
|
44810
|
+
if (basename37(parent) === "node_modules") {
|
|
44811
|
+
return basename37(resolve29(parent, "..")) === "lib" ? "npm install -g loki-mode@latest" : "npm install loki-mode@latest";
|
|
44764
44812
|
}
|
|
44765
44813
|
return "reinstall loki-mode (npm install -g loki-mode@latest)";
|
|
44766
44814
|
}
|
|
@@ -44773,11 +44821,11 @@ function checkAgentSdkPin(root = REPO_ROOT, env = process.env) {
|
|
|
44773
44821
|
return null;
|
|
44774
44822
|
}
|
|
44775
44823
|
};
|
|
44776
|
-
const deps = readJson7(
|
|
44824
|
+
const deps = readJson7(resolve29(root, "loki-ts/package.json"))?.["dependencies"];
|
|
44777
44825
|
const pinned = typeof deps?.[name] === "string" ? deps[name] : null;
|
|
44778
44826
|
let installed = null;
|
|
44779
44827
|
for (const nm of sdkSearchRoots(env, root)) {
|
|
44780
|
-
const v = readJson7(
|
|
44828
|
+
const v = readJson7(resolve29(nm, name, "package.json"))?.["version"];
|
|
44781
44829
|
if (typeof v === "string" && v !== "") {
|
|
44782
44830
|
installed = v;
|
|
44783
44831
|
break;
|
|
@@ -44798,7 +44846,7 @@ function checkAgentSdkPin(root = REPO_ROOT, env = process.env) {
|
|
|
44798
44846
|
return { status: "pass", pinned, installed, detail: `Agent SDK ${installed} matches the pin` };
|
|
44799
44847
|
}
|
|
44800
44848
|
function describeCatalogFreshness() {
|
|
44801
|
-
const path = process.env["LOKI_MODEL_CATALOG"] ||
|
|
44849
|
+
const path = process.env["LOKI_MODEL_CATALOG"] || resolve29(REPO_ROOT, "providers/model_catalog.json");
|
|
44802
44850
|
let updated;
|
|
44803
44851
|
let ageDays;
|
|
44804
44852
|
try {
|
|
@@ -44873,7 +44921,7 @@ async function checkModelCapabilities(env = process.env) {
|
|
|
44873
44921
|
return { status: "warn", detail: "Skipped: set ANTHROPIC_API_KEY to compare the catalog with models.retrieve", mismatches: [] };
|
|
44874
44922
|
let models;
|
|
44875
44923
|
try {
|
|
44876
|
-
const path = env["LOKI_MODEL_CATALOG"] ||
|
|
44924
|
+
const path = env["LOKI_MODEL_CATALOG"] || resolve29(REPO_ROOT, "providers/model_catalog.json");
|
|
44877
44925
|
models = JSON.parse(readFileSync111(path, "utf-8")).providers?.claude?.models;
|
|
44878
44926
|
if (!Array.isArray(models))
|
|
44879
44927
|
throw new Error("no claude models");
|
|
@@ -45308,7 +45356,7 @@ async function runText(deps = {}) {
|
|
|
45308
45356
|
}
|
|
45309
45357
|
if (!anyProvider) {
|
|
45310
45358
|
let sdkUsable = claudeSdkReady(process.env);
|
|
45311
|
-
const sdkOfferScript =
|
|
45359
|
+
const sdkOfferScript = resolve29(REPO_ROOT, "autonomy/provider-offer.sh");
|
|
45312
45360
|
if (!sdkUsable && existsSync84(sdkOfferScript)) {
|
|
45313
45361
|
const probe = helperSpawn("bash", [sdkOfferScript, "detect-sdk"], { stdio: "ignore" });
|
|
45314
45362
|
sdkUsable = probe.status === 0;
|
|
@@ -45330,7 +45378,7 @@ async function runText(deps = {}) {
|
|
|
45330
45378
|
bump(tally, "fail");
|
|
45331
45379
|
tally.blockers.push("No AI provider CLI. Fix: npm install -g @anthropic-ai/claude-code");
|
|
45332
45380
|
if (process.stdout.isTTY) {
|
|
45333
|
-
const offerScript =
|
|
45381
|
+
const offerScript = resolve29(REPO_ROOT, "autonomy/provider-offer.sh");
|
|
45334
45382
|
if (existsSync84(offerScript)) {
|
|
45335
45383
|
spawnSync17("bash", [offerScript, "report"], { env: tokenFreeEnv(), stdio: "inherit" });
|
|
45336
45384
|
}
|
|
@@ -45727,7 +45775,7 @@ async function runText(deps = {}) {
|
|
|
45727
45775
|
];
|
|
45728
45776
|
const missingDetectors = [];
|
|
45729
45777
|
for (const det of detectors) {
|
|
45730
|
-
if (existsSync84(
|
|
45778
|
+
if (existsSync84(resolve29(REPO_ROOT, "tests", `${det}.sh`))) {
|
|
45731
45779
|
bump(tally, "pass");
|
|
45732
45780
|
} else {
|
|
45733
45781
|
missingDetectors.push(`${det}.sh`);
|
|
@@ -45757,7 +45805,7 @@ async function runText(deps = {}) {
|
|
|
45757
45805
|
const isExec = (p) => {
|
|
45758
45806
|
try {
|
|
45759
45807
|
accessSync3(p, fsConstants3.X_OK);
|
|
45760
|
-
return
|
|
45808
|
+
return statSync37(p).isFile();
|
|
45761
45809
|
} catch {
|
|
45762
45810
|
return false;
|
|
45763
45811
|
}
|
|
@@ -45778,7 +45826,7 @@ async function runText(deps = {}) {
|
|
|
45778
45826
|
seen.add(real4);
|
|
45779
45827
|
if (real4 === runningReal)
|
|
45780
45828
|
continue;
|
|
45781
|
-
const pj =
|
|
45829
|
+
const pj = resolve29(real4, "..", "..", "package.json");
|
|
45782
45830
|
let ver = "";
|
|
45783
45831
|
try {
|
|
45784
45832
|
ver = String(JSON.parse(readFileSync111(pj, "utf8")).version ?? "");
|
|
@@ -45856,7 +45904,7 @@ async function runText(deps = {}) {
|
|
|
45856
45904
|
`);
|
|
45857
45905
|
}
|
|
45858
45906
|
const id = process.env["LOKI_PROVIDER"] || readEffectiveProvider() || "claude";
|
|
45859
|
-
const modelRun = helperSpawn("bash", ["-c", 'source "$1" >/dev/null 2>&1; printf %s "${PROVIDER_MODEL_DEVELOPMENT:-}"', "_",
|
|
45907
|
+
const modelRun = helperSpawn("bash", ["-c", 'source "$1" >/dev/null 2>&1; printf %s "${PROVIDER_MODEL_DEVELOPMENT:-}"', "_", resolve29(REPO_ROOT, "providers", `${id}.sh`)], { encoding: "utf8" });
|
|
45860
45908
|
const model = (modelRun.stdout ?? "").toString().trim() || "default";
|
|
45861
45909
|
const { createPublicKey: createPublicKey6 } = await import("crypto");
|
|
45862
45910
|
const signer = await Promise.resolve().then(() => (init_receipt_signer(), exports_receipt_signer));
|
|
@@ -46044,7 +46092,7 @@ var init_doctor = __esm(() => {
|
|
|
46044
46092
|
init_model_routes();
|
|
46045
46093
|
init_js_resolve();
|
|
46046
46094
|
init_types();
|
|
46047
|
-
REQUIREMENTS_FILE =
|
|
46095
|
+
REQUIREMENTS_FILE = resolve29(REPO_ROOT, "autonomy/lib/setup-requirements.json");
|
|
46048
46096
|
VERSION_NUMBER_RE = /(\d+\.\d+(?:\.\d+)*)/;
|
|
46049
46097
|
pyImpl = { fn: pythonImportOk };
|
|
46050
46098
|
LSP_BINS = [
|
|
@@ -46104,7 +46152,7 @@ __export(exports_first_run_repo, {
|
|
|
46104
46152
|
initEmptyRepo: () => initEmptyRepo,
|
|
46105
46153
|
NOT_A_REPO: () => NOT_A_REPO
|
|
46106
46154
|
});
|
|
46107
|
-
import { readdirSync as readdirSync47, statSync as
|
|
46155
|
+
import { readdirSync as readdirSync47, statSync as statSync38 } from "fs";
|
|
46108
46156
|
import { join as join123 } from "path";
|
|
46109
46157
|
async function initEmptyRepo(dir, env) {
|
|
46110
46158
|
if (env["LOKI_AUTO_GIT_INIT"] === "0")
|
|
@@ -46113,7 +46161,7 @@ async function initEmptyRepo(dir, env) {
|
|
|
46113
46161
|
let empty = false, written = [];
|
|
46114
46162
|
const isFile2 = (f) => {
|
|
46115
46163
|
try {
|
|
46116
|
-
return
|
|
46164
|
+
return statSync38(join123(dir, f)).isFile();
|
|
46117
46165
|
} catch {
|
|
46118
46166
|
return false;
|
|
46119
46167
|
}
|
|
@@ -46491,8 +46539,8 @@ var init_forecast = __esm(() => {
|
|
|
46491
46539
|
});
|
|
46492
46540
|
|
|
46493
46541
|
// ../../loki-ts/src/commands/queue.ts
|
|
46494
|
-
import { existsSync as existsSync86, mkdirSync as mkdirSync65, readFileSync as readFileSync113, readdirSync as readdirSync48, renameSync as renameSync25, statSync as
|
|
46495
|
-
import { join as join126, resolve as
|
|
46542
|
+
import { existsSync as existsSync86, mkdirSync as mkdirSync65, readFileSync as readFileSync113, readdirSync as readdirSync48, renameSync as renameSync25, statSync as statSync39, writeFileSync as writeFileSync67 } from "fs";
|
|
46543
|
+
import { join as join126, resolve as resolve30 } from "path";
|
|
46496
46544
|
function normalizeRef(raw2) {
|
|
46497
46545
|
const m = URL_RE.exec(raw2);
|
|
46498
46546
|
if (m)
|
|
@@ -46737,7 +46785,7 @@ function newestRecord(lokiDir2, since) {
|
|
|
46737
46785
|
const p = join126(dir, name, file);
|
|
46738
46786
|
if (!existsSync86(p))
|
|
46739
46787
|
continue;
|
|
46740
|
-
const t =
|
|
46788
|
+
const t = statSync39(p).mtimeMs;
|
|
46741
46789
|
if (t >= since && (!best || t > best.t))
|
|
46742
46790
|
best = { t, p, name };
|
|
46743
46791
|
}
|
|
@@ -46779,7 +46827,7 @@ function queueStartArgs(ref, pr) {
|
|
|
46779
46827
|
function makeDefaultRunner(lokiDir2) {
|
|
46780
46828
|
return async (ref, opts) => {
|
|
46781
46829
|
const since = Date.now();
|
|
46782
|
-
const argv = [
|
|
46830
|
+
const argv = [resolve30(REPO_ROOT, "bin", "loki"), ...queueStartArgs(ref, !!opts.pr)];
|
|
46783
46831
|
const runLoki = opts.cwd ? join126(opts.cwd, ".loki") : lokiDir2;
|
|
46784
46832
|
const env = runnerEnv(opts, runLoki);
|
|
46785
46833
|
const proc = Bun.spawn(argv, { stdout: "pipe", stderr: "pipe", stdin: "ignore", env, ...opts.cwd ? { cwd: opts.cwd } : {} });
|
|
@@ -47123,7 +47171,7 @@ var init_issues_epic = __esm(() => {
|
|
|
47123
47171
|
|
|
47124
47172
|
// ../../loki-ts/src/util/group_integrate.ts
|
|
47125
47173
|
import { existsSync as existsSync88, mkdirSync as mkdirSync66, readFileSync as readFileSync115, rmSync as rmSync39, writeFileSync as writeFileSync68 } from "fs";
|
|
47126
|
-
import { basename as
|
|
47174
|
+
import { basename as basename38, dirname as dirname55, join as join127, normalize as normalize8 } from "path";
|
|
47127
47175
|
function integrationOrder(dag) {
|
|
47128
47176
|
const ids = dag.units.map((u) => u.id), indeg = new Map(ids.map((i) => [i, 0]));
|
|
47129
47177
|
for (const e of dag.edges)
|
|
@@ -47159,7 +47207,7 @@ async function rerunWalls(runner, repoDir, merged, walls) {
|
|
|
47159
47207
|
}
|
|
47160
47208
|
try {
|
|
47161
47209
|
for (const f of bad ? [] : files) {
|
|
47162
|
-
const rel = normalize8(f.rel), abs = join127(repoDir, rel), r2 = f.runner ?? guessRunner(
|
|
47210
|
+
const rel = normalize8(f.rel), abs = join127(repoDir, rel), r2 = f.runner ?? guessRunner(basename38(rel), harnessRunners([], [rel], process.env, repoDir, [rel]), rel);
|
|
47163
47211
|
if (bad = wallPathProblem(repoDir, rel) ?? (r2 ? undefined : `no runner for ${f.rel}`))
|
|
47164
47212
|
break;
|
|
47165
47213
|
written.push({ abs, prev: existsSync88(abs) ? readFileSync115(abs) : null });
|
|
@@ -48061,10 +48109,10 @@ __export(exports_run_group, {
|
|
|
48061
48109
|
groupCostLine: () => groupCostLine,
|
|
48062
48110
|
NOT_PROVEN: () => NOT_PROVEN
|
|
48063
48111
|
});
|
|
48064
|
-
import { cpSync as cpSync6, existsSync as existsSync90, mkdirSync as mkdirSync68, readdirSync as readdirSync49, readFileSync as readFileSync117, rmSync as rmSync41, statSync as
|
|
48112
|
+
import { cpSync as cpSync6, existsSync as existsSync90, mkdirSync as mkdirSync68, readdirSync as readdirSync49, readFileSync as readFileSync117, rmSync as rmSync41, statSync as statSync40 } from "fs";
|
|
48065
48113
|
import { createHash as createHash32 } from "crypto";
|
|
48066
48114
|
import { spawn as spawn11 } from "child_process";
|
|
48067
|
-
import { join as join129, resolve as
|
|
48115
|
+
import { join as join129, resolve as resolve31 } from "path";
|
|
48068
48116
|
function scopedEnv(env) {
|
|
48069
48117
|
const out3 = {};
|
|
48070
48118
|
for (const [k, v] of Object.entries(env))
|
|
@@ -48144,7 +48192,7 @@ function findResumable(repoDir, specSha, unitIds) {
|
|
|
48144
48192
|
continue;
|
|
48145
48193
|
let at = 0;
|
|
48146
48194
|
try {
|
|
48147
|
-
at =
|
|
48195
|
+
at = statSync40(p).mtimeMs;
|
|
48148
48196
|
} catch {
|
|
48149
48197
|
continue;
|
|
48150
48198
|
}
|
|
@@ -48342,7 +48390,7 @@ async function runGroupCore(launcher, dag, ctx) {
|
|
|
48342
48390
|
atomicWriteJson(spec, { id: u.id, writeSet: u.writeSet, pack: u.writeSet, tokenBudget: 1e9, acceptance: u.acceptance ?? accOf.get(u.id) ?? [], items: u.items ?? [], base: u.base ?? "" });
|
|
48343
48391
|
u.spec = spec;
|
|
48344
48392
|
}
|
|
48345
|
-
const jdir = repoCacheDir(repoKey(git11(repoDir, ["remote", "get-url", "origin"]) || null, repoDir), env.LOKI_CACHE_ROOT ?
|
|
48393
|
+
const jdir = repoCacheDir(repoKey(git11(repoDir, ["remote", "get-url", "origin"]) || null, repoDir), env.LOKI_CACHE_ROOT ? resolve31(env.LOKI_CACHE_ROOT) : undefined);
|
|
48346
48394
|
const keyOf = (u) => sliceKey(JSON.stringify({ id: u.id, items: u.items, writeSet: u.writeSet, acceptance: accOf.get(u.id) ?? [] }), baseRef);
|
|
48347
48395
|
let doneCount = 0;
|
|
48348
48396
|
for (const [i, u] of units.entries()) {
|
|
@@ -48517,7 +48565,7 @@ async function runGroupCore(launcher, dag, ctx) {
|
|
|
48517
48565
|
`);
|
|
48518
48566
|
return 0;
|
|
48519
48567
|
}
|
|
48520
|
-
var NOT_PROVEN = 4, ENV_KEEP, defaultLauncher = (argv, env, cwd, onOut) => new Promise((
|
|
48568
|
+
var NOT_PROVEN = 4, ENV_KEEP, defaultLauncher = (argv, env, cwd, onOut) => new Promise((resolve32) => {
|
|
48521
48569
|
const child = spawn11("python3", argv, { cwd, env, stdio: ["ignore", "pipe", "pipe"] });
|
|
48522
48570
|
let out3 = "";
|
|
48523
48571
|
child.stdout.on("data", (b) => {
|
|
@@ -48528,8 +48576,8 @@ var NOT_PROVEN = 4, ENV_KEEP, defaultLauncher = (argv, env, cwd, onOut) => new P
|
|
|
48528
48576
|
child.stderr.on("data", (b) => {
|
|
48529
48577
|
process.stderr.write(b);
|
|
48530
48578
|
});
|
|
48531
|
-
child.on("error", (e) =>
|
|
48532
|
-
child.on("close", (c) =>
|
|
48579
|
+
child.on("error", (e) => resolve32({ code: 127, stdout: out3 + String(e) }));
|
|
48580
|
+
child.on("close", (c) => resolve32({ code: c ?? 1, stdout: out3 }));
|
|
48533
48581
|
}), git11 = (dir, args) => {
|
|
48534
48582
|
const r = safeGitSpawn(dir, args, { encoding: "utf8" });
|
|
48535
48583
|
return r.status === 0 ? String(r.stdout).trim() : "";
|
|
@@ -48572,7 +48620,7 @@ __export(exports_route, {
|
|
|
48572
48620
|
MAX_SEQ_TASK_BYTES: () => MAX_SEQ_TASK_BYTES
|
|
48573
48621
|
});
|
|
48574
48622
|
import { closeSync as closeSync17, constants as constants4, fstatSync as fstatSync9, openSync as openSync17, readFileSync as readFileSync118, realpathSync as realpathSync41 } from "fs";
|
|
48575
|
-
import { isAbsolute as isAbsolute20, relative as relative29, resolve as
|
|
48623
|
+
import { isAbsolute as isAbsolute20, relative as relative29, resolve as resolve32 } from "path";
|
|
48576
48624
|
function providerSlots(env, provider) {
|
|
48577
48625
|
provider = (provider || env.LOKI_PROVIDER || "claude").toLowerCase();
|
|
48578
48626
|
return { provider, slots: PROVIDER_SLOTS[provider] ?? 1 };
|
|
@@ -48580,7 +48628,7 @@ function providerSlots(env, provider) {
|
|
|
48580
48628
|
function readSpec(task, repoDir, cwd) {
|
|
48581
48629
|
if (/\s/.test(task) || !SPEC_PATH_RE.test(task))
|
|
48582
48630
|
return { kind: "text" };
|
|
48583
|
-
const p = isAbsolute20(task) ? task :
|
|
48631
|
+
const p = isAbsolute20(task) ? task : resolve32(cwd, task);
|
|
48584
48632
|
let real4;
|
|
48585
48633
|
try {
|
|
48586
48634
|
real4 = realpathSync41(p);
|
|
@@ -48749,7 +48797,7 @@ __export(exports_issues_run, {
|
|
|
48749
48797
|
import { spawnSync as spawnSync20 } from "child_process";
|
|
48750
48798
|
import { cpSync as cpSync7, existsSync as existsSync91, mkdirSync as mkdirSync69, mkdtempSync as mkdtempSync19, readdirSync as readdirSync50, readFileSync as readFileSync119, rmdirSync as rmdirSync2, rmSync as rmSync42, writeFileSync as writeFileSync70 } from "fs";
|
|
48751
48799
|
import { tmpdir as tmpdir24 } from "os";
|
|
48752
|
-
import { join as join130, resolve as
|
|
48800
|
+
import { join as join130, resolve as resolve33 } from "path";
|
|
48753
48801
|
import { createInterface as createInterface3 } from "readline";
|
|
48754
48802
|
function epicParallel(env, provider) {
|
|
48755
48803
|
const n3 = Number(env["LOKI_EPIC_PARALLEL"]);
|
|
@@ -49459,7 +49507,7 @@ async function startMany(o) {
|
|
|
49459
49507
|
const env = o.env ?? process.env, { ManyStatus: ManyStatus2, consoleOn: consoleOn2 } = await Promise.resolve().then(() => (init_console(), exports_console));
|
|
49460
49508
|
const userEnv = groupEnv({ ...env, ...o.provider ? { LOKI_PROVIDER: o.provider } : {} }, o.capUsd, o.repoDir);
|
|
49461
49509
|
const tty = consoleOn2(env), status = new ManyStatus2({ write: (s) => void process.stdout.write(s), tty });
|
|
49462
|
-
const d = issuesDeps(o.repoDir, env["LOKI_DIR"] ??
|
|
49510
|
+
const d = issuesDeps(o.repoDir, env["LOKI_DIR"] ?? resolve33(o.repoDir, ".loki"), userEnv, { out: (s) => status.print(s), ...tty ? { err: (s) => status.print(s) } : {}, status, ...o.inject });
|
|
49463
49511
|
try {
|
|
49464
49512
|
return await issuesRun({ slug: o.slug, label: o.label, milestone: null, limit: DEFAULT_LIMIT, parallel: startParallel(env), draft: false, dryRun: false, yes: false, comment: false, split: false, triage: false, json: false, fromStart: true, noPr: o.noPr, ...o.numbers ? { numbers: o.numbers } : {} }, d);
|
|
49465
49513
|
} finally {
|
|
@@ -49502,7 +49550,7 @@ async function runIssues(args, inject) {
|
|
|
49502
49550
|
return 2;
|
|
49503
49551
|
}
|
|
49504
49552
|
const repoDir = inject?.repoDir ?? process.cwd();
|
|
49505
|
-
const lokiDir2 = inject?.lokiDir ?? process.env["LOKI_DIR"] ??
|
|
49553
|
+
const lokiDir2 = inject?.lokiDir ?? process.env["LOKI_DIR"] ?? resolve33(repoDir, ".loki");
|
|
49506
49554
|
const userEnv = { ...process.env };
|
|
49507
49555
|
if (!inject?.triage)
|
|
49508
49556
|
(await Promise.resolve().then(() => (init_github_token(), exports_github_token))).withholdGithubTokens(process.env, () => {});
|
|
@@ -49590,7 +49638,7 @@ __export(exports_supervisor, {
|
|
|
49590
49638
|
import { spawnSync as spawnSync21 } from "child_process";
|
|
49591
49639
|
import { createHash as createHash33, createPublicKey as createPublicKey6, sign as sign4 } from "crypto";
|
|
49592
49640
|
import { existsSync as existsSync92, mkdirSync as mkdirSync70, readFileSync as readFileSync120, writeFileSync as writeFileSync71 } from "fs";
|
|
49593
|
-
import { dirname as dirname57, join as join131, relative as relative30, resolve as
|
|
49641
|
+
import { dirname as dirname57, join as join131, relative as relative30, resolve as resolve34 } from "path";
|
|
49594
49642
|
async function slackEvent(...a) {
|
|
49595
49643
|
try {
|
|
49596
49644
|
await (await Promise.resolve().then(() => (init_slack_events(), exports_slack_events))).notifyEvent(...a);
|
|
@@ -50051,7 +50099,7 @@ async function main3(args) {
|
|
|
50051
50099
|
noteRefusal("unsupported_flag");
|
|
50052
50100
|
return 2;
|
|
50053
50101
|
}
|
|
50054
|
-
sealPatch =
|
|
50102
|
+
sealPatch = resolve34(v);
|
|
50055
50103
|
noPr = true;
|
|
50056
50104
|
i++;
|
|
50057
50105
|
} else if (a === "--" && !eoo)
|
|
@@ -50071,7 +50119,7 @@ usage: loki "<task>" [--no-pr] [--deep] [--json] [--verbose] [--quiet] [--max-co
|
|
|
50071
50119
|
let spec = null;
|
|
50072
50120
|
if (specFile !== null) {
|
|
50073
50121
|
try {
|
|
50074
|
-
spec = loadSpecFile(
|
|
50122
|
+
spec = loadSpecFile(resolve34(specFile));
|
|
50075
50123
|
} catch (e) {
|
|
50076
50124
|
process.stderr.write(`engine10: ${e.message}
|
|
50077
50125
|
`);
|
|
@@ -50405,8 +50453,8 @@ usage: loki "<goal>" (or: loki start <prd.md | owner/repo#N>)
|
|
|
50405
50453
|
env,
|
|
50406
50454
|
capS,
|
|
50407
50455
|
capCeilingS: sized?.ceilingS,
|
|
50408
|
-
workerArgv: [process.execPath, ...SAFE_BUN_FLAGS,
|
|
50409
|
-
deepArgv: noPr ? undefined : [process.execPath, ...SAFE_BUN_FLAGS,
|
|
50456
|
+
workerArgv: [process.execPath, ...SAFE_BUN_FLAGS, resolve34(process.argv[1]), "engine10", "worker", runId2, provider, model, deep ? "deep" : "fast"],
|
|
50457
|
+
deepArgv: noPr ? undefined : [process.execPath, ...SAFE_BUN_FLAGS, resolve34(process.argv[1]), "engine10", "deep-worker", runId2, provider, model],
|
|
50410
50458
|
status: statusStep,
|
|
50411
50459
|
started: {
|
|
50412
50460
|
task_source: isIssue ? "issue" : "text",
|
|
@@ -50589,7 +50637,7 @@ var init_supervisor = __esm(() => {
|
|
|
50589
50637
|
|
|
50590
50638
|
// ../../loki-ts/src/e10ext/compound_match.ts
|
|
50591
50639
|
import { readFileSync as readFileSync121 } from "fs";
|
|
50592
|
-
import { basename as
|
|
50640
|
+
import { basename as basename39, join as join132 } from "path";
|
|
50593
50641
|
function parts(s) {
|
|
50594
50642
|
return s.replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().match(/[a-z0-9]+/g) ?? [];
|
|
50595
50643
|
}
|
|
@@ -50610,9 +50658,9 @@ function fuzzyHit(word2, ps) {
|
|
|
50610
50658
|
}
|
|
50611
50659
|
function linkedHits(word2, repoMap, testMap, repoDir) {
|
|
50612
50660
|
const out3 = [];
|
|
50613
|
-
const srcs = repoMap.entries.filter((e) => !vendored(e.path) && e.symbols.some((s) => fuzzyHit(word2, parts(s))) && fuzzyHit(word2, parts(
|
|
50661
|
+
const srcs = repoMap.entries.filter((e) => !vendored(e.path) && e.symbols.some((s) => fuzzyHit(word2, parts(s))) && fuzzyHit(word2, parts(basename39(e.path))));
|
|
50614
50662
|
for (const t of testMap.tests) {
|
|
50615
|
-
if (vendored(t.path) || !fuzzyHit(word2, parts(
|
|
50663
|
+
if (vendored(t.path) || !fuzzyHit(word2, parts(basename39(t.path))))
|
|
50616
50664
|
continue;
|
|
50617
50665
|
let body;
|
|
50618
50666
|
try {
|
|
@@ -50630,7 +50678,7 @@ function linkedHits(word2, repoMap, testMap, repoDir) {
|
|
|
50630
50678
|
}
|
|
50631
50679
|
return out3;
|
|
50632
50680
|
}
|
|
50633
|
-
var MIN_PREFIX = 5, SUFFIX, VENDORED, vendored = (p) => p.split("/").some((s) => VENDORED.has(s)), stemOf2 = (p) => parts(
|
|
50681
|
+
var MIN_PREFIX = 5, SUFFIX, VENDORED, vendored = (p) => p.split("/").some((s) => VENDORED.has(s)), stemOf2 = (p) => parts(basename39(p)).slice(0, -1).filter((x) => x !== "test" && x !== "spec").join("-");
|
|
50634
50682
|
var init_compound_match = __esm(() => {
|
|
50635
50683
|
SUFFIX = /^(ation|ization|isation|ity|ivity|ments?|ives?|als?|ures?|ness|ism|ist|ize|ise|able|ible|ous|ics?|ings?|ed|ers?|ions?|ly|less|es|s|(ful|hood|ship|dom|ance|ence|ancy|ency|ator|ant|ent|ary|ery|ory|ward|wise|like|ish)s?)$/;
|
|
50636
50684
|
VENDORED = new Set(["vendor", "third_party", "build", ".venv", "__generated__", "coverage", "node_modules", "dist"]);
|
|
@@ -50638,7 +50686,7 @@ var init_compound_match = __esm(() => {
|
|
|
50638
50686
|
|
|
50639
50687
|
// ../../loki-ts/src/util/already_done_evidence.ts
|
|
50640
50688
|
import { existsSync as existsSync93, readFileSync as readFileSync122 } from "fs";
|
|
50641
|
-
import { basename as
|
|
50689
|
+
import { basename as basename40, join as join133 } from "path";
|
|
50642
50690
|
function keywords2(task) {
|
|
50643
50691
|
const words3 = task.toLowerCase().match(/[a-z0-9_]+/g) ?? [];
|
|
50644
50692
|
return Array.from(new Set(words3.filter((w) => w.length > 2 && !STOP_WORDS.has(w))));
|
|
@@ -50659,7 +50707,7 @@ function codeEvidence(words3, repoMap) {
|
|
|
50659
50707
|
function testEvidence(words3, testMap) {
|
|
50660
50708
|
const hits = [];
|
|
50661
50709
|
for (const t of testMap.tests) {
|
|
50662
|
-
const toks2 = tokenSet(
|
|
50710
|
+
const toks2 = tokenSet(basename40(t.path));
|
|
50663
50711
|
if (words3.some((w) => toks2.has(w)))
|
|
50664
50712
|
hits.push({ source: "test", path: t.path, line: t.path });
|
|
50665
50713
|
}
|
|
@@ -50732,7 +50780,7 @@ function citesToken(text4, token) {
|
|
|
50732
50780
|
function citesRealHit(text4, hit2, repoDir) {
|
|
50733
50781
|
if (hit2.source === "changelog")
|
|
50734
50782
|
return false;
|
|
50735
|
-
return (citesToken(text4, hit2.path) || citesToken(text4,
|
|
50783
|
+
return (citesToken(text4, hit2.path) || citesToken(text4, basename40(hit2.path))) && existsSync93(join133(repoDir, hit2.path));
|
|
50736
50784
|
}
|
|
50737
50785
|
function renderAlreadyDoneComment(evidence) {
|
|
50738
50786
|
return ["Loki 10: no change needed. This already appears to be implemented.", "", "Evidence:", ...evidence.map((e) => `- ${e}`), ""].join(`
|
|
@@ -50934,15 +50982,15 @@ __export(exports_warm, {
|
|
|
50934
50982
|
WarmEngine: () => WarmEngine
|
|
50935
50983
|
});
|
|
50936
50984
|
import { createHash as createHash34 } from "crypto";
|
|
50937
|
-
import { existsSync as existsSync94, mkdirSync as mkdirSync71, readFileSync as readFileSync123, statSync as
|
|
50985
|
+
import { existsSync as existsSync94, mkdirSync as mkdirSync71, readFileSync as readFileSync123, statSync as statSync41, unlinkSync as unlinkSync11 } from "fs";
|
|
50938
50986
|
import { createServer as createServer2 } from "net";
|
|
50939
|
-
import { dirname as dirname58, resolve as
|
|
50987
|
+
import { dirname as dirname58, resolve as resolve35 } from "path";
|
|
50940
50988
|
function speedEnabled() {
|
|
50941
50989
|
return process.env["LOKI_SPEED"] !== "0";
|
|
50942
50990
|
}
|
|
50943
50991
|
function warmSocketPath() {
|
|
50944
50992
|
const o = process.env["LOKI_WARM_SOCK"];
|
|
50945
|
-
return o && o.trim() ? o.trim() :
|
|
50993
|
+
return o && o.trim() ? o.trim() : resolve35(homeLokiDir(), "run", "engine.sock");
|
|
50946
50994
|
}
|
|
50947
50995
|
function git12(repoDir, args) {
|
|
50948
50996
|
try {
|
|
@@ -50962,8 +51010,8 @@ function dirtyHash(repoDir) {
|
|
|
50962
51010
|
`);
|
|
50963
51011
|
const rel = line2.slice(3).split(" -> ").pop().replace(/^"|"$/g, "");
|
|
50964
51012
|
try {
|
|
50965
|
-
const p =
|
|
50966
|
-
if (existsSync94(p) &&
|
|
51013
|
+
const p = resolve35(repoDir, rel);
|
|
51014
|
+
if (existsSync94(p) && statSync41(p).isFile() && statSync41(p).size <= MAX_HASHED_BYTES)
|
|
50967
51015
|
h.update(readFileSync123(p));
|
|
50968
51016
|
} catch {}
|
|
50969
51017
|
}
|
|
@@ -50973,7 +51021,7 @@ function warmKey(repoDir) {
|
|
|
50973
51021
|
const tree = git12(repoDir, ["rev-parse", "HEAD^{tree}"]);
|
|
50974
51022
|
if (tree === null)
|
|
50975
51023
|
return null;
|
|
50976
|
-
return `${
|
|
51024
|
+
return `${resolve35(repoDir)}|${tree.trim()}|${dirtyHash(repoDir)}`;
|
|
50977
51025
|
}
|
|
50978
51026
|
|
|
50979
51027
|
class WarmEngine {
|
|
@@ -51216,7 +51264,7 @@ __export(exports_intake, {
|
|
|
51216
51264
|
alreadyDoneCheckOn: () => alreadyDoneCheckOn
|
|
51217
51265
|
});
|
|
51218
51266
|
import { appendFileSync as appendFileSync14, existsSync as existsSync95, mkdirSync as mkdirSync73, readFileSync as readFileSync124, writeFileSync as writeFileSync72 } from "fs";
|
|
51219
|
-
import { dirname as dirname59, join as join135, resolve as
|
|
51267
|
+
import { dirname as dirname59, join as join135, resolve as resolve36 } from "path";
|
|
51220
51268
|
function issueRefOf(raw2) {
|
|
51221
51269
|
return typeof raw2.repo === "string" && raw2.repo && typeof raw2.number === "number" ? `${raw2.repo}#${raw2.number}` : null;
|
|
51222
51270
|
}
|
|
@@ -51238,7 +51286,7 @@ function ensureBranch(repoDir, branch, from) {
|
|
|
51238
51286
|
function excludeLokiDir(repoDir) {
|
|
51239
51287
|
let path = join135(repoDir, ".git", "info", "exclude");
|
|
51240
51288
|
try {
|
|
51241
|
-
path =
|
|
51289
|
+
path = resolve36(repoDir, git13(repoDir, ["rev-parse", "--git-path", "info/exclude"]));
|
|
51242
51290
|
} catch {}
|
|
51243
51291
|
const existing = existsSync95(path) ? readFileSync124(path, "utf8") : "";
|
|
51244
51292
|
if (existing.split(`
|
|
@@ -51487,7 +51535,7 @@ __export(exports_fix, {
|
|
|
51487
51535
|
fixStage: () => fixStage,
|
|
51488
51536
|
buildFixBrief: () => buildFixBrief
|
|
51489
51537
|
});
|
|
51490
|
-
import { relative as relative31, resolve as
|
|
51538
|
+
import { relative as relative31, resolve as resolve37 } from "path";
|
|
51491
51539
|
function isTestFailure(g2) {
|
|
51492
51540
|
return !g2.signature.startsWith("lint:") && g2.signature !== "select-tests";
|
|
51493
51541
|
}
|
|
@@ -51578,7 +51626,7 @@ ${g2.sample}`)].join(`
|
|
|
51578
51626
|
|
|
51579
51627
|
`) || null;
|
|
51580
51628
|
const fullBrief = buildFixBrief(task, groups, diffStat2, repeated ? { priorDiagnosis: prevDiag } : undefined, holdoutFailed, hintsPlus);
|
|
51581
|
-
let r = await runFixSession(ctx, sessionBase, `${ctx.runId}-fix${round2}`, prior.fix?.iteration_ids ?? [], chain, actualModel, fullBrief, buildFixResumeBrief(groups, diffStat2, prevDiag, holdoutFailed, [...prior.implement?.tests_reverted ?? [], ...prior.fix?.tests_reverted ?? []].map((f) => relative31(ctx.repoDir,
|
|
51629
|
+
let r = await runFixSession(ctx, sessionBase, `${ctx.runId}-fix${round2}`, prior.fix?.iteration_ids ?? [], chain, actualModel, fullBrief, buildFixResumeBrief(groups, diffStat2, prevDiag, holdoutFailed, [...prior.implement?.tests_reverted ?? [], ...prior.fix?.tests_reverted ?? []].map((f) => relative31(ctx.repoDir, resolve37(ctx.repoDir, f))), hintsPlus));
|
|
51582
51630
|
const ro = prior.wall?.readOnlyFiles ?? [], wd = r.session.markers.specConflict && !r.session.killed ? await adjudicateWallConflict(ctx, { ...sessionBase, iterationId: r.ids[r.ids.length - 1], brief: fullBrief }, r.session, ro) : null;
|
|
51583
51631
|
if (wd)
|
|
51584
51632
|
r = { ...r, session: wd.session, ids: [...r.ids, ...wd.ids] };
|
|
@@ -53305,7 +53353,7 @@ var init_seal2 = __esm(() => {
|
|
|
53305
53353
|
import { spawnSync as spawnSync24 } from "child_process";
|
|
53306
53354
|
import { copyFileSync as copyFileSync10, existsSync as existsSync100, linkSync as linkSync4, mkdirSync as mkdirSync77, mkdtempSync as mkdtempSync22, readFileSync as readFileSync130, renameSync as renameSync27, rmSync as rmSync45, rmdirSync as rmdirSync3, writeFileSync as writeFileSync76 } from "fs";
|
|
53307
53355
|
import { tmpdir as tmpdir27 } from "os";
|
|
53308
|
-
import { basename as
|
|
53356
|
+
import { basename as basename41, dirname as dirname62, join as join143 } from "path";
|
|
53309
53357
|
function search(unitSource, seedCases, propose, runCapture, opts = {}) {
|
|
53310
53358
|
const maxRounds = opts.maxRounds ?? 10;
|
|
53311
53359
|
const plateauLimit = opts.plateauRounds ?? 2;
|
|
@@ -53415,7 +53463,7 @@ function makeProposeInputs(session, cap = 20) {
|
|
|
53415
53463
|
return (unitPath, missing, round2) => {
|
|
53416
53464
|
const cwd = mkdtempSync22(join143(tmpdir27(), "m27-propose-"));
|
|
53417
53465
|
try {
|
|
53418
|
-
const unitFile = join143(cwd,
|
|
53466
|
+
const unitFile = join143(cwd, basename41(unitPath));
|
|
53419
53467
|
copyFileSync10(unitPath, unitFile);
|
|
53420
53468
|
session({ cwd, env: tokenFreeEnv(), unitFile, missing, round: round2 });
|
|
53421
53469
|
const out3 = [];
|
|
@@ -54820,7 +54868,7 @@ var init_unit = __esm(() => {
|
|
|
54820
54868
|
|
|
54821
54869
|
// ../../loki-ts/src/engine10/modernize/wave.ts
|
|
54822
54870
|
import { spawnSync as spawnSync26 } from "child_process";
|
|
54823
|
-
import { readFileSync as readFileSync136, statSync as
|
|
54871
|
+
import { readFileSync as readFileSync136, statSync as statSync42 } from "fs";
|
|
54824
54872
|
import { join as join149 } from "path";
|
|
54825
54873
|
function clampTimeout(ms) {
|
|
54826
54874
|
if (ms === undefined || !Number.isFinite(ms) || ms <= 0)
|
|
@@ -54902,7 +54950,7 @@ function detectWaveCommands(inv, target) {
|
|
|
54902
54950
|
if (system === "gradle") {
|
|
54903
54951
|
let gw = "gradle";
|
|
54904
54952
|
try {
|
|
54905
|
-
if (inv.files.includes("gradlew") && (
|
|
54953
|
+
if (inv.files.includes("gradlew") && (statSync42(join149(target, "gradlew")).mode & 73) !== 0)
|
|
54906
54954
|
gw = "./gradlew";
|
|
54907
54955
|
} catch {}
|
|
54908
54956
|
return { build: { argv: [gw, "assemble"] }, integration: text4().includes("integrationTest") ? { argv: [gw, "integrationTest"] } : null, original_suite: { argv: [gw, "test"] } };
|
|
@@ -54946,7 +54994,7 @@ var init_wave = __esm(() => {
|
|
|
54946
54994
|
|
|
54947
54995
|
// ../../loki-ts/src/util/modernize_unit.ts
|
|
54948
54996
|
import { spawnSync as spawnSync27 } from "child_process";
|
|
54949
|
-
import { existsSync as existsSync103, lstatSync as lstatSync33, mkdtempSync as mkdtempSync23, readFileSync as readFileSync137, realpathSync as realpathSync43, rmSync as rmSync47, statSync as
|
|
54997
|
+
import { existsSync as existsSync103, lstatSync as lstatSync33, mkdtempSync as mkdtempSync23, readFileSync as readFileSync137, realpathSync as realpathSync43, rmSync as rmSync47, statSync as statSync43, writeFileSync as writeFileSync80 } from "fs";
|
|
54950
54998
|
import { tmpdir as tmpdir29 } from "os";
|
|
54951
54999
|
import { join as join150, sep as sep23 } from "path";
|
|
54952
55000
|
function parseUnitArgs(args) {
|
|
@@ -55171,7 +55219,7 @@ var UNIT_USAGE = "loki modernize unit --repo <owner/name> --ref <ref> --unit <id
|
|
|
55171
55219
|
return s.size === 1 ? [...s][0] : null;
|
|
55172
55220
|
}, isRealDir = (p) => {
|
|
55173
55221
|
try {
|
|
55174
|
-
return !lstatSync33(p).isSymbolicLink() &&
|
|
55222
|
+
return !lstatSync33(p).isSymbolicLink() && statSync43(p).isDirectory();
|
|
55175
55223
|
} catch {
|
|
55176
55224
|
return false;
|
|
55177
55225
|
}
|
|
@@ -55485,7 +55533,7 @@ __export(exports_cli, {
|
|
|
55485
55533
|
main: () => main6,
|
|
55486
55534
|
USAGE: () => USAGE2
|
|
55487
55535
|
});
|
|
55488
|
-
import { existsSync as existsSync105, statSync as
|
|
55536
|
+
import { existsSync as existsSync105, statSync as statSync44 } from "fs";
|
|
55489
55537
|
function parseArgs2(args) {
|
|
55490
55538
|
let repoDir = null;
|
|
55491
55539
|
let target = null;
|
|
@@ -55622,7 +55670,7 @@ ${USAGE2}`);
|
|
|
55622
55670
|
return 2;
|
|
55623
55671
|
}
|
|
55624
55672
|
const opts = parsed.opts;
|
|
55625
|
-
if (!existsSync105(opts.repoDir) || !
|
|
55673
|
+
if (!existsSync105(opts.repoDir) || !statSync44(opts.repoDir).isDirectory()) {
|
|
55626
55674
|
process.stderr.write(`modernize: not a directory: ${opts.repoDir}
|
|
55627
55675
|
`);
|
|
55628
55676
|
return 2;
|
|
@@ -56131,10 +56179,10 @@ var init_undo = __esm(() => {
|
|
|
56131
56179
|
});
|
|
56132
56180
|
|
|
56133
56181
|
// ../../loki-ts/src/commands/run_status.ts
|
|
56134
|
-
import { existsSync as existsSync107, readdirSync as readdirSync53, readFileSync as readFileSync140, statSync as
|
|
56135
|
-
import { basename as
|
|
56182
|
+
import { existsSync as existsSync107, readdirSync as readdirSync53, readFileSync as readFileSync140, statSync as statSync45 } from "fs";
|
|
56183
|
+
import { basename as basename42, dirname as dirname64, join as join153, resolve as resolve38 } from "path";
|
|
56136
56184
|
function runsRoot(env, repoDir) {
|
|
56137
|
-
return env.LOKI_DIR ? join153(
|
|
56185
|
+
return env.LOKI_DIR ? join153(resolve38(repoDir, env.LOKI_DIR), "runs") : join153(repoDir, ".loki", "runs");
|
|
56138
56186
|
}
|
|
56139
56187
|
function listRunIds(root) {
|
|
56140
56188
|
if (!existsSync107(root))
|
|
@@ -56190,9 +56238,9 @@ __export(exports_base_guard, {
|
|
|
56190
56238
|
});
|
|
56191
56239
|
import { execFileSync as execFileSync12 } from "child_process";
|
|
56192
56240
|
import { createHash as createHash39 } from "crypto";
|
|
56193
|
-
import { existsSync as existsSync108, mkdirSync as mkdirSync81, mkdtempSync as mkdtempSync25, readdirSync as readdirSync54, readFileSync as readFileSync141, readlinkSync as readlinkSync8, realpathSync as realpathSync44, rmSync as rmSync49, statSync as
|
|
56241
|
+
import { existsSync as existsSync108, mkdirSync as mkdirSync81, mkdtempSync as mkdtempSync25, readdirSync as readdirSync54, readFileSync as readFileSync141, readlinkSync as readlinkSync8, realpathSync as realpathSync44, rmSync as rmSync49, statSync as statSync46, symlinkSync as symlinkSync6, utimesSync, writeFileSync as writeFileSync82 } from "fs";
|
|
56194
56242
|
import { tmpdir as tmpdir31 } from "os";
|
|
56195
|
-
import { basename as
|
|
56243
|
+
import { basename as basename43, dirname as dirname65, join as join154, relative as relative32, resolve as resolve39, sep as sep24 } from "path";
|
|
56196
56244
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
56197
56245
|
function git14(repoDir, args, timeout = 20000, extraEnv = {}) {
|
|
56198
56246
|
try {
|
|
@@ -56289,7 +56337,7 @@ function noteOf(intake) {
|
|
|
56289
56337
|
}
|
|
56290
56338
|
function insideAny(p, roots) {
|
|
56291
56339
|
const under3 = (q) => roots.some((r) => q === r || q.startsWith(r + sep24));
|
|
56292
|
-
if (under3(
|
|
56340
|
+
if (under3(resolve39(p)))
|
|
56293
56341
|
return true;
|
|
56294
56342
|
try {
|
|
56295
56343
|
return under3(realpathSync44(p));
|
|
@@ -56299,7 +56347,7 @@ function insideAny(p, roots) {
|
|
|
56299
56347
|
}
|
|
56300
56348
|
function namedPaths2(file, text4) {
|
|
56301
56349
|
const out3 = text4.split(/\r?\n/).map((l) => l.trim()).filter((l) => l !== "");
|
|
56302
|
-
if (
|
|
56350
|
+
if (basename43(file) !== "direct_url.json")
|
|
56303
56351
|
return out3;
|
|
56304
56352
|
const url = JSON.parse(text4).url;
|
|
56305
56353
|
return typeof url === "string" && url.startsWith("file:") ? [...out3, fileURLToPath5(url)] : out3;
|
|
@@ -56307,7 +56355,7 @@ function namedPaths2(file, text4) {
|
|
|
56307
56355
|
function depsSeeHead(pkgDir, repoDir) {
|
|
56308
56356
|
let roots;
|
|
56309
56357
|
try {
|
|
56310
|
-
roots = [...new Set([
|
|
56358
|
+
roots = [...new Set([resolve39(repoDir), realpathSync44(repoDir)])];
|
|
56311
56359
|
} catch {
|
|
56312
56360
|
return true;
|
|
56313
56361
|
}
|
|
@@ -56318,7 +56366,7 @@ function depsSeeHead(pkgDir, repoDir) {
|
|
|
56318
56366
|
return true;
|
|
56319
56367
|
const p = join154(dir, e.name);
|
|
56320
56368
|
if (e.isSymbolicLink()) {
|
|
56321
|
-
const t =
|
|
56369
|
+
const t = resolve39(dir, readlinkSync8(p));
|
|
56322
56370
|
let rt = t;
|
|
56323
56371
|
try {
|
|
56324
56372
|
rt = realpathSync44(t);
|
|
@@ -56340,7 +56388,7 @@ function depsSeeHead(pkgDir, repoDir) {
|
|
|
56340
56388
|
return ["node_modules", ".venv"].some((d) => {
|
|
56341
56389
|
try {
|
|
56342
56390
|
const top = join154(pkgDir, d);
|
|
56343
|
-
return walk(top, [...new Set([
|
|
56391
|
+
return walk(top, [...new Set([resolve39(top), realpathSync44(top)])]);
|
|
56344
56392
|
} catch (e) {
|
|
56345
56393
|
if (e.code === "ENOENT")
|
|
56346
56394
|
return false;
|
|
@@ -56412,7 +56460,7 @@ function envChangedSince(repoDir, pkgDir, sinceMs, ignored, deps) {
|
|
|
56412
56460
|
try {
|
|
56413
56461
|
const roots = [];
|
|
56414
56462
|
for (const rel of ignored) {
|
|
56415
|
-
const st =
|
|
56463
|
+
const st = statSync46(join154(repoDir, rel), { throwIfNoEntry: false });
|
|
56416
56464
|
if (!st)
|
|
56417
56465
|
return true;
|
|
56418
56466
|
if (!st.isDirectory() && !TOOL_OUTPUT_FILE.test(rel))
|
|
@@ -56514,11 +56562,11 @@ function splitDeclaredAdvisories(notes, c) {
|
|
|
56514
56562
|
return "";
|
|
56515
56563
|
}).join(`
|
|
56516
56564
|
`);
|
|
56517
|
-
const named2 = (f) => new RegExp(`${f.includes("/") ? `(?<![\\w./-])${escapeRegex(f)}(?![\\w-])|` : ""}[/"'\`]${escapeRegex(
|
|
56565
|
+
const named2 = (f) => new RegExp(`${f.includes("/") ? `(?<![\\w./-])${escapeRegex(f)}(?![\\w-])|` : ""}[/"'\`]${escapeRegex(basename43(f))}(?=["'\`\\s);]|$)`).test(wall());
|
|
56518
56566
|
const linkOk = (f) => {
|
|
56519
56567
|
try {
|
|
56520
56568
|
const root = realpathSync44(c.repoDir), t = realpathSync44(join154(c.repoDir, f)), rel = relative32(root, t);
|
|
56521
|
-
return !rel.startsWith("..") && !rel.split(sep24).includes(".git") &&
|
|
56569
|
+
return !rel.startsWith("..") && !rel.split(sep24).includes(".git") && statSync46(t).isFile() && changed.has(rel.split(sep24).join("/")) && !isTestFile(rel) && !c.wallPaths.includes(rel);
|
|
56522
56570
|
} catch {
|
|
56523
56571
|
return false;
|
|
56524
56572
|
}
|
|
@@ -56553,7 +56601,7 @@ function removeRunWorktrees(repoDir, baseSha) {
|
|
|
56553
56601
|
roots.push(realpathSync44(tmpdir31()));
|
|
56554
56602
|
} catch {}
|
|
56555
56603
|
for (const t of checkedOut(repoDir).trees.slice(1)) {
|
|
56556
|
-
const named2 = RUN_TMP_WORKTREE_RE.test(
|
|
56604
|
+
const named2 = RUN_TMP_WORKTREE_RE.test(basename43(t.path)) || RUN_TMP_WORKTREE_RE.test(basename43(dirname65(t.path)));
|
|
56557
56605
|
if (t.detached && t.head === baseSha && named2 && roots.some((r) => t.path.startsWith(r + sep24)))
|
|
56558
56606
|
git14(repoDir, ["worktree", "remove", "--force", "--force", t.path]);
|
|
56559
56607
|
}
|
|
@@ -56617,8 +56665,8 @@ function removeOwnWallFiles(repoDir, runId2) {
|
|
|
56617
56665
|
for (const f of files) {
|
|
56618
56666
|
if (typeof f.path !== "string" || typeof f.sha256 !== "string")
|
|
56619
56667
|
continue;
|
|
56620
|
-
const abs =
|
|
56621
|
-
if (rel.startsWith("..") || rel.startsWith(".loki/") || !
|
|
56668
|
+
const abs = resolve39(repoDir, f.path), rel = relative32(repoDir, abs);
|
|
56669
|
+
if (rel.startsWith("..") || rel.startsWith(".loki/") || !basename43(rel).startsWith("loki_wall_"))
|
|
56622
56670
|
continue;
|
|
56623
56671
|
if (git14(repoDir, ["ls-files", "--error-unmatch", "--", rel]) !== null)
|
|
56624
56672
|
continue;
|
|
@@ -56744,7 +56792,7 @@ var init_base_guard = __esm(() => {
|
|
|
56744
56792
|
init_stop_restore();
|
|
56745
56793
|
REPO_LINK_FILE = /\.pth$|\.egg-link$|^direct_url\.json$|^__editable___.*_finder\.py$/;
|
|
56746
56794
|
RUNNER_CACHE_DIRS = [".vite", ".vite-temp", ".vitest", ".vitest-cache", ".cache", "__pycache__", ".pytest_cache"];
|
|
56747
|
-
TOOL_OUTPUT_FILE = /(?:^|\/)(?:[^/]*\.tsbuildinfo|\.eslintcache|\.stylelintcache|\.DS_Store)$/;
|
|
56795
|
+
TOOL_OUTPUT_FILE = /(?:^|\/)(?:[^/]*\.tsbuildinfo|\.eslintcache|\.stylelintcache|\.DS_Store|next-env\.d\.ts)$/;
|
|
56748
56796
|
ADVISORY_PATH = /^(?:test configuration changed|runner config changed): (.+?)(?: \(.*\))?$|^symlink added by the change .*?\): (.+)$/;
|
|
56749
56797
|
E10_BRANCH_RE = /^loki\/(e10-[A-Za-z0-9-]+)$/;
|
|
56750
56798
|
RUN_TMP_WORKTREE_RE = /^(?:e10-base-|e10-loadown-|loki-mutproof-)/;
|
|
@@ -56810,9 +56858,9 @@ __export(exports_verify, {
|
|
|
56810
56858
|
COLLATERAL_RED: () => COLLATERAL_RED,
|
|
56811
56859
|
BCE_REASON: () => BCE_REASON
|
|
56812
56860
|
});
|
|
56813
|
-
import { existsSync as existsSync109, mkdtempSync as mkdtempSync26, readFileSync as readFileSync142, realpathSync as realpathSync45, rmSync as rmSync50, statSync as
|
|
56861
|
+
import { existsSync as existsSync109, mkdtempSync as mkdtempSync26, readFileSync as readFileSync142, realpathSync as realpathSync45, rmSync as rmSync50, statSync as statSync47 } from "fs";
|
|
56814
56862
|
import { tmpdir as tmpdir32 } from "os";
|
|
56815
|
-
import { basename as
|
|
56863
|
+
import { basename as basename44, dirname as dirname66, isAbsolute as isAbsolute21, join as join155, relative as relative33, resolve as resolve40 } from "path";
|
|
56816
56864
|
function carriedTimeouts(prev, tests, changed, keep, env = process.env) {
|
|
56817
56865
|
if (!timeoutCarryOn(env))
|
|
56818
56866
|
return [];
|
|
@@ -56851,15 +56899,15 @@ ${tail2(f.out)}
|
|
|
56851
56899
|
}
|
|
56852
56900
|
function collateralTests(relevant2, named2) {
|
|
56853
56901
|
const stems = new Set(named2.flatMap((f) => {
|
|
56854
|
-
const s =
|
|
56855
|
-
return /^(index|__init__|mod)$/.test(s) && f.includes("/") ? [s,
|
|
56902
|
+
const s = basename44(f).replace(/\.[^.]+$/, "");
|
|
56903
|
+
return /^(index|__init__|mod)$/.test(s) && f.includes("/") ? [s, basename44(f.slice(0, f.lastIndexOf("/")))] : [s];
|
|
56856
56904
|
}));
|
|
56857
56905
|
return relevant2.filter((t) => !named2.includes(t.path) && !stems.has(coveredStem(t.path)));
|
|
56858
56906
|
}
|
|
56859
56907
|
function ownTests(relevant2, named2, changed) {
|
|
56860
56908
|
const src = named2.filter((f) => !isTestFile(f) && changed.includes(f)).map((f) => {
|
|
56861
56909
|
const d = f.includes("/") ? f.slice(0, f.lastIndexOf("/")) : ".";
|
|
56862
|
-
const s =
|
|
56910
|
+
const s = basename44(f).replace(/\.[^.]+$/, "");
|
|
56863
56911
|
return { d, s };
|
|
56864
56912
|
});
|
|
56865
56913
|
const inDir = (t, d) => {
|
|
@@ -57059,7 +57107,7 @@ async function vitestBatch(cwd, rels, signal, opts = {}) {
|
|
|
57059
57107
|
}
|
|
57060
57108
|
}, byAbs = new Map;
|
|
57061
57109
|
for (const rel of rels)
|
|
57062
|
-
for (const p of [
|
|
57110
|
+
for (const p of [resolve40(cwd, rel), real4(resolve40(cwd, rel))])
|
|
57063
57111
|
byAbs.set(p, rel);
|
|
57064
57112
|
const out3 = new Map;
|
|
57065
57113
|
for (const tr of tests) {
|
|
@@ -57198,7 +57246,7 @@ function changedSymbolsFirst(ctx, tests, changed) {
|
|
|
57198
57246
|
return [...hits, ...tests.filter((t) => !hits.includes(t))];
|
|
57199
57247
|
}
|
|
57200
57248
|
function uncausedRed(c, changed, symbols, excerpt2) {
|
|
57201
|
-
const names = (t) => changed.some((f) => t.includes(f) || t.includes(
|
|
57249
|
+
const names = (t) => changed.some((f) => t.includes(f) || t.includes(basename44(f)));
|
|
57202
57250
|
if ((c.ids ?? []).some(names) || names(c.name))
|
|
57203
57251
|
return false;
|
|
57204
57252
|
if (c.name.startsWith("lint:")) {
|
|
@@ -57296,7 +57344,7 @@ function baseMemo(runDir, baseSha, on = baseMemoOn()) {
|
|
|
57296
57344
|
};
|
|
57297
57345
|
}
|
|
57298
57346
|
async function subtractBase(ctx, api, checks, tests, changed, wall, rel, signal, zeroOk = true, zeroIntake = zeroGate(null), dep = new Set, own = rel, symbols = []) {
|
|
57299
|
-
const out3 = { ids: [], names: [], knownRed: [], sameError: [], quiet: [], shapeDiffers: [], weak: [], zero: [], cnt: {}, envCrash: [] };
|
|
57347
|
+
const out3 = { ids: [], names: [], knownRed: [], sameError: [], quiet: [], shapeDiffers: [], compared: [], weak: [], zero: [], cnt: {}, envCrash: [] };
|
|
57300
57348
|
const pairs = checks.flatMap((c) => {
|
|
57301
57349
|
const t = tests.find((x) => testCheckName(x) === c.name);
|
|
57302
57350
|
return t ? [{ c, t }] : [];
|
|
@@ -57325,7 +57373,8 @@ async function subtractBase(ctx, api, checks, tests, changed, wall, rel, signal,
|
|
|
57325
57373
|
git15(["-c", "core.hooksPath=/dev/null", "worktree", "add", "--detach", dir, ctx.baseSha]);
|
|
57326
57374
|
const base2 = new Map;
|
|
57327
57375
|
const record = (c, b) => {
|
|
57328
|
-
|
|
57376
|
+
const red2 = !b.ok && !b.cut ? failIds(b.out) : [];
|
|
57377
|
+
base2.set(c, { red: red2, n: ran(b.out) ?? summaryPassFailCount(b.out), sk: skipped2(b.out), out: b.cut ? "" : b.out, live: b.ok && !b.cut || red2.length > 0 });
|
|
57329
57378
|
};
|
|
57330
57379
|
await baseGoBatch(sus.map(({ c, t }) => ({ c, t, bc: commandFor(t, dir, api) })), signal, record);
|
|
57331
57380
|
for (const { c, t } of sus) {
|
|
@@ -57386,6 +57435,8 @@ async function subtractBase(ctx, api, checks, tests, changed, wall, rel, signal,
|
|
|
57386
57435
|
const progress = checks.some((c) => wall.has(c.name) && c.result === "pass") || sus.some(({ c }) => !out3.weak.includes(c.name) && base2.get(c).red.length > 0 && (c.n ?? 0) >= base2.get(c).n);
|
|
57387
57436
|
{
|
|
57388
57437
|
for (const { c } of un) {
|
|
57438
|
+
if (c.result === "fail" && c.ids?.length && base2.get(c)?.live)
|
|
57439
|
+
out3.compared.push(c.name);
|
|
57389
57440
|
if (own.has(c.name) || c.result !== "fail" || !c.ids?.length || !comparableIds(c.ids).every((i) => base2.get(c)?.red.includes(i)))
|
|
57390
57441
|
continue;
|
|
57391
57442
|
out3.knownRed.push(c.name);
|
|
@@ -57455,7 +57506,7 @@ function tscOnlyIgnored(repoDir, cwd, out3) {
|
|
|
57455
57506
|
const target = join155(dirname66(file), mod).replace(/\.(js|mjs|cjs|jsx)$/, "");
|
|
57456
57507
|
return ![target, ...[".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".d.ts"].map((e) => target + e), ...["index.ts", "index.tsx", "index.js"].map((e) => join155(target, e))].some((t) => {
|
|
57457
57508
|
try {
|
|
57458
|
-
return
|
|
57509
|
+
return statSync47(t).isFile();
|
|
57459
57510
|
} catch {
|
|
57460
57511
|
return false;
|
|
57461
57512
|
}
|
|
@@ -57667,7 +57718,7 @@ var init_verify = __esm(() => {
|
|
|
57667
57718
|
const rec2 = recorded.get(p), found = map.tests.find((t) => t.path === p && (!rec2 || t.runner === rec2));
|
|
57668
57719
|
if (found)
|
|
57669
57720
|
return [found];
|
|
57670
|
-
const runner = rec2 ?? guessRunner(
|
|
57721
|
+
const runner = rec2 ?? guessRunner(basename44(p), map.runners, p);
|
|
57671
57722
|
return runner && (runner !== "bun" || map.runners.includes("bun") || /[._](?:test|spec)\.[cm]?[jt]sx?$/.test(p)) ? [{ runner, path: p }] : [];
|
|
57672
57723
|
});
|
|
57673
57724
|
const dep = dependentTests(ctx.repoDir, map, changed, [...impacted, ...changedTestFiles, ...wallTests, ...relevant2]), depNames = new Set(dep.tests.map(testCheckName));
|
|
@@ -57735,6 +57786,15 @@ var init_verify = __esm(() => {
|
|
|
57735
57786
|
const root = api?.packageRootOf(rel) ?? ".";
|
|
57736
57787
|
return [...new Set([root, "."])].every((d) => !envChangedSince(ctx.repoDir, d === "." ? ctx.repoDir : join155(ctx.repoDir, d), zgEnv.sinceMs, zgEnv.ignored ?? null, zgEnv.deps));
|
|
57737
57788
|
};
|
|
57789
|
+
const depsSeen = new Map, depsAsIntake = (rel) => {
|
|
57790
|
+
if (zgEnv.sinceMs === undefined)
|
|
57791
|
+
return false;
|
|
57792
|
+
return [...new Set([api?.packageRootOf(rel) ?? ".", "."])].every((d) => {
|
|
57793
|
+
if (!depsSeen.has(d))
|
|
57794
|
+
depsSeen.set(d, !envChangedSince(ctx.repoDir, d === "." ? ctx.repoDir : join155(ctx.repoDir, d), zgEnv.sinceMs, [], zgEnv.deps));
|
|
57795
|
+
return depsSeen.get(d);
|
|
57796
|
+
});
|
|
57797
|
+
};
|
|
57738
57798
|
const touchedRed = new Set(checks.filter((c) => {
|
|
57739
57799
|
const rel = c.name.slice(c.name.indexOf(":") + 1);
|
|
57740
57800
|
return c.result === "fail" && changed.includes(rel) && !wallNames0.has(c.name) && !isHold(c) && envAsIntake(rel) && touchedRedOnBase(ctx.repoDir, ctx.baseSha, { ids: c.ids, errors: headErrors.get(c) }, editedTestTitles(ctx.repoDir, ctx.baseSha, rel));
|
|
@@ -57798,7 +57858,7 @@ var init_verify = __esm(() => {
|
|
|
57798
57858
|
const t = tests.find((x) => testCheckName(x) === name), pkg = t ? api?.packageOf(t.path) : null;
|
|
57799
57859
|
return pkg?.commands.test ? `full suite: ${pkg.name}` : undefined;
|
|
57800
57860
|
};
|
|
57801
|
-
const attr = attribute(ctx.repoDir, ctx.baseSha, checks.filter((c) => c.result === "fail" && !preRed.names.includes(c.name)).map((c) => ({ name: c.name, ids: c.ids, eligible: !targetNames.has(c.name) && !changed.includes(c.name.slice(c.name.indexOf(":") + 1)), ...suiteOf(c.name) && preRed.
|
|
57861
|
+
const attr = attribute(ctx.repoDir, ctx.baseSha, checks.filter((c) => c.result === "fail" && !preRed.names.includes(c.name)).map((c) => ({ name: c.name, ids: c.ids, eligible: !targetNames.has(c.name) && !changed.includes(c.name.slice(c.name.indexOf(":") + 1)), ...suiteOf(c.name) && (preRed.compared.includes(c.name) || depsAsIntake(c.name.slice(c.name.indexOf(":") + 1))) ? { suite: suiteOf(c.name), ...headErrors.get(c) ? { errors: headErrors.get(c) } : {}, ...preRed.sameError.includes(c.name) ? { rerun: "same" } : preRed.compared.includes(c.name) ? { rerun: "differs" } : {} } : {} })));
|
|
57802
57862
|
attr.introducedChecks = [...new Set(attr.introducedChecks.map((n3) => isHoldoutCheck(n3) ? "holdout" : n3))];
|
|
57803
57863
|
preRed.names.push(...attr.preExistingChecks);
|
|
57804
57864
|
preRed.ids.push(...attr.preExistingIds);
|
|
@@ -57916,8 +57976,8 @@ var init_verify = __esm(() => {
|
|
|
57916
57976
|
});
|
|
57917
57977
|
|
|
57918
57978
|
// ../../loki-ts/src/runner/stop_checks.ts
|
|
57919
|
-
import { appendFileSync as appendFileSync15, existsSync as existsSync110, mkdirSync as mkdirSync82, readFileSync as readFileSync143, statSync as
|
|
57920
|
-
import { basename as
|
|
57979
|
+
import { appendFileSync as appendFileSync15, existsSync as existsSync110, mkdirSync as mkdirSync82, readFileSync as readFileSync143, statSync as statSync48 } from "fs";
|
|
57980
|
+
import { basename as basename45, isAbsolute as isAbsolute22, join as join156, relative as relative34 } from "path";
|
|
57921
57981
|
function redOnBase(repoDir) {
|
|
57922
57982
|
try {
|
|
57923
57983
|
const b = JSON.parse(readFileSync143(join156(repoDir, ".loki", "state", "repo-profile.json"), "utf8")).baseline;
|
|
@@ -57936,7 +57996,7 @@ function planStopChecks(repoDir, outputs, impacted, stageLimitS, baseSha, env =
|
|
|
57936
57996
|
const p = rel(f.path), found = map.tests.find((t) => t.path === p && (!f.runner || t.runner === f.runner));
|
|
57937
57997
|
if (found)
|
|
57938
57998
|
return [found];
|
|
57939
|
-
const runner = f.runner ?? guessRunner(
|
|
57999
|
+
const runner = f.runner ?? guessRunner(basename45(p), map.runners, p);
|
|
57940
58000
|
return runner && (runner !== "bun" || map.runners.includes("bun") || /[._](?:test|spec)\.[cm]?[jt]sx?$/.test(p)) ? [{ runner, path: p }] : [];
|
|
57941
58001
|
});
|
|
57942
58002
|
const red = redOnBase(repoDir), api = loadProjectApi(repoDir), seen = new Set;
|
|
@@ -57970,7 +58030,7 @@ function recordStopBlock(repoDir, name, err, env = process.env) {
|
|
|
57970
58030
|
return;
|
|
57971
58031
|
try {
|
|
57972
58032
|
const p = stopBlocksPath(repoDir);
|
|
57973
|
-
if (existsSync110(p) &&
|
|
58033
|
+
if (existsSync110(p) && statSync48(p).size >= STOP_BLOCKS_MAX_BYTES)
|
|
57974
58034
|
return;
|
|
57975
58035
|
mkdirSync82(join156(repoDir, ".loki", "state"), { recursive: true });
|
|
57976
58036
|
appendFileSync15(p, JSON.stringify({ at: new Date().toISOString(), run_id: runId2.slice(0, 128), name: redactSecrets(name).slice(0, 200), first_error: redactSecrets(err).slice(0, 300) }) + `
|
|
@@ -99231,7 +99291,7 @@ __export(exports_providers, {
|
|
|
99231
99291
|
PROVIDER_COMMIT_HYGIENE: () => PROVIDER_COMMIT_HYGIENE
|
|
99232
99292
|
});
|
|
99233
99293
|
import { mkdirSync as mkdirSync85, existsSync as existsSync112, readFileSync as readFileSync145, realpathSync as realpathSync47, appendFileSync as appendFileSync17 } from "fs";
|
|
99234
|
-
import { delimiter as delimiter5, dirname as dirname69, isAbsolute as isAbsolute24, relative as relative35, resolve as
|
|
99294
|
+
import { delimiter as delimiter5, dirname as dirname69, isAbsolute as isAbsolute24, relative as relative35, resolve as resolve42, sep as sep26 } from "path";
|
|
99235
99295
|
function mergeDisallowedTools(policy, stageCsv) {
|
|
99236
99296
|
return [...new Set([...policy ?? [], ...stageCsv.split(",").filter(Boolean)])];
|
|
99237
99297
|
}
|
|
@@ -99383,7 +99443,7 @@ function physicalPath(path) {
|
|
|
99383
99443
|
try {
|
|
99384
99444
|
return realpathSync47(path);
|
|
99385
99445
|
} catch {
|
|
99386
|
-
return
|
|
99446
|
+
return resolve42(path);
|
|
99387
99447
|
}
|
|
99388
99448
|
}
|
|
99389
99449
|
function hostGuardRequired(cwd) {
|
|
@@ -99496,7 +99556,7 @@ function claudeProvider() {
|
|
|
99496
99556
|
const baseModel = claudeModelFor(call);
|
|
99497
99557
|
const routed = sessionPlanEnabled() ? planRouterSession({
|
|
99498
99558
|
model: baseModel,
|
|
99499
|
-
runDir: process.env["LOKI_DIR"] ??
|
|
99559
|
+
runDir: process.env["LOKI_DIR"] ?? resolve42(call.cwd, ".loki"),
|
|
99500
99560
|
claudeCodeVersion: await installedClaudeCodeVersion(cli)
|
|
99501
99561
|
}) : null;
|
|
99502
99562
|
const model = routed ? routed.model : baseModel;
|
|
@@ -99570,7 +99630,7 @@ function providerCallTimeoutMs(env) {
|
|
|
99570
99630
|
}
|
|
99571
99631
|
function emitSdkDegradationEvent(cwd, payload) {
|
|
99572
99632
|
try {
|
|
99573
|
-
const lokiRoot = process.env["LOKI_DIR"] ??
|
|
99633
|
+
const lokiRoot = process.env["LOKI_DIR"] ?? resolve42(cwd, ".loki");
|
|
99574
99634
|
mkdirSync85(lokiRoot, { recursive: true });
|
|
99575
99635
|
const record = {
|
|
99576
99636
|
type: "capability_degraded",
|
|
@@ -99578,7 +99638,7 @@ function emitSdkDegradationEvent(cwd, payload) {
|
|
|
99578
99638
|
timestamp: new Date().toISOString(),
|
|
99579
99639
|
payload: { capability: "sdk_query", fail_closed: true, ...payload }
|
|
99580
99640
|
};
|
|
99581
|
-
appendFileSync17(
|
|
99641
|
+
appendFileSync17(resolve42(lokiRoot, "events.jsonl"), `${JSON.stringify(record)}
|
|
99582
99642
|
`);
|
|
99583
99643
|
} catch {}
|
|
99584
99644
|
}
|
|
@@ -99592,7 +99652,7 @@ function buildSdkLoopOptions(args) {
|
|
|
99592
99652
|
const out3 = {};
|
|
99593
99653
|
const router = sessionPlanEnabled() ? planRouterSession({
|
|
99594
99654
|
model: args.model,
|
|
99595
|
-
runDir: args.runDir ?? process.env["LOKI_DIR"] ??
|
|
99655
|
+
runDir: args.runDir ?? process.env["LOKI_DIR"] ?? resolve42(args.cwd, ".loki"),
|
|
99596
99656
|
claudeCodeVersion: args.claudeCodeVersion ?? bundledClaudeCodeVersion2()
|
|
99597
99657
|
}) : null;
|
|
99598
99658
|
if (router) {
|
|
@@ -99845,7 +99905,7 @@ __export(exports_session, {
|
|
|
99845
99905
|
});
|
|
99846
99906
|
import { spawn as spawn12 } from "child_process";
|
|
99847
99907
|
import { copyFileSync as copyFileSync11, existsSync as existsSync113, mkdirSync as mkdirSync86, readFileSync as readFileSync146, writeFileSync as writeFileSync84, writeSync as writeSync4 } from "fs";
|
|
99848
|
-
import { dirname as dirname70, join as join159, resolve as
|
|
99908
|
+
import { dirname as dirname70, join as join159, resolve as resolve43 } from "path";
|
|
99849
99909
|
import { tmpdir as tmpdir33 } from "os";
|
|
99850
99910
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
99851
99911
|
function capStopOf(summary) {
|
|
@@ -99914,7 +99974,7 @@ function childEnv2(opts, cfg) {
|
|
|
99914
99974
|
else
|
|
99915
99975
|
delete env["LOKI_E10_DISALLOWED_TOOLS"];
|
|
99916
99976
|
if (opts.outputs?.length)
|
|
99917
|
-
env[HARNESS_OUTPUTS_ENV] = JSON.stringify(opts.outputs.map((p) =>
|
|
99977
|
+
env[HARNESS_OUTPUTS_ENV] = JSON.stringify(opts.outputs.map((p) => resolve43(opts.cwd ?? process.cwd(), p)));
|
|
99918
99978
|
else
|
|
99919
99979
|
delete env[HARNESS_OUTPUTS_ENV];
|
|
99920
99980
|
if (opts.suiteCmds?.length)
|
|
@@ -100120,7 +100180,7 @@ function createSessionRunner(cfg) {
|
|
|
100120
100180
|
}, cfg.heartbeatMs ?? HEARTBEAT_MS_DEFAULT);
|
|
100121
100181
|
opts.signal.addEventListener("abort", onAbort, { once: true });
|
|
100122
100182
|
const untrack = trackSession(() => kill("aborted"));
|
|
100123
|
-
return new Promise((
|
|
100183
|
+
return new Promise((resolve44) => {
|
|
100124
100184
|
child.on("exit", () => reapLiveGroup(pgid, () => cfg.emit?.("session.group_reaped", opts.stage, { session_id: sessionId, pgid })));
|
|
100125
100185
|
child.on("close", (code) => {
|
|
100126
100186
|
clearTimeout(limitTimer);
|
|
@@ -100182,7 +100242,7 @@ function createSessionRunner(cfg) {
|
|
|
100182
100242
|
rememberSessionEffort(psid, ran2);
|
|
100183
100243
|
recordCost(cfg, opts, killed ? "killed" : code === 0 ? "completed" : "failed", durationS, stdout + logText);
|
|
100184
100244
|
untrack();
|
|
100185
|
-
|
|
100245
|
+
resolve44({ exit: guard.ok ? code : 1, markers, durationS, killed, summary: (stdout + logText).trim().slice(-4096), stderrTail: (guard.ok ? "" : `guard violation: ${guard.violations.map((v10) => v10.detail).join("; ")}
|
|
100186
100246
|
`) + stderrTail.toString("utf8") + (logText.match(/^\[sdk-loop error: .*\]$/gm) ?? []).join(`
|
|
100187
100247
|
`) });
|
|
100188
100248
|
});
|
|
@@ -100270,10 +100330,10 @@ var init_model_rank = __esm(() => {
|
|
|
100270
100330
|
|
|
100271
100331
|
// ../../loki-ts/src/engine10/sizing.ts
|
|
100272
100332
|
import { existsSync as existsSync114, readFileSync as readFileSync147 } from "fs";
|
|
100273
|
-
import { basename as
|
|
100333
|
+
import { basename as basename46 } from "path";
|
|
100274
100334
|
function namedFiles(task, map) {
|
|
100275
100335
|
const text4 = task.toLowerCase();
|
|
100276
|
-
const hit2 = (map?.files ?? []).filter((f) => new RegExp(`(?<![\\w.-])${escapeRegex(
|
|
100336
|
+
const hit2 = (map?.files ?? []).filter((f) => new RegExp(`(?<![\\w.-])${escapeRegex(basename46(f).toLowerCase())}(?![\\w-]|\\.\\w)`).test(text4));
|
|
100277
100337
|
if (!namedExactOn())
|
|
100278
100338
|
return hit2;
|
|
100279
100339
|
const spelled = text4.split(/[^\w@.()[\]\/-]+/).filter((t) => t.includes("/")).flatMap((t) => {
|
|
@@ -100281,11 +100341,11 @@ function namedFiles(task, map) {
|
|
|
100281
100341
|
return m ? [m[1]] : [];
|
|
100282
100342
|
});
|
|
100283
100343
|
return hit2.filter((f) => {
|
|
100284
|
-
const b =
|
|
100344
|
+
const b = basename46(f).toLowerCase();
|
|
100285
100345
|
if (new RegExp(`(?<![\\w./-])${escapeRegex(b)}(?![\\w-]|\\.\\w)`).test(text4))
|
|
100286
100346
|
return true;
|
|
100287
100347
|
const lf2 = f.toLowerCase();
|
|
100288
|
-
return spelled.some((t) =>
|
|
100348
|
+
return spelled.some((t) => basename46(t) === b && (lf2 === t || lf2.endsWith(`/${t}`) || t.endsWith(`/${lf2}`)));
|
|
100289
100349
|
});
|
|
100290
100350
|
}
|
|
100291
100351
|
function sizeTask(task, map, tests) {
|
|
@@ -100309,8 +100369,8 @@ function sizeTask(task, map, tests) {
|
|
|
100309
100369
|
function namedDistinct(task, map) {
|
|
100310
100370
|
const text4 = task.toLowerCase(), named2 = namedFiles(task, map).filter((f) => !isTestFile(f)).map((f) => f.toLowerCase());
|
|
100311
100371
|
const spelled = new Set(named2.filter((f) => f.includes("/") && new RegExp(`(?<![\\w./-])(?:\\./)?${escapeRegex(f)}(?![\\w-]|\\.\\w)`).test(text4)));
|
|
100312
|
-
const spelledBase = new Set([...spelled].map((f) =>
|
|
100313
|
-
return spelled.size + new Set(named2.map((f) =>
|
|
100372
|
+
const spelledBase = new Set([...spelled].map((f) => basename46(f)));
|
|
100373
|
+
return spelled.size + new Set(named2.map((f) => basename46(f)).filter((b) => !spelledBase.has(b))).size;
|
|
100314
100374
|
}
|
|
100315
100375
|
function hardReason(size, map, task) {
|
|
100316
100376
|
if (size === "large")
|
|
@@ -100803,9 +100863,9 @@ var init_python_build_check = __esm(() => {
|
|
|
100803
100863
|
// ../../loki-ts/src/util/check_result.ts
|
|
100804
100864
|
import { spawn as spawn13, spawnSync as spawnSync28 } from "child_process";
|
|
100805
100865
|
import { createHash as createHash40 } from "crypto";
|
|
100806
|
-
import { copyFileSync as copyFileSync12, existsSync as existsSync117, lstatSync as lstatSync35, mkdirSync as mkdirSync89, readlinkSync as readlinkSync10, mkdtempSync as mkdtempSync27, readdirSync as readdirSync56, readFileSync as readFileSync149, realpathSync as realpathSync48, renameSync as renameSync29, rmSync as rmSync53, statSync as
|
|
100866
|
+
import { copyFileSync as copyFileSync12, existsSync as existsSync117, lstatSync as lstatSync35, mkdirSync as mkdirSync89, readlinkSync as readlinkSync10, mkdtempSync as mkdtempSync27, readdirSync as readdirSync56, readFileSync as readFileSync149, realpathSync as realpathSync48, renameSync as renameSync29, rmSync as rmSync53, statSync as statSync50, writeFileSync as writeFileSync87 } from "fs";
|
|
100807
100867
|
import { homedir as homedir16, tmpdir as tmpdir34 } from "os";
|
|
100808
|
-
import { basename as
|
|
100868
|
+
import { basename as basename47, dirname as dirname71, isAbsolute as isAbsolute25, join as join164, normalize as normalize9, relative as relative36, resolve as resolve44, sep as sep27 } from "path";
|
|
100809
100869
|
function plainTestEnv(base2 = process.env) {
|
|
100810
100870
|
const e10 = {};
|
|
100811
100871
|
for (const [k10, v10] of Object.entries(tokenFreeEnv(base2)))
|
|
@@ -100824,7 +100884,7 @@ function ran(raw2, path, ok2) {
|
|
|
100824
100884
|
if (blk) {
|
|
100825
100885
|
const c = n10(blk, /(?:#|\u2139) pass (\d+)/) + n10(blk, /(?:#|\u2139) fail (\d+)/);
|
|
100826
100886
|
const nm2 = out3.match(/^(?:ok \d+ - |\u2714 )(\S+\.[cm]?[jt]s)(?: \(|$)/m)?.[1];
|
|
100827
|
-
return c === 1 && nm2 && (!path ||
|
|
100887
|
+
return c === 1 && nm2 && (!path || basename47(nm2) === basename47(path)) ? 0 : c;
|
|
100828
100888
|
}
|
|
100829
100889
|
const cg2 = cargoTrailer(out3);
|
|
100830
100890
|
if (cg2.length)
|
|
@@ -101079,7 +101139,7 @@ function runsTool(tool, words3, depth) {
|
|
|
101079
101139
|
return NO2;
|
|
101080
101140
|
if (w.includes("$"))
|
|
101081
101141
|
return varIsTool(tool, w) ? YES : UNKNOWN;
|
|
101082
|
-
const name =
|
|
101142
|
+
const name = basename47(w);
|
|
101083
101143
|
if (wordIsTool(tool, w))
|
|
101084
101144
|
return YES;
|
|
101085
101145
|
if (SHELL_WORDS.has(name)) {
|
|
@@ -101133,7 +101193,7 @@ function goRunner(cmd2, args) {
|
|
|
101133
101193
|
return mentionsTool("go", cmd2, args) ? { runner: "go" } : {};
|
|
101134
101194
|
}
|
|
101135
101195
|
function parseCargo(toks2) {
|
|
101136
|
-
if (
|
|
101196
|
+
if (basename47(toks2[0] ?? "") !== "cargo" || toks2.some((t) => /[&|;$`"'<>()\\]/.test(t)))
|
|
101137
101197
|
return null;
|
|
101138
101198
|
let k10 = 1;
|
|
101139
101199
|
for (;k10 < toks2.length; k10++) {
|
|
@@ -101214,12 +101274,12 @@ function cargoRunnerConfigured(cwd, env, toks2) {
|
|
|
101214
101274
|
for (const v10 of vals) {
|
|
101215
101275
|
if (CARGO_REDIRECT_TEXT(v10))
|
|
101216
101276
|
return true;
|
|
101217
|
-
const f =
|
|
101277
|
+
const f = resolve44(cwd, v10);
|
|
101218
101278
|
if (existsSync117(f) && lstatSync35(f).isFile() && doubtful(f))
|
|
101219
101279
|
return true;
|
|
101220
101280
|
}
|
|
101221
101281
|
const dirs = [env["CARGO_HOME"] ?? join164(env["HOME"] ?? homedir16(), ".cargo"), join164(homedir16(), ".cargo")];
|
|
101222
|
-
for (let d =
|
|
101282
|
+
for (let d = resolve44(cwd), prev = "";d !== prev; prev = d, d = dirname71(d))
|
|
101223
101283
|
dirs.push(join164(d, ".cargo"));
|
|
101224
101284
|
return dirs.some((dir) => ["config", "config.toml"].some((f) => existsSync117(join164(dir, f)) && doubtful(join164(dir, f))));
|
|
101225
101285
|
}
|
|
@@ -101238,7 +101298,7 @@ function cargoToolchainRedirected(cwd, env) {
|
|
|
101238
101298
|
return true;
|
|
101239
101299
|
}
|
|
101240
101300
|
};
|
|
101241
|
-
for (let d =
|
|
101301
|
+
for (let d = resolve44(cwd), prev = "";d !== prev; prev = d, d = dirname71(d))
|
|
101242
101302
|
if (["rust-toolchain", "rust-toolchain.toml"].some((f) => lstatOk(join164(d, f)) && doubtful(join164(d, f))))
|
|
101243
101303
|
return true;
|
|
101244
101304
|
return false;
|
|
@@ -101307,13 +101367,13 @@ function compilerSettingIn(raw2) {
|
|
|
101307
101367
|
}
|
|
101308
101368
|
function cargoRepoRoot(cwd) {
|
|
101309
101369
|
let top = null;
|
|
101310
|
-
for (let d =
|
|
101370
|
+
for (let d = resolve44(cwd), prev = "";d !== prev; prev = d, d = dirname71(d)) {
|
|
101311
101371
|
if (existsSync117(join164(d, ".git")))
|
|
101312
101372
|
return d;
|
|
101313
101373
|
if (existsSync117(join164(d, "Cargo.toml")))
|
|
101314
101374
|
top = d;
|
|
101315
101375
|
}
|
|
101316
|
-
return top ??
|
|
101376
|
+
return top ?? resolve44(cwd);
|
|
101317
101377
|
}
|
|
101318
101378
|
function topLevelDoubt(t) {
|
|
101319
101379
|
let q = "", depth = 0, lineStart = true;
|
|
@@ -101362,16 +101422,16 @@ function cargoProfileRustflagsManifest(root, cwd, toks2) {
|
|
|
101362
101422
|
}
|
|
101363
101423
|
};
|
|
101364
101424
|
const seen = new Set, files = [];
|
|
101365
|
-
for (let d =
|
|
101425
|
+
for (let d = resolve44(cwd), prev = "";d !== prev; prev = d, d = dirname71(d)) {
|
|
101366
101426
|
files.push(join164(d, "Cargo.toml"));
|
|
101367
101427
|
if (d === root)
|
|
101368
101428
|
break;
|
|
101369
101429
|
}
|
|
101370
101430
|
toks2.forEach((t, i) => {
|
|
101371
101431
|
if (t === "--manifest-path")
|
|
101372
|
-
files.push(
|
|
101432
|
+
files.push(resolve44(cwd, toks2[i + 1] ?? ""));
|
|
101373
101433
|
else if (t.startsWith("--manifest-path="))
|
|
101374
|
-
files.push(
|
|
101434
|
+
files.push(resolve44(cwd, t.slice(16)));
|
|
101375
101435
|
});
|
|
101376
101436
|
for (let stack = [[root, 0]], seenDirs = 0;stack.length && seenDirs < 500; ) {
|
|
101377
101437
|
const [d, depth] = stack.pop();
|
|
@@ -101411,19 +101471,19 @@ function cargoRepoCompilerRedirected(cwd, env, toks2) {
|
|
|
101411
101471
|
const inline = compilerSettingIn(v10);
|
|
101412
101472
|
if (inline)
|
|
101413
101473
|
return cargoCompilerReason(inline, "--config");
|
|
101414
|
-
const f =
|
|
101474
|
+
const f = resolve44(cwd, v10);
|
|
101415
101475
|
if (existsSync117(f) && lstatSync35(f).isFile()) {
|
|
101416
101476
|
const w = inFile(f);
|
|
101417
101477
|
if (w)
|
|
101418
101478
|
return cargoCompilerReason(w, v10);
|
|
101419
101479
|
}
|
|
101420
101480
|
}
|
|
101421
|
-
const home = new Set([
|
|
101481
|
+
const home = new Set([resolve44(env["CARGO_HOME"] || join164(env["HOME"] || homedir16(), ".cargo")), resolve44(homedir16(), ".cargo")]);
|
|
101422
101482
|
const aboveRoot = (dir) => {
|
|
101423
101483
|
const r = relative36(dirname71(dir), root);
|
|
101424
101484
|
return r !== "" && !r.startsWith("..") && !isAbsolute25(r);
|
|
101425
101485
|
};
|
|
101426
|
-
for (let d =
|
|
101486
|
+
for (let d = resolve44(cwd), prev = "";d !== prev; prev = d, d = dirname71(d)) {
|
|
101427
101487
|
const dir = join164(d, ".cargo");
|
|
101428
101488
|
if (home.has(dir) && aboveRoot(dir))
|
|
101429
101489
|
continue;
|
|
@@ -101516,7 +101576,7 @@ function* corroborateGoSteps(c, out3, cmdOrLine, args, toks2, o) {
|
|
|
101516
101576
|
const first = goJson(stripAnsi(out3));
|
|
101517
101577
|
const names = first?.passedNames ?? [];
|
|
101518
101578
|
const shellish = (t, i) => /[&|;$`"'<>()\\]/.test(t) && !(args !== undefined && toks2[i - 1] === "-run" && /^\^\([A-Za-z0-9_|]+\)\$$/.test(t));
|
|
101519
|
-
if (!names.length || toks2.some(shellish) ||
|
|
101579
|
+
if (!names.length || toks2.some(shellish) || basename47(toks2[0] ?? "") !== "go" || toks2[1] !== "test")
|
|
101520
101580
|
return refuse;
|
|
101521
101581
|
const pkgs = [], run2 = [];
|
|
101522
101582
|
for (let k10 = 2;k10 < toks2.length; k10++) {
|
|
@@ -101686,7 +101746,7 @@ function javaSummary(raw2) {
|
|
|
101686
101746
|
return null;
|
|
101687
101747
|
}
|
|
101688
101748
|
function javaTestClass(path) {
|
|
101689
|
-
const m = /^(.*?)\/?src\/test\/java\/(.+)\.java$/.exec(path), cls = (m ? m[2] :
|
|
101749
|
+
const m = /^(.*?)\/?src\/test\/java\/(.+)\.java$/.exec(path), cls = (m ? m[2] : basename47(path, ".java")).split("/").join(".");
|
|
101690
101750
|
return { root: m?.[1] || ".", cls, rel: m ? `src/test/java/${m[2]}.java` : path };
|
|
101691
101751
|
}
|
|
101692
101752
|
function testCount(raw2, path, ok2) {
|
|
@@ -102222,7 +102282,7 @@ function publishableWall(repoDir, runDir, o, env = process.env, task) {
|
|
|
102222
102282
|
const listed = arr5(o.wall?.["files"]);
|
|
102223
102283
|
for (const w of listed) {
|
|
102224
102284
|
const rel = relative36(repoDir, String(w["path"])), hit2 = arr5(o.verify?.["checks"]).find((c) => tgt.has(String(c["name"])) && String(c["name"]).slice(String(c["name"]).indexOf(":") + 1) === rel && hasExecutedProof([c]));
|
|
102225
|
-
if (!hit2 || rel.startsWith("..") || isAbsolute25(rel) || rel.startsWith(".loki/") || !
|
|
102285
|
+
if (!hit2 || rel.startsWith("..") || isAbsolute25(rel) || rel.startsWith(".loki/") || !basename47(rel).startsWith("loki_wall_"))
|
|
102226
102286
|
continue;
|
|
102227
102287
|
try {
|
|
102228
102288
|
const bytes = readFileSync149(sealedWallCopy(runDir, rel));
|
|
@@ -102280,12 +102340,12 @@ function loadSealedWall(runDir, unitRepoDir) {
|
|
|
102280
102340
|
continue;
|
|
102281
102341
|
}
|
|
102282
102342
|
try {
|
|
102283
|
-
const bytes = readFileSync149(join164(runDir, "wall",
|
|
102343
|
+
const bytes = readFileSync149(join164(runDir, "wall", basename47(rel)));
|
|
102284
102344
|
if (createHash40("sha256").update(bytes).digest("hex") !== w.sha256)
|
|
102285
102345
|
throw new Error("hash");
|
|
102286
102346
|
files.push({ rel, bytes, ...typeof w.runner === "string" ? { runner: w.runner } : {} });
|
|
102287
102347
|
} catch {
|
|
102288
|
-
problems.push(`sealed Wall copy ${
|
|
102348
|
+
problems.push(`sealed Wall copy ${basename47(rel)} missing or not the sealed bytes`);
|
|
102289
102349
|
}
|
|
102290
102350
|
}
|
|
102291
102351
|
return { files, problems };
|
|
@@ -102351,7 +102411,7 @@ function hiddenEdits(repoDir) {
|
|
|
102351
102411
|
try {
|
|
102352
102412
|
const idxRel = safeGit(repoDir, ["rev-parse", "--git-path", "index"]).trim(), idx = isAbsolute25(idxRel) ? idxRel : join164(repoDir, idxRel);
|
|
102353
102413
|
const flags = new Map;
|
|
102354
|
-
for (const l of safeGit(repoDir, ["-c", "core.quotePath=false", "ls-files", "-v", "-z"], { maxBuffer: Math.max(64 << 20,
|
|
102414
|
+
for (const l of safeGit(repoDir, ["-c", "core.quotePath=false", "ls-files", "-v", "-z"], { maxBuffer: Math.max(64 << 20, statSync50(idx).size * 32) }).split("\x00")) {
|
|
102355
102415
|
const m = /^([a-zS]) ([\s\S]+)$/.exec(l);
|
|
102356
102416
|
if (m)
|
|
102357
102417
|
flags.set(m[2], m[1]);
|
|
@@ -102396,16 +102456,16 @@ function execFiles(repoDir) {
|
|
|
102396
102456
|
} catch {
|
|
102397
102457
|
return null;
|
|
102398
102458
|
}
|
|
102399
|
-
const roots = new Set([".venv", "venv", ...all.filter((f) =>
|
|
102459
|
+
const roots = new Set([".venv", "venv", ...all.filter((f) => basename47(f) === "pyvenv.cfg").map((f) => dirname71(f))]);
|
|
102400
102460
|
const inVenvBin = (f) => {
|
|
102401
102461
|
for (let d = dirname71(f);d !== "." && d !== "/"; d = dirname71(d))
|
|
102402
|
-
if ((
|
|
102462
|
+
if ((basename47(d) === "bin" || basename47(d) === "Scripts") && roots.has(dirname71(d)))
|
|
102403
102463
|
return true;
|
|
102404
102464
|
return false;
|
|
102405
102465
|
};
|
|
102406
102466
|
const out3 = {};
|
|
102407
102467
|
for (const f of all) {
|
|
102408
|
-
if (!(EXEC_NAMES.has(
|
|
102468
|
+
if (!(EXEC_NAMES.has(basename47(f)) || VENV_TOOL.test(basename47(f)) && inVenvBin(f)))
|
|
102409
102469
|
continue;
|
|
102410
102470
|
const abs = join164(repoDir, f);
|
|
102411
102471
|
try {
|
|
@@ -102427,7 +102487,7 @@ function ignoreSnapshot(repoDir) {
|
|
|
102427
102487
|
const resolved = (args, dflt) => {
|
|
102428
102488
|
try {
|
|
102429
102489
|
const v10 = safeGit(repoDir, args).trim();
|
|
102430
|
-
return v10 ?
|
|
102490
|
+
return v10 ? resolve44(repoDir, v10) : dflt;
|
|
102431
102491
|
} catch {
|
|
102432
102492
|
return dflt;
|
|
102433
102493
|
}
|
|
@@ -102448,10 +102508,10 @@ function noteLabel(repoDir, p) {
|
|
|
102448
102508
|
const h10 = home ? inside2(home) : null;
|
|
102449
102509
|
if (h10)
|
|
102450
102510
|
return `~/${h10}`;
|
|
102451
|
-
return
|
|
102511
|
+
return basename47(p);
|
|
102452
102512
|
}
|
|
102453
102513
|
function pureToolCache(repoDir, dir) {
|
|
102454
|
-
const text4 = TOOL_CACHE_GITIGNORE[
|
|
102514
|
+
const text4 = TOOL_CACHE_GITIGNORE[basename47(dir)];
|
|
102455
102515
|
if (text4 === undefined)
|
|
102456
102516
|
return false;
|
|
102457
102517
|
try {
|
|
@@ -102468,7 +102528,7 @@ function pureToolCache(repoDir, dir) {
|
|
|
102468
102528
|
return false;
|
|
102469
102529
|
continue;
|
|
102470
102530
|
}
|
|
102471
|
-
if (!e10.isFile() || CACHE_CODE_EXT.test(e10.name) || (EXEC_NAMES.has(e10.name) || /^(conftest|sitecustomize|usercustomize)\./.test(e10.name)) && e10.name !== ".gitignore" || /^python/i.test(e10.name) || (
|
|
102531
|
+
if (!e10.isFile() || CACHE_CODE_EXT.test(e10.name) || (EXEC_NAMES.has(e10.name) || /^(conftest|sitecustomize|usercustomize)\./.test(e10.name)) && e10.name !== ".gitignore" || /^python/i.test(e10.name) || (statSync50(join164(repoDir, r)).mode & 73) !== 0)
|
|
102472
102532
|
return false;
|
|
102473
102533
|
}
|
|
102474
102534
|
return true;
|
|
@@ -102496,14 +102556,14 @@ function ignoreRuleChanges(repoDir, snap, baseSha) {
|
|
|
102496
102556
|
const prior = s.exec_files, cur = execFiles(repoDir);
|
|
102497
102557
|
if (!prior || !cur)
|
|
102498
102558
|
return ["ignore rules could not be compared with the intake snapshot: the ignored files that can change what verify runs were not recorded or could not be listed"];
|
|
102499
|
-
const gi2 = new Set(changedFiles(repoDir, baseSha ?? "HEAD").filter((f) =>
|
|
102559
|
+
const gi2 = new Set(changedFiles(repoDir, baseSha ?? "HEAD").filter((f) => basename47(f) === ".gitignore"));
|
|
102500
102560
|
const hidden = [];
|
|
102501
102561
|
for (const [f, h10] of Object.entries(cur)) {
|
|
102502
102562
|
if (prior[f] === h10)
|
|
102503
102563
|
continue;
|
|
102504
|
-
if (
|
|
102564
|
+
if (basename47(f) === ".gitignore" && pureToolCache(repoDir, dirname71(f)))
|
|
102505
102565
|
continue;
|
|
102506
|
-
if (
|
|
102566
|
+
if (basename47(f) === ".gitignore")
|
|
102507
102567
|
gi2.add(f);
|
|
102508
102568
|
else
|
|
102509
102569
|
hidden.push(f);
|
|
@@ -102516,7 +102576,7 @@ function ignoreRuleChanges(repoDir, snap, baseSha) {
|
|
|
102516
102576
|
return [];
|
|
102517
102577
|
const made = listIgnoredFiles(repoDir).filter((f) => {
|
|
102518
102578
|
try {
|
|
102519
|
-
const st2 =
|
|
102579
|
+
const st2 = statSync50(join164(repoDir, f));
|
|
102520
102580
|
return Math.max(st2.birthtimeMs, st2.mtimeMs) >= s.at;
|
|
102521
102581
|
} catch {
|
|
102522
102582
|
return false;
|
|
@@ -102848,15 +102908,15 @@ function missingRelativeImportIsRed(f, raw2, repoDir) {
|
|
|
102848
102908
|
hits.push({ spec: m[1], importer: m[2] });
|
|
102849
102909
|
if (hits.length === 0)
|
|
102850
102910
|
return false;
|
|
102851
|
-
const abs =
|
|
102911
|
+
const abs = resolve44(repoDir, f.path);
|
|
102852
102912
|
return hits.every(({ spec, importer }) => {
|
|
102853
102913
|
if (!/^\.\.?(?:\/|$)/.test(spec) || !(abs === importer || abs.endsWith("/" + importer.replace(/^\.\//, "")) || importer.endsWith("/" + f.path) || importer === f.path))
|
|
102854
102914
|
return false;
|
|
102855
|
-
const target =
|
|
102915
|
+
const target = resolve44(dirname71(abs), spec.replace(/[?#].*$/, ""));
|
|
102856
102916
|
const stem2 = target.replace(/\.(?:jsx?|mjs|cjs)$/, "");
|
|
102857
|
-
if (existsSync117(target) &&
|
|
102917
|
+
if (existsSync117(target) && statSync50(target).isDirectory())
|
|
102858
102918
|
return false;
|
|
102859
|
-
return ![target, stem2].some((t) => ["", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".json"].some((x10) => existsSync117(t + x10) &&
|
|
102919
|
+
return ![target, stem2].some((t) => ["", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".json"].some((x10) => existsSync117(t + x10) && statSync50(t + x10).isFile())) && !["ts", "tsx", "js", "jsx", "mjs", "cjs"].some((x10) => existsSync117(join164(target, `index.${x10}`)));
|
|
102860
102920
|
});
|
|
102861
102921
|
}
|
|
102862
102922
|
function classify(f, status, output, repoDir, interpreter) {
|
|
@@ -103108,7 +103168,7 @@ ${r.stderr ?? ""}` };
|
|
|
103108
103168
|
}
|
|
103109
103169
|
}
|
|
103110
103170
|
function spawnCollect(cmd2, args, o) {
|
|
103111
|
-
return new Promise((
|
|
103171
|
+
return new Promise((resolve45) => {
|
|
103112
103172
|
let out3 = "", err = "", error = false, done = false;
|
|
103113
103173
|
const MAX = o.maxBytes ?? 1024 * 1024;
|
|
103114
103174
|
const timers = [];
|
|
@@ -103119,7 +103179,7 @@ function spawnCollect(cmd2, args, o) {
|
|
|
103119
103179
|
o.signal?.removeEventListener("abort", abort);
|
|
103120
103180
|
killGroup2(c.pid, "SIGKILL");
|
|
103121
103181
|
wd2?.kill("SIGKILL");
|
|
103122
|
-
|
|
103182
|
+
resolve45({ status: error ? null : status, output: `${out3}
|
|
103123
103183
|
${err}` });
|
|
103124
103184
|
}
|
|
103125
103185
|
};
|
|
@@ -103255,7 +103315,7 @@ function runnerCmd(t, repoDir) {
|
|
|
103255
103315
|
case "dotnet":
|
|
103256
103316
|
return dotnetTestCmd(repoDir, t.path);
|
|
103257
103317
|
case "cargo":
|
|
103258
|
-
return CARGO_TEST_FILE_RE.test(t.path) ? ["cargo", ["test", "--test",
|
|
103318
|
+
return CARGO_TEST_FILE_RE.test(t.path) ? ["cargo", ["test", "--test", basename47(t.path, ".rs")]] : ["cargo", ["test"]];
|
|
103259
103319
|
}
|
|
103260
103320
|
}
|
|
103261
103321
|
function fullSuiteCmd(runner, repoDir) {
|
|
@@ -103473,7 +103533,7 @@ function firstFileLineAnchor(desc2) {
|
|
|
103473
103533
|
}
|
|
103474
103534
|
return null;
|
|
103475
103535
|
}
|
|
103476
|
-
var NO_TESTS_REASON = "no tests executed", sealedWallDir = (runDir) => join164(runDir, "wall"), sealedWallCopy = (runDir, path) => join164(sealedWallDir(runDir),
|
|
103536
|
+
var NO_TESTS_REASON = "no tests executed", sealedWallDir = (runDir) => join164(runDir, "wall"), sealedWallCopy = (runDir, path) => join164(sealedWallDir(runDir), basename47(path)), NO_RUNNER_REASON = "no runner of this repo runs this file", harnessSkipCode = (env = process.env) => env.LOKI_WALL_HARNESS_RUNNER === "0" ? "harness_runner_disabled" : Bun.which("bun", { PATH: env.PATH ?? "" }) ? "no_toolchain" : "bun_not_on_path", GO_EXIT0_REASON = "test count could not be confirmed: go test output is produced by the code under test and cannot confirm execution (a Go exit 0 is never a pass)", UNCONFIRMED_REASON = "test count could not be confirmed", FAIL_EVIDENCE, GO_FAIL_EVIDENCE, UNMEASURED_REASON = "executed count unmeasured (Loki could not parse the runner summary, harness-owned)", pytestPrettyOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_PYTEST_PRETTY"] ?? "").trim()), stripAnsi = (s) => s.replace(/\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)/g, "").replace(/(?:\u001b\[|\u009b)[0-9;?]*[ -\/]*[@-~]/g, "").replace(/\r\n?/g, `
|
|
103477
103537
|
`), tailLines = (out3) => out3.split(`
|
|
103478
103538
|
`).filter((x10) => x10.trim()).slice(-12), CARGO_NOISE, cargoMergedDoctestOn = (env = process.env) => !/^(0|off|false|no)$/i.test((env["LOKI_E10_CARGO_MERGED_DOCTEST"] ?? "").trim()), DOCTEST_NOTE, cargoNoise = (l) => CARGO_NOISE.test(l) || cargoMergedDoctestOn() && DOCTEST_NOTE.test(l), GO_PKG_RE, GO_SRC, GO_DIR, GO_PKG_AFTER, GO_MAIN_BEFORE, GO_IDENT, GO_MAJOR, GO_KEYWORDS, goRel = (r) => r.replace(/^(?:\.\/)+/, ""), GO_NON_PKG_WORD, goIgnoredPath = (rel) => rel.split("/").some((g10) => g10 === "testdata" || g10.startsWith("_") || g10.startsWith(".")), goSiblingPkg = (dir) => existsSync117(dir) ? readdirSync56(dir).filter((f) => f.endsWith(".go") && !f.endsWith("_test.go")).map((f) => /^package\s+(\w+)/m.exec(readFileSync149(join164(dir, f), "utf8"))?.[1]).find(Boolean) : undefined, goDirPackage = (dir) => goSiblingPkg(dir) ?? (existsSync117(dir) ? readdirSync56(dir).filter((f) => f.endsWith("_test.go")).map((f) => /^package\s+(\w+)/m.exec(readFileSync149(join164(dir, f), "utf8"))?.[1]?.replace(/_test$/, "")).find(Boolean) : undefined), goPackageBrief = (repoDir, targetDir, runners, texts, importPathOf) => {
|
|
103479
103539
|
if (!runners.includes("go"))
|
|
@@ -103488,7 +103548,7 @@ Go: your test files sit in the package directory, so each one starts with "packa
|
|
|
103488
103548
|
|
|
103489
103549
|
Go: your test files are copied into ${relative36(repoDir, targetDir) || "the repository root"}/, whose existing Go files declare "package ${here}". Start each file with "package ${here}"; any other package clause breaks that directory's build and the file is discarded.${imp ? ` Import the package under test as "${imp}" and call its identifiers qualified (${p.pkg}.Name).` : ""}` : "";
|
|
103490
103550
|
}, KNOWN_RUNNERS, SHELL_WORDS, RESERVED_WORDS, WRAPPERS, NO2 = 0, YES = 1, UNKNOWN = 2, triOr = (a, b) => a === YES || b === YES ? YES : a === UNKNOWN || b === UNKNOWN ? UNKNOWN : NO2, TOOL_ALIASES, INLINE_CODE_FLAGS, INTERPRETERS, GO_VERSIONED, wordIsTool = (tool, w) => {
|
|
103491
|
-
const name =
|
|
103551
|
+
const name = basename47(w);
|
|
103492
103552
|
return name === tool || (TOOL_ALIASES[tool]?.includes(name) ?? false) || tool === "go" && GO_VERSIONED.test(name);
|
|
103493
103553
|
}, TOOL_PATH_VARS, varNamesTool = (tool, v10) => {
|
|
103494
103554
|
const l = v10.toLowerCase(), last = l.split("_").pop();
|
|
@@ -103717,7 +103777,7 @@ var init_check_result = __esm(() => {
|
|
|
103717
103777
|
});
|
|
103718
103778
|
|
|
103719
103779
|
// ../../loki-ts/src/council/finding_schema.ts
|
|
103720
|
-
import { existsSync as existsSync118, readdirSync as readdirSync57, readFileSync as readFileSync150, statSync as
|
|
103780
|
+
import { existsSync as existsSync118, readdirSync as readdirSync57, readFileSync as readFileSync150, statSync as statSync51 } from "fs";
|
|
103721
103781
|
import { resolve as resolvePath3, dirname as dirname72, relative as relative37, isAbsolute as isAbsolute26, join as join165, sep as sep28 } from "path";
|
|
103722
103782
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
103723
103783
|
function resolveSchemaDataDir(moduleDir = _moduleDir, candidates2 = SCHEMA_DATA_DIR_CANDIDATES) {
|
|
@@ -104200,16 +104260,16 @@ var init_values = __esm(() => {
|
|
|
104200
104260
|
});
|
|
104201
104261
|
|
|
104202
104262
|
// ../../loki-ts/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs
|
|
104203
|
-
var sleep = (ms, signal) => new Promise((
|
|
104263
|
+
var sleep = (ms, signal) => new Promise((resolve45) => {
|
|
104204
104264
|
if (signal?.aborted)
|
|
104205
|
-
return
|
|
104265
|
+
return resolve45();
|
|
104206
104266
|
const onAbort = () => {
|
|
104207
104267
|
clearTimeout(timer);
|
|
104208
|
-
|
|
104268
|
+
resolve45();
|
|
104209
104269
|
};
|
|
104210
104270
|
const timer = setTimeout(() => {
|
|
104211
104271
|
signal?.removeEventListener("abort", onAbort);
|
|
104212
|
-
|
|
104272
|
+
resolve45();
|
|
104213
104273
|
}, ms);
|
|
104214
104274
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
104215
104275
|
});
|
|
@@ -107546,8 +107606,8 @@ var init_api_promise = __esm(() => {
|
|
|
107546
107606
|
|
|
107547
107607
|
class APIPromise2 extends Promise {
|
|
107548
107608
|
constructor(client, responsePromise, parseResponse = defaultParseResponse) {
|
|
107549
|
-
super((
|
|
107550
|
-
|
|
107609
|
+
super((resolve45) => {
|
|
107610
|
+
resolve45(null);
|
|
107551
107611
|
});
|
|
107552
107612
|
this.responsePromise = responsePromise;
|
|
107553
107613
|
this.parseResponse = parseResponse;
|
|
@@ -109826,16 +109886,16 @@ var init_async_queue = __esm(() => {
|
|
|
109826
109886
|
if (__classPrivateFieldGet(this, _AsyncQueue_closed, "f") || signal?.aborted) {
|
|
109827
109887
|
return Promise.resolve({ done: true, value: undefined });
|
|
109828
109888
|
}
|
|
109829
|
-
return new Promise((
|
|
109889
|
+
return new Promise((resolve45) => {
|
|
109830
109890
|
const waiter = (r) => {
|
|
109831
109891
|
signal?.removeEventListener("abort", onAbort);
|
|
109832
|
-
|
|
109892
|
+
resolve45(r);
|
|
109833
109893
|
};
|
|
109834
109894
|
const onAbort = () => {
|
|
109835
109895
|
const idx = __classPrivateFieldGet(this, _AsyncQueue_waiters, "f").indexOf(waiter);
|
|
109836
109896
|
if (idx >= 0)
|
|
109837
109897
|
__classPrivateFieldGet(this, _AsyncQueue_waiters, "f").splice(idx, 1);
|
|
109838
|
-
|
|
109898
|
+
resolve45({ done: true, value: undefined });
|
|
109839
109899
|
};
|
|
109840
109900
|
__classPrivateFieldGet(this, _AsyncQueue_waiters, "f").push(waiter);
|
|
109841
109901
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
@@ -110488,13 +110548,13 @@ var init_json_schema = () => {};
|
|
|
110488
110548
|
|
|
110489
110549
|
// ../../loki-ts/node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs
|
|
110490
110550
|
function promiseWithResolvers() {
|
|
110491
|
-
let
|
|
110551
|
+
let resolve45;
|
|
110492
110552
|
let reject;
|
|
110493
110553
|
const promise = new Promise((res, rej) => {
|
|
110494
|
-
|
|
110554
|
+
resolve45 = res;
|
|
110495
110555
|
reject = rej;
|
|
110496
110556
|
});
|
|
110497
|
-
return { promise, resolve:
|
|
110557
|
+
return { promise, resolve: resolve45, reject };
|
|
110498
110558
|
}
|
|
110499
110559
|
|
|
110500
110560
|
// ../../loki-ts/node_modules/@anthropic-ai/sdk/internal/node.mjs
|
|
@@ -111275,10 +111335,10 @@ async function settledOrAborted(p, signal) {
|
|
|
111275
111335
|
return;
|
|
111276
111336
|
}
|
|
111277
111337
|
let onAbort;
|
|
111278
|
-
const aborted = new Promise((
|
|
111279
|
-
onAbort =
|
|
111338
|
+
const aborted = new Promise((resolve45) => {
|
|
111339
|
+
onAbort = resolve45;
|
|
111280
111340
|
if (signal.aborted)
|
|
111281
|
-
|
|
111341
|
+
resolve45();
|
|
111282
111342
|
});
|
|
111283
111343
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
111284
111344
|
try {
|
|
@@ -112235,7 +112295,7 @@ function betaGrepTool(ctx) {
|
|
|
112235
112295
|
});
|
|
112236
112296
|
}
|
|
112237
112297
|
function runRipgrep(rg2, pattern, searchPath, signal) {
|
|
112238
|
-
return new Promise((
|
|
112298
|
+
return new Promise((resolve46, reject) => {
|
|
112239
112299
|
const proc = cp2.spawn(rg2, ["-n", "--no-heading", "-e", pattern, "--", searchPath], {
|
|
112240
112300
|
...signal ? { signal } : {}
|
|
112241
112301
|
});
|
|
@@ -112257,12 +112317,12 @@ function runRipgrep(rg2, pattern, searchPath, signal) {
|
|
|
112257
112317
|
if (signal?.aborted)
|
|
112258
112318
|
return reject(new ToolError("grep: aborted"));
|
|
112259
112319
|
if (truncated)
|
|
112260
|
-
return
|
|
112320
|
+
return resolve46(out3 + `
|
|
112261
112321
|
[output truncated at ${GREP_OUTPUT_LIMIT} bytes]`);
|
|
112262
112322
|
if (code === 0)
|
|
112263
|
-
return
|
|
112323
|
+
return resolve46(out3);
|
|
112264
112324
|
if (code === 1)
|
|
112265
|
-
return
|
|
112325
|
+
return resolve46("no matches");
|
|
112266
112326
|
reject(new ToolError(`grep: rg failed: ${errOut || `exit ${code}`}`));
|
|
112267
112327
|
});
|
|
112268
112328
|
proc.on("error", (e10) => {
|
|
@@ -112434,8 +112494,8 @@ var init_node2 = __esm(() => {
|
|
|
112434
112494
|
`;
|
|
112435
112495
|
__classPrivateFieldGet(this, _BashSession_proc, "f").stdin.write(wrapped);
|
|
112436
112496
|
if (__classPrivateFieldGet(this, _BashSession_buf, "f").indexOf(sentinel3) < 0) {
|
|
112437
|
-
const { promise: sentinelSeen, resolve:
|
|
112438
|
-
__classPrivateFieldSet(this, _BashSession_waiting, { sentinel: sentinel3, resolve:
|
|
112497
|
+
const { promise: sentinelSeen, resolve: resolve46 } = promiseWithResolvers();
|
|
112498
|
+
__classPrivateFieldSet(this, _BashSession_waiting, { sentinel: sentinel3, resolve: resolve46 }, "f");
|
|
112439
112499
|
let timer;
|
|
112440
112500
|
let onAbort;
|
|
112441
112501
|
try {
|
|
@@ -112595,8 +112655,8 @@ async function withTimeout(p, ms) {
|
|
|
112595
112655
|
try {
|
|
112596
112656
|
return await Promise.race([
|
|
112597
112657
|
p.then(() => false, () => false),
|
|
112598
|
-
new Promise((
|
|
112599
|
-
timer = setTimeout(() =>
|
|
112658
|
+
new Promise((resolve46) => {
|
|
112659
|
+
timer = setTimeout(() => resolve46(true), ms);
|
|
112600
112660
|
})
|
|
112601
112661
|
]);
|
|
112602
112662
|
} finally {
|
|
@@ -114269,12 +114329,12 @@ var init_BetaMessageStream = __esm(() => {
|
|
|
114269
114329
|
}
|
|
114270
114330
|
return this._emit("error", new AnthropicError(String(error2)));
|
|
114271
114331
|
});
|
|
114272
|
-
__classPrivateFieldSet(this, _BetaMessageStream_connectedPromise, new Promise((
|
|
114273
|
-
__classPrivateFieldSet(this, _BetaMessageStream_resolveConnectedPromise,
|
|
114332
|
+
__classPrivateFieldSet(this, _BetaMessageStream_connectedPromise, new Promise((resolve46, reject) => {
|
|
114333
|
+
__classPrivateFieldSet(this, _BetaMessageStream_resolveConnectedPromise, resolve46, "f");
|
|
114274
114334
|
__classPrivateFieldSet(this, _BetaMessageStream_rejectConnectedPromise, reject, "f");
|
|
114275
114335
|
}), "f");
|
|
114276
|
-
__classPrivateFieldSet(this, _BetaMessageStream_endPromise, new Promise((
|
|
114277
|
-
__classPrivateFieldSet(this, _BetaMessageStream_resolveEndPromise,
|
|
114336
|
+
__classPrivateFieldSet(this, _BetaMessageStream_endPromise, new Promise((resolve46, reject) => {
|
|
114337
|
+
__classPrivateFieldSet(this, _BetaMessageStream_resolveEndPromise, resolve46, "f");
|
|
114278
114338
|
__classPrivateFieldSet(this, _BetaMessageStream_rejectEndPromise, reject, "f");
|
|
114279
114339
|
}), "f");
|
|
114280
114340
|
__classPrivateFieldGet(this, _BetaMessageStream_connectedPromise, "f").catch(() => {});
|
|
@@ -114434,11 +114494,11 @@ var init_BetaMessageStream = __esm(() => {
|
|
|
114434
114494
|
return this;
|
|
114435
114495
|
}
|
|
114436
114496
|
emitted(event) {
|
|
114437
|
-
return new Promise((
|
|
114497
|
+
return new Promise((resolve46, reject) => {
|
|
114438
114498
|
__classPrivateFieldSet(this, _BetaMessageStream_catchingPromiseCreated, true, "f");
|
|
114439
114499
|
if (event !== "error")
|
|
114440
114500
|
this.once("error", reject);
|
|
114441
|
-
this.once(event,
|
|
114501
|
+
this.once(event, resolve46);
|
|
114442
114502
|
});
|
|
114443
114503
|
}
|
|
114444
114504
|
async done() {
|
|
@@ -114815,7 +114875,7 @@ var init_BetaMessageStream = __esm(() => {
|
|
|
114815
114875
|
if (done) {
|
|
114816
114876
|
return { value: undefined, done: true };
|
|
114817
114877
|
}
|
|
114818
|
-
return new Promise((
|
|
114878
|
+
return new Promise((resolve46, reject) => readQueue2.push({ resolve: resolve46, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
|
|
114819
114879
|
}
|
|
114820
114880
|
const chunk = pushQueue.shift();
|
|
114821
114881
|
return { value: chunk, done: false };
|
|
@@ -121206,12 +121266,12 @@ var init_MessageStream = __esm(() => {
|
|
|
121206
121266
|
}
|
|
121207
121267
|
return this._emit("error", new AnthropicError(String(error2)));
|
|
121208
121268
|
});
|
|
121209
|
-
__classPrivateFieldSet(this, _MessageStream_connectedPromise, new Promise((
|
|
121210
|
-
__classPrivateFieldSet(this, _MessageStream_resolveConnectedPromise,
|
|
121269
|
+
__classPrivateFieldSet(this, _MessageStream_connectedPromise, new Promise((resolve46, reject) => {
|
|
121270
|
+
__classPrivateFieldSet(this, _MessageStream_resolveConnectedPromise, resolve46, "f");
|
|
121211
121271
|
__classPrivateFieldSet(this, _MessageStream_rejectConnectedPromise, reject, "f");
|
|
121212
121272
|
}), "f");
|
|
121213
|
-
__classPrivateFieldSet(this, _MessageStream_endPromise, new Promise((
|
|
121214
|
-
__classPrivateFieldSet(this, _MessageStream_resolveEndPromise,
|
|
121273
|
+
__classPrivateFieldSet(this, _MessageStream_endPromise, new Promise((resolve46, reject) => {
|
|
121274
|
+
__classPrivateFieldSet(this, _MessageStream_resolveEndPromise, resolve46, "f");
|
|
121215
121275
|
__classPrivateFieldSet(this, _MessageStream_rejectEndPromise, reject, "f");
|
|
121216
121276
|
}), "f");
|
|
121217
121277
|
__classPrivateFieldGet(this, _MessageStream_connectedPromise, "f").catch(() => {});
|
|
@@ -121354,11 +121414,11 @@ var init_MessageStream = __esm(() => {
|
|
|
121354
121414
|
return this;
|
|
121355
121415
|
}
|
|
121356
121416
|
emitted(event) {
|
|
121357
|
-
return new Promise((
|
|
121417
|
+
return new Promise((resolve46, reject) => {
|
|
121358
121418
|
__classPrivateFieldSet(this, _MessageStream_catchingPromiseCreated, true, "f");
|
|
121359
121419
|
if (event !== "error")
|
|
121360
121420
|
this.once("error", reject);
|
|
121361
|
-
this.once(event,
|
|
121421
|
+
this.once(event, resolve46);
|
|
121362
121422
|
});
|
|
121363
121423
|
}
|
|
121364
121424
|
async done() {
|
|
@@ -121683,7 +121743,7 @@ var init_MessageStream = __esm(() => {
|
|
|
121683
121743
|
if (done) {
|
|
121684
121744
|
return { value: undefined, done: true };
|
|
121685
121745
|
}
|
|
121686
|
-
return new Promise((
|
|
121746
|
+
return new Promise((resolve46, reject) => readQueue2.push({ resolve: resolve46, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
|
|
121687
121747
|
}
|
|
121688
121748
|
const chunk = pushQueue.shift();
|
|
121689
121749
|
return { value: chunk, done: false };
|
|
@@ -126991,9 +127051,9 @@ var init_opus_consult = __esm(() => {
|
|
|
126991
127051
|
// ../../loki-ts/src/util/conflict_resume.ts
|
|
126992
127052
|
import { createHash as createHash41 } from "crypto";
|
|
126993
127053
|
import { execFileSync as execFileSync14 } from "child_process";
|
|
126994
|
-
import { chmodSync as chmodSync10, existsSync as existsSync119, mkdirSync as mkdirSync91, mkdtempSync as mkdtempSync28, readdirSync as readdirSync58, readFileSync as readFileSync153, rmSync as rmSync54, statSync as
|
|
127054
|
+
import { chmodSync as chmodSync10, existsSync as existsSync119, mkdirSync as mkdirSync91, mkdtempSync as mkdtempSync28, readdirSync as readdirSync58, readFileSync as readFileSync153, rmSync as rmSync54, statSync as statSync52, symlinkSync as symlinkSync7, writeFileSync as writeFileSync89 } from "fs";
|
|
126995
127055
|
import { tmpdir as tmpdir36 } from "os";
|
|
126996
|
-
import { basename as
|
|
127056
|
+
import { basename as basename48, dirname as dirname74, isAbsolute as isAbsolute28, join as join168, relative as relative38 } from "path";
|
|
126997
127057
|
function answerMark(events2, assumeNext = false) {
|
|
126998
127058
|
if (assumeNext)
|
|
126999
127059
|
return events2.length;
|
|
@@ -127360,7 +127420,7 @@ async function adjudicateWallConflict(ctx, first, firstSession, wall, deps = {})
|
|
|
127360
127420
|
const reason = firstSession.markers.specConflict, rels = wall.map((f5) => relative38(ctx.repoDir, f5.path)), a = reason ? wallAnchor(reason, rels) : null;
|
|
127361
127421
|
if (!reason || !a)
|
|
127362
127422
|
return null;
|
|
127363
|
-
const f = wall[rels.indexOf(a.file)], o = ctx.outputs(), task = o.intake?.task ?? "", name =
|
|
127423
|
+
const f = wall[rels.indexOf(a.file)], o = ctx.outputs(), task = o.intake?.task ?? "", name = basename48(f.path), original = f.content;
|
|
127364
127424
|
if (!wallRefereeEnabled())
|
|
127365
127425
|
return legacyReauthor(ctx, first, firstSession, f, a, reason, task);
|
|
127366
127426
|
const done = o.wall?.arbitration_rounds ?? [];
|
|
@@ -127460,7 +127520,7 @@ ${brief}`, ...sid ? { resumeSessionId: sid } : {} });
|
|
|
127460
127520
|
}
|
|
127461
127521
|
}
|
|
127462
127522
|
async function legacyReauthor(ctx, first, firstSession, f, a, reason, task) {
|
|
127463
|
-
const ids = [], o = ctx.outputs(), cwd = mkdtempSync28(join168(tmpdir36(), "loki-e15-wall-")), name =
|
|
127523
|
+
const ids = [], o = ctx.outputs(), cwd = mkdtempSync28(join168(tmpdir36(), "loki-e15-wall-")), name = basename48(f.path);
|
|
127464
127524
|
try {
|
|
127465
127525
|
writeFileSync89(join168(cwd, name), f.content, "utf8");
|
|
127466
127526
|
const id2 = `${first.iterationId}-wa`;
|
|
@@ -127558,7 +127618,7 @@ async function deliverOverWallConflict(o, repoDir, reverify, emit2, opts = {}) {
|
|
|
127558
127618
|
}
|
|
127559
127619
|
}, modeOf = (p) => {
|
|
127560
127620
|
try {
|
|
127561
|
-
return
|
|
127621
|
+
return statSync52(p).mode & 4095;
|
|
127562
127622
|
} catch {
|
|
127563
127623
|
return null;
|
|
127564
127624
|
}
|
|
@@ -127825,8 +127885,8 @@ __export(exports_run_outputs, {
|
|
|
127825
127885
|
});
|
|
127826
127886
|
import { execFile as execFile3, spawnSync as spawnSync29 } from "child_process";
|
|
127827
127887
|
import { createHash as createHash42 } from "crypto";
|
|
127828
|
-
import { existsSync as existsSync120, lstatSync as lstatSync36, mkdirSync as mkdirSync92, readdirSync as readdirSync59, readFileSync as readFileSync154, statSync as
|
|
127829
|
-
import { basename as
|
|
127888
|
+
import { existsSync as existsSync120, lstatSync as lstatSync36, mkdirSync as mkdirSync92, readdirSync as readdirSync59, readFileSync as readFileSync154, statSync as statSync53, writeFileSync as writeFileSync90 } from "fs";
|
|
127889
|
+
import { basename as basename49, join as join169, resolve as resolve46 } from "path";
|
|
127830
127890
|
function intentRevisionsBlock(revs) {
|
|
127831
127891
|
const r = (revs ?? []).filter((r10) => r10.unapplied !== true).map(({ rev, source, actor, sha: sha6 }) => ({ rev, source, actor, sha: sha6 }));
|
|
127832
127892
|
return r.length ? { intent_revisions: r } : {};
|
|
@@ -127859,7 +127919,7 @@ function sealAccuracyLine(changed, checks, model, env2 = process.env, nowMs = Da
|
|
|
127859
127919
|
const res = JSON.parse(readFileSync154(file, "utf8"));
|
|
127860
127920
|
if (res.manifest_sha256 !== corpus2 || !Array.isArray(res.runs))
|
|
127861
127921
|
return SEAL_ACCURACY_NOT_MEASURED;
|
|
127862
|
-
const first = changed.map((f) =>
|
|
127922
|
+
const first = changed.map((f) => basename49(f)).find((b) => !SPEC_PREFIXES.some((p) => b.startsWith(p)));
|
|
127863
127923
|
const lang = first === undefined ? "unknown" : LANG_BY_EXT[first.slice(first.lastIndexOf(".")).toLowerCase()] ?? "unknown";
|
|
127864
127924
|
const runner = checks.find((c) => c.result === "pass")?.cmd.trim().split(/\s+/)[0];
|
|
127865
127925
|
const run2 = res.runs.find((r) => typeof r["model"] === "string" && resolveClaudeModel(r["model"]) === resolveClaudeModel(model));
|
|
@@ -128007,7 +128067,7 @@ function findInterrupted(repoDir, runId2, includeCancelled = false, why) {
|
|
|
128007
128067
|
} catch {
|
|
128008
128068
|
return null;
|
|
128009
128069
|
}
|
|
128010
|
-
const rows = ids.filter((id2) => /^e10-[A-Za-z0-9-]+$/.test(id2) && existsSync120(join169(repoDir, eventsRelPath(id2)))).map((id2) => ({ id: id2, m:
|
|
128070
|
+
const rows = ids.filter((id2) => /^e10-[A-Za-z0-9-]+$/.test(id2) && existsSync120(join169(repoDir, eventsRelPath(id2)))).map((id2) => ({ id: id2, m: statSync53(join169(repoDir, eventsRelPath(id2))).mtimeMs })).sort((a, b) => b.m - a.m);
|
|
128011
128071
|
const top = rows[0];
|
|
128012
128072
|
if (!top)
|
|
128013
128073
|
return null;
|
|
@@ -128285,7 +128345,7 @@ async function resumeFlag(runId2, noPr = false, deps = {}, answer) {
|
|
|
128285
128345
|
};
|
|
128286
128346
|
const supervise = deps.supervise ?? (async (o) => (await Promise.resolve().then(() => (init_supervisor(), exports_supervisor))).runSupervisor(o));
|
|
128287
128347
|
const { exitCodeOf: exitCodeOf2 } = await Promise.resolve().then(() => (init_output(), exports_output));
|
|
128288
|
-
const res = await supervise({ runId: it2.runId, repoDir, env: env2, resume: true, capS: capS === undefined ? undefined : Math.floor(capS), capCeilingS: ceilS === undefined ? undefined : Math.floor(ceilS), restoreBranch: origBranch, workerArgv: [process.execPath, ...SAFE_BUN_FLAGS,
|
|
128348
|
+
const res = await supervise({ runId: it2.runId, repoDir, env: env2, resume: true, capS: capS === undefined ? undefined : Math.floor(capS), capCeilingS: ceilS === undefined ? undefined : Math.floor(ceilS), restoreBranch: origBranch, workerArgv: [process.execPath, ...SAFE_BUN_FLAGS, resolve46(process.argv[1] ?? ""), "engine10", "worker", it2.runId, provider, model, deep ? "deep" : "fast"], started: { ...st2, resumed_from: rp2.stage, ...answer !== undefined ? { answered: true, answer: redactSecrets(answer), answer_sha256: createHash42("sha256").update(redactSecrets(answer)).digest("hex"), question: String(conflictReasonOf(it2.events) ?? "the run is blocked on a spec conflict").replace(/[\x00-\x1f\x7f]+/g, " ").trim().slice(0, 500) } : {} }, pr: pr2 });
|
|
128289
128349
|
out3(`engine10: resumed run ${it2.runId}: ${res.outcome}
|
|
128290
128350
|
`);
|
|
128291
128351
|
return exitCodeOf2(res.outcome);
|
|
@@ -128304,7 +128364,7 @@ async function signedReceiptFacts(runDir, runId2, events2) {
|
|
|
128304
128364
|
for (const f of [file, join169(runDir, "events.jsonl")]) {
|
|
128305
128365
|
try {
|
|
128306
128366
|
if (lstatSync36(f).isSymbolicLink())
|
|
128307
|
-
return { problem: `${
|
|
128367
|
+
return { problem: `${basename49(f)} is a symlink; a run's own files are never links` };
|
|
128308
128368
|
} catch {}
|
|
128309
128369
|
}
|
|
128310
128370
|
let r;
|
|
@@ -128674,7 +128734,7 @@ function issueStatusProjector(o) {
|
|
|
128674
128734
|
return r.catch(() => null);
|
|
128675
128735
|
};
|
|
128676
128736
|
}
|
|
128677
|
-
function policyGate(repoDir, action, env2 = process.env, checkJs =
|
|
128737
|
+
function policyGate(repoDir, action, env2 = process.env, checkJs = resolve46(import.meta.dir, "../../../src/policies/check.js"), timeoutMs = 30000) {
|
|
128678
128738
|
if (policyFile(repoDir, env2) === null)
|
|
128679
128739
|
return { decision: "allow", reason: "no policy file" };
|
|
128680
128740
|
if (env2.LOKI_POLICY_REQUIRE_NODE === "0" && spawnSync29("node", ["--version"], { env: { PATH: env2.PATH }, encoding: "utf8" }).status !== 0)
|
|
@@ -128909,7 +128969,7 @@ var init_run_outputs = __esm(() => {
|
|
|
128909
128969
|
|
|
128910
128970
|
// ../../loki-ts/src/util/composite_seal.ts
|
|
128911
128971
|
import { existsSync as existsSync121, readFileSync as readFileSync155 } from "fs";
|
|
128912
|
-
import { basename as
|
|
128972
|
+
import { basename as basename50, dirname as dirname75, join as join170 } from "path";
|
|
128913
128973
|
function logProblem(runDir, integ) {
|
|
128914
128974
|
if (typeof integ["log_sha256"] !== "string")
|
|
128915
128975
|
return null;
|
|
@@ -128980,8 +129040,8 @@ function composeComposite(runDir, rh, toolchain = collectToolchain()) {
|
|
|
128980
129040
|
throw new Error("workspace has no repos");
|
|
128981
129041
|
return {
|
|
128982
129042
|
schema: COMPOSITE_SCHEMA,
|
|
128983
|
-
workspace:
|
|
128984
|
-
run_id:
|
|
129043
|
+
workspace: basename50(dirname75(runDir)),
|
|
129044
|
+
run_id: basename50(runDir),
|
|
128985
129045
|
integration_sha256: sha3(ibytes),
|
|
128986
129046
|
integration: { status: String(integ["status"]), exit_code: typeof integ["exit_code"] === "number" ? integ["exit_code"] : null, log_sha256: typeof integ["log_sha256"] === "string" ? integ["log_sha256"] : null, heads },
|
|
128987
129047
|
children,
|
|
@@ -129108,8 +129168,8 @@ __export(exports_verify_cmd, {
|
|
|
129108
129168
|
checkEventLog: () => checkEventLog,
|
|
129109
129169
|
checkAttestation: () => checkAttestation
|
|
129110
129170
|
});
|
|
129111
|
-
import { existsSync as existsSync122, readFileSync as readFileSync156, renameSync as renameSync30, statSync as
|
|
129112
|
-
import { basename as
|
|
129171
|
+
import { existsSync as existsSync122, readFileSync as readFileSync156, renameSync as renameSync30, statSync as statSync54, writeFileSync as writeFileSync91 } from "fs";
|
|
129172
|
+
import { basename as basename51, dirname as dirname76, join as join171 } from "path";
|
|
129113
129173
|
import { createHash as createHash43, verify as verify5 } from "crypto";
|
|
129114
129174
|
function checkAttestation(jwt, expectedHash, given) {
|
|
129115
129175
|
const bad = (reason) => ({ status: "tampered", reason });
|
|
@@ -129144,11 +129204,11 @@ function wallTamperProblem(receiptPath, receipt) {
|
|
|
129144
129204
|
cur = createHash43("sha256").update(readFileSync156(copy)).digest("hex");
|
|
129145
129205
|
} catch {
|
|
129146
129206
|
if (haveWallDir)
|
|
129147
|
-
return `sealed Wall file ${
|
|
129207
|
+
return `sealed Wall file ${basename51(f.path)} is missing from the run's wall directory: it was deleted after the seal`;
|
|
129148
129208
|
continue;
|
|
129149
129209
|
}
|
|
129150
129210
|
if (cur !== f.sha256)
|
|
129151
|
-
return `sealed Wall file ${
|
|
129211
|
+
return `sealed Wall file ${basename51(f.path)} changed after the seal: receipt recorded sha256 ${f.sha256}, on disk ${cur}`;
|
|
129152
129212
|
}
|
|
129153
129213
|
return null;
|
|
129154
129214
|
}
|
|
@@ -129330,7 +129390,7 @@ async function verifyCompositeFile(receiptPath, receipt, deps) {
|
|
|
129330
129390
|
}
|
|
129331
129391
|
function sealCompositeCmd(runDir) {
|
|
129332
129392
|
let body;
|
|
129333
|
-
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(
|
|
129393
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(basename51(runDir.replace(/\/+$/, ""))))
|
|
129334
129394
|
return process.stderr.write(`loki verify: run directory name is not a valid run id; composite would never verify
|
|
129335
129395
|
`), 2;
|
|
129336
129396
|
try {
|
|
@@ -129426,7 +129486,7 @@ ${/^(unknown option|expected at most one)/.test(pk.error) ? `Usage: loki verify
|
|
|
129426
129486
|
if (!runId2)
|
|
129427
129487
|
return process.stderr.write(`loki verify: no runs found
|
|
129428
129488
|
`), 66;
|
|
129429
|
-
const isFile2 = existsSync122(runId2) &&
|
|
129489
|
+
const isFile2 = existsSync122(runId2) && statSync54(runId2).isFile();
|
|
129430
129490
|
const isPath = isFile2 || /[\\/]/.test(runId2) || runId2.endsWith(".json");
|
|
129431
129491
|
const receiptPath = isPath ? runId2 : join171(runsRoot2, runId2, "receipt.json");
|
|
129432
129492
|
const byRunId = !isPath;
|
|
@@ -129572,8 +129632,8 @@ var init_verify_cmd = __esm(() => {
|
|
|
129572
129632
|
});
|
|
129573
129633
|
|
|
129574
129634
|
// src/server/app.ts
|
|
129575
|
-
import { existsSync as existsSync125, readFileSync as readFileSync160, statSync as
|
|
129576
|
-
import { join as join175, resolve as
|
|
129635
|
+
import { existsSync as existsSync125, readFileSync as readFileSync160, statSync as statSync56 } from "fs";
|
|
129636
|
+
import { join as join175, resolve as resolve48, sep as sep31 } from "path";
|
|
129577
129637
|
|
|
129578
129638
|
// node_modules/hono/dist/request/constants.js
|
|
129579
129639
|
var GET_MATCH_RESULT = Symbol();
|
|
@@ -136218,6 +136278,7 @@ function reconcileDeadRuns(db, o = {}) {
|
|
|
136218
136278
|
|
|
136219
136279
|
// src/server/repos.ts
|
|
136220
136280
|
import { execFile } from "child_process";
|
|
136281
|
+
import { statSync as statSync6 } from "fs";
|
|
136221
136282
|
import { basename as basename2, resolve as resolve5 } from "path";
|
|
136222
136283
|
init_discover();
|
|
136223
136284
|
function syncLocalRepos(db, repoDir, env = process.env) {
|
|
@@ -136228,6 +136289,17 @@ function syncLocalRepos(db, repoDir, env = process.env) {
|
|
|
136228
136289
|
}
|
|
136229
136290
|
return found.length;
|
|
136230
136291
|
}
|
|
136292
|
+
function repoPathsByName(db, name) {
|
|
136293
|
+
const rows = db.select({ sourceId: localRepos.sourceId, realpath: localRepos.realpath, name: localRepos.name }).from(localRepos).all();
|
|
136294
|
+
const byOrigin = new Set(db.selectDistinct({ s: runs.sourceId, r: runs.originRepo }).from(runs).all().filter((x) => x.r !== null && x.r.split("/").pop() === name).map((x) => x.s));
|
|
136295
|
+
return [...new Set(rows.filter((r) => r.name === name || byOrigin.has(r.sourceId)).map((r) => r.realpath))].filter((d) => {
|
|
136296
|
+
try {
|
|
136297
|
+
return statSync6(d).isDirectory();
|
|
136298
|
+
} catch {
|
|
136299
|
+
return false;
|
|
136300
|
+
}
|
|
136301
|
+
});
|
|
136302
|
+
}
|
|
136231
136303
|
function repoNames(db) {
|
|
136232
136304
|
return [...new Set(db.select({ name: localRepos.name }).from(localRepos).all().map((r) => r.name))].sort();
|
|
136233
136305
|
}
|
|
@@ -136390,7 +136462,7 @@ function mount2(ctx) {
|
|
|
136390
136462
|
import { basename as basename4 } from "path";
|
|
136391
136463
|
|
|
136392
136464
|
// src/ask/policy.ts
|
|
136393
|
-
import { chmodSync as chmodSync3, existsSync as existsSync8, lstatSync as lstatSync4, mkdtempSync as mkdtempSync3, readFileSync as readFileSync13, realpathSync as realpathSync7, rmSync as rmSync5, statSync as
|
|
136465
|
+
import { chmodSync as chmodSync3, existsSync as existsSync8, lstatSync as lstatSync4, mkdtempSync as mkdtempSync3, readFileSync as readFileSync13, realpathSync as realpathSync7, rmSync as rmSync5, statSync as statSync7, writeFileSync as writeFileSync8 } from "fs";
|
|
136394
136466
|
import { tmpdir as tmpdir5 } from "os";
|
|
136395
136467
|
import { dirname as dirname7, join as join19, parse } from "path";
|
|
136396
136468
|
var MCP_SERVER_NAME = "loki-ask";
|
|
@@ -136505,7 +136577,7 @@ function removeJobDir(dir) {
|
|
|
136505
136577
|
const marker = join19(dir, MARKER);
|
|
136506
136578
|
if (!existsSync8(marker) || readFileSync13(marker, "utf8") !== dir)
|
|
136507
136579
|
refuse("marker missing or wrong");
|
|
136508
|
-
if (!
|
|
136580
|
+
if (!statSync7(marker).isFile())
|
|
136509
136581
|
refuse("marker is not a file");
|
|
136510
136582
|
rmSync5(dir, { recursive: true, force: true });
|
|
136511
136583
|
}
|
|
@@ -136626,7 +136698,7 @@ import { join as join21 } from "path";
|
|
|
136626
136698
|
// src/server/spawn.ts
|
|
136627
136699
|
init_types();
|
|
136628
136700
|
import { spawn } from "child_process";
|
|
136629
|
-
import { existsSync as existsSync9, readFileSync as readFileSync14, realpathSync as realpathSync8, statSync as
|
|
136701
|
+
import { existsSync as existsSync9, readFileSync as readFileSync14, realpathSync as realpathSync8, statSync as statSync8 } from "fs";
|
|
136630
136702
|
import { homedir as homedir7 } from "os";
|
|
136631
136703
|
import { basename as basename3, dirname as dirname8, join as join20, resolve as resolve6 } from "path";
|
|
136632
136704
|
var ISSUE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}\/[A-Za-z0-9._-]{1,100}#[1-9][0-9]{0,8}$/;
|
|
@@ -136665,7 +136737,7 @@ function repoRefusal(cwd, env = process.env) {
|
|
|
136665
136737
|
function registryRepos2(env = process.env) {
|
|
136666
136738
|
try {
|
|
136667
136739
|
const j = JSON.parse(readFileSync14(join20(env.HOME || homedir7(), ".loki", "dashboard", "projects.json"), "utf8"));
|
|
136668
|
-
return Object.values(j.projects ?? {}).map((p) => typeof p?.path === "string" ? p.path : "").filter((p) => p && existsSync9(p) &&
|
|
136740
|
+
return Object.values(j.projects ?? {}).map((p) => typeof p?.path === "string" ? p.path : "").filter((p) => p && existsSync9(p) && statSync8(p).isDirectory());
|
|
136669
136741
|
} catch {
|
|
136670
136742
|
return [];
|
|
136671
136743
|
}
|
|
@@ -137365,11 +137437,11 @@ function mount5(ctx) {
|
|
|
137365
137437
|
|
|
137366
137438
|
// src/server/routes/checkpoints.ts
|
|
137367
137439
|
init_safe_git();
|
|
137368
|
-
import { appendFileSync as appendFileSync3, copyFileSync, cpSync, existsSync as existsSync11, lstatSync as lstatSync5, mkdirSync as mkdirSync9, readdirSync as readdirSync9, readFileSync as readFileSync16, realpathSync as realpathSync9, rmSync as rmSync6, statSync as
|
|
137440
|
+
import { appendFileSync as appendFileSync3, copyFileSync, cpSync, existsSync as existsSync11, lstatSync as lstatSync5, mkdirSync as mkdirSync9, readdirSync as readdirSync9, readFileSync as readFileSync16, realpathSync as realpathSync9, rmSync as rmSync6, statSync as statSync10, writeFileSync as writeFileSync10 } from "fs";
|
|
137369
137441
|
import { join as join23, sep as sep6 } from "path";
|
|
137370
137442
|
|
|
137371
137443
|
// src/server/routes/cost_ledger.ts
|
|
137372
|
-
import { existsSync as existsSync10, readdirSync as readdirSync8, readFileSync as readFileSync15, statSync as
|
|
137444
|
+
import { existsSync as existsSync10, readdirSync as readdirSync8, readFileSync as readFileSync15, statSync as statSync9 } from "fs";
|
|
137373
137445
|
import { join as join22 } from "path";
|
|
137374
137446
|
var isNum2 = (v) => typeof v === "number" && Number.isFinite(v);
|
|
137375
137447
|
var isObj3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -137594,7 +137666,7 @@ function costTimeline(lokiDir2) {
|
|
|
137594
137666
|
} catch {}
|
|
137595
137667
|
for (const e of entries) {
|
|
137596
137668
|
try {
|
|
137597
|
-
if (!
|
|
137669
|
+
if (!statSync9(join22(proofs, e)).isDirectory())
|
|
137598
137670
|
continue;
|
|
137599
137671
|
} catch {
|
|
137600
137672
|
continue;
|
|
@@ -137759,7 +137831,7 @@ function rollbackCheckpoint(repoDir, id, now2 = new Date) {
|
|
|
137759
137831
|
} catch {
|
|
137760
137832
|
return null;
|
|
137761
137833
|
}
|
|
137762
|
-
if (!real3.startsWith(`${realStore}${sep6}`) || !
|
|
137834
|
+
if (!real3.startsWith(`${realStore}${sep6}`) || !statSync10(real3).isDirectory())
|
|
137763
137835
|
return null;
|
|
137764
137836
|
const preId = `rb-pre-${stamp(now2)}`, pre = join23(store, preId);
|
|
137765
137837
|
mkdirSync9(pre, { recursive: true });
|
|
@@ -137891,8 +137963,8 @@ function mount7(ctx) {
|
|
|
137891
137963
|
|
|
137892
137964
|
// src/server/routes/config.ts
|
|
137893
137965
|
import { createHash as createHash6, randomBytes as randomBytes2 } from "crypto";
|
|
137894
|
-
import { closeSync as closeSync6, fchmodSync, fsyncSync as fsyncSync2, lstatSync as lstatSync6, openSync as openSync6, readFileSync as readFileSync17, realpathSync as realpathSync10, renameSync as renameSync5, statSync as
|
|
137895
|
-
import { basename as
|
|
137966
|
+
import { closeSync as closeSync6, fchmodSync, fsyncSync as fsyncSync2, lstatSync as lstatSync6, openSync as openSync6, readFileSync as readFileSync17, realpathSync as realpathSync10, renameSync as renameSync5, statSync as statSync11, unlinkSync as unlinkSync2, writeSync as writeSync3 } from "fs";
|
|
137967
|
+
import { basename as basename6, dirname as dirname9, join as join24, sep as sep7 } from "path";
|
|
137896
137968
|
|
|
137897
137969
|
// node_modules/yaml/dist/index.js
|
|
137898
137970
|
var composer = require_composer();
|
|
@@ -137941,6 +138013,7 @@ var $visit = visit.visit;
|
|
|
137941
138013
|
var $visitAsync = visit.visitAsync;
|
|
137942
138014
|
|
|
137943
138015
|
// src/server/routes/start.ts
|
|
138016
|
+
import { basename as basename5, resolve as resolve7 } from "path";
|
|
137944
138017
|
function originOk(origin) {
|
|
137945
138018
|
if (origin === undefined || origin === null)
|
|
137946
138019
|
return true;
|
|
@@ -137969,7 +138042,18 @@ function mount8(ctx) {
|
|
|
137969
138042
|
return c.json({ error: "invalid JSON" }, 400);
|
|
137970
138043
|
}
|
|
137971
138044
|
const target = typeof body?.target === "string" ? body.target : undefined;
|
|
137972
|
-
const
|
|
138045
|
+
const b = body, known = [repoDir, ...registryRepos2()];
|
|
138046
|
+
if (b && typeof b.repo === "string" && b.repo !== "" && !b.repo.includes("/") && !known.some((k) => basename5(resolve7(k)) === b.repo)) {
|
|
138047
|
+
const hits = repoPathsByName(db, b.repo);
|
|
138048
|
+
if (hits.length === 1) {
|
|
138049
|
+
known.push(hits[0]);
|
|
138050
|
+
b.repo = hits[0];
|
|
138051
|
+
} else if (hits.length > 1) {
|
|
138052
|
+
audit3(db, { kind: "run.start", target, result: "refused", detail: `${hits.length} checkouts match ${b.repo}` });
|
|
138053
|
+
return c.json({ error: `${hits.length} checkouts on this machine belong to ${b.repo}; start the run from the one you mean with loki start` }, 400);
|
|
138054
|
+
}
|
|
138055
|
+
}
|
|
138056
|
+
const plan = planStart(body, known, ctx.startBin);
|
|
137973
138057
|
if (!plan.ok) {
|
|
137974
138058
|
audit3(db, { kind: "run.start", target, result: "refused", detail: plan.error });
|
|
137975
138059
|
return c.json({ error: plan.error }, 400);
|
|
@@ -138348,7 +138432,7 @@ function resolveConfigFile(repoDir) {
|
|
|
138348
138432
|
}
|
|
138349
138433
|
if (!real3.startsWith(root + sep7))
|
|
138350
138434
|
return { ok: false, status: 400, error: "loki.yaml is a symlink that resolves outside the repo" };
|
|
138351
|
-
if (!
|
|
138435
|
+
if (!statSync11(real3).isFile())
|
|
138352
138436
|
return { ok: false, status: 422, error: "loki.yaml is not a regular file" };
|
|
138353
138437
|
return { ok: true, file: real3, exists: true };
|
|
138354
138438
|
}
|
|
@@ -138357,7 +138441,7 @@ function resolveConfigFile(repoDir) {
|
|
|
138357
138441
|
return { ok: true, file: p, exists: true };
|
|
138358
138442
|
}
|
|
138359
138443
|
function atomicWrite(file, text2, mode) {
|
|
138360
|
-
const tmp = join24(dirname9(file), `.${
|
|
138444
|
+
const tmp = join24(dirname9(file), `.${basename6(file)}.${process.pid}.${randomBytes2(6).toString("hex")}.tmp`);
|
|
138361
138445
|
const fd = openSync6(tmp, "wx", mode);
|
|
138362
138446
|
try {
|
|
138363
138447
|
writeSync3(fd, text2);
|
|
@@ -138397,7 +138481,7 @@ function mount9(ctx) {
|
|
|
138397
138481
|
return deny(c, "config.read", r.status, r.error);
|
|
138398
138482
|
let raw2 = "";
|
|
138399
138483
|
if (r.exists) {
|
|
138400
|
-
if (
|
|
138484
|
+
if (statSync11(r.file).size > MAX_FILE)
|
|
138401
138485
|
return deny(c, "config.read", 413, "loki.yaml is too large");
|
|
138402
138486
|
raw2 = readFileSync17(r.file, "utf8");
|
|
138403
138487
|
}
|
|
@@ -138462,7 +138546,7 @@ function mount9(ctx) {
|
|
|
138462
138546
|
return refuse(r.status, r.error);
|
|
138463
138547
|
let raw2 = "";
|
|
138464
138548
|
if (r.exists) {
|
|
138465
|
-
if (
|
|
138549
|
+
if (statSync11(r.file).size > MAX_FILE)
|
|
138466
138550
|
return refuse(400, "loki.yaml is too large");
|
|
138467
138551
|
raw2 = readFileSync17(r.file, "utf8");
|
|
138468
138552
|
}
|
|
@@ -138489,7 +138573,7 @@ function mount9(ctx) {
|
|
|
138489
138573
|
return refuse(400, "could not render the config safely");
|
|
138490
138574
|
const changed = [...new Set([...Object.keys(prev), ...Object.keys(next)])].filter((k) => !deepEq(prev[k], next[k]));
|
|
138491
138575
|
try {
|
|
138492
|
-
const mode = r.exists ?
|
|
138576
|
+
const mode = r.exists ? statSync11(r.file).mode & 511 : 420;
|
|
138493
138577
|
if (r.exists)
|
|
138494
138578
|
atomicWrite(`${r.file}.bak`, raw2, 384);
|
|
138495
138579
|
atomicWrite(r.file, out, mode);
|
|
@@ -138508,7 +138592,7 @@ function mount9(ctx) {
|
|
|
138508
138592
|
|
|
138509
138593
|
// src/server/routes/control.ts
|
|
138510
138594
|
import { existsSync as existsSync12, realpathSync as realpathSync11 } from "fs";
|
|
138511
|
-
import { join as join25, resolve as
|
|
138595
|
+
import { join as join25, resolve as resolve8, sep as sep8 } from "path";
|
|
138512
138596
|
init_run_pid();
|
|
138513
138597
|
var ID4 = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
138514
138598
|
var busy = new Set;
|
|
@@ -138534,7 +138618,7 @@ function mount10(ctx) {
|
|
|
138534
138618
|
}
|
|
138535
138619
|
if (!repo)
|
|
138536
138620
|
return done(404, "refused", { error: "this run's repo is not known on this machine" });
|
|
138537
|
-
const runsRoot = join25(repo, ".loki", "runs"), runDir =
|
|
138621
|
+
const runsRoot = join25(repo, ".loki", "runs"), runDir = resolve8(runsRoot, id);
|
|
138538
138622
|
if (!runDir.startsWith(runsRoot + sep8))
|
|
138539
138623
|
return done(400, "refused", { error: "invalid run id" }, "path escape");
|
|
138540
138624
|
return handler({ source, run: id, repo, runDir }, done);
|
|
@@ -138691,7 +138775,7 @@ var DOCTOR_TIMEOUT_MS = 25000;
|
|
|
138691
138775
|
var MAX_OUT = 1e6;
|
|
138692
138776
|
var isStatus = (s) => s === "pass" || s === "warn" || s === "fail";
|
|
138693
138777
|
function runDoctor(bin, timeoutMs = DOCTOR_TIMEOUT_MS) {
|
|
138694
|
-
return new Promise((
|
|
138778
|
+
return new Promise((resolve9, reject) => {
|
|
138695
138779
|
let out2 = "";
|
|
138696
138780
|
let done = false;
|
|
138697
138781
|
let child;
|
|
@@ -138718,7 +138802,7 @@ function runDoctor(bin, timeoutMs = DOCTOR_TIMEOUT_MS) {
|
|
|
138718
138802
|
out2 += d.toString("utf8");
|
|
138719
138803
|
});
|
|
138720
138804
|
child.on("error", (e) => finish2(() => reject(new Error(`could not run loki doctor: ${e.message}`))));
|
|
138721
|
-
child.on("close", () => finish2(() =>
|
|
138805
|
+
child.on("close", () => finish2(() => resolve9(out2)));
|
|
138722
138806
|
});
|
|
138723
138807
|
}
|
|
138724
138808
|
function mapDoctor(raw2) {
|
|
@@ -138764,7 +138848,7 @@ function mount12(ctx) {
|
|
|
138764
138848
|
// src/server/routes/fleet.ts
|
|
138765
138849
|
import { readdirSync as readdirSync10, readFileSync as readFileSync18 } from "fs";
|
|
138766
138850
|
import { homedir as homedir8 } from "os";
|
|
138767
|
-
import { basename as
|
|
138851
|
+
import { basename as basename7, join as join26 } from "path";
|
|
138768
138852
|
var isNum3 = (v) => typeof v === "number" && Number.isFinite(v);
|
|
138769
138853
|
var isObj6 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
138770
138854
|
var registryFile = () => join26(process.env.HOME ?? homedir8(), ".loki", "dashboard", "projects.json");
|
|
@@ -138845,7 +138929,7 @@ function fleetRuns(includeInactive = true, file = registryFile()) {
|
|
|
138845
138929
|
}
|
|
138846
138930
|
return {
|
|
138847
138931
|
id: p.id ?? null,
|
|
138848
|
-
name: p.name || (path ?
|
|
138932
|
+
name: p.name || (path ? basename7(path) : "project"),
|
|
138849
138933
|
path,
|
|
138850
138934
|
status,
|
|
138851
138935
|
running,
|
|
@@ -138881,7 +138965,7 @@ function mount13(ctx) {
|
|
|
138881
138965
|
}
|
|
138882
138966
|
|
|
138883
138967
|
// src/server/routes/memory.ts
|
|
138884
|
-
import { existsSync as existsSync13, readFileSync as readFileSync19, readdirSync as readdirSync11, realpathSync as realpathSync12, statSync as
|
|
138968
|
+
import { existsSync as existsSync13, readFileSync as readFileSync19, readdirSync as readdirSync11, realpathSync as realpathSync12, statSync as statSync12 } from "fs";
|
|
138885
138969
|
import { join as join27, sep as sep9 } from "path";
|
|
138886
138970
|
var isObj7 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
138887
138971
|
var nonEmpty = (v) => !(v === undefined || v === null || v === "" || Array.isArray(v) && v.length === 0 || isObj7(v) && Object.keys(v).length === 0);
|
|
@@ -138935,12 +139019,12 @@ function setFocus(repoDir, raw2, registry = registryFile()) {
|
|
|
138935
139019
|
let real3 = "";
|
|
138936
139020
|
try {
|
|
138937
139021
|
real3 = realpathSync12(s);
|
|
138938
|
-
if (!
|
|
139022
|
+
if (!statSync12(real3).isDirectory())
|
|
138939
139023
|
throw new Error("not a dir");
|
|
138940
139024
|
} catch {
|
|
138941
139025
|
return { ok: false, error: `Directory does not exist: ${s}` };
|
|
138942
139026
|
}
|
|
138943
|
-
if (!existsSync13(join27(real3, ".loki")) || !
|
|
139027
|
+
if (!existsSync13(join27(real3, ".loki")) || !statSync12(join27(real3, ".loki")).isDirectory())
|
|
138944
139028
|
return { ok: false, error: `Directory does not contain a .loki/ subdirectory: ${s}` };
|
|
138945
139029
|
const allowed = new Set;
|
|
138946
139030
|
try {
|
|
@@ -139159,7 +139243,7 @@ function mount14(ctx) {
|
|
|
139159
139243
|
}
|
|
139160
139244
|
|
|
139161
139245
|
// src/server/routes/metrics.ts
|
|
139162
|
-
import { readdirSync as readdirSync12, readFileSync as readFileSync20, statSync as
|
|
139246
|
+
import { readdirSync as readdirSync12, readFileSync as readFileSync20, statSync as statSync13 } from "fs";
|
|
139163
139247
|
import { join as join28 } from "path";
|
|
139164
139248
|
var isObj8 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
139165
139249
|
var arr = (v) => Array.isArray(v) ? v : [];
|
|
@@ -139233,7 +139317,7 @@ function buildMetricsText(repoDir, now2 = Date.now()) {
|
|
|
139233
139317
|
} catch {}
|
|
139234
139318
|
for (const e of entries) {
|
|
139235
139319
|
try {
|
|
139236
|
-
if (!
|
|
139320
|
+
if (!statSync13(join28(pdir, e)).isDirectory())
|
|
139237
139321
|
continue;
|
|
139238
139322
|
} catch {
|
|
139239
139323
|
continue;
|
|
@@ -139485,7 +139569,7 @@ function mount16(ctx) {
|
|
|
139485
139569
|
|
|
139486
139570
|
// src/server/routes/integrations.ts
|
|
139487
139571
|
import { spawn as spawn4 } from "child_process";
|
|
139488
|
-
import { existsSync as existsSync15, readFileSync as readFileSync22, statSync as
|
|
139572
|
+
import { existsSync as existsSync15, readFileSync as readFileSync22, statSync as statSync14 } from "fs";
|
|
139489
139573
|
import { delimiter, join as join30 } from "path";
|
|
139490
139574
|
var GH_TIMEOUT_MS = 3000;
|
|
139491
139575
|
var isSet = (n3) => !!n3 && (process.env[n3] ?? "") !== "";
|
|
@@ -139493,21 +139577,21 @@ function ghAuthed(pathVar = process.env.PATH ?? "", timeoutMs = GH_TIMEOUT_MS) {
|
|
|
139493
139577
|
const exe = pathVar.split(delimiter).filter(Boolean).map((d) => join30(d, "gh")).find((p) => existsSync15(p));
|
|
139494
139578
|
if (!exe)
|
|
139495
139579
|
return Promise.resolve(null);
|
|
139496
|
-
return new Promise((
|
|
139580
|
+
return new Promise((resolve9) => {
|
|
139497
139581
|
let done = false;
|
|
139498
139582
|
let timer;
|
|
139499
139583
|
const finish2 = (v) => {
|
|
139500
139584
|
if (!done) {
|
|
139501
139585
|
done = true;
|
|
139502
139586
|
clearTimeout(timer);
|
|
139503
|
-
|
|
139587
|
+
resolve9(v);
|
|
139504
139588
|
}
|
|
139505
139589
|
};
|
|
139506
139590
|
let child;
|
|
139507
139591
|
try {
|
|
139508
139592
|
child = spawn4(exe, ["auth", "status"], { stdio: "ignore", env: { ...process.env, NO_COLOR: "1" } });
|
|
139509
139593
|
} catch {
|
|
139510
|
-
return
|
|
139594
|
+
return resolve9(null);
|
|
139511
139595
|
}
|
|
139512
139596
|
timer = setTimeout(() => {
|
|
139513
139597
|
try {
|
|
@@ -139522,7 +139606,7 @@ function ghAuthed(pathVar = process.env.PATH ?? "", timeoutMs = GH_TIMEOUT_MS) {
|
|
|
139522
139606
|
function configuredName(repoDir, path) {
|
|
139523
139607
|
try {
|
|
139524
139608
|
const r = resolveConfigFile(repoDir);
|
|
139525
|
-
if (!r.ok || !r.exists ||
|
|
139609
|
+
if (!r.ok || !r.exists || statSync14(r.file).size > 1e6)
|
|
139526
139610
|
return null;
|
|
139527
139611
|
const doc = $parseDocument(readFileSync22(r.file, "utf8"));
|
|
139528
139612
|
if (doc.errors.length)
|
|
@@ -139536,7 +139620,7 @@ function configuredName(repoDir, path) {
|
|
|
139536
139620
|
function mcpServers(repoDir) {
|
|
139537
139621
|
try {
|
|
139538
139622
|
const p = join30(repoDir, ".mcp.json");
|
|
139539
|
-
if (!existsSync15(p) ||
|
|
139623
|
+
if (!existsSync15(p) || statSync14(p).size > 1e6)
|
|
139540
139624
|
return null;
|
|
139541
139625
|
const j = JSON.parse(readFileSync22(p, "utf8"));
|
|
139542
139626
|
return j.mcpServers && typeof j.mcpServers === "object" ? Object.keys(j.mcpServers).length : null;
|
|
@@ -139617,7 +139701,7 @@ function mount17(ctx) {
|
|
|
139617
139701
|
// src/server/routes/merge_risk.ts
|
|
139618
139702
|
import { spawn as spawn5 } from "child_process";
|
|
139619
139703
|
import { realpathSync as realpathSync13 } from "fs";
|
|
139620
|
-
import { basename as
|
|
139704
|
+
import { basename as basename8, resolve as resolve9 } from "path";
|
|
139621
139705
|
var PR = /^[0-9]{1,7}$/;
|
|
139622
139706
|
var REF = /^[A-Za-z0-9._/][A-Za-z0-9._/-]{0,99}$/;
|
|
139623
139707
|
var MAX_OUT2 = 256 * 1024;
|
|
@@ -139729,12 +139813,12 @@ function mount18(ctx) {
|
|
|
139729
139813
|
for (const k of [ctx.repoDir, ...registryRepos2()]) {
|
|
139730
139814
|
const r = real3(k);
|
|
139731
139815
|
if (r)
|
|
139732
|
-
known.set(r,
|
|
139816
|
+
known.set(r, basename8(resolve9(k)));
|
|
139733
139817
|
}
|
|
139734
139818
|
const wantReal = real3(want);
|
|
139735
139819
|
if (wantReal && known.has(wantReal))
|
|
139736
139820
|
return wantReal;
|
|
139737
|
-
const named = [...known].filter(([r, label2]) => label2 === want ||
|
|
139821
|
+
const named = [...known].filter(([r, label2]) => label2 === want || basename8(r) === want).map(([r]) => r);
|
|
139738
139822
|
return named.length === 1 ? named[0] : null;
|
|
139739
139823
|
};
|
|
139740
139824
|
const slot = async (c, kind, auditKind, fn) => {
|
|
@@ -139949,7 +140033,7 @@ function probeCli(bin, timeoutMs, pathVar = process.env.PATH ?? "") {
|
|
|
139949
140033
|
const exe = findOnPath(bin, pathVar);
|
|
139950
140034
|
if (!exe)
|
|
139951
140035
|
return Promise.resolve({ installed: false, version: null, probe: "not_found" });
|
|
139952
|
-
return new Promise((
|
|
140036
|
+
return new Promise((resolve10) => {
|
|
139953
140037
|
let out2 = "";
|
|
139954
140038
|
let done = false;
|
|
139955
140039
|
let timer;
|
|
@@ -139957,14 +140041,14 @@ function probeCli(bin, timeoutMs, pathVar = process.env.PATH ?? "") {
|
|
|
139957
140041
|
if (!done) {
|
|
139958
140042
|
done = true;
|
|
139959
140043
|
clearTimeout(timer);
|
|
139960
|
-
|
|
140044
|
+
resolve10(r);
|
|
139961
140045
|
}
|
|
139962
140046
|
};
|
|
139963
140047
|
let child;
|
|
139964
140048
|
try {
|
|
139965
140049
|
child = spawn6(exe, ["--version"], { stdio: ["ignore", "pipe", "ignore"], env: { ...process.env, NO_COLOR: "1" } });
|
|
139966
140050
|
} catch {
|
|
139967
|
-
return
|
|
140051
|
+
return resolve10({ installed: true, version: null, probe: "error" });
|
|
139968
140052
|
}
|
|
139969
140053
|
timer = setTimeout(() => {
|
|
139970
140054
|
try {
|
|
@@ -140120,9 +140204,9 @@ function mount21(ctx) {
|
|
|
140120
140204
|
}
|
|
140121
140205
|
|
|
140122
140206
|
// src/server/routes/workspace.ts
|
|
140123
|
-
import { existsSync as existsSync123, mkdirSync as mkdirSync93, readFileSync as readFileSync158, readdirSync as readdirSync60, renameSync as renameSync31, statSync as
|
|
140207
|
+
import { existsSync as existsSync123, mkdirSync as mkdirSync93, readFileSync as readFileSync158, readdirSync as readdirSync60, renameSync as renameSync31, statSync as statSync55, writeFileSync as writeFileSync92 } from "fs";
|
|
140124
140208
|
import { homedir as homedir18, userInfo } from "os";
|
|
140125
|
-
import { dirname as dirname77, join as join173, resolve as
|
|
140209
|
+
import { dirname as dirname77, join as join173, resolve as resolve47, sep as sep30 } from "path";
|
|
140126
140210
|
var ID7 = /^[a-z0-9][a-z0-9-]{0,39}$/;
|
|
140127
140211
|
var MAX_BYTES3 = 200000;
|
|
140128
140212
|
var workspaceFile = (env2 = process.env) => env2["LOKI_WORKSPACE_FILE"] || join173(homedir18(), ".loki", "control", "workspace.json");
|
|
@@ -140192,7 +140276,7 @@ function repoDirsOf(db2, name) {
|
|
|
140192
140276
|
const rows = db2.select({ name: localRepos.name, realpath: localRepos.realpath }).from(localRepos).all().filter((r) => r.name === name);
|
|
140193
140277
|
return [...new Set(rows.map((r) => r.realpath))].filter((d) => {
|
|
140194
140278
|
try {
|
|
140195
|
-
return
|
|
140279
|
+
return statSync55(d).isDirectory();
|
|
140196
140280
|
} catch {
|
|
140197
140281
|
return false;
|
|
140198
140282
|
}
|
|
@@ -140203,7 +140287,7 @@ var INSTRUCTION_FILES = ["CLAUDE.md", "CLAUDE.local.md", ".claude/CLAUDE.md", "A
|
|
|
140203
140287
|
var NOTE_DIRS = [".loki/memory", ".loki/learnings", ".claude/rules"];
|
|
140204
140288
|
var readCapped3 = (p) => {
|
|
140205
140289
|
try {
|
|
140206
|
-
const st2 =
|
|
140290
|
+
const st2 = statSync55(p);
|
|
140207
140291
|
if (!st2.isFile())
|
|
140208
140292
|
return null;
|
|
140209
140293
|
const b = readFileSync158(p);
|
|
@@ -140234,7 +140318,7 @@ function repoKnowledge(dir) {
|
|
|
140234
140318
|
return { instructions, notes };
|
|
140235
140319
|
}
|
|
140236
140320
|
function writeInstructions(dir, content) {
|
|
140237
|
-
const root =
|
|
140321
|
+
const root = resolve47(dir), target = join173(root, "CLAUDE.md");
|
|
140238
140322
|
if (!target.startsWith(root + sep30))
|
|
140239
140323
|
throw new Error("path outside the repository");
|
|
140240
140324
|
const tmp = `${target}.${process.pid}.tmp`;
|
|
@@ -141046,9 +141130,9 @@ function createApp(opts) {
|
|
|
141046
141130
|
}
|
|
141047
141131
|
if (!uiDir || p.startsWith("/v1/"))
|
|
141048
141132
|
return c.json({ error: "not found" }, 404);
|
|
141049
|
-
const root =
|
|
141050
|
-
const f =
|
|
141051
|
-
if (f.startsWith(root + sep31) && existsSync125(f) &&
|
|
141133
|
+
const root = resolve48(uiDir);
|
|
141134
|
+
const f = resolve48(root, `.${p}`);
|
|
141135
|
+
if (f.startsWith(root + sep31) && existsSync125(f) && statSync56(f).isFile())
|
|
141052
141136
|
return new Response(Bun.file(f));
|
|
141053
141137
|
if (/\.[a-z0-9]+$/i.test(p))
|
|
141054
141138
|
return c.json({ error: "not found" }, 404);
|