@taskless-app/swarm 0.6.80 → 0.6.81
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 +317 -42
- package/dist/overmind.js +774 -120
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -23,6 +23,11 @@ async function askTty(question) {
|
|
|
23
23
|
async function askYesNo(question) {
|
|
24
24
|
return YES.includes((await askTty(`${question} [y/N]: `)).trim().toLowerCase());
|
|
25
25
|
}
|
|
26
|
+
function readCommandOutcome(result) {
|
|
27
|
+
if (typeof result === "number") return { exitCode: result, output: "" };
|
|
28
|
+
return { exitCode: result.exitCode, output: `${result.stdout ?? ""}
|
|
29
|
+
${result.stderr ?? ""}` };
|
|
30
|
+
}
|
|
26
31
|
async function runQuiet(command, opts = {}) {
|
|
27
32
|
try {
|
|
28
33
|
const res = await execa(command, { shell: true, reject: false, timeout: opts.timeoutMs ?? PROBE_TIMEOUT_MS });
|
|
@@ -35,6 +40,15 @@ async function execLoud(command) {
|
|
|
35
40
|
const res = await execa(command, { shell: true, reject: false, stdio: "inherit" });
|
|
36
41
|
return res.exitCode ?? 1;
|
|
37
42
|
}
|
|
43
|
+
async function execCaptured(command) {
|
|
44
|
+
const res = await execa(command, {
|
|
45
|
+
shell: true,
|
|
46
|
+
reject: false,
|
|
47
|
+
stdout: ["pipe", "inherit"],
|
|
48
|
+
stderr: ["pipe", "inherit"]
|
|
49
|
+
});
|
|
50
|
+
return { exitCode: res.exitCode ?? 1, stdout: res.stdout ?? "", stderr: res.stderr ?? "" };
|
|
51
|
+
}
|
|
38
52
|
var YES, PROBE_TIMEOUT_MS;
|
|
39
53
|
var init_cliIo = __esm({
|
|
40
54
|
"src/cliIo.ts"() {
|
|
@@ -223,12 +237,13 @@ function verifyStatsLine(s) {
|
|
|
223
237
|
const pct = Math.round(s.negativeShare * 100);
|
|
224
238
|
return `\u0432\u0435\u0440\u0434\u0438\u043A\u0442\u043E\u0432 ${s.total} \xB7 \u043E\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0445 ${s.negative} (${pct}%): \u043D\u0435 \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u043B\u043E\u0441\u044C ${s.notReproduced}, \u043D\u0430\u0448\u043B\u0438 \u0434\u0435\u0444\u0435\u043A\u0442 ${s.foundIssues}`;
|
|
225
239
|
}
|
|
226
|
-
var VERIFY_VERDICTS, VERIFY_VERDICT_SET;
|
|
240
|
+
var VERIFY_VERDICTS, VERIFY_VERDICT_SET, DRONE_COMMENT_SIGNATURE;
|
|
227
241
|
var init_verifyVerdict = __esm({
|
|
228
242
|
"../swarm-core/src/verifyVerdict.ts"() {
|
|
229
243
|
"use strict";
|
|
230
244
|
VERIFY_VERDICTS = ["confirmed", "not_reproduced", "found_issues"];
|
|
231
245
|
VERIFY_VERDICT_SET = new Set(VERIFY_VERDICTS);
|
|
246
|
+
DRONE_COMMENT_SIGNATURE = "\u{1F41D} \u0414\u0440\u043E\u043D";
|
|
232
247
|
}
|
|
233
248
|
});
|
|
234
249
|
|
|
@@ -870,16 +885,30 @@ function sanitizeEventText(text) {
|
|
|
870
885
|
if (!cleaned.length) return null;
|
|
871
886
|
return cleaned.length <= EVENT_TEXT_MAX ? cleaned : clampEventText(cleaned);
|
|
872
887
|
}
|
|
888
|
+
function sanitizeVerdictEventText(text) {
|
|
889
|
+
if (text == null) return null;
|
|
890
|
+
const cleaned = text.replace(ANSI_CSI_RE, "").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(VERDICT_CONTROL_RE, " ").trim();
|
|
891
|
+
if (!cleaned.length) return null;
|
|
892
|
+
return cleaned.length <= EVENT_TEXT_MAX ? cleaned : clampEventText(cleaned);
|
|
893
|
+
}
|
|
894
|
+
function sanitizeStoredEventText(text) {
|
|
895
|
+
if (typeof text === "string") {
|
|
896
|
+
const head = text.trimStart();
|
|
897
|
+
if (head.startsWith("\u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0440\u0435\u0432\u044C\u044E") || head.startsWith("\u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438")) return sanitizeVerdictEventText(text);
|
|
898
|
+
}
|
|
899
|
+
return sanitizeEventText(text);
|
|
900
|
+
}
|
|
873
901
|
function clampEventText(text) {
|
|
874
902
|
const note = ` \u2026 (\u043E\u0431\u0440\u0435\u0437\u0430\u043D\u043E, \u0431\u044B\u043B\u043E ${text.length} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432)`;
|
|
875
903
|
return text.slice(0, Math.max(0, EVENT_TEXT_MAX - note.length)) + note;
|
|
876
904
|
}
|
|
877
|
-
var ANSI_CSI_RE, CONTROL_CHARS_RE, EVENT_TEXT_MAX;
|
|
905
|
+
var ANSI_CSI_RE, CONTROL_CHARS_RE, VERDICT_CONTROL_RE, EVENT_TEXT_MAX;
|
|
878
906
|
var init_text = __esm({
|
|
879
907
|
"../swarm-core/src/text.ts"() {
|
|
880
908
|
"use strict";
|
|
881
909
|
ANSI_CSI_RE = /\x1b\[[0-9;]*[A-Za-z]/g;
|
|
882
910
|
CONTROL_CHARS_RE = /[\x00-\x1f\x7f]/g;
|
|
911
|
+
VERDICT_CONTROL_RE = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g;
|
|
883
912
|
EVENT_TEXT_MAX = 16e3;
|
|
884
913
|
}
|
|
885
914
|
});
|
|
@@ -3626,6 +3655,7 @@ var init_toolFailure = __esm({
|
|
|
3626
3655
|
});
|
|
3627
3656
|
|
|
3628
3657
|
// src/procList.ts
|
|
3658
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
3629
3659
|
function parsePsRows(out) {
|
|
3630
3660
|
const rows = [];
|
|
3631
3661
|
for (const line of out.split("\n")) {
|
|
@@ -3908,7 +3938,7 @@ var init_package = __esm({
|
|
|
3908
3938
|
"package.json"() {
|
|
3909
3939
|
package_default = {
|
|
3910
3940
|
name: "@taskless-app/swarm",
|
|
3911
|
-
version: "0.6.
|
|
3941
|
+
version: "0.6.81",
|
|
3912
3942
|
type: "module",
|
|
3913
3943
|
description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
|
|
3914
3944
|
keywords: [
|
|
@@ -3960,7 +3990,7 @@ var init_package = __esm({
|
|
|
3960
3990
|
undici: "^7.30.1",
|
|
3961
3991
|
zod: "3.25.76"
|
|
3962
3992
|
},
|
|
3963
|
-
gitHead: "
|
|
3993
|
+
gitHead: "0a4c6ee0b5f07c122a325e3df3bc3361ee01b312"
|
|
3964
3994
|
};
|
|
3965
3995
|
}
|
|
3966
3996
|
});
|
|
@@ -4126,12 +4156,12 @@ var init_netTimeout = __esm({
|
|
|
4126
4156
|
|
|
4127
4157
|
// src/droneChannel.ts
|
|
4128
4158
|
import { createHmac, randomBytes, timingSafeEqual } from "crypto";
|
|
4129
|
-
import { chmodSync as chmodSync2, mkdirSync as mkdirSync8, readFileSync as
|
|
4159
|
+
import { chmodSync as chmodSync2, mkdirSync as mkdirSync8, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "fs";
|
|
4130
4160
|
import { dirname as dirname3 } from "path";
|
|
4131
4161
|
import { serve } from "@hono/node-server";
|
|
4132
4162
|
function loadChannelSecret(path) {
|
|
4133
4163
|
try {
|
|
4134
|
-
const s =
|
|
4164
|
+
const s = readFileSync10(path, "utf8").trim();
|
|
4135
4165
|
if (s.length >= 32) return s;
|
|
4136
4166
|
} catch {
|
|
4137
4167
|
}
|
|
@@ -4214,7 +4244,7 @@ var init_authState = __esm({
|
|
|
4214
4244
|
|
|
4215
4245
|
// src/oauth.ts
|
|
4216
4246
|
import { createHash, randomBytes as randomBytes2 } from "crypto";
|
|
4217
|
-
import { readFileSync as
|
|
4247
|
+
import { readFileSync as readFileSync11, writeFileSync as writeFileSync9, unlinkSync as unlinkSync3 } from "fs";
|
|
4218
4248
|
import { join as join13 } from "path";
|
|
4219
4249
|
function makePkce() {
|
|
4220
4250
|
const verifier = randomBytes2(48).toString("base64url");
|
|
@@ -4299,7 +4329,7 @@ function toStore(clientId, t, now) {
|
|
|
4299
4329
|
}
|
|
4300
4330
|
function loadStore() {
|
|
4301
4331
|
try {
|
|
4302
|
-
return JSON.parse(
|
|
4332
|
+
return JSON.parse(readFileSync11(STORE_PATH2, "utf8"));
|
|
4303
4333
|
} catch {
|
|
4304
4334
|
return null;
|
|
4305
4335
|
}
|
|
@@ -4315,7 +4345,7 @@ function clearStore() {
|
|
|
4315
4345
|
}
|
|
4316
4346
|
function loadClientId() {
|
|
4317
4347
|
try {
|
|
4318
|
-
return JSON.parse(
|
|
4348
|
+
return JSON.parse(readFileSync11(CLIENT_PATH, "utf8")).clientId;
|
|
4319
4349
|
} catch {
|
|
4320
4350
|
return null;
|
|
4321
4351
|
}
|
|
@@ -4735,11 +4765,11 @@ var init_prodHttp = __esm({
|
|
|
4735
4765
|
});
|
|
4736
4766
|
|
|
4737
4767
|
// src/workspace.ts
|
|
4738
|
-
import { readFileSync as
|
|
4768
|
+
import { readFileSync as readFileSync12, writeFileSync as writeFileSync10, unlinkSync as unlinkSync4 } from "fs";
|
|
4739
4769
|
import { join as join19 } from "path";
|
|
4740
4770
|
function loadWorkspace() {
|
|
4741
4771
|
try {
|
|
4742
|
-
const w = JSON.parse(
|
|
4772
|
+
const w = JSON.parse(readFileSync12(WORKSPACE_PATH, "utf8"));
|
|
4743
4773
|
return w && typeof w.id === "string" && w.id ? w : null;
|
|
4744
4774
|
} catch {
|
|
4745
4775
|
return null;
|
|
@@ -5203,14 +5233,14 @@ var init_daemonLink = __esm({
|
|
|
5203
5233
|
});
|
|
5204
5234
|
|
|
5205
5235
|
// src/pauseState.ts
|
|
5206
|
-
import { existsSync as existsSync12, readFileSync as
|
|
5236
|
+
import { existsSync as existsSync12, readFileSync as readFileSync13, renameSync as renameSync5, unlinkSync as unlinkSync5, writeFileSync as writeFileSync11 } from "fs";
|
|
5207
5237
|
import { join as join20 } from "path";
|
|
5208
5238
|
function pauseStatePath(home) {
|
|
5209
5239
|
return join20(home, "pause.json");
|
|
5210
5240
|
}
|
|
5211
5241
|
function loadPauseState(home, io = {}) {
|
|
5212
5242
|
const exists = io.exists ?? existsSync12;
|
|
5213
|
-
const readFile2 = io.readFile ?? ((p) =>
|
|
5243
|
+
const readFile2 = io.readFile ?? ((p) => readFileSync13(p, "utf8"));
|
|
5214
5244
|
const path = pauseStatePath(home);
|
|
5215
5245
|
if (!exists(path)) return ACTIVE;
|
|
5216
5246
|
try {
|
|
@@ -5271,10 +5301,10 @@ var init_pauseState = __esm({
|
|
|
5271
5301
|
});
|
|
5272
5302
|
|
|
5273
5303
|
// src/heartbeat.ts
|
|
5274
|
-
import { readFileSync as
|
|
5304
|
+
import { readFileSync as readFileSync14, renameSync as renameSync6, writeFileSync as writeFileSync12 } from "fs";
|
|
5275
5305
|
function readHeartbeat(path) {
|
|
5276
5306
|
try {
|
|
5277
|
-
const ms = Number(
|
|
5307
|
+
const ms = Number(readFileSync14(path, "utf8").trim());
|
|
5278
5308
|
return Number.isFinite(ms) ? ms : null;
|
|
5279
5309
|
} catch {
|
|
5280
5310
|
return null;
|
|
@@ -6122,7 +6152,7 @@ CREATE TABLE IF NOT EXISTS imports (
|
|
|
6122
6152
|
}
|
|
6123
6153
|
// --- events (лог/хроника) ---
|
|
6124
6154
|
addEvent(run_id, kind, text, actor = null) {
|
|
6125
|
-
const clean =
|
|
6155
|
+
const clean = sanitizeStoredEventText(text);
|
|
6126
6156
|
const insert = () => this.db.prepare("INSERT INTO events (run_id, kind, text, actor) VALUES (?, ?, ?, ?)").run(run_id, kind, clean, actor);
|
|
6127
6157
|
try {
|
|
6128
6158
|
insert();
|
|
@@ -6285,7 +6315,7 @@ CREATE TABLE IF NOT EXISTS imports (
|
|
|
6285
6315
|
});
|
|
6286
6316
|
|
|
6287
6317
|
// src/repoScan.ts
|
|
6288
|
-
import { readdirSync as readdirSync11, readFileSync as
|
|
6318
|
+
import { readdirSync as readdirSync11, readFileSync as readFileSync15, statSync as statSync11 } from "fs";
|
|
6289
6319
|
import { join as join21 } from "path";
|
|
6290
6320
|
var init_repoScan = __esm({
|
|
6291
6321
|
"src/repoScan.ts"() {
|
|
@@ -6296,7 +6326,7 @@ var init_repoScan = __esm({
|
|
|
6296
6326
|
|
|
6297
6327
|
// src/repoDiscovery.ts
|
|
6298
6328
|
import { homedir as homedir6 } from "os";
|
|
6299
|
-
import { readFileSync as
|
|
6329
|
+
import { readFileSync as readFileSync16, renameSync as renameSync7, writeFileSync as writeFileSync13 } from "fs";
|
|
6300
6330
|
import { isAbsolute as isAbsolute3, join as join22, resolve as resolve4 } from "path";
|
|
6301
6331
|
function repoMapLines(rows) {
|
|
6302
6332
|
if (!rows?.length) return [];
|
|
@@ -6312,7 +6342,7 @@ function repoMapLines(rows) {
|
|
|
6312
6342
|
}
|
|
6313
6343
|
function loadRepoMapCache(path) {
|
|
6314
6344
|
try {
|
|
6315
|
-
const raw = JSON.parse(
|
|
6345
|
+
const raw = JSON.parse(readFileSync16(path, "utf8"));
|
|
6316
6346
|
if (!Array.isArray(raw?.entries)) return { scannedAt: null, entries: [] };
|
|
6317
6347
|
return {
|
|
6318
6348
|
scannedAt: typeof raw.scannedAt === "string" && raw.scannedAt ? raw.scannedAt : null,
|
|
@@ -6688,11 +6718,11 @@ __export(statusCli_exports, {
|
|
|
6688
6718
|
probeLink: () => probeLink,
|
|
6689
6719
|
runStatusCli: () => runStatusCli
|
|
6690
6720
|
});
|
|
6691
|
-
import { existsSync as existsSync14, readFileSync as
|
|
6721
|
+
import { existsSync as existsSync14, readFileSync as readFileSync17 } from "fs";
|
|
6692
6722
|
function outboxPending(path) {
|
|
6693
6723
|
try {
|
|
6694
6724
|
if (!existsSync14(path)) return 0;
|
|
6695
|
-
return
|
|
6725
|
+
return readFileSync17(path, "utf8").split("\n").filter((l) => l.trim()).length;
|
|
6696
6726
|
} catch {
|
|
6697
6727
|
return null;
|
|
6698
6728
|
}
|
|
@@ -6899,11 +6929,11 @@ var init_prodMergeGate = __esm({
|
|
|
6899
6929
|
});
|
|
6900
6930
|
|
|
6901
6931
|
// src/platform.ts
|
|
6902
|
-
import { existsSync as existsSync15, readFileSync as
|
|
6903
|
-
import { delimiter, join as join23 } from "path";
|
|
6932
|
+
import { accessSync, constants, existsSync as existsSync15, readFileSync as readFileSync18, realpathSync as realpathSync3 } from "fs";
|
|
6933
|
+
import { delimiter, join as join23, posix as posix2, win32 } from "path";
|
|
6904
6934
|
function safeReadText(path) {
|
|
6905
6935
|
try {
|
|
6906
|
-
return
|
|
6936
|
+
return readFileSync18(path, "utf8");
|
|
6907
6937
|
} catch {
|
|
6908
6938
|
return null;
|
|
6909
6939
|
}
|
|
@@ -6985,7 +7015,11 @@ function detectGlobalPm(entry, io = {}) {
|
|
|
6985
7015
|
const has2 = io.hasCommand ?? ((n) => hasCommandInPath(n, env, platform));
|
|
6986
7016
|
return has2("npm") ? "npm" : "unknown";
|
|
6987
7017
|
}
|
|
6988
|
-
function
|
|
7018
|
+
function quotePrefix(prefix, platform) {
|
|
7019
|
+
if (platform === "win32") return `"${prefix}"`;
|
|
7020
|
+
return `'${prefix.replaceAll("'", "'\\''")}'`;
|
|
7021
|
+
}
|
|
7022
|
+
function globalInstallCommand(pm, spec, prefix, platform = process.platform) {
|
|
6989
7023
|
switch (pm) {
|
|
6990
7024
|
case "pnpm":
|
|
6991
7025
|
return `pnpm add -g ${spec}`;
|
|
@@ -6994,13 +7028,93 @@ function globalInstallCommand(pm, spec) {
|
|
|
6994
7028
|
case "yarn":
|
|
6995
7029
|
return `yarn global add ${spec}`;
|
|
6996
7030
|
default:
|
|
6997
|
-
return `npm i -g ${spec}`;
|
|
7031
|
+
return prefix ? `npm i -g --prefix ${quotePrefix(prefix, platform)} ${spec}` : `npm i -g ${spec}`;
|
|
7032
|
+
}
|
|
7033
|
+
}
|
|
7034
|
+
function resolveReal(entry, io) {
|
|
7035
|
+
const realpath = io.realpath ?? realpathSync3;
|
|
7036
|
+
try {
|
|
7037
|
+
return realpath(entry);
|
|
7038
|
+
} catch {
|
|
7039
|
+
return entry;
|
|
6998
7040
|
}
|
|
6999
7041
|
}
|
|
7000
|
-
|
|
7042
|
+
function npmInstallLocation(entry, io = {}) {
|
|
7043
|
+
if (!entry) return null;
|
|
7044
|
+
const platform = io.platform ?? process.platform;
|
|
7045
|
+
const real = resolveReal(entry, io);
|
|
7046
|
+
const norm = real.replace(/\\/g, "/");
|
|
7047
|
+
if (norm.includes("/_npx/") && norm.includes("/@taskless-app/swarm")) return { kind: "npx" };
|
|
7048
|
+
const marker = platform === "win32" ? WIN_MARKER : UNIX_MARKER;
|
|
7049
|
+
const at = norm.indexOf(marker);
|
|
7050
|
+
if (at < 0) return null;
|
|
7051
|
+
const next = norm[at + marker.length];
|
|
7052
|
+
if (next !== void 0 && next !== "/") return null;
|
|
7053
|
+
let prefix = real.slice(0, at);
|
|
7054
|
+
if (prefix === "") prefix = platform === "win32" ? "" : "/";
|
|
7055
|
+
if (!prefix) return null;
|
|
7056
|
+
const path = platform === "win32" ? win32 : posix2;
|
|
7057
|
+
const modulesDir = platform === "win32" ? path.join(prefix, "node_modules") : path.join(prefix, "lib", "node_modules");
|
|
7058
|
+
return { kind: "prefix", prefix, modulesDir };
|
|
7059
|
+
}
|
|
7060
|
+
function dirWritable(dir, platform, access) {
|
|
7061
|
+
const path = platform === "win32" ? win32 : posix2;
|
|
7062
|
+
let current = dir;
|
|
7063
|
+
for (; ; ) {
|
|
7064
|
+
try {
|
|
7065
|
+
access(current, constants.W_OK);
|
|
7066
|
+
return true;
|
|
7067
|
+
} catch (e) {
|
|
7068
|
+
const code = e && typeof e === "object" && "code" in e ? e.code : void 0;
|
|
7069
|
+
if (code !== "ENOENT") return false;
|
|
7070
|
+
const parent = path.dirname(current);
|
|
7071
|
+
if (parent === current) return false;
|
|
7072
|
+
current = parent;
|
|
7073
|
+
}
|
|
7074
|
+
}
|
|
7075
|
+
}
|
|
7076
|
+
function npxRefusal() {
|
|
7077
|
+
return `\u0440\u043E\u0439 \u0437\u0430\u043F\u0443\u0449\u0435\u043D \u0447\u0435\u0440\u0435\u0437 npx, \u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0442\u044C \u043D\u0435\u0447\u0435\u0433\u043E. \u0427\u0442\u043E\u0431\u044B \u043E\u0431\u043D\u043E\u0432\u043B\u044F\u043B\u0441\u044F \u043A\u043D\u043E\u043F\u043A\u043E\u0439, \u043F\u043E\u0441\u0442\u0430\u0432\u044C \u0435\u0433\u043E \u043F\u043E\u0441\u0442\u043E\u044F\u043D\u043D\u043E: ${LATEST_INSTALL}`;
|
|
7078
|
+
}
|
|
7079
|
+
function unwritableRefusal(modulesDir, prefix, platform = process.platform) {
|
|
7080
|
+
const sudoInstall = `sudo ${globalInstallCommand("npm", `${SWARM_PACKAGE_NAME}@latest`, prefix, platform)}`;
|
|
7081
|
+
return `\u0432 \u043F\u0430\u043F\u043A\u0443 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 \u043F\u0438\u0441\u0430\u0442\u044C \u043D\u0435\u043B\u044C\u0437\u044F: ${modulesDir}. npm \u043D\u0435 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u044E. \u041E\u0434\u0438\u043D \u0440\u0430\u0437: ${sudoInstall}. \u0418\u043B\u0438 \u0441\u0432\u043E\u0439 \u043A\u0430\u0442\u0430\u043B\u043E\u0433: npm config set prefix ~/.npm-global, \u0434\u043E\u0431\u0430\u0432\u044C ~/.npm-global/bin \u0432 PATH \u0438 \u043F\u043E\u0441\u0442\u0430\u0432\u044C \u0437\u0430\u043D\u043E\u0432\u043E.`;
|
|
7082
|
+
}
|
|
7083
|
+
function gatePackageInstall(pm, spec, entry, io = {}) {
|
|
7084
|
+
if (pm === "pnpm" || pm === "bun" || pm === "yarn") {
|
|
7085
|
+
return { action: "run", command: globalInstallCommand(pm, spec) };
|
|
7086
|
+
}
|
|
7087
|
+
if (pm === "sources") {
|
|
7088
|
+
return { action: "run", command: globalInstallCommand("npm", spec) };
|
|
7089
|
+
}
|
|
7090
|
+
const loc = npmInstallLocation(entry, io);
|
|
7091
|
+
if (loc?.kind === "npx") return { action: "refuse", kind: "npx", message: npxRefusal() };
|
|
7092
|
+
if (loc?.kind === "prefix") {
|
|
7093
|
+
const platform = io.platform ?? process.platform;
|
|
7094
|
+
const access = io.access ?? accessSync;
|
|
7095
|
+
if (!dirWritable(loc.modulesDir, platform, access)) {
|
|
7096
|
+
return { action: "refuse", kind: "unwritable", message: unwritableRefusal(loc.modulesDir, loc.prefix, platform) };
|
|
7097
|
+
}
|
|
7098
|
+
return { action: "run", command: globalInstallCommand("npm", spec, loc.prefix, platform) };
|
|
7099
|
+
}
|
|
7100
|
+
return { action: "run", command: globalInstallCommand("npm", spec) };
|
|
7101
|
+
}
|
|
7102
|
+
function npmFailureCode(output) {
|
|
7103
|
+
const plain = output.replace(/\u001b\[[0-9;]*m/g, "");
|
|
7104
|
+
const tagged = plain.match(/(?:npm ERR!|npm error) code ([A-Z][A-Z0-9_]*)/);
|
|
7105
|
+
if (tagged?.[1]) return tagged[1];
|
|
7106
|
+
const bare = plain.match(/\bError: ([A-Z][A-Z0-9_]*):/);
|
|
7107
|
+
return bare?.[1] ?? null;
|
|
7108
|
+
}
|
|
7109
|
+
function installFailureLabel(exitCode, output) {
|
|
7110
|
+
const code = npmFailureCode(output);
|
|
7111
|
+
return code ? `${code}, \u043A\u043E\u0434 ${exitCode}` : `\u043A\u043E\u0434 ${exitCode}`;
|
|
7112
|
+
}
|
|
7113
|
+
var LINUX_PMS, PLATFORM_LABEL, UNIX_MARKER, WIN_MARKER, LATEST_INSTALL;
|
|
7001
7114
|
var init_platform = __esm({
|
|
7002
7115
|
"src/platform.ts"() {
|
|
7003
7116
|
"use strict";
|
|
7117
|
+
init_src();
|
|
7004
7118
|
LINUX_PMS = [
|
|
7005
7119
|
{ cmd: "apt-get", pm: "apt" },
|
|
7006
7120
|
{ cmd: "dnf", pm: "dnf" },
|
|
@@ -7014,6 +7128,9 @@ var init_platform = __esm({
|
|
|
7014
7128
|
wsl: "WSL2 (Linux \u0432\u043D\u0443\u0442\u0440\u0438 Windows)",
|
|
7015
7129
|
windows: "Windows (\u043D\u0430\u0442\u0438\u0432\u043D\u0430\u044F)"
|
|
7016
7130
|
};
|
|
7131
|
+
UNIX_MARKER = "/lib/node_modules/@taskless-app/swarm";
|
|
7132
|
+
WIN_MARKER = "/node_modules/@taskless-app/swarm";
|
|
7133
|
+
LATEST_INSTALL = `npm i -g ${SWARM_PACKAGE_NAME}@latest`;
|
|
7017
7134
|
}
|
|
7018
7135
|
});
|
|
7019
7136
|
|
|
@@ -7465,12 +7582,12 @@ var init_doctor = __esm({
|
|
|
7465
7582
|
});
|
|
7466
7583
|
|
|
7467
7584
|
// src/repoMemory.ts
|
|
7468
|
-
import { readFileSync as
|
|
7585
|
+
import { readFileSync as readFileSync19, writeFileSync as writeFileSync14 } from "fs";
|
|
7469
7586
|
import { join as join26 } from "path";
|
|
7470
7587
|
function loadRememberedRepos(home) {
|
|
7471
7588
|
let raw;
|
|
7472
7589
|
try {
|
|
7473
|
-
raw =
|
|
7590
|
+
raw = readFileSync19(join26(home, FILE), "utf8");
|
|
7474
7591
|
} catch {
|
|
7475
7592
|
return [];
|
|
7476
7593
|
}
|
|
@@ -7741,17 +7858,24 @@ __export(updateCli_exports, {
|
|
|
7741
7858
|
async function runUpdateCli(argv, deps) {
|
|
7742
7859
|
const out = deps.out ?? ((l) => console.log(l));
|
|
7743
7860
|
const err = deps.err ?? ((l) => console.error(l));
|
|
7744
|
-
const
|
|
7745
|
-
const
|
|
7861
|
+
const entry = deps.entry ?? process.argv[1];
|
|
7862
|
+
const pm = deps.globalPm ?? detectGlobalPm(entry);
|
|
7863
|
+
const exec = deps.exec ?? execCaptured;
|
|
7746
7864
|
const latestVersion = deps.latestVersion ?? (() => fetchLatestVersion());
|
|
7747
7865
|
const daemonAlive = deps.daemonAlive ?? (async () => await daemonStatus2() != null);
|
|
7748
7866
|
const force = argv.includes("--force");
|
|
7867
|
+
const launchIO = deps.launchIO;
|
|
7749
7868
|
if (pm === "sources") {
|
|
7750
7869
|
err("\u0442\u044B \u0437\u0430\u043F\u0443\u0449\u0435\u043D \u0418\u0417 \u0418\u0421\u0425\u041E\u0414\u041D\u0418\u041A\u041E\u0412 \u043C\u043E\u043D\u043E\u0440\u0435\u043F\u044B, \u0430 \u043D\u0435 \u0438\u0437 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u043E\u0433\u043E \u043F\u0430\u043A\u0435\u0442\u0430 \u2014 \u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0442\u044C npm-\u043E\u043C \u0442\u0443\u0442 \u043D\u0435\u0447\u0435\u0433\u043E.");
|
|
7751
7870
|
err(" \u0441\u0432\u0435\u0436\u0438\u0439 \u043A\u043E\u0434 \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u044F: git pull && pnpm install && pnpm --filter @taskless-app/swarm... build");
|
|
7752
7871
|
err(` \u043F\u043E\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u043F\u0430\u043A\u0435\u0442 \u0440\u044F\u0434\u043E\u043C: ${globalInstallCommand("npm", SWARM_PACKAGE)}`);
|
|
7753
7872
|
return 1;
|
|
7754
7873
|
}
|
|
7874
|
+
const early = gatePackageInstall(pm, `${SWARM_PACKAGE}@latest`, entry, launchIO);
|
|
7875
|
+
if (early.action === "refuse" && early.kind === "npx") {
|
|
7876
|
+
err(early.message);
|
|
7877
|
+
return 1;
|
|
7878
|
+
}
|
|
7755
7879
|
const latest = await latestVersion();
|
|
7756
7880
|
if (latest === null) {
|
|
7757
7881
|
err("\u0434\u043E registry.npmjs.org \u043D\u0435 \u0434\u043E\u0437\u0432\u043E\u043D\u0438\u043B\u0438\u0441\u044C \u2014 \u043A\u0430\u043A\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F \u043E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D\u0430, \u0443\u0437\u043D\u0430\u0442\u044C \u043D\u0435\u0447\u0435\u043C. \u041F\u0440\u043E\u0432\u0435\u0440\u044C \u0441\u0435\u0442\u044C \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438.");
|
|
@@ -7761,13 +7885,18 @@ async function runUpdateCli(argv, deps) {
|
|
|
7761
7885
|
out(`\u0443\u0436\u0435 \u0441\u0432\u0435\u0436\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F: v${deps.packageVersion} (\u043E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D\u0430 v${latest}) \u2014 \u043E\u0431\u043D\u043E\u0432\u043B\u044F\u0442\u044C \u043D\u0435\u0447\u0435\u0433\u043E.`);
|
|
7762
7886
|
return 0;
|
|
7763
7887
|
}
|
|
7764
|
-
const
|
|
7888
|
+
const decided = gatePackageInstall(pm, `${SWARM_PACKAGE}@${latest}`, entry, launchIO);
|
|
7889
|
+
if (decided.action === "refuse") {
|
|
7890
|
+
err(decided.message);
|
|
7891
|
+
return 1;
|
|
7892
|
+
}
|
|
7893
|
+
const command = decided.command;
|
|
7765
7894
|
out(`\u043E\u0431\u043D\u043E\u0432\u043B\u044F\u044E \u0440\u043E\u0439: v${deps.packageVersion} \u2192 v${latest}`);
|
|
7766
7895
|
out(` $ ${command}`);
|
|
7767
|
-
const
|
|
7768
|
-
if (
|
|
7769
|
-
err(`\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u043D\u0435 \u043F\u0440\u043E\u0448\u043B\u043E (
|
|
7770
|
-
return
|
|
7896
|
+
const ran = readCommandOutcome(await exec(command));
|
|
7897
|
+
if (ran.exitCode !== 0) {
|
|
7898
|
+
err(`\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u043D\u0435 \u043F\u0440\u043E\u0448\u043B\u043E (${installFailureLabel(ran.exitCode, ran.output)}). \u0421\u0442\u0440\u043E\u043A\u0430 \u0432\u044B\u0448\u0435 \u2014 \u0442\u0430 \u0441\u0430\u043C\u0430\u044F, \u0447\u0442\u043E \u043D\u0443\u0436\u043D\u0430; \u0432\u044B\u043F\u043E\u043B\u043D\u0438 \u0435\u0451 \u0440\u0443\u043A\u0430\u043C\u0438 \u0438 \u043F\u043E\u0441\u043C\u043E\u0442\u0440\u0438, \u043D\u0430 \u0447\u0451\u043C \u0441\u043F\u043E\u0442\u044B\u043A\u0430\u0435\u0442\u0441\u044F.`);
|
|
7899
|
+
return ran.exitCode;
|
|
7771
7900
|
}
|
|
7772
7901
|
out(`\u0433\u043E\u0442\u043E\u0432\u043E: v${latest}`);
|
|
7773
7902
|
if (await daemonAlive()) {
|
|
@@ -7790,7 +7919,7 @@ var init_updateCli = __esm({
|
|
|
7790
7919
|
// src/cli.ts
|
|
7791
7920
|
init_cliIo();
|
|
7792
7921
|
import { basename as basename6, dirname as dirname5, join as join27 } from "path";
|
|
7793
|
-
import { existsSync as existsSync18, readFileSync as
|
|
7922
|
+
import { existsSync as existsSync18, readFileSync as readFileSync20, writeFileSync as writeFileSync15, mkdirSync as mkdirSync11, readdirSync as readdirSync12, statSync as statSync12, openSync as openSync5, readSync as readSync2, closeSync as closeSync5 } from "fs";
|
|
7794
7923
|
import { setTimeout as sleep2 } from "timers/promises";
|
|
7795
7924
|
|
|
7796
7925
|
// src/swarmClient.ts
|
|
@@ -8844,7 +8973,7 @@ var SwarmClient = class _SwarmClient {
|
|
|
8844
8973
|
}
|
|
8845
8974
|
// ── events / хроника ─────────────────────────────────────────────────────────
|
|
8846
8975
|
addEvent(run_id, kind, text, actor = null) {
|
|
8847
|
-
const clean =
|
|
8976
|
+
const clean = sanitizeStoredEventText(text);
|
|
8848
8977
|
const ev = { id: this.nextEventId++, run_id, kind, text: clean, actor: actor ?? null, at: stamp() };
|
|
8849
8978
|
this.eventsLog.push(ev);
|
|
8850
8979
|
if (run_id == null) {
|
|
@@ -10672,7 +10801,7 @@ init_repoRegistry();
|
|
|
10672
10801
|
|
|
10673
10802
|
// src/hostIdentity.ts
|
|
10674
10803
|
import { hostname } from "os";
|
|
10675
|
-
import { existsSync as existsSync9, readFileSync as
|
|
10804
|
+
import { existsSync as existsSync9, readFileSync as readFileSync9, renameSync as renameSync4, writeFileSync as writeFileSync7 } from "fs";
|
|
10676
10805
|
import { join as join11 } from "path";
|
|
10677
10806
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
10678
10807
|
function hostIdentityPath(home) {
|
|
@@ -10680,7 +10809,7 @@ function hostIdentityPath(home) {
|
|
|
10680
10809
|
}
|
|
10681
10810
|
function loadHostIdentity(deps) {
|
|
10682
10811
|
const exists = deps.exists ?? existsSync9;
|
|
10683
|
-
const readFile2 = deps.readFile ?? ((p) =>
|
|
10812
|
+
const readFile2 = deps.readFile ?? ((p) => readFileSync9(p, "utf8"));
|
|
10684
10813
|
const writeFile3 = deps.writeFile ?? ((p, data) => {
|
|
10685
10814
|
writeFileSync7(`${p}.tmp`, data);
|
|
10686
10815
|
renameSync4(`${p}.tmp`, p);
|
|
@@ -11010,6 +11139,10 @@ function ghRepoRunner(timeoutMs = GH_CALL_TIMEOUT_MS) {
|
|
|
11010
11139
|
}
|
|
11011
11140
|
var realRunner = ghRunner();
|
|
11012
11141
|
var realRepoRunner = ghRepoRunner();
|
|
11142
|
+
var GH_PR_RE = /^(?:https?:\/\/)?(?:www\.)?github\.com\/[^/\s]+\/[^/\s]+\/pull\/\d+(?:[/?#].*)?$/i;
|
|
11143
|
+
function isGithubPrUrl(url) {
|
|
11144
|
+
return GH_PR_RE.test(url.trim());
|
|
11145
|
+
}
|
|
11013
11146
|
async function openPrsForBranch(branch, repoDir, run = realRepoRunner) {
|
|
11014
11147
|
if (!branch || !repoDir) return [];
|
|
11015
11148
|
try {
|
|
@@ -11020,6 +11153,140 @@ async function openPrsForBranch(branch, repoDir, run = realRepoRunner) {
|
|
|
11020
11153
|
return [];
|
|
11021
11154
|
}
|
|
11022
11155
|
}
|
|
11156
|
+
var FINDING_CATEGORIES = [
|
|
11157
|
+
"correctness",
|
|
11158
|
+
"security",
|
|
11159
|
+
"reuse",
|
|
11160
|
+
"boundaries",
|
|
11161
|
+
"over-abstraction",
|
|
11162
|
+
"duplication",
|
|
11163
|
+
"spine",
|
|
11164
|
+
"tests",
|
|
11165
|
+
"ui-rules"
|
|
11166
|
+
];
|
|
11167
|
+
var FINDING_SEVERITIES = ["blocker", "major", "nit"];
|
|
11168
|
+
var FINDINGS_BLOCK_RE = /```findings[^\n]*\n([\s\S]*?)```/gi;
|
|
11169
|
+
var READ_ONLY_PHRASE_RE = /прогнать не мог|окружения нет/i;
|
|
11170
|
+
var FINDING_WHAT_MAX = 400;
|
|
11171
|
+
var FINDING_PATH_MAX = 300;
|
|
11172
|
+
var FINDINGS_MAX = 50;
|
|
11173
|
+
function oneOf(dict, v) {
|
|
11174
|
+
return typeof v === "string" && dict.includes(v) ? v : null;
|
|
11175
|
+
}
|
|
11176
|
+
function normalizeFinding(raw) {
|
|
11177
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
11178
|
+
const r = raw;
|
|
11179
|
+
const what = typeof r.what === "string" ? r.what.trim().slice(0, FINDING_WHAT_MAX) : "";
|
|
11180
|
+
if (!what) return null;
|
|
11181
|
+
const rawLine = typeof r.line === "number" ? r.line : typeof r.line === "string" && r.line.trim() ? Number(r.line) : NaN;
|
|
11182
|
+
return {
|
|
11183
|
+
category: oneOf(FINDING_CATEGORIES, r.category),
|
|
11184
|
+
severity: oneOf(FINDING_SEVERITIES, r.severity),
|
|
11185
|
+
path: typeof r.path === "string" && r.path.trim() ? r.path.trim().slice(0, FINDING_PATH_MAX) : null,
|
|
11186
|
+
// Номер строки — только целый положительный: «7.5», «-1» и NaN значат, что ревьюер
|
|
11187
|
+
// строку не знал, а не что дефект на строке −1 (по такому числу потом ищут в файле).
|
|
11188
|
+
line: Number.isInteger(rawLine) && rawLine > 0 ? rawLine : null,
|
|
11189
|
+
what
|
|
11190
|
+
};
|
|
11191
|
+
}
|
|
11192
|
+
function parseFindingsBlock(body) {
|
|
11193
|
+
const byPhrase = READ_ONLY_PHRASE_RE.test(body) ? "read" : null;
|
|
11194
|
+
const blocks = [...body.matchAll(FINDINGS_BLOCK_RE)];
|
|
11195
|
+
const last = blocks[blocks.length - 1];
|
|
11196
|
+
if (!last) return { findings: null, mode: byPhrase };
|
|
11197
|
+
let payload;
|
|
11198
|
+
try {
|
|
11199
|
+
payload = JSON.parse(last[1]);
|
|
11200
|
+
} catch {
|
|
11201
|
+
console.warn("[gh] \u0431\u043B\u043E\u043A findings \u0432 \u0432\u0435\u0440\u0434\u0438\u043A\u0442-\u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0435 \u043D\u0435 \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u043D (\u0431\u0438\u0442\u044B\u0439 JSON) \u2014 \u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0437\u0430\u0441\u0447\u0438\u0442\u0430\u043D, \u043D\u0430\u0445\u043E\u0434\u043E\u043A \u043D\u0435\u0442");
|
|
11202
|
+
return { findings: null, mode: byPhrase };
|
|
11203
|
+
}
|
|
11204
|
+
const arr = Array.isArray(payload) ? payload : payload && typeof payload === "object" && Array.isArray(payload.findings) ? payload.findings : null;
|
|
11205
|
+
const mode = payload && typeof payload === "object" && !Array.isArray(payload) ? oneOf(["ran", "read"], payload.mode) ?? byPhrase : byPhrase;
|
|
11206
|
+
if (!arr) {
|
|
11207
|
+
console.warn("[gh] \u0431\u043B\u043E\u043A findings \u0432 \u0432\u0435\u0440\u0434\u0438\u043A\u0442-\u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0435 \u043D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u043C\u0430\u0441\u0441\u0438\u0432\u0430 \u043D\u0430\u0445\u043E\u0434\u043E\u043A \u2014 \u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0437\u0430\u0441\u0447\u0438\u0442\u0430\u043D, \u043D\u0430\u0445\u043E\u0434\u043E\u043A \u043D\u0435\u0442");
|
|
11208
|
+
return { findings: null, mode };
|
|
11209
|
+
}
|
|
11210
|
+
const capped = arr.slice(0, FINDINGS_MAX);
|
|
11211
|
+
if (arr.length > capped.length) {
|
|
11212
|
+
console.warn(`[gh] \u0432 \u0431\u043B\u043E\u043A\u0435 findings ${arr.length} \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u2014 \u0431\u0435\u0440\u0443 \u043F\u0435\u0440\u0432\u044B\u0435 ${FINDINGS_MAX}, \u043E\u0441\u0442\u0430\u043B\u044C\u043D\u043E\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u043E`);
|
|
11213
|
+
}
|
|
11214
|
+
const findings = capped.map((raw) => normalizeFinding(raw)).filter((f) => f != null);
|
|
11215
|
+
if (findings.length < capped.length) {
|
|
11216
|
+
console.warn("[gh] \u0432 \u0431\u043B\u043E\u043A\u0435 findings \u043F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u043E \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u0431\u0435\u0437 \u0441\u0443\u0442\u0438: " + (capped.length - findings.length));
|
|
11217
|
+
}
|
|
11218
|
+
return { findings, mode };
|
|
11219
|
+
}
|
|
11220
|
+
var realCommentsRunner = (prUrl) => runGh(["pr", "view", prUrl, "--json", "comments"], GH_CALL_TIMEOUT_MS);
|
|
11221
|
+
var CHANGES_FIRST_LINE_RE = new RegExp(
|
|
11222
|
+
[
|
|
11223
|
+
"^#\\d+:\\s*CHANGES\\b",
|
|
11224
|
+
"^#\\d+\\s+\u043A\u0440\u0443\u0433\\s+\\d+\\s*:\\s*CHANGES\\b",
|
|
11225
|
+
"^\u041D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0435 \u0440\u0435\u0432\u044C\u044E\\s*[\u2014\u2013-]\\s*CHANGES\\b",
|
|
11226
|
+
"^(?:\u274C\\s*)?(?:\\*\\*)?REQUEST(?:ED)?\\s+CHANGES(?:\\*\\*)?\\b",
|
|
11227
|
+
"^(?:\\*\\*)?CHANGES(?:\\s+REQUESTED)?(?:\\*\\*)?(?=\\s*(?:$|[:.!(\u2014\u2013-]))",
|
|
11228
|
+
'^[\xAB"]?\u043D\u0443\u0436\u043D\u044B \u043F\u0440\u0430\u0432\u043A\u0438[\xBB"]?(?=\\s*(?:$|[:.!(\u2014\u2013-]))'
|
|
11229
|
+
].join("|"),
|
|
11230
|
+
"iu"
|
|
11231
|
+
);
|
|
11232
|
+
var APPROVE_FIRST_LINE_RE = /^(?:✅\s*)?(?:\*\*)?(?:APPROVED?|LGTM)(?:\*\*)?\b/iu;
|
|
11233
|
+
function firstContentLine(body) {
|
|
11234
|
+
for (const line of body.split(/\r?\n/)) {
|
|
11235
|
+
const trimmed = line.trim();
|
|
11236
|
+
if (trimmed) return trimmed;
|
|
11237
|
+
}
|
|
11238
|
+
return "";
|
|
11239
|
+
}
|
|
11240
|
+
function classifyPrVerdict(body) {
|
|
11241
|
+
const line = firstContentLine(body);
|
|
11242
|
+
if (!line) return null;
|
|
11243
|
+
if (line.includes(DRONE_COMMENT_SIGNATURE)) return null;
|
|
11244
|
+
if (CHANGES_FIRST_LINE_RE.test(line)) return "changes";
|
|
11245
|
+
if (APPROVE_FIRST_LINE_RE.test(line)) return "approve";
|
|
11246
|
+
return null;
|
|
11247
|
+
}
|
|
11248
|
+
async function latestVerdictComment(prUrl, sinceIso, run = realCommentsRunner) {
|
|
11249
|
+
const found = await scanPrComments(prUrl, sinceIso, run, (body) => {
|
|
11250
|
+
const verdict = classifyPrVerdict(body);
|
|
11251
|
+
if (!verdict) return null;
|
|
11252
|
+
const { findings, mode } = parseFindingsBlock(body);
|
|
11253
|
+
return { verdict, findings, reviewMode: mode };
|
|
11254
|
+
});
|
|
11255
|
+
if (!found) return null;
|
|
11256
|
+
return {
|
|
11257
|
+
verdict: found.verdict.verdict,
|
|
11258
|
+
createdAt: found.createdAt,
|
|
11259
|
+
body: found.body,
|
|
11260
|
+
findings: found.verdict.findings,
|
|
11261
|
+
reviewMode: found.verdict.reviewMode
|
|
11262
|
+
};
|
|
11263
|
+
}
|
|
11264
|
+
async function scanPrComments(prUrl, sinceIso, run, pick3) {
|
|
11265
|
+
if (!isGithubPrUrl(prUrl)) return null;
|
|
11266
|
+
let out;
|
|
11267
|
+
try {
|
|
11268
|
+
out = await run(prUrl);
|
|
11269
|
+
} catch {
|
|
11270
|
+
return null;
|
|
11271
|
+
}
|
|
11272
|
+
let j;
|
|
11273
|
+
try {
|
|
11274
|
+
j = JSON.parse(out);
|
|
11275
|
+
} catch {
|
|
11276
|
+
return null;
|
|
11277
|
+
}
|
|
11278
|
+
const comments = Array.isArray(j.comments) ? j.comments : [];
|
|
11279
|
+
const sinceMs = sqliteMs(sinceIso);
|
|
11280
|
+
for (let i = comments.length - 1; i >= 0; i--) {
|
|
11281
|
+
const c = comments[i];
|
|
11282
|
+
if (!c?.body || !c.createdAt) continue;
|
|
11283
|
+
if (Number.isFinite(sinceMs) && Date.parse(c.createdAt) < sinceMs) continue;
|
|
11284
|
+
const verdict = pick3(c.body);
|
|
11285
|
+
if (verdict == null) continue;
|
|
11286
|
+
return { verdict, createdAt: c.createdAt, body: c.body };
|
|
11287
|
+
}
|
|
11288
|
+
return null;
|
|
11289
|
+
}
|
|
11023
11290
|
var NO_CHECKS_STDERR = /no checks reported/i;
|
|
11024
11291
|
var CiAccessDeniedError = class extends Error {
|
|
11025
11292
|
detail;
|
|
@@ -14564,7 +14831,7 @@ async function scoutRepo(repo) {
|
|
|
14564
14831
|
repoFullName,
|
|
14565
14832
|
repoPath: worktree,
|
|
14566
14833
|
name,
|
|
14567
|
-
readFile: (rel) => existsSync18(abs(rel)) ?
|
|
14834
|
+
readFile: (rel) => existsSync18(abs(rel)) ? readFileSync20(abs(rel), "utf8") : null,
|
|
14568
14835
|
writeFile: (rel, text) => {
|
|
14569
14836
|
mkdirSync11(dirname5(abs(rel)), { recursive: true });
|
|
14570
14837
|
writeFileSync15(abs(rel), text);
|
|
@@ -15081,7 +15348,15 @@ switch (cmd) {
|
|
|
15081
15348
|
// иначе побудка codex-прогона при мёртвом демоне теряла продолжаемую сессию.
|
|
15082
15349
|
hasTranscript: (run2) => !!run2.worktree_path && executorForRun(run2, null).session.exists(run2.worktree_path),
|
|
15083
15350
|
respawn: (r, mode, nudge) => respawnRun(
|
|
15084
|
-
{
|
|
15351
|
+
{
|
|
15352
|
+
db,
|
|
15353
|
+
launch,
|
|
15354
|
+
repoFallback: SWARM_REPO,
|
|
15355
|
+
worktreesDir: effectiveWorktreesDir(),
|
|
15356
|
+
getTask: () => Promise.resolve(null),
|
|
15357
|
+
// TASWM-618: тот же фолбэк комментария PR, что у живого демона.
|
|
15358
|
+
verdictComment: (prUrl, sinceIso) => latestVerdictComment(prUrl, sinceIso)
|
|
15359
|
+
},
|
|
15085
15360
|
r,
|
|
15086
15361
|
mode,
|
|
15087
15362
|
nudge
|