loki-mode 11.83.0 → 11.84.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 +1354 -1350
- package/mcp/__init__.py +1 -1
- package/package.json +2 -2
- package/packages/control-plane/dist/server.js +200 -80
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/web-app/dist/assets/{AdminPage-DpWNKWhs.js → AdminPage-CXLv81So.js} +1 -1
- package/web-app/dist/assets/{Avatar-BjGfE5Z2.js → Avatar-Dkquf4s9.js} +1 -1
- package/web-app/dist/assets/{Badge-BZzQgc5L.js → Badge-BPlO-Wiw.js} +1 -1
- package/web-app/dist/assets/{Button-B4UFBoKo.js → Button-BO-JvVyh.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-HrjOxPcp.js → CockpitPage-DCuXv1OL.js} +1 -1
- package/web-app/dist/assets/{ComparePage-rDB52mbC.js → ComparePage-zVSpiuEp.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-BnGTHBD5.js → ErrorBoundary-Ci4wqP2a.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-EWQ-AUvr.js → EvidenceReceiptPanel-CEBhqO60.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-COCm9cnv.js → GitHubIssuesPanel-UR6xkpVn.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-ZYNmFQAR.js → GitHubPRsPanel-BspmPZ6K.js} +1 -1
- package/web-app/dist/assets/{HomePage-CJXtxNhl.js → HomePage-DchBOs8o.js} +2 -2
- package/web-app/dist/assets/{LoginPage-CXG5HrnH.js → LoginPage-BldlfUlE.js} +1 -1
- package/web-app/dist/assets/{MagicPage-D_1k-qFR.js → MagicPage-CVnhnrh6.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-Bh2OOgQW.js → MetricsPage-I_Ye6IjS.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-DYtJqd7q.js → NotFoundPage-CCDI4T7K.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-C0_lqGnI.js → ProjectPage-DuyA8Qz7.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-C3ZDOF-i.js → ProjectsPage-BF2JSz1r.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-DNLBBiFb.js → SettingsPage-B_5LeF6K.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-jxMrHvDJ.js → ShowcasePage-lE5cIgbU.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-C2ZPx8uP.js → SystemSettingsPage-v2DJyogx.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-CmSWv2WS.js → TeamsPage-eXMmORI1.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-Cqcz3jC1.js → TemplatesPage-CkHulSrT.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-Cfy74R8E.js → TerminalOutput-DJwjzb2Y.js} +1 -1
- package/web-app/dist/assets/{activity-DvB2Cewz.js → activity-CAtLpfNe.js} +1 -1
- package/web-app/dist/assets/{bell-DFPKTgoZ.js → bell-CL-IIbCA.js} +1 -1
- package/web-app/dist/assets/{bot-Bf5xNfiN.js → bot-fT57nwl5.js} +1 -1
- package/web-app/dist/assets/{check-BdqIiGKJ.js → check-hWhzzw0m.js} +1 -1
- package/web-app/dist/assets/{chevron-left-Q2RMHGjD.js → chevron-left-BLHNp2u-.js} +1 -1
- package/web-app/dist/assets/{circle-alert-CSsLxjNX.js → circle-alert-BiPOqU-L.js} +1 -1
- package/web-app/dist/assets/{clock-SUq-A-Pc.js → clock-Cqcvrmkj.js} +1 -1
- package/web-app/dist/assets/{cloud-1Qu-bH4o.js → cloud-DUijmoIE.js} +1 -1
- package/web-app/dist/assets/{code-xml-B8tVFMMA.js → code-xml-CHpO2Oxh.js} +1 -1
- package/web-app/dist/assets/{database-BqqcDq2C.js → database-DggasNHP.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-D3Q2UCG0.js → dollar-sign-CXxG_8K6.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-CRIBFOW5.js → file-code-corner-xfVvREvW.js} +1 -1
- package/web-app/dist/assets/{file-plus-Bv-fZPBA.js → file-plus-CxboFD8a.js} +1 -1
- package/web-app/dist/assets/{globe-C4B7SAB9.js → globe-uQo7wmFo.js} +1 -1
- package/web-app/dist/assets/{hammer-y0Ikysax.js → hammer-DpmqB3Jc.js} +1 -1
- package/web-app/dist/assets/{index-dNruR__0.js → index-DSecwFL3.js} +3 -3
- package/web-app/dist/assets/{layers-EgGWmhHw.js → layers-DAhv2mJy.js} +1 -1
- package/web-app/dist/assets/{loader-circle-Bt5dIF0I.js → loader-circle-DlfD5ae4.js} +1 -1
- package/web-app/dist/assets/{lock-BGuyekU7.js → lock-Bp9L8WT9.js} +1 -1
- package/web-app/dist/assets/{package-BkYbeAX3.js → package-YoE2sWU8.js} +1 -1
- package/web-app/dist/assets/{plus-BzcgCbLN.js → plus-DdcvjiWR.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-Dm5Jp3fH.js → refresh-cw-DlhQH4A4.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-BwCcLLQd.js → rotate-ccw-BMskUWd9.js} +1 -1
- package/web-app/dist/assets/{scroll-text-ZdYcnYoT.js → scroll-text-wq9VgYsu.js} +1 -1
- package/web-app/dist/assets/{server-BKLLV1vh.js → server-BvBfqjcL.js} +1 -1
- package/web-app/dist/assets/{shield-alert-BmdJ5RUP.js → shield-alert-Ctv17L9P.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-BkgThloL.js → thumbs-up-Bppr-IMM.js} +1 -1
- package/web-app/dist/assets/{trash-2-CEGx8Si2.js → trash-2-C__rfpz0.js} +1 -1
- package/web-app/dist/assets/{trending-down-bDEP2c-J.js → trending-down-CA0bokwG.js} +1 -1
- package/web-app/dist/assets/{trending-up-BTZtHq6z.js → trending-up-BFh3twff.js} +1 -1
- package/web-app/dist/assets/{upload-CU4BNteU.js → upload-DABSXWW6.js} +1 -1
- package/web-app/dist/assets/{usePolling-uzQ6JTcy.js → usePolling-DcTxi6kF.js} +1 -1
- package/web-app/dist/assets/{user-Bz1t2qnf.js → user-y8K-uMqG.js} +1 -1
- package/web-app/dist/index.html +1 -1
|
@@ -8987,7 +8987,12 @@ function reapLiveGroup(pgid, onReap) {
|
|
|
8987
8987
|
onReap();
|
|
8988
8988
|
killGroupWithGrace(pgid);
|
|
8989
8989
|
}
|
|
8990
|
+
function maxTurnsFor(limitS, env) {
|
|
8991
|
+
const user = Number(env["LOKI_E10_MAX_TURNS"]);
|
|
8992
|
+
return Number.isInteger(user) && user > 0 ? user : Math.max(MIN_TURNS, Math.ceil(limitS / SECONDS_PER_TURN));
|
|
8993
|
+
}
|
|
8990
8994
|
function clampBashTimeoutEnv(env, limitS) {
|
|
8995
|
+
env["LOKI_E10_MAX_TURNS"] = String(maxTurnsFor(limitS, env));
|
|
8991
8996
|
const budget = Math.max(BASH_CLAMP_FLOOR_MS, Math.floor(limitS * 1000) - BASH_CLAMP_MARGIN_MS);
|
|
8992
8997
|
for (const [k, dflt] of [["BASH_DEFAULT_TIMEOUT_MS", 120000], ["BASH_MAX_TIMEOUT_MS", 600000]]) {
|
|
8993
8998
|
const cur = Number(env[k]);
|
|
@@ -9075,7 +9080,7 @@ function spawnWorker(argv, env, cwd, backstopMs, escalateMs, onLine, onStopped =
|
|
|
9075
9080
|
});
|
|
9076
9081
|
});
|
|
9077
9082
|
}
|
|
9078
|
-
var CANCEL_GRACE_MS, DRAIN_MS = 2000, KILL_GRACE_MS2 = 2000, BASH_CLAMP_FLOOR_MS = 30000, BASH_CLAMP_MARGIN_MS = 1e4, SAFE_BUN_FLAGS, ULIMIT_REFUSED_EXIT = 97, ULIMIT_KNOBS;
|
|
9083
|
+
var CANCEL_GRACE_MS, DRAIN_MS = 2000, KILL_GRACE_MS2 = 2000, BASH_CLAMP_FLOOR_MS = 30000, BASH_CLAMP_MARGIN_MS = 1e4, MAX_TURNS_EXIT = 98, SECONDS_PER_TURN = 3, MIN_TURNS = 10, SAFE_BUN_FLAGS, ULIMIT_REFUSED_EXIT = 97, ULIMIT_KNOBS;
|
|
9079
9084
|
var init_worker_proc = __esm(() => {
|
|
9080
9085
|
CANCEL_GRACE_MS = Number(process.env["LOKI_E10_CANCEL_GRACE_MS"]) > 0 ? Number(process.env["LOKI_E10_CANCEL_GRACE_MS"]) : 1e4;
|
|
9081
9086
|
SAFE_BUN_FLAGS = ["--no-env-file", "--config=/dev/null"];
|
|
@@ -12485,6 +12490,7 @@ async function consumeSdkStream(messages, ctx, clock) {
|
|
|
12485
12490
|
let refusedNoFallback = false;
|
|
12486
12491
|
let rateLimit;
|
|
12487
12492
|
let sawResult = false;
|
|
12493
|
+
let maxTurns = false;
|
|
12488
12494
|
const usageById = new Map;
|
|
12489
12495
|
let anonUsageId = 0;
|
|
12490
12496
|
let firstTurnId;
|
|
@@ -12725,10 +12731,11 @@ async function consumeSdkStream(messages, ctx, clock) {
|
|
|
12725
12731
|
if (advisorById.size === 0)
|
|
12726
12732
|
recordRouterUsage(new Map, advisorById, "#result", data.usage ?? {});
|
|
12727
12733
|
writeResultCost(lokiRoot, ctx.iteration, data, data.model ?? sessionModel, firstTurnPromptTokens, { ...routerTelemetry(reqById, advisorById, advisorFaults), ...toolTelemetry() }, ctx.requestedModel);
|
|
12728
|
-
|
|
12734
|
+
maxTurns = data.subtype === "error_max_turns";
|
|
12735
|
+
exitCode = data.is_error || maxTurns ? 1 : 0;
|
|
12729
12736
|
}
|
|
12730
12737
|
}
|
|
12731
|
-
return { exitCode, sessionId: sessionId ?? seenSessionId, totalCostUsd, capturedText: captured, rateLimit, sawResult, truncated: guard.truncated || !sawResult, refused, refusedNoFallback };
|
|
12738
|
+
return { exitCode, sessionId: sessionId ?? seenSessionId, totalCostUsd, capturedText: captured, rateLimit, sawResult, truncated: guard.truncated || !sawResult, refused, refusedNoFallback, maxTurns };
|
|
12732
12739
|
}
|
|
12733
12740
|
async function* asAsync(src, guard) {
|
|
12734
12741
|
try {
|
|
@@ -53667,6 +53674,7 @@ var exports_providers = {};
|
|
|
53667
53674
|
__export(exports_providers, {
|
|
53668
53675
|
useProviderDefaultModel: () => useProviderDefaultModel,
|
|
53669
53676
|
truthy: () => truthy,
|
|
53677
|
+
stageMaxTurns: () => stageMaxTurns,
|
|
53670
53678
|
selectClaudeInvokerKind: () => selectClaudeInvokerKind,
|
|
53671
53679
|
sdkQueryProvider: () => sdkQueryProvider,
|
|
53672
53680
|
resolveSystemPrompt: () => resolveSystemPrompt,
|
|
@@ -53755,6 +53763,10 @@ function claudeTierToModel(tier) {
|
|
|
53755
53763
|
return pinned("DEVELOPMENT", "sonnet");
|
|
53756
53764
|
}
|
|
53757
53765
|
}
|
|
53766
|
+
function stageMaxTurns(env = process.env) {
|
|
53767
|
+
const n10 = Number(env["LOKI_E10_MAX_TURNS"]);
|
|
53768
|
+
return env["LOKI_E10_STAGE"] && Number.isInteger(n10) && n10 > 0 ? n10 : undefined;
|
|
53769
|
+
}
|
|
53758
53770
|
async function* closeQueryOnResult(q10, enabled) {
|
|
53759
53771
|
if (!enabled) {
|
|
53760
53772
|
yield* q10;
|
|
@@ -54186,7 +54198,8 @@ function sdkQueryProvider() {
|
|
|
54186
54198
|
...extra.maxBudgetUsd ? { maxBudgetUsd: extra.maxBudgetUsd } : {},
|
|
54187
54199
|
...extra.taskBudget ? { taskBudget: extra.taskBudget } : {},
|
|
54188
54200
|
...extra.fallbackModel ? { fallbackModel: extra.fallbackModel } : {},
|
|
54189
|
-
...extra.settings ? { settings: extra.settings } : {}
|
|
54201
|
+
...extra.settings ? { settings: extra.settings } : {},
|
|
54202
|
+
...stageMaxTurns() ? { maxTurns: stageMaxTurns() } : {}
|
|
54190
54203
|
}
|
|
54191
54204
|
});
|
|
54192
54205
|
const res = await consumeSdkStream(closeQueryOnResult(q10, !!process.env["LOKI_E10_STAGE"]), {
|
|
@@ -54200,7 +54213,11 @@ function sdkQueryProvider() {
|
|
|
54200
54213
|
captured = res.capturedText;
|
|
54201
54214
|
if (process.env["LOKI_E10_STAGE"])
|
|
54202
54215
|
writeSessionId(call.cwd, process.env["LOKI_ITERATION"] ?? "0", res);
|
|
54203
|
-
exitCode = res.sawResult ? res.exitCode : 1;
|
|
54216
|
+
exitCode = res.sawResult ? res.maxTurns ? MAX_TURNS_EXIT : res.exitCode : 1;
|
|
54217
|
+
if (res.maxTurns)
|
|
54218
|
+
captured += `
|
|
54219
|
+
[sdk-loop error: turn cap reached (error_max_turns)]
|
|
54220
|
+
`;
|
|
54204
54221
|
rateLimit = res.rateLimit;
|
|
54205
54222
|
} catch (e10) {
|
|
54206
54223
|
captured += `
|
|
@@ -54939,6 +54956,8 @@ function childEnv2(opts, cfg) {
|
|
|
54939
54956
|
env["LOKI_SDK_LOOP"] = "1";
|
|
54940
54957
|
env["LOKI_HOST_GUARD"] = "1";
|
|
54941
54958
|
env["CLAUDE_CODE_DISABLE_BACKGROUND_TASKS"] = "1";
|
|
54959
|
+
if (process.env["LOKI_E10_STAGE"])
|
|
54960
|
+
delete env["LOKI_E10_MAX_TURNS"];
|
|
54942
54961
|
clampBashTimeoutEnv(env, opts.limitS);
|
|
54943
54962
|
if (env["LOKI_E10_PREFIX"] === undefined)
|
|
54944
54963
|
env["LOKI_E10_PREFIX"] = "lean";
|
|
@@ -55183,7 +55202,8 @@ var init_session = __esm(() => {
|
|
|
55183
55202
|
[127, "command not found"],
|
|
55184
55203
|
[130, "SIGINT"],
|
|
55185
55204
|
[137, "SIGKILL"],
|
|
55186
|
-
[143, "SIGTERM"]
|
|
55205
|
+
[143, "SIGTERM"],
|
|
55206
|
+
[98, "turn cap"]
|
|
55187
55207
|
].map(([code, what]) => [code, `exit ${code} (${what})`]));
|
|
55188
55208
|
lastStageEnd = new WeakMap;
|
|
55189
55209
|
main = sessionChildMain;
|
|
@@ -55485,7 +55505,8 @@ async function discoverProjectModel(ctx, signal, opts = {}) {
|
|
|
55485
55505
|
const session = raced;
|
|
55486
55506
|
const raw2 = readAnswer(answerPath, session.summary);
|
|
55487
55507
|
if (raw2 === undefined && (session.killed || session.exit !== 0)) {
|
|
55488
|
-
|
|
55508
|
+
const capped = session.exit === MAX_TURNS_EXIT && !session.killed;
|
|
55509
|
+
return { model: unknownModel("", `owner=${capped ? "harness" : "provider"}: the discovery session ${capped ? "hit the turn cap" : "failed"} (exit ${session.exit}${session.killed ? ", killed" : ""})`), cached: false, attempts: attempt, owner: capped ? "harness" : "provider" };
|
|
55489
55510
|
}
|
|
55490
55511
|
const v3 = raw2 === undefined ? null : validateAnswer(ctx.repoDir, raw2);
|
|
55491
55512
|
if (v3?.ok) {
|
|
@@ -55515,6 +55536,7 @@ async function intakeProjectModel(ctx, signal, startedMs) {
|
|
|
55515
55536
|
var PROJECT_FILE = ".loki/project.json", UNKNOWN_TTL_MS, SESSION_LIMIT_S = 60, HARD_GRACE_MS = 5000, MIN_SESSION_S = 8, KILL_GRACE_S = 2, MARGIN_S = 3;
|
|
55516
55537
|
var init_discover2 = __esm(() => {
|
|
55517
55538
|
init_model_downgrades();
|
|
55539
|
+
init_worker_proc();
|
|
55518
55540
|
init_types();
|
|
55519
55541
|
init_gather();
|
|
55520
55542
|
init_schema();
|
|
@@ -55997,7 +56019,8 @@ var init_python_build_check = __esm(() => {
|
|
|
55997
56019
|
// ../../loki-ts/src/util/check_result.ts
|
|
55998
56020
|
import { spawn as spawn9 } from "child_process";
|
|
55999
56021
|
import { createHash as createHash13 } from "crypto";
|
|
56000
|
-
import { existsSync as existsSync37, mkdirSync as mkdirSync23, readFileSync as readFileSync49, realpathSync as realpathSync19, renameSync as renameSync11, rmSync as rmSync13, writeFileSync as writeFileSync22 } from "fs";
|
|
56022
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync23, mkdtempSync as mkdtempSync5, readFileSync as readFileSync49, realpathSync as realpathSync19, renameSync as renameSync11, rmSync as rmSync13, writeFileSync as writeFileSync22 } from "fs";
|
|
56023
|
+
import { tmpdir as tmpdir7 } from "os";
|
|
56001
56024
|
import { basename as basename12, dirname as dirname23, isAbsolute as isAbsolute6, join as join54, relative as relative6 } from "path";
|
|
56002
56025
|
function plainTestEnv(base = process.env) {
|
|
56003
56026
|
const e10 = {};
|
|
@@ -56033,7 +56056,7 @@ function ran(raw2, path, ok2) {
|
|
|
56033
56056
|
function cargoTrailer(out3) {
|
|
56034
56057
|
const ls2 = out3.split(`
|
|
56035
56058
|
`).filter((x3) => x3.trim());
|
|
56036
|
-
while (ls2.length &&
|
|
56059
|
+
while (ls2.length && CARGO_NOISE.test(ls2[ls2.length - 1]))
|
|
56037
56060
|
ls2.pop();
|
|
56038
56061
|
const segs = [];
|
|
56039
56062
|
for (const l of ls2) {
|
|
@@ -56122,7 +56145,8 @@ function goRunner(cmd, args) {
|
|
|
56122
56145
|
return {};
|
|
56123
56146
|
}
|
|
56124
56147
|
function goJson(out3) {
|
|
56125
|
-
let any = false, failed2 = false;
|
|
56148
|
+
let any = false, failed2 = false, dirty = false;
|
|
56149
|
+
const status = new Map, ranSet = new Set, pkgs = new Set, failedTests = new Set, starts = new Map, done = new Map;
|
|
56126
56150
|
for (const x3 of out3.split(`
|
|
56127
56151
|
`)) {
|
|
56128
56152
|
if (!x3.trim() || /^go: /.test(x3))
|
|
@@ -56136,10 +56160,97 @@ function goJson(out3) {
|
|
|
56136
56160
|
if (!e10 || typeof e10 !== "object" || typeof e10.Action !== "string")
|
|
56137
56161
|
return null;
|
|
56138
56162
|
any = true;
|
|
56139
|
-
|
|
56163
|
+
const pkg = typeof e10.Package === "string" ? e10.Package : "", test = typeof e10.Test === "string" ? e10.Test : "";
|
|
56164
|
+
if (e10.Action === "start" && !test) {
|
|
56165
|
+
pkgs.add(pkg);
|
|
56166
|
+
starts.set(pkg, (starts.get(pkg) ?? 0) + 1);
|
|
56167
|
+
}
|
|
56168
|
+
if (e10.Action === "fail") {
|
|
56140
56169
|
failed2 = true;
|
|
56170
|
+
if (test)
|
|
56171
|
+
failedTests.add(`${pkg}::${test}`);
|
|
56172
|
+
}
|
|
56173
|
+
if (!/^build-/.test(e10.Action) && !starts.has(pkg))
|
|
56174
|
+
dirty = true;
|
|
56175
|
+
if (!test && e10.Action === "output" && /\[no tests to run\]/.test(String(e10.Output ?? "")))
|
|
56176
|
+
dirty = true;
|
|
56177
|
+
if (!test) {
|
|
56178
|
+
if (/^(?:pass|fail|skip)$/.test(e10.Action))
|
|
56179
|
+
done.set(pkg, (done.get(pkg) ?? 0) + 1);
|
|
56180
|
+
continue;
|
|
56181
|
+
}
|
|
56182
|
+
if (test.includes("/"))
|
|
56183
|
+
continue;
|
|
56184
|
+
const k3 = `${pkg}::${test}`;
|
|
56185
|
+
if (e10.Action === "run") {
|
|
56186
|
+
if (ranSet.has(k3))
|
|
56187
|
+
dirty = true;
|
|
56188
|
+
ranSet.add(k3);
|
|
56189
|
+
} else if (ranSet.has(k3) && /^(?:pass|fail|skip)$/.test(e10.Action))
|
|
56190
|
+
status.set(k3, e10.Action);
|
|
56191
|
+
}
|
|
56192
|
+
if (!any)
|
|
56193
|
+
return null;
|
|
56194
|
+
const passedNames = [...status].filter(([, v3]) => v3 === "pass").map(([k3]) => k3);
|
|
56195
|
+
return { failed: failed2, failedTests: [...failedTests], passed: passedNames.length, passedNames, complete: !dirty && pkgs.size > 0 && [...pkgs].every((p) => starts.get(p) === 1 && done.get(p) === 1) };
|
|
56196
|
+
}
|
|
56197
|
+
async function corroborateGoPass(c, out3, cmdOrLine, args, o) {
|
|
56198
|
+
if (c.result !== "pass" || goRunner(cmdOrLine, args).runner !== "go")
|
|
56199
|
+
return c;
|
|
56200
|
+
const refuse = { result: "not_run", reason: GO_EXIT0_REASON };
|
|
56201
|
+
const first = goJson(stripAnsi(out3));
|
|
56202
|
+
const names = first?.passedNames ?? [];
|
|
56203
|
+
const toks = args ? [cmdOrLine, ...args] : cmdOrLine.trim().split(/\s+/);
|
|
56204
|
+
if (!names.length || toks.some((t) => /[&|;$`"'<>()\\]/.test(t)) || basename12(toks[0] ?? "") !== "go" || toks[1] !== "test")
|
|
56205
|
+
return refuse;
|
|
56206
|
+
const pkgs = [], run2 = [];
|
|
56207
|
+
for (let k3 = 2;k3 < toks.length; k3++) {
|
|
56208
|
+
const t = toks[k3];
|
|
56209
|
+
if (t === "-json")
|
|
56210
|
+
continue;
|
|
56211
|
+
if (t === "-run") {
|
|
56212
|
+
const v3 = toks[++k3];
|
|
56213
|
+
if (v3 === undefined)
|
|
56214
|
+
return refuse;
|
|
56215
|
+
run2.push("-run", v3);
|
|
56216
|
+
continue;
|
|
56217
|
+
}
|
|
56218
|
+
if (t.startsWith("-"))
|
|
56219
|
+
return refuse;
|
|
56220
|
+
pkgs.push(t);
|
|
56221
|
+
}
|
|
56222
|
+
const dir = mkdtempSync5(join54(tmpdir7(), "loki-gocov-")), prof = join54(dir, "cover.out");
|
|
56223
|
+
try {
|
|
56224
|
+
const r = await spawnCollect("go", ["test", "-json", "-count=1", `-coverprofile=${prof}`, ...run2, ...pkgs.length ? pkgs : ["."]], { cwd: o.cwd, env: o.env, timeoutMs: 600000 });
|
|
56225
|
+
const second = goJson(stripAnsi(r.output));
|
|
56226
|
+
if (r.status !== 0 || !second || second.failed || !second.complete)
|
|
56227
|
+
return refuse;
|
|
56228
|
+
const again = new Set(second.passedNames);
|
|
56229
|
+
if (!names.every((n10) => again.has(n10)))
|
|
56230
|
+
return refuse;
|
|
56231
|
+
const covered = new Set;
|
|
56232
|
+
for (const l of (existsSync37(prof) ? readFileSync49(prof, "utf8") : "").split(`
|
|
56233
|
+
`)) {
|
|
56234
|
+
const m = /^(.+)\/[^/:]+:\d+\.\d+,\d+\.\d+ \d+ \d+$/.exec(l);
|
|
56235
|
+
if (m)
|
|
56236
|
+
covered.add(m[1]);
|
|
56237
|
+
}
|
|
56238
|
+
return [...new Set(names.map((n10) => n10.slice(0, n10.indexOf("::"))))].every((pk2) => covered.has(pk2)) ? c : refuse;
|
|
56239
|
+
} finally {
|
|
56240
|
+
rmSync13(dir, { recursive: true, force: true });
|
|
56141
56241
|
}
|
|
56142
|
-
|
|
56242
|
+
}
|
|
56243
|
+
function readableFailIds(runner, out3) {
|
|
56244
|
+
const text3 = stripAnsi(out3);
|
|
56245
|
+
if (runner === "go")
|
|
56246
|
+
return goJson(text3)?.failedTests ?? [];
|
|
56247
|
+
const failed2 = cargoTrailer(text3).reduce((t, l) => t + +(l.match(/(\d+) failed/)?.[1] ?? 0), 0);
|
|
56248
|
+
const ids = [...new Set(text3.split(`
|
|
56249
|
+
`).flatMap((l) => {
|
|
56250
|
+
const m = /^test (.+?) \.\.\. FAILED$/.exec(l.trim());
|
|
56251
|
+
return m ? [m[1]] : [];
|
|
56252
|
+
}))];
|
|
56253
|
+
return failed2 > 0 && ids.length >= failed2 ? ids : [];
|
|
56143
56254
|
}
|
|
56144
56255
|
function summaryPassFailCount(out3) {
|
|
56145
56256
|
return ["pass", "fail"].reduce((t, k3) => t + +([...out3.matchAll(new RegExp(`^(?:#|\\u2139) ${k3} (\\d+)$`, "gm"))].pop()?.[1] ?? 0), 0);
|
|
@@ -56250,9 +56361,12 @@ function classifyCheck(i) {
|
|
|
56250
56361
|
return { result: i.ok ? "pass" : "fail" };
|
|
56251
56362
|
const text3 = stripAnsi(i.out);
|
|
56252
56363
|
if (i.runner === "go") {
|
|
56253
|
-
if (i.ok)
|
|
56254
|
-
return { result: "not_run", reason: GO_EXIT0_REASON };
|
|
56255
56364
|
const j10 = goJson(text3);
|
|
56365
|
+
if (i.ok) {
|
|
56366
|
+
if (!j10 || j10.failed || !j10.complete)
|
|
56367
|
+
return { result: "not_run", reason: GO_EXIT0_REASON };
|
|
56368
|
+
return j10.passed > 0 ? { result: "pass", n: j10.passed } : { result: "not_run", n: 0, reason: `${NO_TESTS_REASON} (ran 0 tests, empty or all skipped)` };
|
|
56369
|
+
}
|
|
56256
56370
|
if (j10)
|
|
56257
56371
|
return j10.failed ? { result: "fail" } : { result: "not_run", reason: UNCONFIRMED_REASON };
|
|
56258
56372
|
return FAIL_EVIDENCE.test(text3) || GO_FAIL_EVIDENCE.test(text3) ? { result: "fail" } : { result: "not_run", reason: UNCONFIRMED_REASON };
|
|
@@ -56777,7 +56891,7 @@ function classify(f, status, output, repoDir, interpreter) {
|
|
|
56777
56891
|
if (status === null || status === 126 || status === 127)
|
|
56778
56892
|
return "not_run";
|
|
56779
56893
|
if (status === 0)
|
|
56780
|
-
return classifyCheck({ kind: "test", ok: true, out: output, path: f.path
|
|
56894
|
+
return f.runner !== "go" && classifyCheck({ kind: "test", ok: true, out: output, path: f.path }).result === "pass" ? "pass" : "not_run";
|
|
56781
56895
|
if (f.runner === "unittest")
|
|
56782
56896
|
return status === 1 && unittestCount(output, false) !== null ? /unittest\.loader\._FailedTest|Failed to import test module/.test(output) ? pytestCollectionIsRed(output, repoDir) ? "fail" : "not_run" : "fail" : "not_run";
|
|
56783
56897
|
if (f.runner === "pytest")
|
|
@@ -56788,6 +56902,8 @@ function classify(f, status, output, repoDir, interpreter) {
|
|
|
56788
56902
|
const j10 = javaSummary(output);
|
|
56789
56903
|
return j10 && j10.failed > 0 ? "fail" : "not_run";
|
|
56790
56904
|
}
|
|
56905
|
+
if (f.runner === "go" || f.runner === "cargo")
|
|
56906
|
+
return readableFailIds(f.runner, output).length > 0 ? "fail" : "not_run";
|
|
56791
56907
|
return f.runner === "node" && nodeIsRed(f, output) ? "fail" : "not_run";
|
|
56792
56908
|
}
|
|
56793
56909
|
function baseJobs() {
|
|
@@ -56985,7 +57101,7 @@ function firstFileLineAnchor(desc2) {
|
|
|
56985
57101
|
}
|
|
56986
57102
|
var NO_TESTS_REASON = "no tests executed", 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)", stripAnsi = (s) => s.replace(/\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)/g, "").replace(/(?:\u001b\[|\u009b)[0-9;?]*[ -\/]*[@-~]/g, "").replace(/\r\n?/g, `
|
|
56987
57103
|
`), tailLines = (out3) => out3.split(`
|
|
56988
|
-
`).filter((x3) => x3.trim()).slice(-12), GO_PKG_RE, JAVAC_WRAPPER = `set -u
|
|
57104
|
+
`).filter((x3) => x3.trim()).slice(-12), CARGO_NOISE, GO_PKG_RE, JAVAC_WRAPPER = `set -u
|
|
56989
57105
|
root="$1"; cls="$2"; shift 2; cd "$root" || exit 70
|
|
56990
57106
|
if [ "$cls" = "-" ]; then
|
|
56991
57107
|
set -- $(find src/test/java -name '*Test.java' 2>/dev/null | sort); cls=""
|
|
@@ -57040,6 +57156,7 @@ var init_check_result = __esm(() => {
|
|
|
57040
57156
|
init_redact();
|
|
57041
57157
|
FAIL_EVIDENCE = /\[(?:build|setup) failed\]|^--- FAIL|^[\w./-]+\.go:\d+:\d+: \S|\b[1-9]\d* (?:failed|errors?)\b/m;
|
|
57042
57158
|
GO_FAIL_EVIDENCE = /^FAIL\t\S+\t[\d.]+s$|^panic: /m;
|
|
57159
|
+
CARGO_NOISE = /^\s*(?:Compiling|Finished|Running|Doc-tests|Fresh|Blocking|Downloaded|Downloading|Updating|Locking|Adding|Packaging|Building)\b|^(?:warning|error|note|help)\b|^\s*(?:-->|=\s|\||\d+\s*\||\^|~)|^(?:Some errors have detailed|For more information about)/;
|
|
57043
57160
|
GO_PKG_RE = /^(?:ok|FAIL|\?)\s+\S+\s+(?:\(cached\)|[\d.]+s\b|\[(?:no test files|build failed|setup failed)\])/;
|
|
57044
57161
|
FRAMEWORK_RE = /\b(?:pytest|py\.test|unittest|nose2?|tox|nox|jest|vitest|mocha|jasmine|ava|tap|playwright|cypress|karma|rspec|minitest|phpunit|pest|codeception|ctest|busted|prove)\b|\b(?:bun|deno|node|go|cargo|dotnet|swift|mix|dart|flutter|zig)\s+(?:[\w:.=-]+\s+)*test\b|\b(?:npm|pnpm|yarn|bun|npx)\b.*\btest|\b(?:mvn|mvnw|gradle|gradlew|ant|sbt|make|cmake|bazel|rake|composer|lein)\b|test/i;
|
|
57045
57162
|
SCRIPT_RE = /^(?:python[\d.]*|node|bash|sh|ruby|perl)\s+(?:--?[\w-]+\s+)*([^\s-][^\s]*\.(?:py|js|mjs|cjs|sh|rb|pl))(?:\s|$)/;
|
|
@@ -60826,8 +60943,8 @@ var init_runner_errors = __esm(() => {
|
|
|
60826
60943
|
|
|
60827
60944
|
// ../../loki-ts/src/runner/load_owner.ts
|
|
60828
60945
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
60829
|
-
import { mkdtempSync as
|
|
60830
|
-
import { tmpdir as
|
|
60946
|
+
import { mkdtempSync as mkdtempSync6, realpathSync as realpathSync23, rmSync as rmSync16 } from "fs";
|
|
60947
|
+
import { tmpdir as tmpdir8 } from "os";
|
|
60831
60948
|
import { basename as basename17, extname as extname3, join as join66 } from "path";
|
|
60832
60949
|
function changedFilesNamed(out3, repoDir, changed) {
|
|
60833
60950
|
return changed.filter((f) => {
|
|
@@ -60950,7 +61067,7 @@ async function loadErrorIsHarnessOwned(i) {
|
|
|
60950
61067
|
return false;
|
|
60951
61068
|
if (i.args.some((a) => changed.includes(a.replace(/^\.\//, ""))))
|
|
60952
61069
|
return false;
|
|
60953
|
-
const dir =
|
|
61070
|
+
const dir = mkdtempSync6(join66(tmpdir8(), "e10-loadown-"));
|
|
60954
61071
|
const git3 = (args) => {
|
|
60955
61072
|
safeGit(i.repoDir, args, { stdio: "ignore" });
|
|
60956
61073
|
};
|
|
@@ -61029,7 +61146,7 @@ ${r.stderr}`);
|
|
|
61029
61146
|
notProven.add(`${lr2} (${name}; harness-owned)`);
|
|
61030
61147
|
continue;
|
|
61031
61148
|
}
|
|
61032
|
-
const cls = classifyCheck({ kind: "test", ok: r.exitCode === 0, out: out3, ...goRunner(line2), exitCoded: isExitCodedScript(line2) });
|
|
61149
|
+
const cls = await corroborateGoPass(classifyCheck({ kind: "test", ok: r.exitCode === 0, out: out3, ...goRunner(line2), exitCoded: isExitCodedScript(line2) }), out3, line2, undefined, { cwd: join67(repoDir, cwd), env: suiteEnv(opts.path) });
|
|
61033
61150
|
checks.push({ name, cmd, result: cls.result, duration_s, ...cls.count ? { count: cls.count } : {}, ...cls.result === "fail" ? { ids: cls.count ? [exitCodedId(line2, out3, repoDir) ?? []].flat() : failIds(out3), excerpt: failureExcerpt(out3, repoDir) } : {} });
|
|
61034
61151
|
if (cls.result === "not_run")
|
|
61035
61152
|
notProven.add(`not run: ${name} (${cls.reason ?? NO_TESTS_REASON})`);
|
|
@@ -63842,8 +63959,8 @@ var init_wall_owned = __esm(() => {
|
|
|
63842
63959
|
});
|
|
63843
63960
|
|
|
63844
63961
|
// ../../loki-ts/src/util/mutation_proof.ts
|
|
63845
|
-
import { existsSync as existsSync53, mkdirSync as mkdirSync38, mkdtempSync as
|
|
63846
|
-
import { tmpdir as
|
|
63962
|
+
import { existsSync as existsSync53, mkdirSync as mkdirSync38, mkdtempSync as mkdtempSync7, readFileSync as readFileSync68, rmSync as rmSync17, symlinkSync as symlinkSync3, writeFileSync as writeFileSync36 } from "fs";
|
|
63963
|
+
import { tmpdir as tmpdir9 } from "os";
|
|
63847
63964
|
import { basename as basename18, dirname as dirname30, isAbsolute as isAbsolute14, join as join77, relative as relative14 } from "path";
|
|
63848
63965
|
function mutationProof(i) {
|
|
63849
63966
|
const rels = i.wallFiles.map((f) => isAbsolute14(f.path) ? relative14(i.repoDir, f.path) : f.path);
|
|
@@ -63862,7 +63979,7 @@ function mutationProof(i) {
|
|
|
63862
63979
|
const deadline = Date.now() + budgetS * 1000, remaining = () => deadline - Date.now();
|
|
63863
63980
|
let parent = null, wt = null, added = false;
|
|
63864
63981
|
try {
|
|
63865
|
-
parent =
|
|
63982
|
+
parent = mkdtempSync7(join77(tmpdir9(), "loki-mutproof-"));
|
|
63866
63983
|
wt = join77(parent, "wt");
|
|
63867
63984
|
const add3 = git5(i.repoDir, ["worktree", "add", "--detach", wt, i.baseSha], Math.max(1000, Math.min(30000, remaining())));
|
|
63868
63985
|
added = existsSync53(wt) || add3.status === 0;
|
|
@@ -63948,10 +64065,10 @@ var init_mutation_proof = __esm(() => {
|
|
|
63948
64065
|
});
|
|
63949
64066
|
|
|
63950
64067
|
// ../../loki-ts/src/util/python.ts
|
|
63951
|
-
import { accessSync, constants as constants4, existsSync as existsSync54, mkdtempSync as
|
|
64068
|
+
import { accessSync, constants as constants4, existsSync as existsSync54, mkdtempSync as mkdtempSync8, readFileSync as readFileSync69, realpathSync as realpathSync25, rmSync as rmSync18, statSync as statSync24 } from "fs";
|
|
63952
64069
|
import { join as join78 } from "path";
|
|
63953
64070
|
import { spawnSync as spawnSync8 } from "child_process";
|
|
63954
|
-
import { tmpdir as
|
|
64071
|
+
import { tmpdir as tmpdir10 } from "os";
|
|
63955
64072
|
async function findPython3() {
|
|
63956
64073
|
if (_pythonCache !== undefined)
|
|
63957
64074
|
return _pythonCache;
|
|
@@ -63990,7 +64107,7 @@ function pySignatures2(src) {
|
|
|
63990
64107
|
const r = spawnSync8(py2, ["-I", "-S", "-c", PY_SCRIPT], {
|
|
63991
64108
|
input: src.replace(/\r\n?/g, `
|
|
63992
64109
|
`),
|
|
63993
|
-
cwd:
|
|
64110
|
+
cwd: tmpdir10(),
|
|
63994
64111
|
timeout: PY_TIMEOUT_MS,
|
|
63995
64112
|
encoding: "utf8",
|
|
63996
64113
|
env: { PATH: process.env.PATH ?? "/usr/bin:/bin" },
|
|
@@ -64133,8 +64250,8 @@ ${res.stderr ?? ""}`, res.status, timedOut, junitXml);
|
|
|
64133
64250
|
};
|
|
64134
64251
|
}
|
|
64135
64252
|
function spawnPytest(pythonBin, repoDir, timeoutMs, extra, withJunit) {
|
|
64136
|
-
const pycPrefix =
|
|
64137
|
-
const junitDir =
|
|
64253
|
+
const pycPrefix = mkdtempSync8(join78(tmpdir10(), "loki-pyc-"));
|
|
64254
|
+
const junitDir = mkdtempSync8(join78(tmpdir10(), "loki-junit-"));
|
|
64138
64255
|
const junit = join78(junitDir, "junit.xml");
|
|
64139
64256
|
let junitXml;
|
|
64140
64257
|
try {
|
|
@@ -64624,7 +64741,7 @@ class TestName(unittest.TestCase):
|
|
|
64624
64741
|
// ../../loki-ts/src/util/holdout.ts
|
|
64625
64742
|
import { createHash as createHash25 } from "crypto";
|
|
64626
64743
|
import { appendFileSync as appendFileSync9, copyFileSync as copyFileSync4, existsSync as existsSync55, mkdirSync as mkdirSync39, readFileSync as readFileSync70, rmSync as rmSync19, writeFileSync as writeFileSync37 } from "fs";
|
|
64627
|
-
import { tmpdir as
|
|
64744
|
+
import { tmpdir as tmpdir11 } from "os";
|
|
64628
64745
|
import { basename as basename20, join as join79, relative as relative15 } from "path";
|
|
64629
64746
|
function wallHoldoutRatio(env = process.env) {
|
|
64630
64747
|
if (env["LOKI_WALL_HOLDOUT"]?.trim() === "0")
|
|
@@ -64695,7 +64812,7 @@ function recordHoldoutTriage(runDir, entry2) {
|
|
|
64695
64812
|
`, { mode: 384 });
|
|
64696
64813
|
} catch {}
|
|
64697
64814
|
}
|
|
64698
|
-
var sha3 = (s) => createHash25("sha256").update(s).digest("hex"), WALL_HOLDOUT_DEFAULT_RATIO = 0.2, isHoldoutCheck = (name) => name.startsWith("holdout:"), holdoutDirFor = (runId, repoDir) => join79(
|
|
64815
|
+
var sha3 = (s) => createHash25("sha256").update(s).digest("hex"), WALL_HOLDOUT_DEFAULT_RATIO = 0.2, isHoldoutCheck = (name) => name.startsWith("holdout:"), holdoutDirFor = (runId, repoDir) => join79(tmpdir11(), `loki-e10-holdout-${sha3(`${runId}:${repoDir}`).slice(0, 16)}`), MANIFEST = "manifest.json", WALL_HOLDOUT_MIN = 5, HOLDOUT_TRIAGE_FILE = "holdout-triage.jsonl";
|
|
64699
64816
|
var init_holdout = () => {};
|
|
64700
64817
|
|
|
64701
64818
|
// ../../loki-ts/src/features/runner_config.ts
|
|
@@ -65098,8 +65215,8 @@ var init_runner_config = __esm(() => {
|
|
|
65098
65215
|
|
|
65099
65216
|
// ../../loki-ts/src/e10ext/assert_delta.ts
|
|
65100
65217
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
65101
|
-
import { mkdtempSync as
|
|
65102
|
-
import { tmpdir as
|
|
65218
|
+
import { mkdtempSync as mkdtempSync9, readFileSync as readFileSync72, rmSync as rmSync20 } from "fs";
|
|
65219
|
+
import { tmpdir as tmpdir12 } from "os";
|
|
65103
65220
|
import { join as join81 } from "path";
|
|
65104
65221
|
import { basename as basename21 } from "path";
|
|
65105
65222
|
function classifyAssertDelta(inp) {
|
|
@@ -65110,7 +65227,7 @@ function classifyAssertDelta(inp) {
|
|
|
65110
65227
|
return WEAKENED;
|
|
65111
65228
|
let cwd = "";
|
|
65112
65229
|
try {
|
|
65113
|
-
cwd =
|
|
65230
|
+
cwd = mkdtempSync9(join81(tmpdir12(), "loki-ad-"));
|
|
65114
65231
|
const raw2 = execFileSync6("python3", ["-I", "-c", PY2], {
|
|
65115
65232
|
input: JSON.stringify({ path: inp.path, base: inp.base, head: inp.head, task: inp.task }),
|
|
65116
65233
|
cwd,
|
|
@@ -65622,9 +65739,9 @@ app_runner_stop >/dev/null 2>&1
|
|
|
65622
65739
|
});
|
|
65623
65740
|
|
|
65624
65741
|
// ../../loki-ts/src/util/secure_scan.ts
|
|
65625
|
-
import { copyFileSync as copyFileSync5, existsSync as existsSync57, lstatSync as lstatSync23, mkdirSync as mkdirSync41, mkdtempSync as
|
|
65742
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync57, lstatSync as lstatSync23, mkdirSync as mkdirSync41, mkdtempSync as mkdtempSync10, readFileSync as readFileSync75, realpathSync as realpathSync26, rmSync as rmSync21, statSync as statSync25, writeFileSync as writeFileSync39 } from "fs";
|
|
65626
65743
|
import { randomBytes as randomBytes6 } from "crypto";
|
|
65627
|
-
import { tmpdir as
|
|
65744
|
+
import { tmpdir as tmpdir13 } from "os";
|
|
65628
65745
|
import { basename as basename22, dirname as dirname34, join as join84, resolve as resolve28, sep as sep17 } from "path";
|
|
65629
65746
|
function fail(error) {
|
|
65630
65747
|
return { ok: false, findings: [], error };
|
|
@@ -65674,7 +65791,7 @@ async function runSecureScan(targetDir, opts = {}) {
|
|
|
65674
65791
|
return fail(`secure-scan failed (exit ${res.exitCode}): ${tail2}`);
|
|
65675
65792
|
}
|
|
65676
65793
|
async function secureScanChanged(repoDir, changed, scriptPath) {
|
|
65677
|
-
const dir =
|
|
65794
|
+
const dir = mkdtempSync10(join84(tmpdir13(), "loki-deep-secure-"));
|
|
65678
65795
|
try {
|
|
65679
65796
|
for (const f of changed)
|
|
65680
65797
|
if (existsSync57(join84(repoDir, f)) && lstatSync23(join84(repoDir, f)).isFile()) {
|
|
@@ -65835,7 +65952,7 @@ async function scanAddedLines(repoDir, opts = {}) {
|
|
|
65835
65952
|
}
|
|
65836
65953
|
if (added.size === 0)
|
|
65837
65954
|
return { ok: true, findings: skipped2 };
|
|
65838
|
-
const mirror =
|
|
65955
|
+
const mirror = mkdtempSync10(join84(tmpdir13(), "loki-secure-added-"));
|
|
65839
65956
|
try {
|
|
65840
65957
|
const root = resolve28(mirror) + sep17;
|
|
65841
65958
|
const chunkMap = new Map;
|
|
@@ -66380,8 +66497,8 @@ var init_conventions = __esm(() => {
|
|
|
66380
66497
|
});
|
|
66381
66498
|
|
|
66382
66499
|
// ../../loki-ts/src/util/pr_lessons.ts
|
|
66383
|
-
import { existsSync as existsSync60, mkdirSync as mkdirSync42, mkdtempSync as
|
|
66384
|
-
import { homedir as homedir10, tmpdir as
|
|
66500
|
+
import { existsSync as existsSync60, mkdirSync as mkdirSync42, mkdtempSync as mkdtempSync11, readFileSync as readFileSync78, rmSync as rmSync22, writeFileSync as writeFileSync41 } from "fs";
|
|
66501
|
+
import { homedir as homedir10, tmpdir as tmpdir14 } from "os";
|
|
66385
66502
|
import { dirname as dirname36, join as join87 } from "path";
|
|
66386
66503
|
import { createHash as createHash26 } from "crypto";
|
|
66387
66504
|
function loadLessons(repoDir) {
|
|
@@ -67195,6 +67312,7 @@ ${relevantFiles.join(`
|
|
|
67195
67312
|
var MAX_PLAN_LINES = 10, PLAN_OUTPUT_FILENAME = "plan-output.txt", planStage, stage2;
|
|
67196
67313
|
var init_plan = __esm(() => {
|
|
67197
67314
|
init_relevant_files();
|
|
67315
|
+
init_worker_proc();
|
|
67198
67316
|
init_session();
|
|
67199
67317
|
init_sizing();
|
|
67200
67318
|
init_types();
|
|
@@ -67248,7 +67366,7 @@ var init_plan = __esm(() => {
|
|
|
67248
67366
|
let planModelNote = null;
|
|
67249
67367
|
if (pr2.pinOpus && !session.killed && session.exit !== 0) {
|
|
67250
67368
|
planModel = planFallbackModel(ctx.model);
|
|
67251
|
-
planModelNote = `Opus plan session failed (exit ${session.exit}); the plan ran on ${planModel}`;
|
|
67369
|
+
planModelNote = `Opus plan session failed (${session.exit === MAX_TURNS_EXIT ? "turn cap reached" : `exit ${session.exit}`}); the plan ran on ${planModel}`;
|
|
67252
67370
|
session = await runPlan(true);
|
|
67253
67371
|
}
|
|
67254
67372
|
if (!session.killed && session.exit !== 0) {
|
|
@@ -67283,8 +67401,8 @@ var init_plan = __esm(() => {
|
|
|
67283
67401
|
|
|
67284
67402
|
// ../../loki-ts/src/util/conflict_resume.ts
|
|
67285
67403
|
import { createHash as createHash27 } from "crypto";
|
|
67286
|
-
import { existsSync as existsSync64, mkdtempSync as
|
|
67287
|
-
import { tmpdir as
|
|
67404
|
+
import { existsSync as existsSync64, mkdtempSync as mkdtempSync12, readFileSync as readFileSync83, rmSync as rmSync24, writeFileSync as writeFileSync45 } from "fs";
|
|
67405
|
+
import { tmpdir as tmpdir15 } from "os";
|
|
67288
67406
|
import { basename as basename24, join as join92, relative as relative18 } from "path";
|
|
67289
67407
|
async function resumeAfterConflict(ctx, first, firstSession) {
|
|
67290
67408
|
if ((ctx.implementLeftS?.() ?? Infinity) < RESUME_MIN_LEFT_S)
|
|
@@ -67309,7 +67427,7 @@ async function adjudicateWallConflict(ctx, first, firstSession, wall) {
|
|
|
67309
67427
|
const reason = firstSession.markers.specConflict, rels = wall.map((f10) => relative18(ctx.repoDir, f10.path)), a = reason ? wallAnchor(reason, rels) : null;
|
|
67310
67428
|
if (!reason || !a)
|
|
67311
67429
|
return null;
|
|
67312
|
-
const f = wall[rels.indexOf(a.file)], ids = [], o = ctx.outputs(), cwd =
|
|
67430
|
+
const f = wall[rels.indexOf(a.file)], ids = [], o = ctx.outputs(), cwd = mkdtempSync12(join92(tmpdir15(), "loki-e15-wall-")), name = basename24(f.path);
|
|
67313
67431
|
try {
|
|
67314
67432
|
writeFileSync45(join92(cwd, name), f.content, "utf8");
|
|
67315
67433
|
const id2 = `${first.iterationId}-wa`;
|
|
@@ -67506,6 +67624,7 @@ var init_implement = __esm(() => {
|
|
|
67506
67624
|
init_verify();
|
|
67507
67625
|
init_resolve();
|
|
67508
67626
|
init_session();
|
|
67627
|
+
init_worker_proc();
|
|
67509
67628
|
init_conflict_resume();
|
|
67510
67629
|
init_session_resume();
|
|
67511
67630
|
init_implement_route();
|
|
@@ -67568,7 +67687,7 @@ var init_implement = __esm(() => {
|
|
|
67568
67687
|
} }) : null;
|
|
67569
67688
|
let session = two ? two.session : await ctx.sessions.run(first);
|
|
67570
67689
|
const ids = two ? two.ids : [first.iterationId];
|
|
67571
|
-
if (resumeId && !session.killed && session.exit !== 0) {
|
|
67690
|
+
if (resumeId && !session.killed && session.exit !== 0 && session.exit !== MAX_TURNS_EXIT) {
|
|
67572
67691
|
planChainMode = "fallback (resume failed)";
|
|
67573
67692
|
if (ownId) {
|
|
67574
67693
|
sessionResume = "fallback (resume failed)";
|
|
@@ -67615,7 +67734,7 @@ var init_implement = __esm(() => {
|
|
|
67615
67734
|
const testsReverted = restoreReadOnly(readOnly);
|
|
67616
67735
|
const iterationId = ids[ids.length - 1];
|
|
67617
67736
|
let exit;
|
|
67618
|
-
if (session.killed) {
|
|
67737
|
+
if (session.killed || session.exit === MAX_TURNS_EXIT) {
|
|
67619
67738
|
exit = "killed";
|
|
67620
67739
|
} else if (session.markers.specConflict) {
|
|
67621
67740
|
exit = "spec_conflict";
|
|
@@ -67640,6 +67759,7 @@ var init_implement = __esm(() => {
|
|
|
67640
67759
|
...rt2 ? { route_model: rt2.current, route_escalations: rt2.escalations } : {},
|
|
67641
67760
|
session_id: readSessionId(ctx.repoDir, iterationId),
|
|
67642
67761
|
duration_s: session.durationS,
|
|
67762
|
+
...session.exit === MAX_TURNS_EXIT && !session.killed ? { stop_cause: "max_turns", owner: "harness", limit_s: implementStage.limitS, elapsed_s: session.durationS } : {},
|
|
67643
67763
|
...planChainMode ? { plan_chain: planChainMode } : {},
|
|
67644
67764
|
...sessionResume ? { session_resume: sessionResume } : {},
|
|
67645
67765
|
...two ? { attempts: two.summary } : {}
|
|
@@ -68332,12 +68452,12 @@ __export(exports_deep, {
|
|
|
68332
68452
|
deepStage: () => deepStage,
|
|
68333
68453
|
DEFAULT_SECRET_SCAN_SH: () => DEFAULT_SECRET_SCAN_SH
|
|
68334
68454
|
});
|
|
68335
|
-
import { existsSync as existsSync67, mkdirSync as mkdirSync49, mkdtempSync as
|
|
68336
|
-
import { tmpdir as
|
|
68455
|
+
import { existsSync as existsSync67, mkdirSync as mkdirSync49, mkdtempSync as mkdtempSync13, rmSync as rmSync27, writeFileSync as writeFileSync48 } from "fs";
|
|
68456
|
+
import { tmpdir as tmpdir16 } from "os";
|
|
68337
68457
|
import { join as join96 } from "path";
|
|
68338
68458
|
function sessionCouncil(sessions) {
|
|
68339
68459
|
return { async run(input, signal) {
|
|
68340
|
-
const cwd =
|
|
68460
|
+
const cwd = mkdtempSync13(join96(tmpdir16(), "loki-deep-council-"));
|
|
68341
68461
|
try {
|
|
68342
68462
|
writeFileSync48(join96(cwd, "diff.patch"), input.diff, "utf8");
|
|
68343
68463
|
const r = await sessions.run({
|
|
@@ -68400,7 +68520,7 @@ ${r.stderr}`), lr2 = r.exitCode === 0 ? undefined : await harnessLoadReason({ re
|
|
|
68400
68520
|
notProven.add(`${lr2} (${name}; harness-owned)`);
|
|
68401
68521
|
continue;
|
|
68402
68522
|
}
|
|
68403
|
-
const cls = classifyCheck({ kind: "test", ok: r.exitCode === 0, out: out3, ...goRunner(spec.cmd, spec.args) });
|
|
68523
|
+
const cls = await corroborateGoPass(classifyCheck({ kind: "test", ok: r.exitCode === 0, out: out3, ...goRunner(spec.cmd, spec.args) }), out3, spec.cmd, spec.args, { cwd: ctx.repoDir, env: suiteEnv(opts.path) });
|
|
68404
68524
|
checks.push({ name, cmd: [spec.cmd, ...spec.args].join(" "), result: cls.result, duration_s: durationS, ...cls.result === "fail" ? { ids: failIds(out3), excerpt: failureExcerpt(out3, ctx.repoDir) } : {} });
|
|
68405
68525
|
if (cls.result === "not_run")
|
|
68406
68526
|
notProven.add(`not run: ${name} (${cls.reason ?? NO_TESTS_REASON})`);
|
|
@@ -68640,8 +68760,8 @@ __export(exports_verify, {
|
|
|
68640
68760
|
commandFor: () => commandFor,
|
|
68641
68761
|
changedFiles: () => changedFiles
|
|
68642
68762
|
});
|
|
68643
|
-
import { existsSync as existsSync68, mkdtempSync as
|
|
68644
|
-
import { tmpdir as
|
|
68763
|
+
import { existsSync as existsSync68, mkdtempSync as mkdtempSync14, readFileSync as readFileSync86, rmSync as rmSync28 } from "fs";
|
|
68764
|
+
import { tmpdir as tmpdir17 } from "os";
|
|
68645
68765
|
import { basename as basename25, isAbsolute as isAbsolute18, join as join97, relative as relative21 } from "path";
|
|
68646
68766
|
async function runOnce3(cmd, args, cwd, signal, opts) {
|
|
68647
68767
|
if (!Bun.which(cmd, { PATH: opts.path ?? process.env["PATH"] ?? "" }))
|
|
@@ -68678,7 +68798,7 @@ async function runCheck(ctx, name, cmd, args, signal, checks, opts = {}) {
|
|
|
68678
68798
|
const kind = opts.kind ?? "test";
|
|
68679
68799
|
const cwd = opts.cwd ?? ctx.repoDir;
|
|
68680
68800
|
const one2 = async (a) => {
|
|
68681
|
-
let c10 = classifyCheck({ kind, ok: a.ok, cut: a.cut, missing: a.missing, out: a.out, ...goRunner(cmd, args), path: /\.[cm]?[jt]s$/.test(args[args.length - 1] ?? "") ? args[args.length - 1] : undefined });
|
|
68801
|
+
let c10 = await corroborateGoPass(classifyCheck({ kind, ok: a.ok, cut: a.cut, missing: a.missing, out: a.out, ...goRunner(cmd, args), path: /\.[cm]?[jt]s$/.test(args[args.length - 1] ?? "") ? args[args.length - 1] : undefined }), a.out, cmd, args, { cwd, env: opts.path ? { ...plainTestEnv(), PATH: opts.path } : plainTestEnv() });
|
|
68682
68802
|
const lr2 = kind === "test" && !a.ok && !a.cut && !a.missing ? await harnessLoadReason({ repoDir: ctx.repoDir, baseSha: ctx.baseSha, skip: installOwned(ctx.repoDir, ctx.outputs?.().intake?.install_created), out: a.out, cmd, args, signal, cwd, protect: opts.protect, ...opts.path ? { env: { PATH: opts.path } } : {} }) : undefined;
|
|
68683
68803
|
if (lr2)
|
|
68684
68804
|
c10 = { result: "not_run", reason: lr2, owner: "harness" };
|
|
@@ -68735,7 +68855,7 @@ async function subtractBase(ctx, api, checks, tests, changed, wall, rel, signal,
|
|
|
68735
68855
|
const zc2 = zeroOk ? un2.filter(({ c, t }) => c.result === "not_run" && !c.owner && (c.reason ?? "").startsWith(NO_TESTS_REASON) && !wall.has(c.name) && !isHoldoutCheck(c.name) && !changed.includes(t.path) && zeroIntake.has(c.name)) : [];
|
|
68736
68856
|
if (!(un2.some(({ c }) => c.result === "fail" && c.ids?.length) || sus.length || zc2.length) || signal.aborted)
|
|
68737
68857
|
return out3;
|
|
68738
|
-
const dir =
|
|
68858
|
+
const dir = mkdtempSync14(join97(tmpdir17(), "e10-base-"));
|
|
68739
68859
|
const git9 = (args) => {
|
|
68740
68860
|
safeGit(ctx.repoDir, args, { stdio: "ignore", repoDrivers: true });
|
|
68741
68861
|
};
|
|
@@ -69034,8 +69154,8 @@ __export(exports_wall, {
|
|
|
69034
69154
|
BASE_RUN_TIMEOUT_MS: () => BASE_RUN_TIMEOUT_MS
|
|
69035
69155
|
});
|
|
69036
69156
|
import { spawnSync as spawnSync10 } from "child_process";
|
|
69037
|
-
import { existsSync as existsSync69, mkdirSync as mkdirSync50, mkdtempSync as
|
|
69038
|
-
import { tmpdir as
|
|
69157
|
+
import { existsSync as existsSync69, mkdirSync as mkdirSync50, mkdtempSync as mkdtempSync15, readFileSync as readFileSync87, readdirSync as readdirSync28, rmSync as rmSync29, writeFileSync as writeFileSync49 } from "fs";
|
|
69158
|
+
import { tmpdir as tmpdir18 } from "os";
|
|
69039
69159
|
import { dirname as dirname39, join as join98, relative as relative22 } from "path";
|
|
69040
69160
|
|
|
69041
69161
|
class RealBaseTestRunner {
|
|
@@ -69148,7 +69268,7 @@ async function wallAuthor(ctx, signal, retry) {
|
|
|
69148
69268
|
const repomapText = repoMapText(ctx.repoDir, tree, repomapRef, WALL_MAP_MAX_LINES);
|
|
69149
69269
|
const targetDir = wallTargetDir(ctx.repoDir, existingTests, runners), pkg = loadProjectApi(ctx.repoDir)?.packageOf(`${relative22(ctx.repoDir, targetDir)}/x`);
|
|
69150
69270
|
const conv2 = readPackageConventions(join98(ctx.repoDir, pkg?.root ?? "."), pkg?.runner ?? null);
|
|
69151
|
-
const cwd =
|
|
69271
|
+
const cwd = mkdtempSync15(join98(tmpdir18(), "loki-e15-wall-"));
|
|
69152
69272
|
const wm2 = wallManifestFor(ctx.repoDir, tree, task);
|
|
69153
69273
|
for (const [n10, c] of [["task.md", task], ["repomap.txt", repomapText], ...wm2 ? [["wall_manifest.txt", wm2.text]] : []])
|
|
69154
69274
|
writeFileSync49(join98(cwd, n10), c, "utf8");
|
|
@@ -71086,7 +71206,7 @@ var init_seal = __esm(() => {
|
|
|
71086
71206
|
checks,
|
|
71087
71207
|
not_proven: [],
|
|
71088
71208
|
verdict,
|
|
71089
|
-
...typeof o.implement?.limit_s === "number" ? { implement_limit: { limit_s: o.implement.limit_s, elapsed_s: typeof o.implement.elapsed_s === "number" ? o.implement.elapsed_s : 0 } } : {},
|
|
71209
|
+
...typeof o.implement?.limit_s === "number" ? { implement_limit: { limit_s: o.implement.limit_s, elapsed_s: typeof o.implement.elapsed_s === "number" ? o.implement.elapsed_s : 0, ...o.implement.stop_cause === "max_turns" ? { stop_cause: "max_turns", owner: "harness" } : {} } } : {},
|
|
71090
71210
|
...grp.section ? { group: grp.section } : {},
|
|
71091
71211
|
...ctx.failovers && ctx.failovers().length > 0 ? { failover: ctx.failovers() } : {},
|
|
71092
71212
|
...str3(o.implement?.spec_conflict_reason) !== null ? { spec_conflict_reason: sanitizeReason(str3(o.implement?.spec_conflict_reason)) } : {},
|
|
@@ -71806,7 +71926,7 @@ var init_raster = () => {};
|
|
|
71806
71926
|
// ../../loki-ts/src/commands/doctor.ts
|
|
71807
71927
|
import { appendFileSync as appendFileSync11, writeFileSync as writeFileSync56, mkdirSync as mkdirSync56, accessSync as accessSync2, constants as fsConstants2, existsSync as existsSync75, lstatSync as lstatSync28, readdirSync as readdirSync32, readFileSync as readFileSync94, readlinkSync as readlinkSync6, realpathSync as realpathSync31, statSync as statSync29, statfsSync } from "fs";
|
|
71808
71928
|
import { spawnSync as spawnSync12 } from "child_process";
|
|
71809
|
-
import { homedir as homedir12, tmpdir as
|
|
71929
|
+
import { homedir as homedir12, tmpdir as tmpdir19 } from "os";
|
|
71810
71930
|
import { join as join108, resolve as resolve31 } from "path";
|
|
71811
71931
|
function loadRequirements(file = REQUIREMENTS_FILE) {
|
|
71812
71932
|
if (file === REQUIREMENTS_FILE && cached)
|
|
@@ -71836,7 +71956,7 @@ function providerLoginIssue(provider, cli, env) {
|
|
|
71836
71956
|
if (provider === "codex") {
|
|
71837
71957
|
if (key("OPENAI_API_KEY") || key("CODEX_API_KEY"))
|
|
71838
71958
|
return null;
|
|
71839
|
-
const r = spawnSync12(cli, ["login", "status"], { env: providerProbeEnv(env), encoding: "utf8", timeout: 5000, cwd:
|
|
71959
|
+
const r = spawnSync12(cli, ["login", "status"], { env: providerProbeEnv(env), encoding: "utf8", timeout: 5000, cwd: tmpdir19() });
|
|
71840
71960
|
if (r.status === 0)
|
|
71841
71961
|
return null;
|
|
71842
71962
|
const said = `${r.stdout}${r.stderr}`;
|
|
@@ -73971,8 +74091,8 @@ __export(exports_issues_run, {
|
|
|
73971
74091
|
TRIAGE_RE: () => TRIAGE_RE
|
|
73972
74092
|
});
|
|
73973
74093
|
import { spawnSync as spawnSync15 } from "child_process";
|
|
73974
|
-
import { cpSync as cpSync3, existsSync as existsSync79, mkdirSync as mkdirSync61, mkdtempSync as
|
|
73975
|
-
import { tmpdir as
|
|
74094
|
+
import { cpSync as cpSync3, existsSync as existsSync79, mkdirSync as mkdirSync61, mkdtempSync as mkdtempSync16, rmSync as rmSync33, writeFileSync as writeFileSync59 } from "fs";
|
|
74095
|
+
import { tmpdir as tmpdir20 } from "os";
|
|
73976
74096
|
import { join as join113, resolve as resolve35 } from "path";
|
|
73977
74097
|
import { createInterface as createInterface3 } from "readline";
|
|
73978
74098
|
function parseIssuesArgs(args) {
|
|
@@ -74387,7 +74507,7 @@ function makeWorktrees(repoDir) {
|
|
|
74387
74507
|
let root = null;
|
|
74388
74508
|
return {
|
|
74389
74509
|
create: (name, base) => {
|
|
74390
|
-
root ??=
|
|
74510
|
+
root ??= mkdtempSync16(join113(tmpdir20(), "loki-issues-"));
|
|
74391
74511
|
const p = join113(root, name);
|
|
74392
74512
|
safeGit(repoDir, ["worktree", "add", "-B", `loki/${name}`, p, base]);
|
|
74393
74513
|
return p;
|
|
@@ -75776,8 +75896,8 @@ var init_warm = __esm(() => {
|
|
|
75776
75896
|
|
|
75777
75897
|
// ../../loki-ts/src/features/speed/already_done_async.ts
|
|
75778
75898
|
import { execFile as execFile3 } from "child_process";
|
|
75779
|
-
import { mkdirSync as mkdirSync65, mkdtempSync as
|
|
75780
|
-
import { tmpdir as
|
|
75899
|
+
import { mkdirSync as mkdirSync65, mkdtempSync as mkdtempSync17, rmSync as rmSync34 } from "fs";
|
|
75900
|
+
import { tmpdir as tmpdir21 } from "os";
|
|
75781
75901
|
import { join as join118 } from "path";
|
|
75782
75902
|
function hitsUnchangedFromBase(repoDir, baseSha, paths) {
|
|
75783
75903
|
if (paths.length === 0 || !baseSha)
|
|
@@ -75816,7 +75936,7 @@ function dropRoot(root) {
|
|
|
75816
75936
|
function pinBaseTree(ctx, signal) {
|
|
75817
75937
|
let root;
|
|
75818
75938
|
try {
|
|
75819
|
-
root =
|
|
75939
|
+
root = mkdtempSync17(join118(tmpdir21(), "loki-already-done-"));
|
|
75820
75940
|
} catch {
|
|
75821
75941
|
return Promise.resolve(null);
|
|
75822
75942
|
}
|
|
@@ -77365,8 +77485,8 @@ var init_seal2 = __esm(() => {
|
|
|
77365
77485
|
|
|
77366
77486
|
// ../../loki-ts/src/engine10/modernize/oracle/search.ts
|
|
77367
77487
|
import { spawnSync as spawnSync18 } from "child_process";
|
|
77368
|
-
import { copyFileSync as copyFileSync6, existsSync as existsSync86, linkSync as linkSync4, mkdirSync as mkdirSync68, mkdtempSync as
|
|
77369
|
-
import { tmpdir as
|
|
77488
|
+
import { copyFileSync as copyFileSync6, existsSync as existsSync86, linkSync as linkSync4, mkdirSync as mkdirSync68, mkdtempSync as mkdtempSync18, readFileSync as readFileSync107, renameSync as renameSync22, rmSync as rmSync35, rmdirSync as rmdirSync2, writeFileSync as writeFileSync63 } from "fs";
|
|
77489
|
+
import { tmpdir as tmpdir22 } from "os";
|
|
77370
77490
|
import { basename as basename31, dirname as dirname48, join as join125 } from "path";
|
|
77371
77491
|
function search(unitSource, seedCases, propose, runCapture, opts = {}) {
|
|
77372
77492
|
const maxRounds = opts.maxRounds ?? 10;
|
|
@@ -77424,7 +77544,7 @@ function realCaptureRunner(unitPath, cases, outPath) {
|
|
|
77424
77544
|
return captureFailed("old runtime unavailable");
|
|
77425
77545
|
let dir = "";
|
|
77426
77546
|
try {
|
|
77427
|
-
dir =
|
|
77547
|
+
dir = mkdtempSync18(join125(tmpdir22(), "m10-search-"));
|
|
77428
77548
|
const casesFile = join125(dir, "cases.jsonl");
|
|
77429
77549
|
const outFile = join125(dir, "out.jsonl");
|
|
77430
77550
|
const covFile = join125(dir, "coverage.json");
|
|
@@ -77475,7 +77595,7 @@ function resolveOldRuntimeSync() {
|
|
|
77475
77595
|
}
|
|
77476
77596
|
function makeProposeInputs(session, cap = 20) {
|
|
77477
77597
|
return (unitPath, missing, round2) => {
|
|
77478
|
-
const cwd =
|
|
77598
|
+
const cwd = mkdtempSync18(join125(tmpdir22(), "m27-propose-"));
|
|
77479
77599
|
try {
|
|
77480
77600
|
const unitFile = join125(cwd, basename31(unitPath));
|
|
77481
77601
|
copyFileSync6(unitPath, unitFile);
|
|
@@ -77519,7 +77639,7 @@ function captureUnitOracle(a) {
|
|
|
77519
77639
|
}
|
|
77520
77640
|
if (r.cases.length === 0)
|
|
77521
77641
|
return { ok: false, reason: "no cases captured" };
|
|
77522
|
-
const scratch =
|
|
77642
|
+
const scratch = mkdtempSync18(join125(tmpdir22(), "m27-replay-"));
|
|
77523
77643
|
const t12 = join125(scratch, "cases"), t22 = join125(scratch, "replay");
|
|
77524
77644
|
const created = [];
|
|
77525
77645
|
for (let p = dir;!existsSync86(p) && !created.includes(p); p = dirname48(p))
|
|
@@ -78582,7 +78702,7 @@ var init_presealed_wall = __esm(() => {
|
|
|
78582
78702
|
import { spawnSync as spawnSync19 } from "child_process";
|
|
78583
78703
|
import { createHash as createHash35 } from "crypto";
|
|
78584
78704
|
import { lstatSync as lstatSync29, readFileSync as readFileSync112, readdirSync as readdirSync37, readlinkSync as readlinkSync7, realpathSync as realpathSync33, rmSync as rmSync36 } from "fs";
|
|
78585
|
-
import { tmpdir as
|
|
78705
|
+
import { tmpdir as tmpdir23 } from "os";
|
|
78586
78706
|
import { join as join130, sep as sep20 } from "path";
|
|
78587
78707
|
function isSealedName(rel) {
|
|
78588
78708
|
return TEST_FILE2.test(rel) || PYTEST_CFG.test(rel);
|
|
@@ -78729,7 +78849,7 @@ for n in sys.argv[1:]:
|
|
|
78729
78849
|
if n in sys.stdlib_module_names or u.find_spec(n): print(n)
|
|
78730
78850
|
except Exception: print(n)
|
|
78731
78851
|
`;
|
|
78732
|
-
const r = spawnSync19(target, ["-I", "-c", code, ...names], { cwd:
|
|
78852
|
+
const r = spawnSync19(target, ["-I", "-c", code, ...names], { cwd: tmpdir23(), encoding: "utf8", timeout: 30000, env: tokenFreeEnv() });
|
|
78733
78853
|
return r.status === 0 ? new Set(r.stdout.split(`
|
|
78734
78854
|
`).filter(Boolean)) : new Set(names);
|
|
78735
78855
|
}
|
|
@@ -79008,8 +79128,8 @@ var init_wave = __esm(() => {
|
|
|
79008
79128
|
|
|
79009
79129
|
// ../../loki-ts/src/util/modernize_unit.ts
|
|
79010
79130
|
import { spawnSync as spawnSync21 } from "child_process";
|
|
79011
|
-
import { existsSync as existsSync89, lstatSync as lstatSync30, mkdtempSync as
|
|
79012
|
-
import { tmpdir as
|
|
79131
|
+
import { existsSync as existsSync89, lstatSync as lstatSync30, mkdtempSync as mkdtempSync19, readFileSync as readFileSync114, realpathSync as realpathSync34, rmSync as rmSync37, statSync as statSync34, writeFileSync as writeFileSync67 } from "fs";
|
|
79132
|
+
import { tmpdir as tmpdir24 } from "os";
|
|
79013
79133
|
import { join as join132, sep as sep21 } from "path";
|
|
79014
79134
|
function parseUnitArgs(args) {
|
|
79015
79135
|
const f = {};
|
|
@@ -79127,7 +79247,7 @@ function runPythonCase(o, unitId, newTreeDir, rec2, stub) {
|
|
|
79127
79247
|
const src = o.unitFile ? o.unitFile(unitId, newTreeDir) : defaultUnitFile(unitId, newTreeDir);
|
|
79128
79248
|
if (!src || !src.endsWith(".py") || !existsSync89(src))
|
|
79129
79249
|
throw new Error(`cannot locate the source of unit ${unitId} in the new tree`);
|
|
79130
|
-
const dir =
|
|
79250
|
+
const dir = mkdtempSync19(join132(tmpdir24(), "loki-newcase-"));
|
|
79131
79251
|
try {
|
|
79132
79252
|
const cases = join132(dir, "in.jsonl"), out3 = join132(dir, "out.jsonl");
|
|
79133
79253
|
writeFileSync67(cases, JSON.stringify({ entry: rec2.entry, args: rec2.args, kwargs: rec2.kwargs, boundaries: boundariesFromCase(rec2) }) + `
|
|
@@ -79159,10 +79279,10 @@ Usage: ${UNIT_USAGE}
|
|
|
79159
79279
|
const runners = u10.implement && u10.runNew && u10.runStub ? null : makeUnitRunners({ target: o.target });
|
|
79160
79280
|
const implement = u10.implement ?? runners.implement, runNew = u10.runNew ?? runners.runNew, runStub = u10.runStub ?? runners.runStub;
|
|
79161
79281
|
const runTmp = process.env["LOKI_RUN_TMP"] ?? "";
|
|
79162
|
-
const root = u10.tmpRoot ?? (runTmp !== "" && isRealDir(runTmp) ? runTmp :
|
|
79282
|
+
const root = u10.tmpRoot ?? (runTmp !== "" && isRealDir(runTmp) ? runTmp : tmpdir24());
|
|
79163
79283
|
let repoDir;
|
|
79164
79284
|
try {
|
|
79165
|
-
repoDir =
|
|
79285
|
+
repoDir = mkdtempSync19(join132(root, "loki-unit-"));
|
|
79166
79286
|
} catch (e10) {
|
|
79167
79287
|
process.stderr.write(`modernize unit: cannot create a temp checkout directory: ${e10.message}
|
|
79168
79288
|
`);
|
|
@@ -79258,8 +79378,8 @@ var init_modernize_unit = __esm(() => {
|
|
|
79258
79378
|
|
|
79259
79379
|
// ../../loki-ts/src/util/modernize_coordinator.ts
|
|
79260
79380
|
import { createHash as createHash36 } from "crypto";
|
|
79261
|
-
import { existsSync as existsSync90, mkdtempSync as
|
|
79262
|
-
import { tmpdir as
|
|
79381
|
+
import { existsSync as existsSync90, mkdtempSync as mkdtempSync20, readFileSync as readFileSync115, rmSync as rmSync38 } from "fs";
|
|
79382
|
+
import { tmpdir as tmpdir25 } from "os";
|
|
79263
79383
|
import { join as join133 } from "path";
|
|
79264
79384
|
function shipUnitOf(d, unit, o) {
|
|
79265
79385
|
const sealed = join133(oracleDir(d.repoDir, d.mid, unit), "sealed.json");
|
|
@@ -79438,7 +79558,7 @@ function makeAttemptRunner(o) {
|
|
|
79438
79558
|
}
|
|
79439
79559
|
function makeUnitPrep(o) {
|
|
79440
79560
|
const runtimeOk = o.runtimeOk ?? (() => {
|
|
79441
|
-
const dir =
|
|
79561
|
+
const dir = mkdtempSync20(join133(tmpdir25(), "loki-probe-"));
|
|
79442
79562
|
try {
|
|
79443
79563
|
return realCaptureRunner(join133(dir, "probe.py"), []).error !== "old runtime unavailable";
|
|
79444
79564
|
} finally {
|