@taskless-app/swarm 0.6.111 → 0.6.113
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 +109 -11
- package/dist/overmind.js +356 -45
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -2926,7 +2926,7 @@ function extractJsonObject(raw) {
|
|
|
2926
2926
|
}
|
|
2927
2927
|
return null;
|
|
2928
2928
|
}
|
|
2929
|
-
var GROK_SWARM_TOOL_TIMEOUT_SEC, grokExecutor;
|
|
2929
|
+
var GROK_SWARM_TOOL_TIMEOUT_SEC, GROK_POLICY_TOML, grokExecutor;
|
|
2930
2930
|
var init_grok = __esm({
|
|
2931
2931
|
"src/executors/grok.ts"() {
|
|
2932
2932
|
"use strict";
|
|
@@ -2935,6 +2935,7 @@ var init_grok = __esm({
|
|
|
2935
2935
|
init_swarmFiles();
|
|
2936
2936
|
init_codex();
|
|
2937
2937
|
GROK_SWARM_TOOL_TIMEOUT_SEC = 7 * 24 * 60 * 60;
|
|
2938
|
+
GROK_POLICY_TOML = ["allow_managed_hooks_only = true", "enable_all_project_mcp_servers = false", ""].join("\n");
|
|
2938
2939
|
grokExecutor = {
|
|
2939
2940
|
id: "grok",
|
|
2940
2941
|
title: "Grok CLI (grok)",
|
|
@@ -2949,6 +2950,7 @@ var init_grok = __esm({
|
|
|
2949
2950
|
plan: (spec) => {
|
|
2950
2951
|
const home = ensureGrokHome(spec.worktree, spec.realHome);
|
|
2951
2952
|
writeFileSync3(join6(home, "config.toml"), grokMcpToml(spec));
|
|
2953
|
+
writeFileSync3(join6(home, "managed_config.toml"), GROK_POLICY_TOML);
|
|
2952
2954
|
writeFileSync3(
|
|
2953
2955
|
join6(spec.worktree, SWARM_MCP_CONFIG_FILE),
|
|
2954
2956
|
JSON.stringify(
|
|
@@ -2970,6 +2972,8 @@ ${notice}` : spec.prompt;
|
|
|
2970
2972
|
"--output-format",
|
|
2971
2973
|
"json",
|
|
2972
2974
|
"--yolo",
|
|
2975
|
+
// Скрытый флаг: в `grok --help` его нет, но 1.0.92 его принимает.
|
|
2976
|
+
"--trust",
|
|
2973
2977
|
...spec.continueSession ? ["--continue"] : [],
|
|
2974
2978
|
...modelArgs(spec.model),
|
|
2975
2979
|
...spec.effort ? ["--effort", spec.effort] : [],
|
|
@@ -4524,7 +4528,7 @@ var init_package = __esm({
|
|
|
4524
4528
|
"package.json"() {
|
|
4525
4529
|
package_default = {
|
|
4526
4530
|
name: "@taskless-app/swarm",
|
|
4527
|
-
version: "0.6.
|
|
4531
|
+
version: "0.6.113",
|
|
4528
4532
|
type: "module",
|
|
4529
4533
|
description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
|
|
4530
4534
|
keywords: [
|
|
@@ -4576,7 +4580,7 @@ var init_package = __esm({
|
|
|
4576
4580
|
undici: "^7.30.1",
|
|
4577
4581
|
zod: "3.25.76"
|
|
4578
4582
|
},
|
|
4579
|
-
gitHead: "
|
|
4583
|
+
gitHead: "932d5ab9568a3a0bf5a68c338a052297afd0bd64"
|
|
4580
4584
|
};
|
|
4581
4585
|
}
|
|
4582
4586
|
});
|
|
@@ -5098,6 +5102,13 @@ var init_deps2 = __esm({
|
|
|
5098
5102
|
}
|
|
5099
5103
|
});
|
|
5100
5104
|
|
|
5105
|
+
// src/intakeHold.ts
|
|
5106
|
+
var init_intakeHold = __esm({
|
|
5107
|
+
"src/intakeHold.ts"() {
|
|
5108
|
+
"use strict";
|
|
5109
|
+
}
|
|
5110
|
+
});
|
|
5111
|
+
|
|
5101
5112
|
// src/orchestrator.ts
|
|
5102
5113
|
import { existsSync as existsSync14, mkdirSync as mkdirSync9, rmSync as rmSync2 } from "fs";
|
|
5103
5114
|
import { join as join18, dirname as dirname3 } from "path";
|
|
@@ -5108,6 +5119,7 @@ var init_orchestrator = __esm({
|
|
|
5108
5119
|
init_git();
|
|
5109
5120
|
init_deps2();
|
|
5110
5121
|
init_config();
|
|
5122
|
+
init_intakeHold();
|
|
5111
5123
|
}
|
|
5112
5124
|
});
|
|
5113
5125
|
|
|
@@ -9031,6 +9043,13 @@ var SwarmClient = class _SwarmClient {
|
|
|
9031
9043
|
pending = [];
|
|
9032
9044
|
/** TASWM-694: id, чья последняя refreshRun не дошла до прода. */
|
|
9033
9045
|
missedProd = /* @__PURE__ */ new Set();
|
|
9046
|
+
/**
|
|
9047
|
+
* TASWM-698: окна «пока прод отвечал». Одно на каждый запрос снимка в полёте (hydrate,
|
|
9048
|
+
* refreshRun): локальный id → поля прогона, записанные за это время. Снимок прода снят в
|
|
9049
|
+
* момент запроса и об этих записях не знает. Применённый как есть, он вернул running
|
|
9050
|
+
* фоновой подготовки обратно в queued, и следующий тик поднял по прогону второго дрона.
|
|
9051
|
+
*/
|
|
9052
|
+
writeWindows = /* @__PURE__ */ new Set();
|
|
9034
9053
|
nextSeq = 1;
|
|
9035
9054
|
flushing = false;
|
|
9036
9055
|
flushTimer = null;
|
|
@@ -9238,6 +9257,7 @@ var SwarmClient = class _SwarmClient {
|
|
|
9238
9257
|
}
|
|
9239
9258
|
enqueueRun(run, fields, opts = {}) {
|
|
9240
9259
|
if (Object.keys(fields).length === 0) return;
|
|
9260
|
+
for (const written of this.writeWindows) written.set(run.id, { ...written.get(run.id), ...fields });
|
|
9241
9261
|
this.enqueue({
|
|
9242
9262
|
t: "run",
|
|
9243
9263
|
runKey: run.runKey,
|
|
@@ -9771,12 +9791,15 @@ var SwarmClient = class _SwarmClient {
|
|
|
9771
9791
|
const prodId = this.prodIdByKey.get(d.runKey);
|
|
9772
9792
|
if (!prodId) return this.mat(d);
|
|
9773
9793
|
const pendingFields = unflushedRunFields(this.pending, d.runKey);
|
|
9794
|
+
const written = this.openWriteWindow();
|
|
9774
9795
|
let res;
|
|
9775
9796
|
try {
|
|
9776
9797
|
res = await this.call("swarm_list_runs", { taskId: d.task_slug, view: "full" });
|
|
9777
9798
|
} catch {
|
|
9778
9799
|
this.missedProd.add(id);
|
|
9779
9800
|
return this.mat(d);
|
|
9801
|
+
} finally {
|
|
9802
|
+
this.writeWindows.delete(written);
|
|
9780
9803
|
}
|
|
9781
9804
|
if (res?.isError) {
|
|
9782
9805
|
this.missedProd.add(id);
|
|
@@ -9788,12 +9811,36 @@ var SwarmClient = class _SwarmClient {
|
|
|
9788
9811
|
this.missedProd.delete(id);
|
|
9789
9812
|
return this.mat(d);
|
|
9790
9813
|
}
|
|
9791
|
-
const
|
|
9814
|
+
const keep = pendingFields || written.has(id) ? { ...pendingFields, ...written.get(id) } : null;
|
|
9815
|
+
const saved = keep ? snapshotUnflushedRun(d, keep) : null;
|
|
9792
9816
|
const local = this.hydrateRun(row);
|
|
9793
9817
|
if (local && saved) restoreUnflushedRun(local, saved);
|
|
9794
9818
|
if (local) this.missedProd.delete(id);
|
|
9795
9819
|
return local ? this.mat(local) : null;
|
|
9796
9820
|
}
|
|
9821
|
+
/** TASWM-698: начать копить локальные записи прогонов на время запроса снимка из прода. */
|
|
9822
|
+
openWriteWindow() {
|
|
9823
|
+
const written = /* @__PURE__ */ new Map();
|
|
9824
|
+
this.writeWindows.add(written);
|
|
9825
|
+
return written;
|
|
9826
|
+
}
|
|
9827
|
+
/**
|
|
9828
|
+
* Строка снимка → зеркало, но поля, которые прогон записал локально, пока снимок ехал,
|
|
9829
|
+
* остаются локальными (TASWM-698). Остальное снимок обновляет как обычно, и следующий
|
|
9830
|
+
* проход, уже после флаша, принесёт прод-значение и для этих полей.
|
|
9831
|
+
*/
|
|
9832
|
+
hydrateRunKeeping(pr, written) {
|
|
9833
|
+
const prodId = String(pr.id ?? "");
|
|
9834
|
+
let fresh;
|
|
9835
|
+
let fields;
|
|
9836
|
+
for (const [id, f] of written) {
|
|
9837
|
+
const d = this.runs.get(id);
|
|
9838
|
+
if (d && prodId && this.prodIdByKey.get(d.runKey) === prodId) [fresh, fields] = [d, f];
|
|
9839
|
+
}
|
|
9840
|
+
const saved = fresh && fields ? snapshotUnflushedRun(fresh, fields) : null;
|
|
9841
|
+
const local = this.hydrateRun(pr);
|
|
9842
|
+
if (local && saved) restoreUnflushedRun(local, saved);
|
|
9843
|
+
}
|
|
9797
9844
|
/** TASWM-694: true, пока последняя сверка этого id не дошла до прода. */
|
|
9798
9845
|
refreshMissedProd(id) {
|
|
9799
9846
|
return this.missedProd.has(id);
|
|
@@ -10095,6 +10142,14 @@ var SwarmClient = class _SwarmClient {
|
|
|
10095
10142
|
return this.runsListComplete;
|
|
10096
10143
|
}
|
|
10097
10144
|
async hydrate() {
|
|
10145
|
+
const written = this.openWriteWindow();
|
|
10146
|
+
try {
|
|
10147
|
+
await this.hydrateFrom(written);
|
|
10148
|
+
} finally {
|
|
10149
|
+
this.writeWindows.delete(written);
|
|
10150
|
+
}
|
|
10151
|
+
}
|
|
10152
|
+
async hydrateFrom(written) {
|
|
10098
10153
|
let res;
|
|
10099
10154
|
try {
|
|
10100
10155
|
res = await this.call("swarm_list_runs", { limit: this.listLimit, view: "full" });
|
|
@@ -10116,7 +10171,7 @@ var SwarmClient = class _SwarmClient {
|
|
|
10116
10171
|
seen.add(id);
|
|
10117
10172
|
runs.push(pr);
|
|
10118
10173
|
}
|
|
10119
|
-
for (const pr of runs) this.
|
|
10174
|
+
for (const pr of runs) this.hydrateRunKeeping(pr, written);
|
|
10120
10175
|
for (const pr of runs) this.linkRefs(pr);
|
|
10121
10176
|
}
|
|
10122
10177
|
/**
|
|
@@ -12065,6 +12120,14 @@ async function collectRunDiff(worktree, opts = {}) {
|
|
|
12065
12120
|
};
|
|
12066
12121
|
}
|
|
12067
12122
|
|
|
12123
|
+
// src/restart.ts
|
|
12124
|
+
init_src();
|
|
12125
|
+
var STOP_WAIT_RESUME_WHY = "\u0440\u043E\u0439 \u0436\u0434\u0451\u0442 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 (swarm stop --wait), \u0430 \u043D\u0435 \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0430 \u2014 resume \u0435\u0451 \u043D\u0435 \u043E\u0442\u043C\u0435\u043D\u044F\u0435\u0442";
|
|
12126
|
+
function localResumeRefusedWhy(intent) {
|
|
12127
|
+
if (intent === "stop") return STOP_WAIT_RESUME_WHY;
|
|
12128
|
+
return "\u0440\u043E\u0439 \u0436\u0434\u0451\u0442 \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0430 \u2014 \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 resume \u0443\u0434\u0435\u0440\u0436\u0430\u043D\u0438\u0435 \u043D\u0435 \u0441\u043D\u0438\u043C\u0430\u0435\u0442: \u043D\u043E\u0432\u0430\u044F \u0441\u0435\u0441\u0441\u0438\u044F \u043D\u0435 \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442, \u043F\u043E\u043A\u0430 \u0436\u0438\u0432\u044B\u0435 \u0441\u043B\u043E\u0442\u044B \u043D\u0435 \u043E\u0441\u0432\u043E\u0431\u043E\u0434\u044F\u0442\u0441\u044F";
|
|
12129
|
+
}
|
|
12130
|
+
|
|
12068
12131
|
// src/web.ts
|
|
12069
12132
|
init_version();
|
|
12070
12133
|
init_storm();
|
|
@@ -12568,10 +12631,13 @@ function hasMergeIntent(r) {
|
|
|
12568
12631
|
return !!(r.merge_requested_at ?? "").trim();
|
|
12569
12632
|
}
|
|
12570
12633
|
var NO_CI_GRACE_MS = 10 * 6e4;
|
|
12634
|
+
var CANCELLED_CI_WAIT_MS = 10 * 6e4;
|
|
12635
|
+
var CANCELLED_CI_STUCK_REASON = "CI \u043E\u0442\u043C\u0435\u043D\u0451\u043D \u0432 \u043E\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u043B\u0441\u044F \u0437\u0430 10 \u043C\u0438\u043D\u0443\u0442 \u2014 \u043C\u0435\u0440\u0436 \u0441\u043D\u044F\u0442, \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438 CI \u0438 \u043F\u043E\u043F\u0440\u043E\u0441\u0438 \u043C\u0435\u0440\u0436 \u0437\u0430\u043D\u043E\u0432\u043E";
|
|
12571
12636
|
var shortSha = (sha) => sha.slice(0, 7);
|
|
12572
12637
|
function makeMergeIntentResolver(deps) {
|
|
12573
12638
|
const read = deps.headState ?? makeHeadStateReader(deps);
|
|
12574
12639
|
const firstSeen = /* @__PURE__ */ new Map();
|
|
12640
|
+
const cancelledSeen = /* @__PURE__ */ new Map();
|
|
12575
12641
|
const ciSettled = async (prUrl, st, now) => {
|
|
12576
12642
|
const sha = st.headSha;
|
|
12577
12643
|
if (!sha) {
|
|
@@ -12596,11 +12662,37 @@ function makeMergeIntentResolver(deps) {
|
|
|
12596
12662
|
}
|
|
12597
12663
|
const cancelled = runs.cancelled ?? [];
|
|
12598
12664
|
if (cancelled.length > 0) {
|
|
12599
|
-
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
}
|
|
12665
|
+
let seen = cancelledSeen.get(prUrl);
|
|
12666
|
+
if (!seen || seen.sha !== sha) {
|
|
12667
|
+
seen = { sha, at: now, reran: false };
|
|
12668
|
+
cancelledSeen.set(prUrl, seen);
|
|
12669
|
+
}
|
|
12670
|
+
const waited = now - seen.at;
|
|
12671
|
+
if (waited < CANCELLED_CI_WAIT_MS) {
|
|
12672
|
+
return {
|
|
12673
|
+
action: "wait",
|
|
12674
|
+
code: "checks_pending",
|
|
12675
|
+
reason: `\u043D\u0430 ${shortSha(sha)} \u043F\u0440\u043E\u0433\u043E\u043D GitHub Actions \u043E\u0442\u043C\u0435\u043D\u0451\u043D: ${cancelled.join(", ")} \u2014 \u044D\u0442\u043E \u043D\u0435 \u0437\u0435\u043B\u0451\u043D\u044B\u0439 CI, \u0436\u0434\u0443 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u043A\u0430`
|
|
12676
|
+
};
|
|
12677
|
+
}
|
|
12678
|
+
const ids = (runs.cancelledRunIds ?? []).filter((id) => /^\d+$/.test(id));
|
|
12679
|
+
if (!seen.reran && ids.length > 0 && deps.rerunCancelled) {
|
|
12680
|
+
let restarted = false;
|
|
12681
|
+
for (const id of ids) {
|
|
12682
|
+
const ok2 = await deps.rerunCancelled(prUrl, id).catch(() => false);
|
|
12683
|
+
if (ok2) restarted = true;
|
|
12684
|
+
}
|
|
12685
|
+
seen.reran = true;
|
|
12686
|
+
if (restarted) {
|
|
12687
|
+
seen.at = now;
|
|
12688
|
+
return {
|
|
12689
|
+
action: "wait",
|
|
12690
|
+
code: "checks_pending",
|
|
12691
|
+
reason: `\u043D\u0430 ${shortSha(sha)} \u043F\u0440\u043E\u0433\u043E\u043D GitHub Actions \u043E\u0442\u043C\u0435\u043D\u0451\u043D: ${cancelled.join(", ")} \u2014 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u043B, \u0436\u0434\u0443 \u043D\u043E\u0432\u044B\u0439 \u043F\u0440\u043E\u0433\u043E\u043D`
|
|
12692
|
+
};
|
|
12693
|
+
}
|
|
12694
|
+
}
|
|
12695
|
+
return { action: "clear", code: "checks_pending", reason: CANCELLED_CI_STUCK_REASON };
|
|
12604
12696
|
}
|
|
12605
12697
|
if (st.checks === "none") {
|
|
12606
12698
|
if (runs.total > 0) {
|
|
@@ -12741,6 +12833,8 @@ function makeMergeGateParts(deps) {
|
|
|
12741
12833
|
...deps.baseSync ? { baseSync: deps.baseSync } : {},
|
|
12742
12834
|
...deps.checks ? { checks: deps.checks } : {},
|
|
12743
12835
|
...deps.actionsRuns ? { actionsRuns: deps.actionsRuns } : {},
|
|
12836
|
+
...deps.rerunCancelled ? { rerunCancelled: deps.rerunCancelled } : {},
|
|
12837
|
+
...deps.now ? { now: deps.now } : {},
|
|
12744
12838
|
...deps.ttlMs != null ? { ttlMs: deps.ttlMs } : {}
|
|
12745
12839
|
});
|
|
12746
12840
|
return { gate, queue: queueFor, intent: intentFor };
|
|
@@ -14356,7 +14450,11 @@ function makeHandler(deps) {
|
|
|
14356
14450
|
if (p === "/resume" && req.method === "POST") {
|
|
14357
14451
|
if (!authed(req)) return unauthorized();
|
|
14358
14452
|
if (!deps.control) return new Response("\u043F\u0430\u0443\u0437\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430: \u043C\u043E\u0440\u0434\u0430 \u0431\u0435\u0437 \u0436\u0438\u0432\u043E\u0433\u043E \u0434\u0435\u043C\u043E\u043D\u0430", { status: 503 });
|
|
14359
|
-
|
|
14453
|
+
const f = await formValue(req);
|
|
14454
|
+
if (deps.restart?.phase === "waiting") {
|
|
14455
|
+
return Response.json({ ok: false, paused: true, why: localResumeRefusedWhy(deps.restart.intent) }, { status: 409 });
|
|
14456
|
+
}
|
|
14457
|
+
setPausedVia(deps, false, pauseSourceOf(f.get("source")), null);
|
|
14360
14458
|
return Response.json({ ok: true, paused: false, why: "\u0440\u043E\u0439 \u0441\u043D\u044F\u0442 \u0441 \u043F\u0430\u0443\u0437\u044B \u2014 \u0441\u043D\u043E\u0432\u0430 \u0431\u0435\u0440\u0451\u043C \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437 \u043E\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0438\u043D\u0442\u0435\u0439\u043A\u0430" });
|
|
14361
14459
|
}
|
|
14362
14460
|
if (p === "/status") return Response.json(daemonStatus(deps));
|
package/dist/overmind.js
CHANGED
|
@@ -2250,6 +2250,21 @@ var init_src = __esm({
|
|
|
2250
2250
|
}
|
|
2251
2251
|
});
|
|
2252
2252
|
|
|
2253
|
+
// src/intakeHold.ts
|
|
2254
|
+
function bindIntakeHold(fn) {
|
|
2255
|
+
reasonOf = fn;
|
|
2256
|
+
}
|
|
2257
|
+
function intakeHoldReason2() {
|
|
2258
|
+
return reasonOf?.() ?? null;
|
|
2259
|
+
}
|
|
2260
|
+
var reasonOf;
|
|
2261
|
+
var init_intakeHold = __esm({
|
|
2262
|
+
"src/intakeHold.ts"() {
|
|
2263
|
+
"use strict";
|
|
2264
|
+
reasonOf = null;
|
|
2265
|
+
}
|
|
2266
|
+
});
|
|
2267
|
+
|
|
2253
2268
|
// src/authorRun.ts
|
|
2254
2269
|
function isSlugAuthorRun(run2) {
|
|
2255
2270
|
if (run2.reviews_run_id != null || run2.resolves_run_id != null || run2.verifies_run_id != null) return false;
|
|
@@ -3186,7 +3201,7 @@ function extractJsonObject(raw) {
|
|
|
3186
3201
|
}
|
|
3187
3202
|
return null;
|
|
3188
3203
|
}
|
|
3189
|
-
var GROK_SWARM_TOOL_TIMEOUT_SEC, grokExecutor;
|
|
3204
|
+
var GROK_SWARM_TOOL_TIMEOUT_SEC, GROK_POLICY_TOML, grokExecutor;
|
|
3190
3205
|
var init_grok = __esm({
|
|
3191
3206
|
"src/executors/grok.ts"() {
|
|
3192
3207
|
"use strict";
|
|
@@ -3195,6 +3210,7 @@ var init_grok = __esm({
|
|
|
3195
3210
|
init_swarmFiles();
|
|
3196
3211
|
init_codex();
|
|
3197
3212
|
GROK_SWARM_TOOL_TIMEOUT_SEC = 7 * 24 * 60 * 60;
|
|
3213
|
+
GROK_POLICY_TOML = ["allow_managed_hooks_only = true", "enable_all_project_mcp_servers = false", ""].join("\n");
|
|
3198
3214
|
grokExecutor = {
|
|
3199
3215
|
id: "grok",
|
|
3200
3216
|
title: "Grok CLI (grok)",
|
|
@@ -3209,6 +3225,7 @@ var init_grok = __esm({
|
|
|
3209
3225
|
plan: (spec) => {
|
|
3210
3226
|
const home = ensureGrokHome(spec.worktree, spec.realHome);
|
|
3211
3227
|
writeFileSync3(join6(home, "config.toml"), grokMcpToml(spec));
|
|
3228
|
+
writeFileSync3(join6(home, "managed_config.toml"), GROK_POLICY_TOML);
|
|
3212
3229
|
writeFileSync3(
|
|
3213
3230
|
join6(spec.worktree, SWARM_MCP_CONFIG_FILE),
|
|
3214
3231
|
JSON.stringify(
|
|
@@ -3230,6 +3247,8 @@ ${notice}` : spec.prompt;
|
|
|
3230
3247
|
"--output-format",
|
|
3231
3248
|
"json",
|
|
3232
3249
|
"--yolo",
|
|
3250
|
+
// Скрытый флаг: в `grok --help` его нет, но 1.0.92 его принимает.
|
|
3251
|
+
"--trust",
|
|
3233
3252
|
...spec.continueSession ? ["--continue"] : [],
|
|
3234
3253
|
...modelArgs(spec.model),
|
|
3235
3254
|
...spec.effort ? ["--effort", spec.effort] : [],
|
|
@@ -6239,8 +6258,17 @@ function recordSpawnLaunch(db, runId, workdir, pid) {
|
|
|
6239
6258
|
function repolessRunDir(worktreesDir, taskSlug) {
|
|
6240
6259
|
return join13(dirname2(worktreesDir), "runs", taskSlug);
|
|
6241
6260
|
}
|
|
6242
|
-
function worktreePathHeldLive(db, path, exceptRunId) {
|
|
6243
|
-
|
|
6261
|
+
function worktreePathHeldLive(db, path, exceptRunId, isAlive) {
|
|
6262
|
+
const runs = db.listRuns();
|
|
6263
|
+
if (runs.some((r) => r.id !== exceptRunId && r.worktree_path === path && WORKTREE_HELD_STATUSES.has(r.status))) return true;
|
|
6264
|
+
if (exceptRunId == null || !isAlive) return false;
|
|
6265
|
+
const own = runs.find((r) => r.id === exceptRunId);
|
|
6266
|
+
const pids = [own?.worktree_path === path ? own.pid : null, lastLaunchPidIn(db, exceptRunId, path)];
|
|
6267
|
+
return pids.some((pid) => pid != null && isAlive(pid));
|
|
6268
|
+
}
|
|
6269
|
+
function lastLaunchPidIn(db, runId, path) {
|
|
6270
|
+
const last = db.events(runId).findLast((e) => (e.kind === "spawned" || e.kind === "resumed") && droneLaunchedPid(e.text) != null);
|
|
6271
|
+
return last?.text?.startsWith(`\u0434\u0440\u043E\u043D \u0437\u0430\u043F\u0443\u0449\u0435\u043D \u0432 ${path} (pid `) ? droneLaunchedPid(last.text) : null;
|
|
6244
6272
|
}
|
|
6245
6273
|
function assertStillWanted(db, runId) {
|
|
6246
6274
|
const fresh = db.getRun(runId);
|
|
@@ -6253,6 +6281,8 @@ function healTaskSlug(db, run2, task) {
|
|
|
6253
6281
|
return db.updateRun(run2.id, { task_slug: slug }) ?? run2;
|
|
6254
6282
|
}
|
|
6255
6283
|
async function spawnDrone(deps, run2) {
|
|
6284
|
+
const held = intakeHoldReason2();
|
|
6285
|
+
if (held) throw new SessionHoldError(held);
|
|
6256
6286
|
if (run2.repoless) {
|
|
6257
6287
|
const workdir = repolessRunDir(deps.worktreesDir, run2.task_slug);
|
|
6258
6288
|
if (existsSync9(workdir)) {
|
|
@@ -6285,7 +6315,7 @@ async function spawnDrone(deps, run2) {
|
|
|
6285
6315
|
if (base3 && await remoteBranchExists(repo, base3) === false) throw new BaseBranchMissingError(base3, repo);
|
|
6286
6316
|
const source = await addWorktree(repo, worktree, branch, {
|
|
6287
6317
|
...base3 ? { base: await remoteBaseRef(repo, base3) } : {},
|
|
6288
|
-
isWorktreeHeldLive: (p) => worktreePathHeldLive(deps.db, p, run2.id),
|
|
6318
|
+
isWorktreeHeldLive: (p) => worktreePathHeldLive(deps.db, p, run2.id, deps.isAlive),
|
|
6289
6319
|
onStaleReclaim: (p) => deps.db.addEvent(run2.id, "step", `\u0440\u0435\u043A\u043B\u0435\u0439\u043C \u043E\u0441\u0438\u0440\u043E\u0442\u0435\u0432\u0448\u0435\u0433\u043E worktree ${p} (\u0434\u0435\u0440\u0436\u0430\u043B \u043C\u0451\u0440\u0442\u0432\u044B\u0439 \u043F\u0440\u043E\u0433\u043E\u043D) \u2014 TASWM-227`)
|
|
6290
6320
|
});
|
|
6291
6321
|
await setWorktreeIdentity(worktree, run2.name);
|
|
@@ -6318,7 +6348,7 @@ ${notice}` : built;
|
|
|
6318
6348
|
...base3 ? { base_branch: base3 } : {}
|
|
6319
6349
|
});
|
|
6320
6350
|
}
|
|
6321
|
-
var DRONE_LAUNCHED_LINE, WORKTREE_HELD_STATUSES, BaseBranchMissingError, SpawnDeferredError, AreaBusyError, FileOverlapError, SpawnAbandonedError;
|
|
6351
|
+
var DRONE_LAUNCHED_LINE, WORKTREE_HELD_STATUSES, BaseBranchMissingError, SpawnDeferredError, SessionHoldError, AreaBusyError, FileOverlapError, SpawnAbandonedError;
|
|
6322
6352
|
var init_orchestrator = __esm({
|
|
6323
6353
|
"src/orchestrator.ts"() {
|
|
6324
6354
|
"use strict";
|
|
@@ -6326,6 +6356,7 @@ var init_orchestrator = __esm({
|
|
|
6326
6356
|
init_git();
|
|
6327
6357
|
init_deps2();
|
|
6328
6358
|
init_config();
|
|
6359
|
+
init_intakeHold();
|
|
6329
6360
|
DRONE_LAUNCHED_LINE = /^дрон запущен в .* \(pid (\d+)\)(?: — .*)?$/;
|
|
6330
6361
|
WORKTREE_HELD_STATUSES = /* @__PURE__ */ new Set(["running", "blocked", "review", "paused", "storm_dead"]);
|
|
6331
6362
|
BaseBranchMissingError = class extends Error {
|
|
@@ -6342,6 +6373,12 @@ var init_orchestrator = __esm({
|
|
|
6342
6373
|
};
|
|
6343
6374
|
SpawnDeferredError = class extends Error {
|
|
6344
6375
|
};
|
|
6376
|
+
SessionHoldError = class extends SpawnDeferredError {
|
|
6377
|
+
constructor(reason) {
|
|
6378
|
+
super(reason);
|
|
6379
|
+
this.name = "SessionHoldError";
|
|
6380
|
+
}
|
|
6381
|
+
};
|
|
6345
6382
|
AreaBusyError = class extends SpawnDeferredError {
|
|
6346
6383
|
constructor(area) {
|
|
6347
6384
|
super(`\u0437\u043E\u043D\u0430 ${area} \u0437\u0430\u043D\u044F\u0442\u0430 \u0434\u0440\u0443\u0433\u0438\u043C \u0434\u0440\u043E\u043D\u043E\u043C \u2014 \u0437\u0430\u0434\u0430\u0447\u0430 \u043E\u0441\u0442\u0430\u0451\u0442\u0441\u044F \u0432 \u043E\u0447\u0435\u0440\u0435\u0434\u0438`);
|
|
@@ -8194,6 +8231,9 @@ function makeTasklessClient(call, workspaceId, taskUrlBase, fetchFile, fetchImpl
|
|
|
8194
8231
|
// тогда null, и возврат просто обойдётся без переназначения (комментарий важнее).
|
|
8195
8232
|
author: taskAuthor(task.creator) ?? taskAuthor(task.requester)
|
|
8196
8233
|
};
|
|
8234
|
+
if (Array.isArray(task.projectRepos)) {
|
|
8235
|
+
body.projectRepos = task.projectRepos.filter((name) => typeof name === "string" && name.trim() !== "");
|
|
8236
|
+
}
|
|
8197
8237
|
idCache.set(slug, body.id);
|
|
8198
8238
|
idCache.set(body.id, body.id);
|
|
8199
8239
|
return body;
|
|
@@ -9932,10 +9972,13 @@ function pulsePause(phase, version, slots, control, at) {
|
|
|
9932
9972
|
if (phase !== "waiting") return control;
|
|
9933
9973
|
return { paused: true, at, source: "remote", reason: restartWaitReason(version, slots) };
|
|
9934
9974
|
}
|
|
9975
|
+
var STOP_WAIT_RESUME_WHY = "\u0440\u043E\u0439 \u0436\u0434\u0451\u0442 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 (swarm stop --wait), \u0430 \u043D\u0435 \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0430 \u2014 resume \u0435\u0451 \u043D\u0435 \u043E\u0442\u043C\u0435\u043D\u044F\u0435\u0442";
|
|
9976
|
+
function localResumeRefusedWhy(intent) {
|
|
9977
|
+
if (intent === "stop") return STOP_WAIT_RESUME_WHY;
|
|
9978
|
+
return "\u0440\u043E\u0439 \u0436\u0434\u0451\u0442 \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0430 \u2014 \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 resume \u0443\u0434\u0435\u0440\u0436\u0430\u043D\u0438\u0435 \u043D\u0435 \u0441\u043D\u0438\u043C\u0430\u0435\u0442: \u043D\u043E\u0432\u0430\u044F \u0441\u0435\u0441\u0441\u0438\u044F \u043D\u0435 \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442, \u043F\u043E\u043A\u0430 \u0436\u0438\u0432\u044B\u0435 \u0441\u043B\u043E\u0442\u044B \u043D\u0435 \u043E\u0441\u0432\u043E\u0431\u043E\u0434\u044F\u0442\u0441\u044F";
|
|
9979
|
+
}
|
|
9935
9980
|
function applyHostResume(phase, intent, cancelWait, clearPause) {
|
|
9936
|
-
if (phase === "waiting" && intent === "stop")
|
|
9937
|
-
return "\u0440\u043E\u0439 \u0436\u0434\u0451\u0442 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 (swarm stop --wait), \u0430 \u043D\u0435 \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0430 \u2014 resume \u0435\u0451 \u043D\u0435 \u043E\u0442\u043C\u0435\u043D\u044F\u0435\u0442";
|
|
9938
|
-
}
|
|
9981
|
+
if (phase === "waiting" && intent === "stop") return STOP_WAIT_RESUME_WHY;
|
|
9939
9982
|
if (phase === "waiting") cancelWait();
|
|
9940
9983
|
clearPause();
|
|
9941
9984
|
return true;
|
|
@@ -9946,16 +9989,17 @@ function applyRemotePause(ctl) {
|
|
|
9946
9989
|
function applyRemoteResume(phase, intent, cancelWait, ctl) {
|
|
9947
9990
|
return applyHostResume(phase, intent, cancelWait, () => ctl.setPaused(false, { source: "remote", reason: null }));
|
|
9948
9991
|
}
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
}
|
|
9955
|
-
function intakeHoldReason2() {
|
|
9956
|
-
return reasonOf?.() ?? null;
|
|
9992
|
+
function remotePauseEffects(opts) {
|
|
9993
|
+
const ctl = { setPaused: opts.setPaused };
|
|
9994
|
+
return {
|
|
9995
|
+
pause: () => applyRemotePause(ctl),
|
|
9996
|
+
resume: () => applyRemoteResume(opts.restart.phase, opts.restart.intent, opts.cancelWait, ctl)
|
|
9997
|
+
};
|
|
9957
9998
|
}
|
|
9958
9999
|
|
|
10000
|
+
// src/overmind.ts
|
|
10001
|
+
init_intakeHold();
|
|
10002
|
+
|
|
9959
10003
|
// src/authorWake.ts
|
|
9960
10004
|
init_src();
|
|
9961
10005
|
init_authorRun();
|
|
@@ -10939,6 +10983,13 @@ var SwarmClient = class _SwarmClient {
|
|
|
10939
10983
|
pending = [];
|
|
10940
10984
|
/** TASWM-694: id, чья последняя refreshRun не дошла до прода. */
|
|
10941
10985
|
missedProd = /* @__PURE__ */ new Set();
|
|
10986
|
+
/**
|
|
10987
|
+
* TASWM-698: окна «пока прод отвечал». Одно на каждый запрос снимка в полёте (hydrate,
|
|
10988
|
+
* refreshRun): локальный id → поля прогона, записанные за это время. Снимок прода снят в
|
|
10989
|
+
* момент запроса и об этих записях не знает. Применённый как есть, он вернул running
|
|
10990
|
+
* фоновой подготовки обратно в queued, и следующий тик поднял по прогону второго дрона.
|
|
10991
|
+
*/
|
|
10992
|
+
writeWindows = /* @__PURE__ */ new Set();
|
|
10942
10993
|
nextSeq = 1;
|
|
10943
10994
|
flushing = false;
|
|
10944
10995
|
flushTimer = null;
|
|
@@ -11146,6 +11197,7 @@ var SwarmClient = class _SwarmClient {
|
|
|
11146
11197
|
}
|
|
11147
11198
|
enqueueRun(run2, fields, opts = {}) {
|
|
11148
11199
|
if (Object.keys(fields).length === 0) return;
|
|
11200
|
+
for (const written of this.writeWindows) written.set(run2.id, { ...written.get(run2.id), ...fields });
|
|
11149
11201
|
this.enqueue({
|
|
11150
11202
|
t: "run",
|
|
11151
11203
|
runKey: run2.runKey,
|
|
@@ -11679,12 +11731,15 @@ var SwarmClient = class _SwarmClient {
|
|
|
11679
11731
|
const prodId = this.prodIdByKey.get(d.runKey);
|
|
11680
11732
|
if (!prodId) return this.mat(d);
|
|
11681
11733
|
const pendingFields = unflushedRunFields(this.pending, d.runKey);
|
|
11734
|
+
const written = this.openWriteWindow();
|
|
11682
11735
|
let res;
|
|
11683
11736
|
try {
|
|
11684
11737
|
res = await this.call("swarm_list_runs", { taskId: d.task_slug, view: "full" });
|
|
11685
11738
|
} catch {
|
|
11686
11739
|
this.missedProd.add(id);
|
|
11687
11740
|
return this.mat(d);
|
|
11741
|
+
} finally {
|
|
11742
|
+
this.writeWindows.delete(written);
|
|
11688
11743
|
}
|
|
11689
11744
|
if (res?.isError) {
|
|
11690
11745
|
this.missedProd.add(id);
|
|
@@ -11696,12 +11751,36 @@ var SwarmClient = class _SwarmClient {
|
|
|
11696
11751
|
this.missedProd.delete(id);
|
|
11697
11752
|
return this.mat(d);
|
|
11698
11753
|
}
|
|
11699
|
-
const
|
|
11754
|
+
const keep = pendingFields || written.has(id) ? { ...pendingFields, ...written.get(id) } : null;
|
|
11755
|
+
const saved = keep ? snapshotUnflushedRun(d, keep) : null;
|
|
11700
11756
|
const local = this.hydrateRun(row);
|
|
11701
11757
|
if (local && saved) restoreUnflushedRun(local, saved);
|
|
11702
11758
|
if (local) this.missedProd.delete(id);
|
|
11703
11759
|
return local ? this.mat(local) : null;
|
|
11704
11760
|
}
|
|
11761
|
+
/** TASWM-698: начать копить локальные записи прогонов на время запроса снимка из прода. */
|
|
11762
|
+
openWriteWindow() {
|
|
11763
|
+
const written = /* @__PURE__ */ new Map();
|
|
11764
|
+
this.writeWindows.add(written);
|
|
11765
|
+
return written;
|
|
11766
|
+
}
|
|
11767
|
+
/**
|
|
11768
|
+
* Строка снимка → зеркало, но поля, которые прогон записал локально, пока снимок ехал,
|
|
11769
|
+
* остаются локальными (TASWM-698). Остальное снимок обновляет как обычно, и следующий
|
|
11770
|
+
* проход, уже после флаша, принесёт прод-значение и для этих полей.
|
|
11771
|
+
*/
|
|
11772
|
+
hydrateRunKeeping(pr, written) {
|
|
11773
|
+
const prodId = String(pr.id ?? "");
|
|
11774
|
+
let fresh;
|
|
11775
|
+
let fields;
|
|
11776
|
+
for (const [id, f] of written) {
|
|
11777
|
+
const d = this.runs.get(id);
|
|
11778
|
+
if (d && prodId && this.prodIdByKey.get(d.runKey) === prodId) [fresh, fields] = [d, f];
|
|
11779
|
+
}
|
|
11780
|
+
const saved = fresh && fields ? snapshotUnflushedRun(fresh, fields) : null;
|
|
11781
|
+
const local = this.hydrateRun(pr);
|
|
11782
|
+
if (local && saved) restoreUnflushedRun(local, saved);
|
|
11783
|
+
}
|
|
11705
11784
|
/** TASWM-694: true, пока последняя сверка этого id не дошла до прода. */
|
|
11706
11785
|
refreshMissedProd(id) {
|
|
11707
11786
|
return this.missedProd.has(id);
|
|
@@ -12003,6 +12082,14 @@ var SwarmClient = class _SwarmClient {
|
|
|
12003
12082
|
return this.runsListComplete;
|
|
12004
12083
|
}
|
|
12005
12084
|
async hydrate() {
|
|
12085
|
+
const written = this.openWriteWindow();
|
|
12086
|
+
try {
|
|
12087
|
+
await this.hydrateFrom(written);
|
|
12088
|
+
} finally {
|
|
12089
|
+
this.writeWindows.delete(written);
|
|
12090
|
+
}
|
|
12091
|
+
}
|
|
12092
|
+
async hydrateFrom(written) {
|
|
12006
12093
|
let res;
|
|
12007
12094
|
try {
|
|
12008
12095
|
res = await this.call("swarm_list_runs", { limit: this.listLimit, view: "full" });
|
|
@@ -12024,7 +12111,7 @@ var SwarmClient = class _SwarmClient {
|
|
|
12024
12111
|
seen.add(id);
|
|
12025
12112
|
runs.push(pr);
|
|
12026
12113
|
}
|
|
12027
|
-
for (const pr of runs) this.
|
|
12114
|
+
for (const pr of runs) this.hydrateRunKeeping(pr, written);
|
|
12028
12115
|
for (const pr of runs) this.linkRefs(pr);
|
|
12029
12116
|
}
|
|
12030
12117
|
/**
|
|
@@ -15917,13 +16004,52 @@ function parkReasonUnretriable(reason) {
|
|
|
15917
16004
|
return `${PRE_START_MARK}, \u0438 ${UNRETRIABLE_PARK_MARK} \u2014 ${SPAWN_PARK_MARK} \u0441\u0440\u0430\u0437\u0443, \u043D\u0435 \u0442\u0440\u0430\u0442\u044F ${PRE_START_ATTEMPT_LIMIT} \u043F\u043E\u043F\u044B\u0442\u043A\u0438. \u0427\u0435\u0433\u043E \u043D\u0435 \u0445\u0432\u0430\u0442\u0438\u043B\u043E: ${reason}`;
|
|
15918
16005
|
}
|
|
15919
16006
|
|
|
16007
|
+
// src/projectClone.ts
|
|
16008
|
+
function matchProjectClone(projectRepos, served) {
|
|
16009
|
+
const wanted = [];
|
|
16010
|
+
const seen = /* @__PURE__ */ new Set();
|
|
16011
|
+
for (const raw of projectRepos) {
|
|
16012
|
+
const name = raw.trim();
|
|
16013
|
+
if (!name) continue;
|
|
16014
|
+
const key = name.toLowerCase();
|
|
16015
|
+
if (seen.has(key)) continue;
|
|
16016
|
+
seen.add(key);
|
|
16017
|
+
wanted.push({ key, name });
|
|
16018
|
+
}
|
|
16019
|
+
if (wanted.length === 0) return { kind: "none" };
|
|
16020
|
+
const keys = new Set(wanted.map((w) => w.key));
|
|
16021
|
+
const matches = [];
|
|
16022
|
+
for (const clone of served) {
|
|
16023
|
+
const key = clone.repoFullName.trim().toLowerCase();
|
|
16024
|
+
const path = clone.path.trim();
|
|
16025
|
+
if (!key || !path || !keys.has(key)) continue;
|
|
16026
|
+
const display = wanted.find((w) => w.key === key)?.name ?? clone.repoFullName.trim();
|
|
16027
|
+
matches.push({ repoFullName: display, path });
|
|
16028
|
+
}
|
|
16029
|
+
if (matches.length === 1) return { kind: "one", ...matches[0] };
|
|
16030
|
+
if (matches.length === 0) return { kind: "missing", lookedUp: wanted.map((w) => w.name) };
|
|
16031
|
+
return { kind: "ambiguous", matches };
|
|
16032
|
+
}
|
|
16033
|
+
function projectCloneRefusal(run2, verdict) {
|
|
16034
|
+
const head = `\u0443 \u043F\u0440\u043E\u0433\u043E\u043D\u0430 #${run2.id} (${run2.task_slug}) \u043D\u0435\u0442 repo`;
|
|
16035
|
+
if (verdict.kind === "none") {
|
|
16036
|
+
return `${head}: \u0443 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 \u043D\u0435\u0442 \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u044F. \u041F\u0440\u0438\u0432\u044F\u0436\u0438 \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u0439 \u043A \u043F\u0440\u043E\u0435\u043A\u0442\u0443 \u0438\u043B\u0438 \u0437\u0430\u0434\u0430\u0439 repo \u043F\u0440\u043E\u0433\u043E\u043D\u0430 \u044F\u0432\u043D\u043E.`;
|
|
16037
|
+
}
|
|
16038
|
+
if (verdict.kind === "missing") {
|
|
16039
|
+
const names = verdict.lookedUp.join(", ");
|
|
16040
|
+
return `${head}: \u043A\u043B\u043E\u043D\u0430 ${names} \u043D\u0430 \u044D\u0442\u043E\u0439 \u043C\u0430\u0448\u0438\u043D\u0435 \u043D\u0435\u0442. \u041A\u043B\u043E\u043D\u0438\u0440\u0443\u0439 \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u0439 \u0438 \u0434\u043E\u0431\u0430\u0432\u044C \u0435\u0433\u043E \u0432 SWARM_REPO_PATHS (\u0438\u043B\u0438 swarm start --repo <\u043F\u0443\u0442\u044C>), \u043B\u0438\u0431\u043E \u043E\u0442\u0434\u0430\u0439 \u0437\u0430\u0434\u0430\u0447\u0443 \u043C\u0430\u0448\u0438\u043D\u0435, \u0433\u0434\u0435 \u043A\u043B\u043E\u043D \u0435\u0441\u0442\u044C.`;
|
|
16041
|
+
}
|
|
16042
|
+
const listed = verdict.matches.map((m) => `${m.repoFullName} (${m.path})`).join(", ");
|
|
16043
|
+
return `${head}: \u0441\u043E\u0432\u043F\u0430\u043B\u043E \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043A\u043B\u043E\u043D\u043E\u0432 (${listed}). \u0417\u0430\u0434\u0430\u0439 repo \u043F\u0440\u043E\u0433\u043E\u043D\u0430 \u044F\u0432\u043D\u043E \u2014 \u0441\u0430\u043C \u043D\u0435 \u0432\u044B\u0431\u0438\u0440\u0430\u044E.`;
|
|
16044
|
+
}
|
|
16045
|
+
|
|
15920
16046
|
// src/overmind.ts
|
|
15921
16047
|
init_deps2();
|
|
15922
16048
|
|
|
15923
16049
|
// package.json
|
|
15924
16050
|
var package_default = {
|
|
15925
16051
|
name: "@taskless-app/swarm",
|
|
15926
|
-
version: "0.6.
|
|
16052
|
+
version: "0.6.113",
|
|
15927
16053
|
type: "module",
|
|
15928
16054
|
description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
|
|
15929
16055
|
keywords: [
|
|
@@ -15975,7 +16101,7 @@ var package_default = {
|
|
|
15975
16101
|
undici: "^7.30.1",
|
|
15976
16102
|
zod: "3.25.76"
|
|
15977
16103
|
},
|
|
15978
|
-
gitHead: "
|
|
16104
|
+
gitHead: "932d5ab9568a3a0bf5a68c338a052297afd0bd64"
|
|
15979
16105
|
};
|
|
15980
16106
|
|
|
15981
16107
|
// src/version.ts
|
|
@@ -16146,13 +16272,21 @@ function escalationText(entry, run2, side) {
|
|
|
16146
16272
|
function escalationsFor(side) {
|
|
16147
16273
|
return ESCALATIONS.filter((e) => e.sides.includes(side));
|
|
16148
16274
|
}
|
|
16149
|
-
function
|
|
16150
|
-
|
|
16275
|
+
function escalationLatched(event, mark) {
|
|
16276
|
+
if (!mark) return false;
|
|
16277
|
+
const text = event.text ?? "";
|
|
16278
|
+
const actor = event.actor;
|
|
16279
|
+
if (actor === "orchestrator") return text.includes(mark);
|
|
16280
|
+
if (actor == null || actor === "") return text.startsWith(mark);
|
|
16281
|
+
return false;
|
|
16282
|
+
}
|
|
16283
|
+
function isEscalationText(event, run2, side) {
|
|
16284
|
+
return escalationsFor(side).some((e) => escalationLatched(event, escalationText(e, run2, side)));
|
|
16151
16285
|
}
|
|
16152
|
-
function findEscalation(
|
|
16286
|
+
function findEscalation(events, run2, side) {
|
|
16153
16287
|
for (const entry of escalationsFor(side)) {
|
|
16154
16288
|
const needle = escalationText(entry, run2, side);
|
|
16155
|
-
if (
|
|
16289
|
+
if (events.some((ev) => escalationLatched(ev, needle))) return entry;
|
|
16156
16290
|
}
|
|
16157
16291
|
return null;
|
|
16158
16292
|
}
|
|
@@ -16635,12 +16769,15 @@ async function prActionsRuns(prUrl, headSha2, run2 = realRunner) {
|
|
|
16635
16769
|
}
|
|
16636
16770
|
const label2 = (r, what) => `${r.name || "workflow"} (${what || "?"})`;
|
|
16637
16771
|
const latestRows = [...latest.values()];
|
|
16772
|
+
const cancelledRows = latestRows.filter((r) => r.status === "completed" && r.conclusion === "cancelled");
|
|
16773
|
+
const cancelledRunIds = cancelledRows.map((r) => typeof r.id === "number" && Number.isInteger(r.id) && r.id > 0 ? String(r.id) : "").filter((id) => /^\d+$/.test(id));
|
|
16638
16774
|
return {
|
|
16639
16775
|
total: runs.length,
|
|
16640
16776
|
active: runs.filter((r) => r.status !== "completed").map((r) => label2(r, r.status)),
|
|
16641
16777
|
failed: latestRows.filter((r) => r.status === "completed" && r.conclusion !== "cancelled" && !ACTIONS_RUN_OK.has(r.conclusion ?? "")).map((r) => label2(r, r.conclusion)),
|
|
16642
16778
|
// Отмена — не красный и не «добежал». Свежий cancelled не даёт влить PR.
|
|
16643
|
-
cancelled:
|
|
16779
|
+
cancelled: cancelledRows.map((r) => label2(r, r.conclusion)),
|
|
16780
|
+
...cancelledRunIds.length > 0 ? { cancelledRunIds } : {}
|
|
16644
16781
|
};
|
|
16645
16782
|
} catch {
|
|
16646
16783
|
return null;
|
|
@@ -21650,10 +21787,13 @@ function hasMergeIntent(r) {
|
|
|
21650
21787
|
return !!(r.merge_requested_at ?? "").trim();
|
|
21651
21788
|
}
|
|
21652
21789
|
var NO_CI_GRACE_MS = 10 * 6e4;
|
|
21790
|
+
var CANCELLED_CI_WAIT_MS = 10 * 6e4;
|
|
21791
|
+
var CANCELLED_CI_STUCK_REASON = "CI \u043E\u0442\u043C\u0435\u043D\u0451\u043D \u0432 \u043E\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u043B\u0441\u044F \u0437\u0430 10 \u043C\u0438\u043D\u0443\u0442 \u2014 \u043C\u0435\u0440\u0436 \u0441\u043D\u044F\u0442, \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438 CI \u0438 \u043F\u043E\u043F\u0440\u043E\u0441\u0438 \u043C\u0435\u0440\u0436 \u0437\u0430\u043D\u043E\u0432\u043E";
|
|
21653
21792
|
var shortSha = (sha) => sha.slice(0, 7);
|
|
21654
21793
|
function makeMergeIntentResolver(deps) {
|
|
21655
21794
|
const read = deps.headState ?? makeHeadStateReader(deps);
|
|
21656
21795
|
const firstSeen = /* @__PURE__ */ new Map();
|
|
21796
|
+
const cancelledSeen = /* @__PURE__ */ new Map();
|
|
21657
21797
|
const ciSettled = async (prUrl, st, now) => {
|
|
21658
21798
|
const sha = st.headSha;
|
|
21659
21799
|
if (!sha) {
|
|
@@ -21678,11 +21818,37 @@ function makeMergeIntentResolver(deps) {
|
|
|
21678
21818
|
}
|
|
21679
21819
|
const cancelled = runs.cancelled ?? [];
|
|
21680
21820
|
if (cancelled.length > 0) {
|
|
21681
|
-
|
|
21682
|
-
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
}
|
|
21821
|
+
let seen = cancelledSeen.get(prUrl);
|
|
21822
|
+
if (!seen || seen.sha !== sha) {
|
|
21823
|
+
seen = { sha, at: now, reran: false };
|
|
21824
|
+
cancelledSeen.set(prUrl, seen);
|
|
21825
|
+
}
|
|
21826
|
+
const waited = now - seen.at;
|
|
21827
|
+
if (waited < CANCELLED_CI_WAIT_MS) {
|
|
21828
|
+
return {
|
|
21829
|
+
action: "wait",
|
|
21830
|
+
code: "checks_pending",
|
|
21831
|
+
reason: `\u043D\u0430 ${shortSha(sha)} \u043F\u0440\u043E\u0433\u043E\u043D GitHub Actions \u043E\u0442\u043C\u0435\u043D\u0451\u043D: ${cancelled.join(", ")} \u2014 \u044D\u0442\u043E \u043D\u0435 \u0437\u0435\u043B\u0451\u043D\u044B\u0439 CI, \u0436\u0434\u0443 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u043A\u0430`
|
|
21832
|
+
};
|
|
21833
|
+
}
|
|
21834
|
+
const ids = (runs.cancelledRunIds ?? []).filter((id) => /^\d+$/.test(id));
|
|
21835
|
+
if (!seen.reran && ids.length > 0 && deps.rerunCancelled) {
|
|
21836
|
+
let restarted = false;
|
|
21837
|
+
for (const id of ids) {
|
|
21838
|
+
const ok = await deps.rerunCancelled(prUrl, id).catch(() => false);
|
|
21839
|
+
if (ok) restarted = true;
|
|
21840
|
+
}
|
|
21841
|
+
seen.reran = true;
|
|
21842
|
+
if (restarted) {
|
|
21843
|
+
seen.at = now;
|
|
21844
|
+
return {
|
|
21845
|
+
action: "wait",
|
|
21846
|
+
code: "checks_pending",
|
|
21847
|
+
reason: `\u043D\u0430 ${shortSha(sha)} \u043F\u0440\u043E\u0433\u043E\u043D GitHub Actions \u043E\u0442\u043C\u0435\u043D\u0451\u043D: ${cancelled.join(", ")} \u2014 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u043B, \u0436\u0434\u0443 \u043D\u043E\u0432\u044B\u0439 \u043F\u0440\u043E\u0433\u043E\u043D`
|
|
21848
|
+
};
|
|
21849
|
+
}
|
|
21850
|
+
}
|
|
21851
|
+
return { action: "clear", code: "checks_pending", reason: CANCELLED_CI_STUCK_REASON };
|
|
21686
21852
|
}
|
|
21687
21853
|
if (st.checks === "none") {
|
|
21688
21854
|
if (runs.total > 0) {
|
|
@@ -21826,6 +21992,8 @@ function makeMergeGateParts(deps) {
|
|
|
21826
21992
|
...deps.baseSync ? { baseSync: deps.baseSync } : {},
|
|
21827
21993
|
...deps.checks ? { checks: deps.checks } : {},
|
|
21828
21994
|
...deps.actionsRuns ? { actionsRuns: deps.actionsRuns } : {},
|
|
21995
|
+
...deps.rerunCancelled ? { rerunCancelled: deps.rerunCancelled } : {},
|
|
21996
|
+
...deps.now ? { now: deps.now } : {},
|
|
21829
21997
|
...deps.ttlMs != null ? { ttlMs: deps.ttlMs } : {}
|
|
21830
21998
|
});
|
|
21831
21999
|
return { gate, queue: queueFor, intent: intentFor };
|
|
@@ -23822,7 +23990,11 @@ function makeHandler(deps) {
|
|
|
23822
23990
|
if (p === "/resume" && req.method === "POST") {
|
|
23823
23991
|
if (!authed(req)) return unauthorized();
|
|
23824
23992
|
if (!deps.control) return new Response("\u043F\u0430\u0443\u0437\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430: \u043C\u043E\u0440\u0434\u0430 \u0431\u0435\u0437 \u0436\u0438\u0432\u043E\u0433\u043E \u0434\u0435\u043C\u043E\u043D\u0430", { status: 503 });
|
|
23825
|
-
|
|
23993
|
+
const f = await formValue(req);
|
|
23994
|
+
if (deps.restart?.phase === "waiting") {
|
|
23995
|
+
return Response.json({ ok: false, paused: true, why: localResumeRefusedWhy(deps.restart.intent) }, { status: 409 });
|
|
23996
|
+
}
|
|
23997
|
+
setPausedVia(deps, false, pauseSourceOf(f.get("source")), null);
|
|
23826
23998
|
return Response.json({ ok: true, paused: false, why: "\u0440\u043E\u0439 \u0441\u043D\u044F\u0442 \u0441 \u043F\u0430\u0443\u0437\u044B \u2014 \u0441\u043D\u043E\u0432\u0430 \u0431\u0435\u0440\u0451\u043C \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437 \u043E\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0438\u043D\u0442\u0435\u0439\u043A\u0430" });
|
|
23827
23999
|
}
|
|
23828
24000
|
if (p === "/status") return Response.json(daemonStatus(deps));
|
|
@@ -24517,7 +24689,7 @@ function decideParkAction(db, droneCap, exclusivityBlocked) {
|
|
|
24517
24689
|
function decideFreshAction(db, wt) {
|
|
24518
24690
|
const stalled = db.listRuns("stalled").filter((r) => r.resolves_run_id == null && r.reviews_run_id == null);
|
|
24519
24691
|
for (const r of stalled) {
|
|
24520
|
-
if (findEscalation(db.events(r.id)
|
|
24692
|
+
if (findEscalation(db.events(r.id), r, "author")) continue;
|
|
24521
24693
|
const path = r.worktree_path;
|
|
24522
24694
|
const recoverable = !!path && wt.exists(path) && wt.hasTranscript(r);
|
|
24523
24695
|
if (recoverable) continue;
|
|
@@ -25347,8 +25519,7 @@ function escalationLimits() {
|
|
|
25347
25519
|
return { reviewSpawn: REVIEW_SPAWN_LIMIT, reviewCycle: effectiveReviewCycleLimit() };
|
|
25348
25520
|
}
|
|
25349
25521
|
function deliberateReviewStop(db, run2) {
|
|
25350
|
-
const
|
|
25351
|
-
const hit = findEscalation(texts, run2, "reviewer");
|
|
25522
|
+
const hit = findEscalation(db.events(run2.id), run2, "reviewer");
|
|
25352
25523
|
return hit?.stopReason?.(run2, escalationLimits()) ?? null;
|
|
25353
25524
|
}
|
|
25354
25525
|
function noteReviewBlocked(deps, run2, reason) {
|
|
@@ -25768,7 +25939,10 @@ ${task.description}` : `\u0417\u0430\u0434\u0430\u0447\u0430 ${run2.task_slug} (
|
|
|
25768
25939
|
// TASWM-466: рядом с правилом о репозитории — у них один смысл (знание, добытое
|
|
25769
25940
|
// прогоном, переживает прогон) и одна цена ошибки: лишняя заметка дороже отсутствующей.
|
|
25770
25941
|
...zoneMemoryBlock ? [zoneMemoryBlock] : [],
|
|
25771
|
-
|
|
25942
|
+
// TASWM-697: бриф собирается до выбора исполнителя, а подхват у харнессов разный:
|
|
25943
|
+
// claude берёт оба набора сам, grok ройные получает путями в промпте. Поэтому без
|
|
25944
|
+
// обещаний — сверка со своим списком и где взять недостающее (держат адаптеры).
|
|
25945
|
+
"\u0421\u043A\u0438\u043B\u043B\u044B \u043F\u0440\u0438\u0445\u043E\u0434\u044F\u0442 \u043A \u0442\u0435\u0431\u0435 \u0414\u0412\u0423\u041C\u042F \u043D\u0430\u0431\u043E\u0440\u0430\u043C\u0438. \u2460 \u0420\u043E\u0439\u043D\u044B\u0435 `swarm-drone:*` \u0435\u0434\u0443\u0442 \u0441 \u0420\u041E\u0415\u041C \u0432 \u043B\u044E\u0431\u043E\u0439 \u043F\u0440\u043E\u0435\u043A\u0442 \u2014 \u0434\u0438\u0441\u0446\u0438\u043F\u043B\u0438\u043D\u0430, \u0432\u0435\u0440\u043D\u0430\u044F \u0432\u0435\u0437\u0434\u0435: swarm-save-often (\u043D\u0435\u0437\u0430\u043F\u0443\u0448\u0435\u043D\u043D\u043E\u0435 \u0443\u043C\u0438\u0440\u0430\u0435\u0442 \u0441 \u0434\u0440\u043E\u043D\u043E\u043C), swarm-merge-main (\u0431\u0430\u0437\u043E\u0432\u0443\u044E \u0432\u0435\u0442\u043A\u0443 \u0432\u043B\u0438\u0432\u0430\u0442\u044C, \u0430 \u043D\u0435 \u0440\u0435\u0431\u0435\u0439\u0437\u0438\u0442\u044C \u0437\u0430\u043F\u0443\u0448\u0435\u043D\u043D\u0443\u044E), swarm-await-process (\u0436\u0434\u0430\u0442\u044C \u0443\u0441\u043B\u043E\u0432\u0438\u0435, \u043D\u0435 sleep), swarm-verify-green (\u0447\u0442\u043E \u0441\u0447\u0438\u0442\u0430\u0442\u044C \u0437\u0435\u043B\u0451\u043D\u044B\u043C, \u0442\u044F\u0436\u0451\u043B\u044B\u0439 \u043F\u0440\u043E\u0433\u043E\u043D \u2014 \u0432 \u0444\u0430\u0439\u043B), \u0438 skills \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0430 \u0438\u0437 \u043D\u0430\u0431\u043E\u0440\u0430 Taskless, \u0442\u0435 \u0436\u0435, \u0447\u0442\u043E \u0443 \u043B\u044E\u0434\u0435\u0439 \u0432 \u043F\u043B\u0430\u0433\u0438\u043D\u0435: taskless-build (\u043A\u0430\u043A \u0434\u0435\u043B\u0430\u0442\u044C: \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0438 \u2014 \u043F\u0435\u0440\u0432\u044B\u0435 \u0442\u0435\u0441\u0442\u044B, \u043A\u0440\u0430\u0441\u043D\u044B\u0439 \u0442\u0435\u0441\u0442 \u0434\u043E \u043A\u043E\u0434\u0430), taskless-check (\u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0437\u0430\u043F\u0443\u0441\u043A\u043E\u043C \u043F\u0435\u0440\u0435\u0434 \u0441\u0434\u0430\u0447\u0435\u0439), taskless-review (\u043A\u043B\u0430\u0441\u0441\u044B \u0434\u0435\u0444\u0435\u043A\u0442\u043E\u0432), taskless-debug (\u043F\u0435\u0440\u0432\u043E\u043F\u0440\u0438\u0447\u0438\u043D\u0430 \u0434\u043E \u0444\u0438\u043A\u0441\u0430). \u2461 \u0421\u043A\u0438\u043B\u043B\u044B \u0420\u0415\u041F\u041E\u0417\u0418\u0422\u041E\u0420\u0418\u042F (`.claude/skills/<\u0438\u043C\u044F>/SKILL.md`, \u0441\u043E\u0441\u0442\u0430\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043E\u0442 \u043F\u0440\u043E\u0435\u043A\u0442\u0430) \u2014 \u0437\u043D\u0430\u043D\u0438\u044F \u043E\u0431 \u044D\u0442\u043E\u043C \u043F\u0440\u043E\u0435\u043A\u0442\u0435: \u043A\u0430\u043A \u043F\u043E\u0434\u043D\u044F\u0442\u044C \u0441\u0442\u0435\u043A, \u043A\u0430\u043A \u0433\u043E\u043D\u044F\u0442\u044C \u0442\u0435\u0441\u0442\u044B \u0438 \u0447\u0442\u043E \u0437\u0434\u0435\u0441\u044C \u0437\u0435\u043B\u0451\u043D\u043E\u0435, UI-\u043F\u0440\u0430\u0432\u0438\u043B\u0430; \u043E\u0431\u0449\u0438\u0435 \u043F\u0440\u0430\u0432\u0438\u043B\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 \u2014 \u0432 CLAUDE.md \u0438 AGENTS.md \u043A\u043E\u0440\u043D\u044F. \u041F\u043E\u0434\u0445\u0432\u0430\u0442\u044B\u0432\u0430\u0435\u0442 \u043B\u0438 \u0438\u0445 \u0445\u0430\u0440\u043D\u0435\u0441\u0441 \u0441\u0430\u043C, \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043E\u0442 \u0438\u0441\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044F, \u043F\u043E\u044D\u0442\u043E\u043C\u0443 \u0441\u0432\u0435\u0440\u044C\u0441\u044F \u0441\u043E \u0441\u0432\u043E\u0438\u043C \u0441\u043F\u0438\u0441\u043A\u043E\u043C \u0441\u043A\u0438\u043B\u043B\u043E\u0432: \u0440\u043E\u0439\u043D\u044B\u0445 \u0432 \u043D\u0451\u043C \u043D\u0435\u0442 \u2014 \u0438\u0445 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0438 \u043D\u0430\u0437\u0432\u0430\u043D\u044B \u0432 \u043A\u043E\u043D\u0446\u0435 \u0431\u0440\u0438\u0444\u0430; \u0441\u043A\u0438\u043B\u043B\u043E\u0432 \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u044F \u043D\u0435\u0442 \u2014 \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0439 \u043D\u0443\u0436\u043D\u044B\u0435 SKILL.md \u0438 CLAUDE.md/AGENTS.md \u0441 \u0434\u0438\u0441\u043A\u0430 \u0441\u0430\u043C, \u0434\u043E \u0440\u0430\u0431\u043E\u0442\u044B. \u041F\u043E\u043B\u044C\u0437\u0443\u0439\u0441\u044F \u043E\u0431\u043E\u0438\u043C\u0438, \u043D\u0435 \u043F\u0435\u0440\u0435\u0438\u0437\u043E\u0431\u0440\u0435\u0442\u0430\u0439; \u043D\u0435\u0442 \u043D\u0443\u0436\u043D\u043E\u0433\u043E \u0437\u043D\u0430\u043D\u0438\u044F \u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0435 \u2014 \u044D\u0442\u043E \u043F\u0440\u043E\u0431\u0435\u043B \u0435\u0433\u043E \u0441\u043A\u0438\u043B\u043B\u043E\u0432, \u0441\u043A\u0430\u0436\u0438 note(), \u0430 \u043D\u0435 \u0432\u044B\u0434\u0443\u043C\u044B\u0432\u0430\u0439 \u043A\u043E\u043C\u0430\u043D\u0434\u044B."
|
|
25772
25946
|
];
|
|
25773
25947
|
if (run2.decision?.chosen?.trim()) {
|
|
25774
25948
|
const d = run2.decision;
|
|
@@ -26370,6 +26544,33 @@ function launchedAtMs(events, pid) {
|
|
|
26370
26544
|
}
|
|
26371
26545
|
return null;
|
|
26372
26546
|
}
|
|
26547
|
+
function launchPids(events) {
|
|
26548
|
+
const out = [];
|
|
26549
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
26550
|
+
const e = events[i];
|
|
26551
|
+
const pid = e.kind === "spawned" || e.kind === "resumed" ? droneLaunchedPid(e.text) : null;
|
|
26552
|
+
if (pid != null) out.push(pid);
|
|
26553
|
+
}
|
|
26554
|
+
return out;
|
|
26555
|
+
}
|
|
26556
|
+
function launchedProcessIsOurs(deps, events, pid) {
|
|
26557
|
+
const launchedAt = launchedAtMs(events, pid);
|
|
26558
|
+
const startedAt = deps.processStartedAt?.(pid) ?? null;
|
|
26559
|
+
if (launchedAt == null || startedAt == null) return null;
|
|
26560
|
+
return startedAt <= launchedAt + LAUNCH_START_SLACK_MS;
|
|
26561
|
+
}
|
|
26562
|
+
function liveDronePid(deps, run2) {
|
|
26563
|
+
const events = deps.db.events(run2.id);
|
|
26564
|
+
for (const pid of [run2.pid, launchPids(events)[0]]) {
|
|
26565
|
+
if (pid == null || launchedAtMs(events, pid) == null || !deps.isAlive(pid)) continue;
|
|
26566
|
+
if (launchedProcessIsOurs(deps, events, pid) === false) continue;
|
|
26567
|
+
return pid;
|
|
26568
|
+
}
|
|
26569
|
+
return null;
|
|
26570
|
+
}
|
|
26571
|
+
function liveDroneReason(pid) {
|
|
26572
|
+
return `\u0443 \u043F\u0440\u043E\u0433\u043E\u043D\u0430 \u0435\u0449\u0451 \u0436\u0438\u0432 \u0441\u0432\u043E\u0439 \u0434\u0440\u043E\u043D (pid ${pid}) \u2014 \u0432\u0442\u043E\u0440\u043E\u0433\u043E \u043D\u0435 \u043F\u043E\u0434\u043D\u0438\u043C\u0430\u044E (TASWM-698)`;
|
|
26573
|
+
}
|
|
26373
26574
|
function submitterCheck(deps, events, pid, openedAt) {
|
|
26374
26575
|
const launchedAt = launchedAtMs(events, pid);
|
|
26375
26576
|
if (launchedAt == null) return { kind: "unknown", why: "\u0432 \u043B\u0435\u043D\u0442\u0435 \u043D\u0435\u0442 \u0437\u0430\u043F\u0438\u0441\u0438 \u043E \u0437\u0430\u043F\u0443\u0441\u043A\u0435 \u044D\u0442\u043E\u0433\u043E pid" };
|
|
@@ -26425,6 +26626,36 @@ function reapLingeringAuthors(deps, now) {
|
|
|
26425
26626
|
}
|
|
26426
26627
|
}
|
|
26427
26628
|
}
|
|
26629
|
+
var DOUBLE_LAUNCH_MARK = "\u0432\u0442\u043E\u0440\u043E\u0439 \u0437\u0430\u043F\u0443\u0441\u043A \u0434\u0440\u043E\u043D\u0430 \u043F\u0440\u0438 \u0436\u0438\u0432\u043E\u043C \u043F\u0440\u043E\u0448\u043B\u043E\u043C (TASWM-698)";
|
|
26630
|
+
function reapDoubleLaunch(deps, now) {
|
|
26631
|
+
const kill = deps.kill;
|
|
26632
|
+
if (!kill) return;
|
|
26633
|
+
for (const run2 of deps.db.listRuns()) {
|
|
26634
|
+
if (isTerminalStatus(run2.status)) continue;
|
|
26635
|
+
const events = deps.db.events(run2.id);
|
|
26636
|
+
const [last, prev] = launchPids(events);
|
|
26637
|
+
if (last == null || prev == null || prev === last || !deps.isAlive(prev)) continue;
|
|
26638
|
+
const ours = launchedProcessIsOurs(deps, events, prev);
|
|
26639
|
+
if (ours === false) continue;
|
|
26640
|
+
const head = `${DOUBLE_LAUNCH_MARK}: \u043F\u0440\u043E\u0433\u043E\u043D \u0432\u0435\u0434\u0451\u0442 pid ${last}, \u043F\u0440\u043E\u0448\u043B\u044B\u0439 pid ${prev} \u0435\u0449\u0451 \u0436\u0438\u0432`;
|
|
26641
|
+
if (ours === null) {
|
|
26642
|
+
const text2 = `${head}, \u043D\u043E \u043D\u0435 \u0433\u0430\u0448\u0443: \u043D\u0435 \u043C\u043E\u0433\u0443 \u0443\u0431\u0435\u0434\u0438\u0442\u044C\u0441\u044F, \u0447\u0442\u043E \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u043D\u0430\u0448 \u2014 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438 \u0435\u0433\u043E \u0432\u0440\u0443\u0447\u043D\u0443\u044E`;
|
|
26643
|
+
if (!events.some((e) => e.text === text2)) deps.db.addEvent(run2.id, "step", text2);
|
|
26644
|
+
continue;
|
|
26645
|
+
}
|
|
26646
|
+
const text = `${head} \u2014 \u0433\u0430\u0448\u0443 \u043F\u0440\u043E\u0448\u043B\u044B\u0439`;
|
|
26647
|
+
const sent = events.findLast((e) => e.text === text);
|
|
26648
|
+
if (sent && now - sqliteMs(sent.at) < STOP_TERM_GRACE_MS) continue;
|
|
26649
|
+
if (!sent) {
|
|
26650
|
+
deps.db.addEvent(run2.id, "step", text);
|
|
26651
|
+
console.log(`[overmind] ${droneLabel(run2)} (#${run2.id}): ${head} \u2014 \u0433\u0430\u0448\u0443 \u043F\u0440\u043E\u0448\u043B\u044B\u0439`);
|
|
26652
|
+
}
|
|
26653
|
+
try {
|
|
26654
|
+
(sent ? deps.hardKill ?? kill : kill)(prev);
|
|
26655
|
+
} catch {
|
|
26656
|
+
}
|
|
26657
|
+
}
|
|
26658
|
+
}
|
|
26428
26659
|
function lingeringSubmitterWhy(run2, events, now) {
|
|
26429
26660
|
const head = `\u043F\u0440\u043E\u0433\u043E\u043D #${run2.id}`;
|
|
26430
26661
|
const pid = run2.pid;
|
|
@@ -26559,7 +26790,7 @@ async function wakeRunPastGate(deps, initial, opts) {
|
|
|
26559
26790
|
why: `${whose} \u0438\u0441\u0447\u0435\u0440\u043F\u0430\u043B \u043B\u0438\u043C\u0438\u0442 \u043A\u0440\u0443\u0433\u043E\u0432 \u043F\u0440\u0430\u0432\u043E\u043A (${capHolder.review_cycle ?? 0} \u0438\u0437 ${limit}) \u2014 \u043D\u0443\u0436\u0435\u043D \u0447\u0435\u043B\u043E\u0432\u0435\u043A, \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0435 \u043F\u043E\u0431\u0443\u0434\u043A\u0438 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u044B`
|
|
26560
26791
|
};
|
|
26561
26792
|
}
|
|
26562
|
-
const stoppedForHuman = deps.db.events(run2.id).some((e) => isEscalationText(e
|
|
26793
|
+
const stoppedForHuman = deps.db.events(run2.id).some((e) => isEscalationText(e, run2, "author"));
|
|
26563
26794
|
if (run2.status === "review" && run2.pr_url && !needsFixIteration(run2) && !stoppedForHuman) {
|
|
26564
26795
|
return { ok: false, why: `\u043F\u0440\u043E\u0433\u043E\u043D #${runId} \u0443\u0436\u0435 \u0441\u0434\u0430\u043D \u043D\u0430 \u0440\u0435\u0432\u044C\u044E (${run2.pr_url}) \u2014 \u0431\u0443\u0434\u0438\u0442\u044C \u043D\u0435\u0447\u0435\u0433\u043E; \u043F\u0440\u0430\u0432\u043A\u0438 \u043F\u043E\u0434\u043D\u0438\u043C\u0435\u0442 \u0440\u043E\u0439 \u043F\u043E \u0432\u0435\u0440\u0434\u0438\u043A\u0442\u0443` };
|
|
26565
26796
|
}
|
|
@@ -27367,14 +27598,15 @@ async function wakeAuthorOnChangesInner(deps, snapshot, now, droneCap, hold, res
|
|
|
27367
27598
|
const prUrl = run2.pr_url;
|
|
27368
27599
|
const events = deps.db.events(run2.id);
|
|
27369
27600
|
const mark = `${CHANGES_WAKE_ESCALATION_MARK} (\u043A\u0440\u0443\u0433 ${run2.review_cycle ?? 0})`;
|
|
27601
|
+
const latched = (e) => escalationLatched(e, mark);
|
|
27370
27602
|
const escalate = (why, said) => {
|
|
27371
|
-
if (!events.some(
|
|
27372
|
-
deps.db.addEvent(run2.id, "step", `${mark}: ${why} \u2014 \u043D\u0443\u0436\u0435\u043D \u0447\u0435\u043B\u043E\u0432\u0435\u043A
|
|
27603
|
+
if (!events.some(latched)) {
|
|
27604
|
+
deps.db.addEvent(run2.id, "step", `${mark}: ${why} \u2014 \u043D\u0443\u0436\u0435\u043D \u0447\u0435\u043B\u043E\u0432\u0435\u043A`, "orchestrator");
|
|
27373
27605
|
narrate(deps, said);
|
|
27374
27606
|
}
|
|
27375
27607
|
return false;
|
|
27376
27608
|
};
|
|
27377
|
-
const alreadyEscalated = events.some(
|
|
27609
|
+
const alreadyEscalated = events.some(latched);
|
|
27378
27610
|
if (run2.stop_reason?.startsWith(BUDGET_STOP_REASON)) {
|
|
27379
27611
|
return escalate(
|
|
27380
27612
|
"\u0444\u0438\u043A\u0441-\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044E \u043D\u0435 \u043F\u043E\u0434\u043D\u044F\u0442\u044C: \u043F\u0440\u043E\u0448\u043B\u0443\u044E \u0441\u0435\u0441\u0441\u0438\u044E \u0441\u0440\u0435\u0437\u0430\u043B \u043F\u043E\u0442\u043E\u043B\u043E\u043A \u0442\u0440\u0430\u0442 \u043F\u0440\u043E\u0433\u043E\u043D\u0430, \u043F\u043E\u0432\u0442\u043E\u0440 \u0443\u043F\u0440\u0451\u0442\u0441\u044F \u0432 \u0442\u043E\u0442 \u0436\u0435",
|
|
@@ -27783,8 +28015,33 @@ function noteStormStall(deps) {
|
|
|
27783
28015
|
}
|
|
27784
28016
|
for (const run2 of waiting) deferSpawn(deps, run2, stormHoldReason(deps, run2), { quiet: true });
|
|
27785
28017
|
}
|
|
28018
|
+
async function resolveEmptyRepo(deps, run2) {
|
|
28019
|
+
if (run2.repoless) return null;
|
|
28020
|
+
if ((run2.repo ?? "").trim()) return null;
|
|
28021
|
+
if (!deps.projectRepos) return null;
|
|
28022
|
+
let names;
|
|
28023
|
+
try {
|
|
28024
|
+
names = await deps.projectRepos(run2);
|
|
28025
|
+
} catch (e) {
|
|
28026
|
+
console.error("[overmind] \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 \u043D\u0435 \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u043B\u0438\u0441\u044C \u2014 \u043E\u0441\u0442\u0430\u0432\u043B\u044F\u044E \u043F\u0440\u0435\u0436\u043D\u0438\u0439 \u043F\u0443\u0442\u044C (\u0434\u0435\u0444\u043E\u043B\u0442 SWARM_REPO):", e);
|
|
28027
|
+
return null;
|
|
28028
|
+
}
|
|
28029
|
+
if (names === void 0) return null;
|
|
28030
|
+
if (!deps.servedClones) return null;
|
|
28031
|
+
const verdict = matchProjectClone(names, deps.servedClones());
|
|
28032
|
+
if (verdict.kind === "one") {
|
|
28033
|
+
const path = normalizeRepo(verdict.path);
|
|
28034
|
+
const updated = deps.db.updateRun(run2.id, { repo: path });
|
|
28035
|
+
deps.db.addEvent(run2.id, "step", `repo \u043D\u0435 \u0431\u044B\u043B \u0437\u0430\u0434\u0430\u043D \u2014 \u0432\u0437\u044F\u043B \u043A\u043B\u043E\u043D ${verdict.repoFullName} \u043F\u0440\u043E\u0435\u043A\u0442\u0430 (${path}) (TASWM-696)`);
|
|
28036
|
+
return updated ?? { ...run2, repo: path };
|
|
28037
|
+
}
|
|
28038
|
+
await failBeforeStart(deps, run2, projectCloneRefusal(run2, verdict));
|
|
28039
|
+
return "failed";
|
|
28040
|
+
}
|
|
27786
28041
|
async function trySpawnQueuedRun(deps, run2) {
|
|
27787
28042
|
if (preparingRuns(deps.db).has(run2.id)) return "skipped";
|
|
28043
|
+
const livePid = liveDronePid(deps, run2);
|
|
28044
|
+
if (livePid != null) return deferSpawn(deps, run2, liveDroneReason(livePid));
|
|
27788
28045
|
if (stormHolds(deps, run2)) return deferSpawn(deps, run2, stormHoldReason(deps, run2), { quiet: true });
|
|
27789
28046
|
if (deps.control?.paused) {
|
|
27790
28047
|
const why = deps.control.state?.reason;
|
|
@@ -27880,6 +28137,9 @@ async function trySpawnQueuedRun(deps, run2) {
|
|
|
27880
28137
|
const why = lost.length ? `\u0436\u0434\u0451\u0442 \u0431\u043B\u043E\u043A\u0435\u0440\u0430, \u043A\u043E\u0442\u043E\u0440\u043E\u0433\u043E \u041D\u0415\u0422: ${lost.map((d) => d.slug).join(", ")} \u2014 \u043F\u043E \u044D\u0442\u043E\u0439 \u0441\u0441\u044B\u043B\u043A\u0435 \u043D\u0435\u0442 \u043D\u0438 \u043E\u0434\u043D\u043E\u0433\u043E \u043F\u0440\u043E\u0433\u043E\u043D\u0430; \u0441\u0430\u043C \u043D\u0435 \u043F\u043E\u0435\u0434\u0435\u0442, \u0441\u043D\u0438\u043C\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u044C (swarm_run_upsert{dependsOn:[]}) \u0438\u043B\u0438 \u0437\u0430\u0432\u0435\u0434\u0438 \u0431\u043B\u043E\u043A\u0435\u0440 \u0437\u0430\u043D\u043E\u0432\u043E (TASWM-399)` : blind.length ? `\u0436\u0434\u0451\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u0438 ${blind.map((d) => d.slug).join(", ")}, \u043D\u043E \u041F\u0420\u041E\u0414 \u0415\u0401 \u041D\u0415 \u041F\u041E\u0414\u0422\u0412\u0415\u0420\u0416\u0414\u0410\u0415\u0422: ${blind[0].attempts} \u043F\u043E\u043F\u044B\u0442(\u043E\u043A) swarm_deps_status, \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F \u043E\u0448\u0438\u0431\u043A\u0430 \u2014 ${blind[0].error}. \u041F\u043E\u043A\u0430 \u043F\u0440\u043E\u0434 \u043C\u043E\u043B\u0447\u0438\u0442, \u0432\u0435\u0440\u0434\u0438\u043A\u0442\u0430 \u043D\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438 \u043F\u0440\u043E\u0433\u043E\u043D \u0441\u0430\u043C \u043D\u0435 \u043F\u043E\u0435\u0434\u0435\u0442 (TASWM-486)` : `\u0436\u0434\u0451\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u0438: ${unmet.map((d) => d.slug).join(", ")}`;
|
|
27881
28138
|
return deferSpawn(deps, run2, why);
|
|
27882
28139
|
}
|
|
28140
|
+
const filled2 = await resolveEmptyRepo(deps, run2);
|
|
28141
|
+
if (filled2 === "failed") return "failed";
|
|
28142
|
+
if (filled2) run2 = filled2;
|
|
27883
28143
|
if (!await envGateAllows(deps, run2)) return "skipped";
|
|
27884
28144
|
if (!await projectQuotaGateAllows(deps, run2)) return "skipped";
|
|
27885
28145
|
const prodOverride = await prodOverrideReason(deps, run2, ["queued"]);
|
|
@@ -27969,6 +28229,9 @@ async function spawnQueuedRun(deps, run2) {
|
|
|
27969
28229
|
return "skipped";
|
|
27970
28230
|
}
|
|
27971
28231
|
if (e instanceof AreaBusyError) return deferSpawn(deps, run2, e.message);
|
|
28232
|
+
if (e instanceof SessionHoldError) return deferSpawn(deps, run2, e.message);
|
|
28233
|
+
const ownPid = e instanceof WorktreeBusyError ? liveDronePid(deps, deps.db.getRun(run2.id) ?? run2) : null;
|
|
28234
|
+
if (ownPid != null) return deferSpawn(deps, run2, liveDroneReason(ownPid));
|
|
27972
28235
|
if (e instanceof WorktreeBusyError && await healBusyWorktree(deps, run2, e)) {
|
|
27973
28236
|
try {
|
|
27974
28237
|
await deps.spawn(run2);
|
|
@@ -28317,11 +28580,39 @@ function returnGrokBalanceProbeToPause(deps, run2, now) {
|
|
|
28317
28580
|
narrate(deps, `${droneLabel(run2)} \u043F\u0440\u043E\u0431\u0430 \u0431\u0430\u043B\u0430\u043D\u0441\u0430 \u0443\u043C\u0435\u0440\u043B\u0430 \u0440\u0430\u043D\u044C\u0448\u0435 5 \u043C\u0438\u043D\u0443\u0442 \u2014 \u0441\u043D\u043E\u0432\u0430 \u0436\u0434\u0443. ${GROK_BALANCE_ACTION}`);
|
|
28318
28581
|
grokBalanceProbeMap(deps.db).delete(run2.id);
|
|
28319
28582
|
}
|
|
28583
|
+
async function closeStaleLimitChecker(deps, run2) {
|
|
28584
|
+
const parentId = run2.kind === "verifier" ? run2.verifies_run_id : run2.kind === "reviewer" ? run2.reviews_run_id : null;
|
|
28585
|
+
if (parentId == null) return false;
|
|
28586
|
+
const parent = deps.db.getRun(parentId);
|
|
28587
|
+
if (!parent) return false;
|
|
28588
|
+
const checkerCycle = run2.review_cycle ?? 0;
|
|
28589
|
+
const parentCycle = parent.review_cycle ?? 0;
|
|
28590
|
+
if (checkerCycle >= parentCycle) return false;
|
|
28591
|
+
if (run2.kind === "verifier") {
|
|
28592
|
+
await supersedeChecker(
|
|
28593
|
+
deps,
|
|
28594
|
+
run2,
|
|
28595
|
+
`\u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043F\u043E\u0448\u043B\u0430 \u043D\u0430 \u043D\u043E\u0432\u044B\u0439 \u043A\u0440\u0443\u0433 (\u0446\u0438\u043A\u043B ${checkerCycle} \u2192 ${parentCycle}: \u0430\u0432\u0442\u043E\u0440 \u0441\u0434\u0430\u043B \u043F\u0440\u0430\u0432\u043A\u0438) \u2014 \u044D\u0442\u0430 \u043F\u043E\u043F\u044B\u0442\u043A\u0430 \u0437\u0430\u043A\u0440\u044B\u0442\u0430, \u0434\u0438\u0444 \u043F\u043E\u0434 \u043D\u0435\u0439 \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u043E\u0439`
|
|
28596
|
+
);
|
|
28597
|
+
deps.db.addEvent(parent.id, "step", `\u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 ${run2.name} (#${run2.id}) \u043F\u0440\u043E\u0448\u043B\u043E\u0433\u043E \u0446\u0438\u043A\u043B\u0430 \u0437\u0430\u043A\u0440\u044B\u0442 \u2014 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0443 \u043F\u043E\u0434\u043D\u0438\u043C\u0435\u043C \u0441\u0432\u0435\u0436\u0435\u0439`);
|
|
28598
|
+
narrate(deps, `${droneLabel(parent)}: \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u043F\u0440\u043E\u0448\u043B\u043E\u0433\u043E \u043A\u0440\u0443\u0433\u0430 \u0435\u0449\u0451 \u0436\u0438\u0432 \u2014 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u044E \u0435\u0433\u043E, \u043F\u043E\u0437\u0434\u043D\u0438\u0439 \u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u043D\u0435 \u0437\u0430\u0441\u0447\u0438\u0442\u0430\u044E.`);
|
|
28599
|
+
return true;
|
|
28600
|
+
}
|
|
28601
|
+
await supersedeChecker(
|
|
28602
|
+
deps,
|
|
28603
|
+
run2,
|
|
28604
|
+
`\u0440\u0435\u0432\u044C\u044E \u043F\u043E\u0448\u043B\u043E \u043D\u0430 \u043D\u043E\u0432\u044B\u0439 \u043A\u0440\u0443\u0433 (\u0446\u0438\u043A\u043B ${checkerCycle} \u2192 ${parentCycle}: \u0430\u0432\u0442\u043E\u0440 \u0441\u0434\u0430\u043B \u043F\u0440\u0430\u0432\u043A\u0438) \u2014 \u044D\u0442\u0430 \u043F\u043E\u043F\u044B\u0442\u043A\u0430 \u0437\u0430\u043A\u0440\u044B\u0442\u0430, \u0434\u0438\u0444 \u043F\u043E\u0434 \u043D\u0435\u0439 \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u043E\u0439`
|
|
28605
|
+
);
|
|
28606
|
+
deps.db.addEvent(parent.id, "step", `\u0440\u0435\u0432\u044C\u044E\u0435\u0440 ${run2.name} (#${run2.id}) \u043F\u0440\u043E\u0448\u043B\u043E\u0433\u043E \u0446\u0438\u043A\u043B\u0430 \u0437\u0430\u043A\u0440\u044B\u0442 \u2014 \u0440\u0435-\u0447\u0435\u043A \u043F\u043E\u0434\u043D\u0438\u043C\u0435\u043C \u0441\u0432\u0435\u0436\u0438\u043C, \u043D\u0435 \u043F\u043E\u0432\u0435\u0440\u0445 \u0436\u0438\u0432\u043E\u0433\u043E`);
|
|
28607
|
+
narrate(deps, `${droneLabel(parent)}: \u0440\u0435\u0432\u044C\u044E\u0435\u0440 \u043F\u0440\u043E\u0448\u043B\u043E\u0433\u043E \u043A\u0440\u0443\u0433\u0430 \u0435\u0449\u0451 \u0436\u0438\u0432 \u2014 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u044E \u0435\u0433\u043E, \u0432\u0442\u043E\u0440\u043E\u0433\u043E \u043F\u043E\u0432\u0435\u0440\u0445 \u043D\u0435 \u0434\u0435\u0440\u0436\u0443.`);
|
|
28608
|
+
return true;
|
|
28609
|
+
}
|
|
28320
28610
|
async function resumeLimitWaits(deps, now, droneCap, _stormActive) {
|
|
28321
28611
|
if (!deps.respawn || countActiveDrones(deps.db) >= droneCap) return;
|
|
28322
28612
|
if (newSessionHold()) return;
|
|
28323
28613
|
const candidates = deps.db.listRuns("paused").filter((run2) => isLimitWaitDue(run2.stop_reason, now)).filter((run2) => run2.pid == null || !deps.isAlive(run2.pid)).sort((a, b) => a.updated_at.localeCompare(b.updated_at));
|
|
28324
28614
|
for (const candidate of candidates) {
|
|
28615
|
+
if (await closeStaleLimitChecker(deps, candidate)) continue;
|
|
28325
28616
|
if (stormHolds(deps, candidate)) continue;
|
|
28326
28617
|
const capHolder = cycleCapHolder(deps.db, candidate);
|
|
28327
28618
|
if (capHolder) {
|
|
@@ -29048,7 +29339,7 @@ async function answerFixBudget(deps, run2, q, answer, verdict) {
|
|
|
29048
29339
|
const mark = `${CHANGES_WAKE_ESCALATION_MARK} (\u043A\u0440\u0443\u0433 ${run2.review_cycle ?? 0})`;
|
|
29049
29340
|
const backToReview = (humanNote) => {
|
|
29050
29341
|
deps.db.updateRun(run2.id, { status: "review", stop_reason: null });
|
|
29051
|
-
if (humanNote) deps.db.addEvent(run2.id, "step", `${mark}: ${humanNote} \u2014 \u043D\u0443\u0436\u0435\u043D \u0447\u0435\u043B\u043E\u0432\u0435\u043A
|
|
29342
|
+
if (humanNote) deps.db.addEvent(run2.id, "step", `${mark}: ${humanNote} \u2014 \u043D\u0443\u0436\u0435\u043D \u0447\u0435\u043B\u043E\u0432\u0435\u043A`, "orchestrator");
|
|
29052
29343
|
budgetSyncAt.delete(run2.id);
|
|
29053
29344
|
};
|
|
29054
29345
|
if (!(base3 > 0)) return backToReview();
|
|
@@ -29077,7 +29368,7 @@ async function buildEscalationCandidates(deps, now, episodes) {
|
|
|
29077
29368
|
const candidates = [];
|
|
29078
29369
|
for (const run2 of deps.db.listRuns("review")) {
|
|
29079
29370
|
const hit = deps.db.events(run2.id).findLast(
|
|
29080
|
-
(e) => e.kind !== "anomaly" && isEscalationText(e
|
|
29371
|
+
(e) => e.kind !== "anomaly" && isEscalationText(e, run2, "supervision")
|
|
29081
29372
|
);
|
|
29082
29373
|
if (!hit) continue;
|
|
29083
29374
|
const cycleStop = (hit.text ?? "").includes(REVIEW_CYCLE_ESCALATION_MARK);
|
|
@@ -29235,6 +29526,8 @@ async function tickOnce(deps) {
|
|
|
29235
29526
|
}
|
|
29236
29527
|
deps.stepClock?.mark("0b1 \u0430\u0432\u0442\u043E\u0440 \u043D\u0435 \u0432\u044B\u0448\u0435\u043B \u043F\u043E\u0441\u043B\u0435 \u0441\u0434\u0430\u0447\u0438");
|
|
29237
29528
|
reapLingeringAuthors(deps, now);
|
|
29529
|
+
deps.stepClock?.mark("0b2 \u0432\u0442\u043E\u0440\u043E\u0439 \u0437\u0430\u043F\u0443\u0441\u043A \u043F\u0440\u0438 \u0436\u0438\u0432\u043E\u043C \u043F\u0440\u043E\u0448\u043B\u043E\u043C");
|
|
29530
|
+
reapDoubleLaunch(deps, now);
|
|
29238
29531
|
deps.stepClock?.mark("0c \u0437\u0430\u0449\u0438\u0442\u043D\u044B\u0439 sweep \u043E\u0441\u0438\u0440\u043E\u0442\u0435\u0432\u0448\u0438\u0445 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u043E\u0432/doc");
|
|
29239
29532
|
if (deps.sweep) {
|
|
29240
29533
|
const sw = deps.sweep;
|
|
@@ -30685,6 +30978,7 @@ async function makeStore(repo, worktreesDir, repoFlag, executorFor) {
|
|
|
30685
30978
|
// пересобирается тиком выше), чтобы причина «клона нет на этой машине» называла
|
|
30686
30979
|
// актуальный список, а не снимок на старте демона.
|
|
30687
30980
|
reposServed: () => repoRegistry.map((e) => e.repoFullName),
|
|
30981
|
+
servedClones: () => repoRegistry.map((e) => ({ repoFullName: e.repoFullName, path: e.path })),
|
|
30688
30982
|
// TASWM-492: обратная сторона того же реестра — путь прогона в owner/repo. Читаем из
|
|
30689
30983
|
// живого `repoRegistry` (не из снимка на старте): репозиторий могли клонировать уже
|
|
30690
30984
|
// после запуска демона, и гейт мержа не должен считать его прогон «неопознанным».
|
|
@@ -30806,6 +31100,7 @@ async function runDaemon(opts) {
|
|
|
30806
31100
|
refreshRepoMap: rebuildRepoMap,
|
|
30807
31101
|
prodMcp,
|
|
30808
31102
|
reposServed,
|
|
31103
|
+
servedClones,
|
|
30809
31104
|
repoFullNameOf
|
|
30810
31105
|
} = await makeStore(
|
|
30811
31106
|
opts.repo,
|
|
@@ -30896,7 +31191,9 @@ async function runDaemon(opts) {
|
|
|
30896
31191
|
worktreesDir,
|
|
30897
31192
|
launch,
|
|
30898
31193
|
prepare: (repo, taskSlug) => prepareReader ? prepareReader(repo, taskSlug) : Promise.resolve(null),
|
|
30899
|
-
conflicts: (run2, repo) => zoneConflictFor(db, zoneModels, activeFiles, run2, repo, opts.repo)
|
|
31194
|
+
conflicts: (run2, repo) => zoneConflictFor(db, zoneModels, activeFiles, run2, repo, opts.repo),
|
|
31195
|
+
isAlive: pidAlive
|
|
31196
|
+
// TASWM-698: реклейм не сносит каталог живого дрона
|
|
30900
31197
|
};
|
|
30901
31198
|
let intake;
|
|
30902
31199
|
if (SWARM_BACKEND === "client" && db instanceof SwarmClient && SWARM_MAX_IN_FLIGHT > 0) {
|
|
@@ -31288,7 +31585,10 @@ async function runDaemon(opts) {
|
|
|
31288
31585
|
},
|
|
31289
31586
|
// TASWM-577: прогоны GitHub Actions на HEAD — только вливанию по намерению: рой
|
|
31290
31587
|
// вливает сам и обязан дождаться, пока CI на этом коммите добежит целиком.
|
|
31291
|
-
actionsRuns: (url, sha) => prActionsRuns(url, sha)
|
|
31588
|
+
actionsRuns: (url, sha) => prActionsRuns(url, sha),
|
|
31589
|
+
// TASWM-681: отмена в очереди concurrency не видна в `gh pr checks`. Перезапуск
|
|
31590
|
+
// из пути намерения, тем же `gh run rerun -R`, что и handleCi.
|
|
31591
|
+
rerunCancelled: (prUrl, runId) => rerunActionsRun(prUrl, runId)
|
|
31292
31592
|
} : {}
|
|
31293
31593
|
});
|
|
31294
31594
|
const deps = {
|
|
@@ -31380,6 +31680,16 @@ async function runDaemon(opts) {
|
|
|
31380
31680
|
} : {},
|
|
31381
31681
|
finishTask: (slug, ws) => tlFor(ws)?.finishTask(slug) ?? Promise.resolve(),
|
|
31382
31682
|
...reposServed ? { reposServed } : {},
|
|
31683
|
+
...servedClones ? { servedClones } : {},
|
|
31684
|
+
// TASWM-696: репозитории проекта для прогона без repo. Ключ есть только у ответа
|
|
31685
|
+
// демона (get_task для isSwarmCaller). Нет клиента или задачи — undefined, и
|
|
31686
|
+
// resolveEmptyRepo оставляет прежний путь (дефолт SWARM_REPO).
|
|
31687
|
+
...tl ? {
|
|
31688
|
+
projectRepos: async (run2) => {
|
|
31689
|
+
const task = await tlFor(run2.workspace_id)?.getTask(run2.task_slug);
|
|
31690
|
+
return task?.projectRepos;
|
|
31691
|
+
}
|
|
31692
|
+
} : {},
|
|
31383
31693
|
// TASWM-422: ОТЛОЖИТЬ задачу, по которой рой трижды не сумел поднять дрона. Механика —
|
|
31384
31694
|
// ровно та же, что у return_task дрона (TASWM-412): `claimableTaskWhere` (api) требует
|
|
31385
31695
|
// категорию unstarted, и start_task её ломает — задача перестаёт быть claimable, то есть
|
|
@@ -31819,9 +32129,10 @@ async function runDaemon(opts) {
|
|
|
31819
32129
|
if (SWARM_BACKEND === "client" && db instanceof SwarmClient) {
|
|
31820
32130
|
const client = db;
|
|
31821
32131
|
const ack = (id, status, patch) => client.ackCommand(id, status, patch ?? {});
|
|
32132
|
+
const remotePause = remotePauseEffects({ setPaused, restart, cancelWait: cancelRestartWait });
|
|
31822
32133
|
const effects = {
|
|
31823
|
-
pause:
|
|
31824
|
-
resume:
|
|
32134
|
+
pause: remotePause.pause,
|
|
32135
|
+
resume: remotePause.resume,
|
|
31825
32136
|
requestRestart: (note) => {
|
|
31826
32137
|
restartWaitVersion = versionFromUpdateMessage(note ?? "");
|
|
31827
32138
|
return requestRestart(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taskless-app/swarm",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.113",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"undici": "^7.30.1",
|
|
41
41
|
"zod": "3.25.76"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "932d5ab9568a3a0bf5a68c338a052297afd0bd64",
|
|
44
44
|
"scripts": {
|
|
45
45
|
"overmind": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --conditions=development\" tsx src/overmind.ts",
|
|
46
46
|
"swarm": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --conditions=development\" tsx src/cli.ts",
|