@kynver-app/runtime 0.1.18 → 0.1.19
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/dist/cli.js +133 -69
- package/dist/cli.js.map +4 -4
- package/dist/index.js +136 -72
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,6 +10,10 @@ function fail(message) {
|
|
|
10
10
|
console.error(message);
|
|
11
11
|
process.exit(1);
|
|
12
12
|
}
|
|
13
|
+
function hiddenSpawnOptions(opts) {
|
|
14
|
+
if (process.platform !== "win32") return opts;
|
|
15
|
+
return { windowsHide: true, ...opts };
|
|
16
|
+
}
|
|
13
17
|
function required(value, name) {
|
|
14
18
|
if (!value) fail(`missing ${name}`);
|
|
15
19
|
return value;
|
|
@@ -393,12 +397,12 @@ var DEFAULT_CRITICAL_FREE_BYTES = 15 * 1024 * 1024 * 1024;
|
|
|
393
397
|
var DEFAULT_MAX_USED_PERCENT = 80;
|
|
394
398
|
var DEFAULT_HARD_MAX_USED_PERCENT = 90;
|
|
395
399
|
function observeRunnerDiskGate(input = {}) {
|
|
396
|
-
const
|
|
400
|
+
const path17 = input.diskPath?.trim() || "/";
|
|
397
401
|
const warnBelowBytes = input.diskFreeWarnBytes ?? DEFAULT_WARN_FREE_BYTES;
|
|
398
402
|
const criticalBelowBytes = input.diskFreeCriticalBytes ?? DEFAULT_CRITICAL_FREE_BYTES;
|
|
399
403
|
const maxUsedPercent = input.diskMaxUsedPercent ?? DEFAULT_MAX_USED_PERCENT;
|
|
400
404
|
const hardMaxUsedPercent = input.diskHardMaxUsedPercent ?? DEFAULT_HARD_MAX_USED_PERCENT;
|
|
401
|
-
const stats = statfsSync(
|
|
405
|
+
const stats = statfsSync(path17);
|
|
402
406
|
const freeBytes = Number(stats.bavail) * Number(stats.bsize);
|
|
403
407
|
const totalBytes = Number(stats.blocks) * Number(stats.bsize);
|
|
404
408
|
const usedPercent = totalBytes > 0 ? (totalBytes - freeBytes) / totalBytes * 100 : 100;
|
|
@@ -418,7 +422,7 @@ function observeRunnerDiskGate(input = {}) {
|
|
|
418
422
|
}
|
|
419
423
|
return {
|
|
420
424
|
ok,
|
|
421
|
-
path:
|
|
425
|
+
path: path17,
|
|
422
426
|
freeBytes,
|
|
423
427
|
totalBytes,
|
|
424
428
|
usedPercent,
|
|
@@ -964,8 +968,8 @@ function observeRunnerResourceGate(input) {
|
|
|
964
968
|
}
|
|
965
969
|
|
|
966
970
|
// src/supervisor.ts
|
|
967
|
-
import { existsSync as
|
|
968
|
-
import
|
|
971
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync3 } from "node:fs";
|
|
972
|
+
import path10 from "node:path";
|
|
969
973
|
|
|
970
974
|
// src/prompt.ts
|
|
971
975
|
function buildPrompt(input) {
|
|
@@ -1083,12 +1087,12 @@ var claudeProvider = {
|
|
|
1083
1087
|
"--include-partial-messages",
|
|
1084
1088
|
opts.prompt
|
|
1085
1089
|
],
|
|
1086
|
-
{
|
|
1090
|
+
hiddenSpawnOptions({
|
|
1087
1091
|
cwd: opts.worktreePath,
|
|
1088
1092
|
detached: true,
|
|
1089
1093
|
stdio: ["ignore", stdoutFd, stderrFd],
|
|
1090
1094
|
env: scrubClaudeEnv(process.env)
|
|
1091
|
-
}
|
|
1095
|
+
})
|
|
1092
1096
|
);
|
|
1093
1097
|
closeSync(stdoutFd);
|
|
1094
1098
|
closeSync(stderrFd);
|
|
@@ -1101,33 +1105,80 @@ var claudeProvider = {
|
|
|
1101
1105
|
};
|
|
1102
1106
|
|
|
1103
1107
|
// src/providers/cursor.ts
|
|
1104
|
-
import { closeSync as closeSync2, existsSync as
|
|
1108
|
+
import { closeSync as closeSync2, existsSync as existsSync8, openSync as openSync2 } from "node:fs";
|
|
1105
1109
|
import { spawn as spawn2 } from "node:child_process";
|
|
1110
|
+
import path7 from "node:path";
|
|
1111
|
+
|
|
1112
|
+
// src/providers/cursor-windows.ts
|
|
1113
|
+
import { existsSync as existsSync7, readdirSync as readdirSync3 } from "node:fs";
|
|
1106
1114
|
import path6 from "node:path";
|
|
1107
|
-
var
|
|
1108
|
-
function
|
|
1115
|
+
var CURSOR_VERSION_DIR = /^\d{4}\.\d{1,2}\.\d{1,2}-[a-f0-9]+$/i;
|
|
1116
|
+
function parseCursorVersionSortKey(versionName) {
|
|
1117
|
+
const datePart = versionName.split("-")[0];
|
|
1118
|
+
const parts = datePart.split(".");
|
|
1119
|
+
if (parts.length !== 3) return null;
|
|
1120
|
+
const [year, month, day] = parts;
|
|
1121
|
+
if (!year || !month || !day) return null;
|
|
1122
|
+
return Number(`${year}${month.padStart(2, "0")}${day.padStart(2, "0")}`);
|
|
1123
|
+
}
|
|
1124
|
+
function pickLatestCursorVersionDir(agentRoot) {
|
|
1125
|
+
const versionsRoot = path6.join(agentRoot, "versions");
|
|
1109
1126
|
if (!existsSync7(versionsRoot)) return null;
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1127
|
+
let bestDir = null;
|
|
1128
|
+
let bestKey = -1;
|
|
1129
|
+
for (const entry of readdirSync3(versionsRoot, { withFileTypes: true })) {
|
|
1130
|
+
if (!entry.isDirectory() || !CURSOR_VERSION_DIR.test(entry.name)) continue;
|
|
1131
|
+
const key = parseCursorVersionSortKey(entry.name);
|
|
1132
|
+
if (key == null || key <= bestKey) continue;
|
|
1133
|
+
bestKey = key;
|
|
1134
|
+
bestDir = path6.join(versionsRoot, entry.name);
|
|
1135
|
+
}
|
|
1136
|
+
return bestDir;
|
|
1137
|
+
}
|
|
1138
|
+
function resolveWindowsCursorBundled(agentRoot) {
|
|
1139
|
+
const root = agentRoot?.trim() || path6.join(process.env.LOCALAPPDATA || "", "cursor-agent");
|
|
1140
|
+
const directNode = path6.join(root, "node.exe");
|
|
1141
|
+
const directIndex = path6.join(root, "index.js");
|
|
1142
|
+
if (existsSync7(directNode) && existsSync7(directIndex)) {
|
|
1143
|
+
return { nodeExe: directNode, indexJs: directIndex, versionDir: root };
|
|
1144
|
+
}
|
|
1145
|
+
const versionDir = pickLatestCursorVersionDir(root);
|
|
1146
|
+
if (!versionDir) return null;
|
|
1114
1147
|
const nodeExe = path6.join(versionDir, "node.exe");
|
|
1115
1148
|
const indexJs = path6.join(versionDir, "index.js");
|
|
1116
1149
|
if (!existsSync7(nodeExe) || !existsSync7(indexJs)) return null;
|
|
1117
|
-
return {
|
|
1150
|
+
return { nodeExe, indexJs, versionDir };
|
|
1118
1151
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1152
|
+
|
|
1153
|
+
// src/providers/cursor.ts
|
|
1154
|
+
var DEFAULT_CURSOR_MODEL = "composer-2.5";
|
|
1155
|
+
function bundledSpawnTarget(nodeExe, indexJs, versionDir) {
|
|
1156
|
+
return {
|
|
1157
|
+
executable: nodeExe,
|
|
1158
|
+
prefixArgs: [indexJs],
|
|
1159
|
+
shell: false,
|
|
1160
|
+
detached: true,
|
|
1161
|
+
bundledVersionDir: versionDir
|
|
1162
|
+
};
|
|
1125
1163
|
}
|
|
1126
1164
|
function resolveCursorSpawn(agentBin) {
|
|
1127
|
-
if (process.platform === "win32"
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
|
|
1165
|
+
if (process.platform === "win32") {
|
|
1166
|
+
const isCursorWrapper = /\.(cmd|bat)$/i.test(agentBin);
|
|
1167
|
+
const isBundledNode = /node\.exe$/i.test(agentBin) && existsSync8(path7.join(path7.dirname(agentBin), "index.js"));
|
|
1168
|
+
const isDefaultShim = agentBin === "agent";
|
|
1169
|
+
if (isCursorWrapper || isBundledNode || isDefaultShim) {
|
|
1170
|
+
const bundled = isCursorWrapper ? resolveWindowsCursorBundled(path7.dirname(agentBin)) : isBundledNode ? {
|
|
1171
|
+
nodeExe: agentBin,
|
|
1172
|
+
indexJs: path7.join(path7.dirname(agentBin), "index.js"),
|
|
1173
|
+
versionDir: path7.dirname(agentBin)
|
|
1174
|
+
} : resolveWindowsCursorBundled();
|
|
1175
|
+
if (bundled) {
|
|
1176
|
+
return bundledSpawnTarget(bundled.nodeExe, bundled.indexJs, bundled.versionDir);
|
|
1177
|
+
}
|
|
1178
|
+
throw new Error(
|
|
1179
|
+
"Cursor Agent on Windows has no headless bundled node.exe under %LOCALAPPDATA%\\cursor-agent\\versions\\\u2026. Run `agent login` / update Cursor Agent CLI, use `--provider claude`, or set KYNVER_CURSOR_AGENT_ROOT to the cursor-agent folder."
|
|
1180
|
+
);
|
|
1181
|
+
}
|
|
1131
1182
|
}
|
|
1132
1183
|
return { executable: agentBin, prefixArgs: [], shell: false, detached: true };
|
|
1133
1184
|
}
|
|
@@ -1135,11 +1186,23 @@ function resolveAgentBin() {
|
|
|
1135
1186
|
const configured = process.env.KYNVER_CURSOR_AGENT_BIN?.trim() || process.env.CURSOR_AGENT_BIN?.trim();
|
|
1136
1187
|
if (configured) return configured;
|
|
1137
1188
|
if (process.platform === "win32") {
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1189
|
+
const bundled = resolveWindowsCursorBundled(
|
|
1190
|
+
process.env.KYNVER_CURSOR_AGENT_ROOT?.trim() || void 0
|
|
1191
|
+
);
|
|
1192
|
+
if (bundled) return bundled.nodeExe;
|
|
1193
|
+
const localAgent = path7.join(process.env.LOCALAPPDATA || "", "cursor-agent", "agent.cmd");
|
|
1194
|
+
if (existsSync8(localAgent)) return localAgent;
|
|
1140
1195
|
}
|
|
1141
1196
|
return "agent";
|
|
1142
1197
|
}
|
|
1198
|
+
function cursorWorkerEnv(agentBin, spawnTarget) {
|
|
1199
|
+
return {
|
|
1200
|
+
...process.env,
|
|
1201
|
+
CI: "1",
|
|
1202
|
+
NO_COLOR: "1",
|
|
1203
|
+
...spawnTarget.bundledVersionDir ? { CURSOR_INVOKED_AS: path7.basename(agentBin) || "agent.cmd" } : {}
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1143
1206
|
var cursorProvider = {
|
|
1144
1207
|
name: "cursor",
|
|
1145
1208
|
defaultModel: DEFAULT_CURSOR_MODEL,
|
|
@@ -1172,16 +1235,13 @@ var cursorProvider = {
|
|
|
1172
1235
|
model,
|
|
1173
1236
|
opts.prompt
|
|
1174
1237
|
],
|
|
1175
|
-
{
|
|
1238
|
+
hiddenSpawnOptions({
|
|
1176
1239
|
cwd: opts.worktreePath,
|
|
1177
1240
|
detached: spawnTarget.detached,
|
|
1178
1241
|
shell: spawnTarget.shell,
|
|
1179
1242
|
stdio: ["ignore", stdoutFd, stderrFd],
|
|
1180
|
-
env:
|
|
1181
|
-
|
|
1182
|
-
...spawnTarget.prefixArgs.length > 0 ? { CURSOR_INVOKED_AS: path6.basename(agentBin) } : {}
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1243
|
+
env: cursorWorkerEnv(agentBin, spawnTarget)
|
|
1244
|
+
})
|
|
1185
1245
|
);
|
|
1186
1246
|
closeSync2(stdoutFd);
|
|
1187
1247
|
closeSync2(stderrFd);
|
|
@@ -1213,12 +1273,12 @@ function resolveWorkerProvider(name) {
|
|
|
1213
1273
|
|
|
1214
1274
|
// src/auto-complete.ts
|
|
1215
1275
|
import { spawn as spawn3 } from "node:child_process";
|
|
1216
|
-
import { existsSync as
|
|
1217
|
-
import
|
|
1276
|
+
import { existsSync as existsSync9, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
|
|
1277
|
+
import path9 from "node:path";
|
|
1218
1278
|
import { fileURLToPath } from "node:url";
|
|
1219
1279
|
|
|
1220
1280
|
// src/worker-ops.ts
|
|
1221
|
-
import
|
|
1281
|
+
import path8 from "node:path";
|
|
1222
1282
|
async function postCompletion(url, secret, body) {
|
|
1223
1283
|
const res = await fetch(url, {
|
|
1224
1284
|
method: "POST",
|
|
@@ -1341,7 +1401,7 @@ async function completeWorker(args) {
|
|
|
1341
1401
|
function workerStatus(args) {
|
|
1342
1402
|
const worker = loadWorker(String(args.run), String(args.name));
|
|
1343
1403
|
const status = computeWorkerStatus(worker);
|
|
1344
|
-
writeJson(
|
|
1404
|
+
writeJson(path8.join(worker.workerDir, "last-status.json"), status);
|
|
1345
1405
|
console.log(JSON.stringify(status, null, 2));
|
|
1346
1406
|
}
|
|
1347
1407
|
function runStatus(args) {
|
|
@@ -1349,7 +1409,7 @@ function runStatus(args) {
|
|
|
1349
1409
|
const names = Object.keys(run.workers || {});
|
|
1350
1410
|
const workers = names.map((name) => {
|
|
1351
1411
|
const worker = readJson(
|
|
1352
|
-
|
|
1412
|
+
path8.join(runDirectory(run.id), "workers", safeSlug(name), "worker.json"),
|
|
1353
1413
|
void 0
|
|
1354
1414
|
);
|
|
1355
1415
|
if (!worker) {
|
|
@@ -1385,7 +1445,7 @@ function runStatus(args) {
|
|
|
1385
1445
|
needsAttention: workers.filter((w) => w.attention && w.attention !== "ok" && w.attention !== "done").map((w) => w.worker),
|
|
1386
1446
|
workers
|
|
1387
1447
|
};
|
|
1388
|
-
writeJson(
|
|
1448
|
+
writeJson(path8.join(runDirectory(run.id), "last-board.json"), board);
|
|
1389
1449
|
console.log(JSON.stringify(board, null, 2));
|
|
1390
1450
|
}
|
|
1391
1451
|
function tailWorker(args) {
|
|
@@ -1524,12 +1584,12 @@ async function autoCompleteWorkerCli(raw) {
|
|
|
1524
1584
|
}
|
|
1525
1585
|
}
|
|
1526
1586
|
function resolveDefaultCliPath() {
|
|
1527
|
-
return
|
|
1587
|
+
return path9.join(fileURLToPath(new URL(".", import.meta.url)), "cli.js");
|
|
1528
1588
|
}
|
|
1529
1589
|
function spawnCompletionSidecar(opts) {
|
|
1530
1590
|
const cliPath = opts.cliPath ?? resolveDefaultCliPath();
|
|
1531
|
-
if (!
|
|
1532
|
-
const logPath =
|
|
1591
|
+
if (!existsSync9(cliPath)) return void 0;
|
|
1592
|
+
const logPath = path9.join(opts.workerDir, "auto-complete.log");
|
|
1533
1593
|
let logFd;
|
|
1534
1594
|
try {
|
|
1535
1595
|
logFd = openSync3(logPath, "a");
|
|
@@ -1555,11 +1615,15 @@ function spawnCompletionSidecar(opts) {
|
|
|
1555
1615
|
if (opts.baseUrl) args.push("--base-url", opts.baseUrl);
|
|
1556
1616
|
if (opts.secret) args.push("--secret", opts.secret);
|
|
1557
1617
|
try {
|
|
1558
|
-
const child = spawn3(
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1618
|
+
const child = spawn3(
|
|
1619
|
+
nodeExecutable,
|
|
1620
|
+
args,
|
|
1621
|
+
hiddenSpawnOptions({
|
|
1622
|
+
detached: true,
|
|
1623
|
+
stdio,
|
|
1624
|
+
env: process.env
|
|
1625
|
+
})
|
|
1626
|
+
);
|
|
1563
1627
|
if (logFd !== void 0) closeSync3(logFd);
|
|
1564
1628
|
child.unref();
|
|
1565
1629
|
return { pid: child.pid, logPath, cliPath };
|
|
@@ -1598,16 +1662,16 @@ function spawnWorkerProcess(run, opts) {
|
|
|
1598
1662
|
launchModel = preflight.model;
|
|
1599
1663
|
}
|
|
1600
1664
|
const { worktreesDir } = getPaths();
|
|
1601
|
-
const workerDir =
|
|
1665
|
+
const workerDir = path10.join(runDirectory(run.id), "workers", name);
|
|
1602
1666
|
mkdirSync3(workerDir, { recursive: true });
|
|
1603
|
-
const worktreePath =
|
|
1667
|
+
const worktreePath = path10.join(worktreesDir, run.id, name);
|
|
1604
1668
|
const branch = opts.branch || `agent/${run.id}/${name}`;
|
|
1605
|
-
if (
|
|
1669
|
+
if (existsSync10(worktreePath)) throw new Error(`worktree path already exists: ${worktreePath}`);
|
|
1606
1670
|
git(run.repo, ["fetch", "origin", "--prune"], { allowFailure: true });
|
|
1607
1671
|
git(run.repo, ["worktree", "add", "-b", branch, worktreePath, run.baseCommit], { throwError: true });
|
|
1608
|
-
const stdoutPath =
|
|
1609
|
-
const stderrPath =
|
|
1610
|
-
const heartbeatPath =
|
|
1672
|
+
const stdoutPath = path10.join(workerDir, "stdout.jsonl");
|
|
1673
|
+
const stderrPath = path10.join(workerDir, "stderr.log");
|
|
1674
|
+
const heartbeatPath = path10.join(workerDir, "heartbeat.jsonl");
|
|
1611
1675
|
const prompt = buildPrompt({
|
|
1612
1676
|
task: opts.task,
|
|
1613
1677
|
ownedPaths: opts.ownedPaths || [],
|
|
@@ -1656,7 +1720,7 @@ function spawnWorkerProcess(run, opts) {
|
|
|
1656
1720
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1657
1721
|
};
|
|
1658
1722
|
saveWorker(run.id, worker);
|
|
1659
|
-
run.workers = { ...run.workers || {}, [name]: { workerDir, statusPath:
|
|
1723
|
+
run.workers = { ...run.workers || {}, [name]: { workerDir, statusPath: path10.join(workerDir, "worker.json") } };
|
|
1660
1724
|
run.status = "running";
|
|
1661
1725
|
saveRun(run);
|
|
1662
1726
|
if (worker.agentOsId && worker.taskId) {
|
|
@@ -1879,7 +1943,7 @@ function redactHarness(text, secret) {
|
|
|
1879
1943
|
}
|
|
1880
1944
|
|
|
1881
1945
|
// src/validate.ts
|
|
1882
|
-
import
|
|
1946
|
+
import path11 from "node:path";
|
|
1883
1947
|
var RUN_ID_RE = /^[a-z0-9][a-z0-9._-]{0,127}$/i;
|
|
1884
1948
|
var WORKER_NAME_RE = /^[a-z0-9][a-z0-9._-]{0,63}$/i;
|
|
1885
1949
|
function validateRunId(runId) {
|
|
@@ -1893,15 +1957,15 @@ function validateWorkerName(name) {
|
|
|
1893
1957
|
return trimmed;
|
|
1894
1958
|
}
|
|
1895
1959
|
function validateRepo(repo) {
|
|
1896
|
-
const resolved =
|
|
1960
|
+
const resolved = path11.resolve(repo);
|
|
1897
1961
|
if (resolved.includes("..")) throw new Error("repo path must not contain .. segments");
|
|
1898
1962
|
return resolved;
|
|
1899
1963
|
}
|
|
1900
1964
|
function validateOwnedPaths(repoRoot, ownedPaths) {
|
|
1901
1965
|
return ownedPaths.map((owned) => {
|
|
1902
|
-
const resolved =
|
|
1903
|
-
const rel =
|
|
1904
|
-
if (rel.startsWith("..") ||
|
|
1966
|
+
const resolved = path11.resolve(repoRoot, owned);
|
|
1967
|
+
const rel = path11.relative(repoRoot, resolved);
|
|
1968
|
+
if (rel.startsWith("..") || path11.isAbsolute(rel)) {
|
|
1905
1969
|
throw new Error(`owned path escapes repo: ${owned}`);
|
|
1906
1970
|
}
|
|
1907
1971
|
return resolved;
|
|
@@ -1913,14 +1977,14 @@ function validateTailLines(lines) {
|
|
|
1913
1977
|
}
|
|
1914
1978
|
|
|
1915
1979
|
// src/worktree.ts
|
|
1916
|
-
import { existsSync as
|
|
1917
|
-
import
|
|
1980
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4 } from "node:fs";
|
|
1981
|
+
import path12 from "node:path";
|
|
1918
1982
|
function createRun(args) {
|
|
1919
1983
|
const repo = validateRepo(required(String(args.repo || ""), "--repo"));
|
|
1920
1984
|
ensureGitRepo(repo);
|
|
1921
1985
|
const id = args.id ? validateRunId(String(args.id)) : timestampSlug(String(args.name || "run"));
|
|
1922
1986
|
const dir = runDirectory(id);
|
|
1923
|
-
if (
|
|
1987
|
+
if (existsSync11(dir)) failExists(`run already exists: ${id}`);
|
|
1924
1988
|
mkdirSync4(dir, { recursive: true });
|
|
1925
1989
|
const base = String(args.base || "origin/main");
|
|
1926
1990
|
const baseCommit = git(repo, ["rev-parse", base]).trim();
|
|
@@ -1934,12 +1998,12 @@ function createRun(args) {
|
|
|
1934
1998
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1935
1999
|
workers: {}
|
|
1936
2000
|
};
|
|
1937
|
-
writeJson(
|
|
2001
|
+
writeJson(path12.join(dir, "run.json"), run);
|
|
1938
2002
|
console.log(JSON.stringify({ runId: id, runDir: dir, repo, base, baseCommit }, null, 2));
|
|
1939
2003
|
}
|
|
1940
2004
|
function listRuns() {
|
|
1941
2005
|
const { runsDir } = getPaths();
|
|
1942
|
-
const rows = listRunIds(runsDir).map((id) => readJson(
|
|
2006
|
+
const rows = listRunIds(runsDir).map((id) => readJson(path12.join(runDirectory(id), "run.json"), void 0)).filter(Boolean).map((run) => ({
|
|
1943
2007
|
id: run.id,
|
|
1944
2008
|
name: run.name,
|
|
1945
2009
|
status: run.status,
|
|
@@ -1954,7 +2018,7 @@ function failExists(message) {
|
|
|
1954
2018
|
}
|
|
1955
2019
|
|
|
1956
2020
|
// src/sweep.ts
|
|
1957
|
-
import
|
|
2021
|
+
import path13 from "node:path";
|
|
1958
2022
|
async function sweepRun(args) {
|
|
1959
2023
|
const pipeline = args.pipeline === true || args.pipeline === "true";
|
|
1960
2024
|
try {
|
|
@@ -1966,7 +2030,7 @@ async function sweepRun(args) {
|
|
|
1966
2030
|
const releasedLocalOrphans = [];
|
|
1967
2031
|
for (const name of Object.keys(run.workers || {})) {
|
|
1968
2032
|
const worker = readJson(
|
|
1969
|
-
|
|
2033
|
+
path13.join(runDirectory(run.id), "workers", safeSlug(name), "worker.json"),
|
|
1970
2034
|
void 0
|
|
1971
2035
|
);
|
|
1972
2036
|
if (!worker || !worker.dispatched || !worker.taskId) continue;
|
|
@@ -2013,10 +2077,10 @@ import { mkdirSync as mkdirSync5, realpathSync } from "node:fs";
|
|
|
2013
2077
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2014
2078
|
|
|
2015
2079
|
// src/pipeline-tick.ts
|
|
2016
|
-
import
|
|
2080
|
+
import path16 from "node:path";
|
|
2017
2081
|
|
|
2018
2082
|
// src/finalize.ts
|
|
2019
|
-
import
|
|
2083
|
+
import path14 from "node:path";
|
|
2020
2084
|
var ACTIVE_RUN_STATUSES = /* @__PURE__ */ new Set(["running", "dispatching", "pending", "queued"]);
|
|
2021
2085
|
function terminalStatusFor(run) {
|
|
2022
2086
|
const names = Object.keys(run.workers || {});
|
|
@@ -2026,7 +2090,7 @@ function terminalStatusFor(run) {
|
|
|
2026
2090
|
let anyCompletionBlocked = false;
|
|
2027
2091
|
for (const name of names) {
|
|
2028
2092
|
const worker = readJson(
|
|
2029
|
-
|
|
2093
|
+
path14.join(runDirectory(run.id), "workers", safeSlug(name), "worker.json"),
|
|
2030
2094
|
void 0
|
|
2031
2095
|
);
|
|
2032
2096
|
if (!worker) continue;
|
|
@@ -2059,7 +2123,7 @@ function finalizeStaleRuns() {
|
|
|
2059
2123
|
}
|
|
2060
2124
|
|
|
2061
2125
|
// src/plan-progress-daemon-sync.ts
|
|
2062
|
-
import
|
|
2126
|
+
import path15 from "node:path";
|
|
2063
2127
|
|
|
2064
2128
|
// src/plan-progress-sync.ts
|
|
2065
2129
|
async function syncPlanProgress(args) {
|
|
@@ -2083,7 +2147,7 @@ async function syncActiveWorkerPlanProgress(runId, args) {
|
|
|
2083
2147
|
const outcomes = [];
|
|
2084
2148
|
for (const name of Object.keys(run.workers || {})) {
|
|
2085
2149
|
const worker = readJson(
|
|
2086
|
-
|
|
2150
|
+
path15.join(runDirectory(run.id), "workers", safeSlug(name), "worker.json"),
|
|
2087
2151
|
void 0
|
|
2088
2152
|
);
|
|
2089
2153
|
if (!worker?.dispatched || !worker.taskId) continue;
|
|
@@ -2137,7 +2201,7 @@ async function completeFinishedWorkers(runId, args) {
|
|
|
2137
2201
|
const outcomes = [];
|
|
2138
2202
|
for (const name of Object.keys(run.workers || {})) {
|
|
2139
2203
|
const worker = readJson(
|
|
2140
|
-
|
|
2204
|
+
path16.join(runDirectory(run.id), "workers", safeSlug(name), "worker.json"),
|
|
2141
2205
|
void 0
|
|
2142
2206
|
);
|
|
2143
2207
|
if (!worker?.taskId) continue;
|