@taskless-app/swarm 0.6.110 → 0.6.111
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
CHANGED
|
@@ -4524,7 +4524,7 @@ var init_package = __esm({
|
|
|
4524
4524
|
"package.json"() {
|
|
4525
4525
|
package_default = {
|
|
4526
4526
|
name: "@taskless-app/swarm",
|
|
4527
|
-
version: "0.6.
|
|
4527
|
+
version: "0.6.111",
|
|
4528
4528
|
type: "module",
|
|
4529
4529
|
description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
|
|
4530
4530
|
keywords: [
|
|
@@ -4576,7 +4576,7 @@ var init_package = __esm({
|
|
|
4576
4576
|
undici: "^7.30.1",
|
|
4577
4577
|
zod: "3.25.76"
|
|
4578
4578
|
},
|
|
4579
|
-
gitHead: "
|
|
4579
|
+
gitHead: "aeb50586a3d19357d384728cf3590e33ef0f8ee4"
|
|
4580
4580
|
};
|
|
4581
4581
|
}
|
|
4582
4582
|
});
|
|
@@ -6427,6 +6427,7 @@ CREATE TABLE IF NOT EXISTS imports (
|
|
|
6427
6427
|
const arr = v;
|
|
6428
6428
|
return arr && arr.length ? JSON.stringify(arr) : null;
|
|
6429
6429
|
}
|
|
6430
|
+
if (f === "decision") return v ? JSON.stringify(v) : null;
|
|
6430
6431
|
if (f === "repoless") return v === true ? 1 : v === false ? 0 : null;
|
|
6431
6432
|
if (f === "area" && typeof v === "string") return normalizeZoneLabel(v) || null;
|
|
6432
6433
|
return v;
|
|
@@ -8674,7 +8675,7 @@ var init_updateCli = __esm({
|
|
|
8674
8675
|
init_cliIo();
|
|
8675
8676
|
import { basename as basename7, dirname as dirname6, join as join32 } from "path";
|
|
8676
8677
|
import { existsSync as existsSync22, readFileSync as readFileSync23, writeFileSync as writeFileSync16, mkdirSync as mkdirSync13, readdirSync as readdirSync14, statSync as statSync14, openSync as openSync6, readSync as readSync2, closeSync as closeSync6 } from "fs";
|
|
8677
|
-
import { setTimeout as
|
|
8678
|
+
import { setTimeout as sleep3 } from "timers/promises";
|
|
8678
8679
|
|
|
8679
8680
|
// src/swarmClient.ts
|
|
8680
8681
|
init_config();
|
|
@@ -9028,6 +9029,8 @@ var SwarmClient = class _SwarmClient {
|
|
|
9028
9029
|
stormPath;
|
|
9029
9030
|
// durable-сайдкар глобальных (штормовых) событий
|
|
9030
9031
|
pending = [];
|
|
9032
|
+
/** TASWM-694: id, чья последняя refreshRun не дошла до прода. */
|
|
9033
|
+
missedProd = /* @__PURE__ */ new Set();
|
|
9031
9034
|
nextSeq = 1;
|
|
9032
9035
|
flushing = false;
|
|
9033
9036
|
flushTimer = null;
|
|
@@ -9767,20 +9770,34 @@ var SwarmClient = class _SwarmClient {
|
|
|
9767
9770
|
if (!d) return null;
|
|
9768
9771
|
const prodId = this.prodIdByKey.get(d.runKey);
|
|
9769
9772
|
if (!prodId) return this.mat(d);
|
|
9770
|
-
|
|
9773
|
+
const pendingFields = unflushedRunFields(this.pending, d.runKey);
|
|
9771
9774
|
let res;
|
|
9772
9775
|
try {
|
|
9773
9776
|
res = await this.call("swarm_list_runs", { taskId: d.task_slug, view: "full" });
|
|
9774
9777
|
} catch {
|
|
9778
|
+
this.missedProd.add(id);
|
|
9779
|
+
return this.mat(d);
|
|
9780
|
+
}
|
|
9781
|
+
if (res?.isError) {
|
|
9782
|
+
this.missedProd.add(id);
|
|
9775
9783
|
return this.mat(d);
|
|
9776
9784
|
}
|
|
9777
|
-
if (res?.isError) return this.mat(d);
|
|
9778
9785
|
const rows = res.structuredContent?.runs ?? [];
|
|
9779
9786
|
const row = rows.find((r) => String(r.id ?? "") === prodId);
|
|
9780
|
-
if (!row)
|
|
9787
|
+
if (!row) {
|
|
9788
|
+
this.missedProd.delete(id);
|
|
9789
|
+
return this.mat(d);
|
|
9790
|
+
}
|
|
9791
|
+
const saved = pendingFields ? snapshotUnflushedRun(d, pendingFields) : null;
|
|
9781
9792
|
const local = this.hydrateRun(row);
|
|
9793
|
+
if (local && saved) restoreUnflushedRun(local, saved);
|
|
9794
|
+
if (local) this.missedProd.delete(id);
|
|
9782
9795
|
return local ? this.mat(local) : null;
|
|
9783
9796
|
}
|
|
9797
|
+
/** TASWM-694: true, пока последняя сверка этого id не дошла до прода. */
|
|
9798
|
+
refreshMissedProd(id) {
|
|
9799
|
+
return this.missedProd.has(id);
|
|
9800
|
+
}
|
|
9784
9801
|
distinctRepos() {
|
|
9785
9802
|
const seen = /* @__PURE__ */ new Set();
|
|
9786
9803
|
for (const r of this.runs.values()) if (r.repo) seen.add(r.repo);
|
|
@@ -11497,6 +11514,60 @@ var SwarmClient = class _SwarmClient {
|
|
|
11497
11514
|
void this.flush();
|
|
11498
11515
|
}
|
|
11499
11516
|
};
|
|
11517
|
+
var OUTBOX_RUN_FIELD = {
|
|
11518
|
+
status: "status",
|
|
11519
|
+
area: "area",
|
|
11520
|
+
model: "model",
|
|
11521
|
+
reviewModel: "review_model",
|
|
11522
|
+
effort: "effort",
|
|
11523
|
+
droneName: "name",
|
|
11524
|
+
costUsd: "cost_usd",
|
|
11525
|
+
tokensIn: "tokens_in",
|
|
11526
|
+
tokensOut: "tokens_out",
|
|
11527
|
+
durationMs: "duration_ms",
|
|
11528
|
+
costUnmeasured: "cost_unmeasured",
|
|
11529
|
+
respawns: "respawns",
|
|
11530
|
+
prUrl: "pr_url",
|
|
11531
|
+
changedPaths: "changed_paths",
|
|
11532
|
+
branch: "branch",
|
|
11533
|
+
repo: "repo",
|
|
11534
|
+
stopReason: "stop_reason",
|
|
11535
|
+
returnReason: "return_reason",
|
|
11536
|
+
dependsOn: "depends_on",
|
|
11537
|
+
decision: "decision",
|
|
11538
|
+
role: "kind",
|
|
11539
|
+
reviewVerdict: "review_verdict",
|
|
11540
|
+
verifyVerdict: "verify_verdict",
|
|
11541
|
+
hostId: "host_id",
|
|
11542
|
+
hostPinned: "host_pinned",
|
|
11543
|
+
reviewPhase: "review_phase",
|
|
11544
|
+
baseBranch: "base_branch",
|
|
11545
|
+
heroId: "hero_run_id",
|
|
11546
|
+
resolvesRunId: "resolves_run_id",
|
|
11547
|
+
supersededById: "superseded_by",
|
|
11548
|
+
reviewsRunId: "reviews_run_id",
|
|
11549
|
+
verifiesRunId: "verifies_run_id"
|
|
11550
|
+
};
|
|
11551
|
+
function unflushedRunFields(pending2, runKey) {
|
|
11552
|
+
let merged = null;
|
|
11553
|
+
for (const e of pending2) {
|
|
11554
|
+
if (e.t !== "run" || e.runKey !== runKey) continue;
|
|
11555
|
+
merged = Object.assign(merged ?? {}, e.fields);
|
|
11556
|
+
}
|
|
11557
|
+
return merged;
|
|
11558
|
+
}
|
|
11559
|
+
function snapshotUnflushedRun(run, fields) {
|
|
11560
|
+
const saved = /* @__PURE__ */ new Map();
|
|
11561
|
+
for (const key of Object.keys(fields)) {
|
|
11562
|
+
const local = OUTBOX_RUN_FIELD[key];
|
|
11563
|
+
if (!local || saved.has(local)) continue;
|
|
11564
|
+
saved.set(local, run[local]);
|
|
11565
|
+
}
|
|
11566
|
+
return saved;
|
|
11567
|
+
}
|
|
11568
|
+
function restoreUnflushedRun(run, saved) {
|
|
11569
|
+
for (const [key, value] of saved) run[key] = value;
|
|
11570
|
+
}
|
|
11500
11571
|
function parseDecision(v) {
|
|
11501
11572
|
if (typeof v !== "string" || !v.trim()) return null;
|
|
11502
11573
|
try {
|
|
@@ -11541,13 +11612,13 @@ function tailText(text, lines) {
|
|
|
11541
11612
|
}
|
|
11542
11613
|
async function waitForReady(opts) {
|
|
11543
11614
|
const now = opts.now ?? Date.now;
|
|
11544
|
-
const
|
|
11615
|
+
const sleep4 = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
11545
11616
|
const started = now();
|
|
11546
11617
|
for (; ; ) {
|
|
11547
11618
|
if (await opts.probe()) return "ready";
|
|
11548
11619
|
if (!opts.alive()) return "died";
|
|
11549
11620
|
if (now() - started >= opts.timeoutMs) return "timeout";
|
|
11550
|
-
await
|
|
11621
|
+
await sleep4(opts.pollMs);
|
|
11551
11622
|
}
|
|
11552
11623
|
}
|
|
11553
11624
|
function launchDetached(opts) {
|
|
@@ -14758,7 +14829,7 @@ function resilientSwarmMcp(opts = {}) {
|
|
|
14758
14829
|
const backoff = opts.backoffMs?.length ? opts.backoffMs : DEFAULT_BACKOFF_MS;
|
|
14759
14830
|
const downAfterMs = opts.downAfterMs ?? DEFAULT_DOWN_AFTER_MS;
|
|
14760
14831
|
const retryDelays = opts.retryDelaysMs ?? DEFAULT_RETRY_DELAYS_MS;
|
|
14761
|
-
const
|
|
14832
|
+
const sleep4 = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
14762
14833
|
const clock = opts.now ?? Date.now;
|
|
14763
14834
|
const passBudgetMs = opts.passBudgetMs ?? PROD_PASS_BUDGET_MS;
|
|
14764
14835
|
let passSpentMs = null;
|
|
@@ -14846,7 +14917,7 @@ function resilientSwarmMcp(opts = {}) {
|
|
|
14846
14917
|
return errorResult(reason, kind === "offline" || kind === "unknown" || kind === "unauthorized" || isProdTimeout(e));
|
|
14847
14918
|
}
|
|
14848
14919
|
opts.onRetry?.({ tool: name, attempt: attempt + 1, reason });
|
|
14849
|
-
await
|
|
14920
|
+
await sleep4(delay);
|
|
14850
14921
|
}
|
|
14851
14922
|
}
|
|
14852
14923
|
};
|
|
@@ -15298,6 +15369,485 @@ async function runShotCli(argv, deps = {}) {
|
|
|
15298
15369
|
}
|
|
15299
15370
|
}
|
|
15300
15371
|
|
|
15372
|
+
// src/watch.ts
|
|
15373
|
+
init_linkFailure();
|
|
15374
|
+
init_taskless();
|
|
15375
|
+
import { writeSync as writeSync3 } from "fs";
|
|
15376
|
+
import { setTimeout as sleep2 } from "timers/promises";
|
|
15377
|
+
var WATCH_NETWORK_DOWN_MS = 5 * 60 * 1e3;
|
|
15378
|
+
var WATCH_RETRY_MS = 1e3;
|
|
15379
|
+
var WATCH_RETRY_MAX_MS = 15e3;
|
|
15380
|
+
var FEED_HANDSHAKE_MS = 2e4;
|
|
15381
|
+
var FEED_IDLE_MS = 9e4;
|
|
15382
|
+
var AGENT_FORBIDDEN_LINE = "swarm_watch \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043A\u0435\u043D\u0443 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430-\u0430\u0433\u0435\u043D\u0442\u0430. \u0412\u043E\u0437\u044C\u043C\u0438 \u0430\u0434\u0440\u0435\u0441 \u0441\u0432\u043E\u0438\u043C \u0432\u044B\u0437\u043E\u0432\u043E\u043C swarm_watch \u0438 \u0437\u0430\u043F\u0443\u0441\u0442\u0438 swarm watch --url <\u0430\u0434\u0440\u0435\u0441>. \u0410\u0434\u0440\u0435\u0441 \u2014 \u0441\u0435\u043A\u0440\u0435\u0442, \u0432 \u0432\u044B\u0432\u043E\u0434 \u0435\u0433\u043E \u043D\u0435 \u043A\u043E\u043F\u0438\u0440\u0443\u0439.";
|
|
15383
|
+
var WATCH_BACKGROUND_HINT = "\u0437\u0430\u043F\u0443\u0441\u0442\u0438 \u0444\u043E\u043D\u043E\u043C \u0438 \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0439 \u0432\u044B\u0432\u043E\u0434, \u043A\u043E\u0433\u0434\u0430 \u043A\u043E\u043C\u0430\u043D\u0434\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044F \u2014 \u043F\u0435\u0440\u0432\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430 \u0438 \u0435\u0441\u0442\u044C \u0434\u0435\u043B\u043E";
|
|
15384
|
+
var WatchDown = class extends Error {
|
|
15385
|
+
constructor(message) {
|
|
15386
|
+
super(message);
|
|
15387
|
+
this.name = "WatchDown";
|
|
15388
|
+
}
|
|
15389
|
+
};
|
|
15390
|
+
var WatchGaveUp = class extends Error {
|
|
15391
|
+
constructor(message) {
|
|
15392
|
+
super(message);
|
|
15393
|
+
this.name = "WatchGaveUp";
|
|
15394
|
+
}
|
|
15395
|
+
};
|
|
15396
|
+
var WatchAbort = class extends Error {
|
|
15397
|
+
constructor() {
|
|
15398
|
+
super("\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E");
|
|
15399
|
+
this.name = "WatchAbort";
|
|
15400
|
+
}
|
|
15401
|
+
};
|
|
15402
|
+
var STALE_ERRORS = /* @__PURE__ */ new Set(["token_expired", "invalid_token", "password_reset"]);
|
|
15403
|
+
function isRepoRef(name) {
|
|
15404
|
+
const slash = name.indexOf("/");
|
|
15405
|
+
if (slash <= 0 || name.indexOf("/", slash + 1) !== -1) return false;
|
|
15406
|
+
const owner = name.slice(0, slash);
|
|
15407
|
+
const repo = name.slice(slash + 1);
|
|
15408
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/.test(owner)) return false;
|
|
15409
|
+
if (!/^[A-Za-z0-9._-]{1,100}$/.test(repo) || /^\.+$/.test(repo)) return false;
|
|
15410
|
+
return true;
|
|
15411
|
+
}
|
|
15412
|
+
function parseRepoList(raw) {
|
|
15413
|
+
const items = raw.split(",").map((part) => part.trim()).filter((part) => part.length > 0);
|
|
15414
|
+
if (items.length === 0) return { ok: false };
|
|
15415
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15416
|
+
for (const item of items) {
|
|
15417
|
+
if (!isRepoRef(item)) return { ok: false };
|
|
15418
|
+
seen.add(item.toLowerCase());
|
|
15419
|
+
}
|
|
15420
|
+
return { ok: true, repos: [...seen].sort() };
|
|
15421
|
+
}
|
|
15422
|
+
function parseWatchArgs(argv) {
|
|
15423
|
+
const repos = [];
|
|
15424
|
+
let url = null;
|
|
15425
|
+
let stream = false;
|
|
15426
|
+
let sawRepos = false;
|
|
15427
|
+
for (let i = 0; i < argv.length; i++) {
|
|
15428
|
+
const arg = argv[i] ?? "";
|
|
15429
|
+
if (arg === "--stream") {
|
|
15430
|
+
stream = true;
|
|
15431
|
+
continue;
|
|
15432
|
+
}
|
|
15433
|
+
if (arg === "--repos") {
|
|
15434
|
+
if (sawRepos) return { ok: false, error: "\u0444\u043B\u0430\u0433 --repos \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044F \u043E\u0434\u0438\u043D \u0440\u0430\u0437" };
|
|
15435
|
+
sawRepos = true;
|
|
15436
|
+
const raw = argv[++i];
|
|
15437
|
+
if (!raw || raw.startsWith("--")) return { ok: false, error: "\u043F\u043E\u0441\u043B\u0435 --repos \u043D\u0443\u0436\u0435\u043D \u0441\u043F\u0438\u0441\u043E\u043A owner/repo \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E" };
|
|
15438
|
+
const parsed = parseRepoList(raw);
|
|
15439
|
+
if (!parsed.ok) return { ok: false, error: "\u0444\u0438\u043B\u044C\u0442\u0440 --repos: \u043D\u0443\u0436\u043D\u043E owner/repo \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E" };
|
|
15440
|
+
repos.push(...parsed.repos);
|
|
15441
|
+
continue;
|
|
15442
|
+
}
|
|
15443
|
+
if (arg === "--url") {
|
|
15444
|
+
if (url) return { ok: false, error: "\u0444\u043B\u0430\u0433 --url \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044F \u043E\u0434\u0438\u043D \u0440\u0430\u0437" };
|
|
15445
|
+
const raw = argv[++i];
|
|
15446
|
+
if (!raw || raw.startsWith("--")) return { ok: false, error: "\u043F\u043E\u0441\u043B\u0435 --url \u043D\u0443\u0436\u0435\u043D \u0430\u0434\u0440\u0435\u0441 \u043B\u0435\u043D\u0442\u044B" };
|
|
15447
|
+
if (!/^https?:\/\//i.test(raw)) return { ok: false, error: "\u0430\u0434\u0440\u0435\u0441 \u043B\u0435\u043D\u0442\u044B \u0434\u043E\u043B\u0436\u0435\u043D \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 http:// \u0438\u043B\u0438 https://" };
|
|
15448
|
+
url = raw;
|
|
15449
|
+
continue;
|
|
15450
|
+
}
|
|
15451
|
+
return { ok: false, error: "\u043D\u0435 \u043F\u043E\u043D\u044F\u043B \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442. \u041D\u0443\u0436\u043D\u043E: swarm watch [--repos owner/repo,\u2026] [--url <\u0430\u0434\u0440\u0435\u0441>] [--stream]" };
|
|
15452
|
+
}
|
|
15453
|
+
return { ok: true, repos, url, stream };
|
|
15454
|
+
}
|
|
15455
|
+
function redactFeedSecrets(text, secrets) {
|
|
15456
|
+
let out = text;
|
|
15457
|
+
const values = secrets.filter((secret) => secret.length >= 6).sort((a, b) => b.length - a.length);
|
|
15458
|
+
for (const secret of values) {
|
|
15459
|
+
if (out.includes(secret)) out = out.split(secret).join("\u2026");
|
|
15460
|
+
}
|
|
15461
|
+
return out.replace(/([?&](?:token|access_token)=)[^&\s"'<>]+/gi, "$1\u2026").replace(/\btlswarm_[A-Za-z0-9._-]+/g, "tlswarm_\u2026");
|
|
15462
|
+
}
|
|
15463
|
+
function toolText(res) {
|
|
15464
|
+
return (res.content ?? []).map((part) => part.text ?? "").filter((part) => part.length > 0).join(" ").trim();
|
|
15465
|
+
}
|
|
15466
|
+
function sseUrlFromWatchResult(res) {
|
|
15467
|
+
const text = toolText(res);
|
|
15468
|
+
if (res.unavailable) {
|
|
15469
|
+
const link2 = explainLinkFailure(text || "fetch failed");
|
|
15470
|
+
throw new WatchDown(redactFeedSecrets(link2.detail, []));
|
|
15471
|
+
}
|
|
15472
|
+
if (res.isError) {
|
|
15473
|
+
if (/agent_forbidden/.test(text)) throw new WatchGaveUp(AGENT_FORBIDDEN_LINE);
|
|
15474
|
+
const link2 = explainLinkFailure(text || "swarm_watch \u043E\u0442\u043A\u0430\u0437\u0430\u043B");
|
|
15475
|
+
if (link2.kind === "offline") throw new WatchDown(redactFeedSecrets(link2.detail, []));
|
|
15476
|
+
throw new WatchGaveUp(redactFeedSecrets(text || link2.detail, []));
|
|
15477
|
+
}
|
|
15478
|
+
const sse = res.structuredContent?.sseUrl;
|
|
15479
|
+
if (typeof sse !== "string" || sse.length === 0) throw new WatchGaveUp("swarm_watch \u043D\u0435 \u0432\u0435\u0440\u043D\u0443\u043B \u0430\u0434\u0440\u0435\u0441 \u043B\u0435\u043D\u0442\u044B");
|
|
15480
|
+
return sse;
|
|
15481
|
+
}
|
|
15482
|
+
async function obtainFeedUrl(repos, call) {
|
|
15483
|
+
const caller = call ?? await connectSwarmMcp();
|
|
15484
|
+
if (!caller) {
|
|
15485
|
+
const why = lastSwarmConnectFailure() ?? "\u043D\u0435\u0442 \u0442\u043E\u043A\u0435\u043D\u0430 \u0440\u043E\u044F \u2014 swarm login \u0438\u043B\u0438 swarm watch --url <\u0430\u0434\u0440\u0435\u0441>";
|
|
15486
|
+
const link2 = explainLinkFailure(why);
|
|
15487
|
+
if (link2.kind === "offline") throw new WatchDown(redactFeedSecrets(link2.detail, []));
|
|
15488
|
+
throw new WatchGaveUp(redactFeedSecrets(why, []));
|
|
15489
|
+
}
|
|
15490
|
+
let res;
|
|
15491
|
+
try {
|
|
15492
|
+
res = await caller("swarm_watch", repos.length > 0 ? { repos: [...repos] } : {});
|
|
15493
|
+
} catch (e) {
|
|
15494
|
+
const link2 = explainLinkFailure(e);
|
|
15495
|
+
if (link2.kind === "offline") throw new WatchDown(redactFeedSecrets(link2.detail, []));
|
|
15496
|
+
throw new WatchGaveUp(redactFeedSecrets(link2.detail, []));
|
|
15497
|
+
}
|
|
15498
|
+
return sseUrlFromWatchResult(res);
|
|
15499
|
+
}
|
|
15500
|
+
var SseParser = class {
|
|
15501
|
+
buf = "";
|
|
15502
|
+
push(chunk) {
|
|
15503
|
+
this.buf += chunk.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
15504
|
+
const out = [];
|
|
15505
|
+
while (true) {
|
|
15506
|
+
const idx = this.buf.indexOf("\n\n");
|
|
15507
|
+
if (idx < 0) break;
|
|
15508
|
+
const raw = this.buf.slice(0, idx);
|
|
15509
|
+
this.buf = this.buf.slice(idx + 2);
|
|
15510
|
+
const ev = parseBlock(raw);
|
|
15511
|
+
if (ev) out.push(ev);
|
|
15512
|
+
}
|
|
15513
|
+
return out;
|
|
15514
|
+
}
|
|
15515
|
+
};
|
|
15516
|
+
function parseBlock(raw) {
|
|
15517
|
+
let event = "message";
|
|
15518
|
+
const data = [];
|
|
15519
|
+
let comment = false;
|
|
15520
|
+
for (const line of raw.split("\n")) {
|
|
15521
|
+
if (line.length === 0 || line.startsWith(":")) {
|
|
15522
|
+
if (line.startsWith(":")) comment = true;
|
|
15523
|
+
continue;
|
|
15524
|
+
}
|
|
15525
|
+
if (line.startsWith("event:")) event = line.slice(6).trim();
|
|
15526
|
+
else if (line.startsWith("data:")) data.push(line.slice(5).replace(/^ /, ""));
|
|
15527
|
+
}
|
|
15528
|
+
if (data.length === 0) return comment ? { kind: "life" } : null;
|
|
15529
|
+
let json;
|
|
15530
|
+
try {
|
|
15531
|
+
json = JSON.parse(data.join("\n"));
|
|
15532
|
+
} catch {
|
|
15533
|
+
return null;
|
|
15534
|
+
}
|
|
15535
|
+
if (!json || typeof json !== "object") return null;
|
|
15536
|
+
const rec = json;
|
|
15537
|
+
const error = typeof rec.error === "string" ? rec.error : event === "error" ? "error" : "";
|
|
15538
|
+
if (error) {
|
|
15539
|
+
const message = typeof rec.message === "string" && rec.message.trim() ? rec.message.trim() : error;
|
|
15540
|
+
if (STALE_ERRORS.has(error)) return { kind: "stale", message };
|
|
15541
|
+
return { kind: "down", message };
|
|
15542
|
+
}
|
|
15543
|
+
if (typeof rec.text === "string" && rec.text.trim()) return { kind: "item", text: rec.text };
|
|
15544
|
+
return null;
|
|
15545
|
+
}
|
|
15546
|
+
function errorMessage(body, fallback) {
|
|
15547
|
+
try {
|
|
15548
|
+
const json = JSON.parse(body);
|
|
15549
|
+
if (typeof json.message === "string" && json.message.trim()) return json.message.trim();
|
|
15550
|
+
if (typeof json.error === "string" && json.error.trim()) return json.error.trim();
|
|
15551
|
+
} catch {
|
|
15552
|
+
}
|
|
15553
|
+
const text = body.replace(/\s+/g, " ").trim();
|
|
15554
|
+
if (!text || text.length > 300) return fallback;
|
|
15555
|
+
return text;
|
|
15556
|
+
}
|
|
15557
|
+
function oneLine(text) {
|
|
15558
|
+
return text.replace(/\r\n|[\r\n]/g, " ").trim();
|
|
15559
|
+
}
|
|
15560
|
+
async function connectFeed(url, signal, idleMs = FEED_IDLE_MS) {
|
|
15561
|
+
if (signal.aborted) throw new WatchAbort();
|
|
15562
|
+
const ctrl = new AbortController();
|
|
15563
|
+
const onAbort = () => ctrl.abort();
|
|
15564
|
+
signal.addEventListener("abort", onAbort);
|
|
15565
|
+
let gotHeaders = false;
|
|
15566
|
+
const timer = setTimeout(() => {
|
|
15567
|
+
if (!gotHeaders) ctrl.abort();
|
|
15568
|
+
}, FEED_HANDSHAKE_MS);
|
|
15569
|
+
const detach = () => {
|
|
15570
|
+
clearTimeout(timer);
|
|
15571
|
+
signal.removeEventListener("abort", onAbort);
|
|
15572
|
+
};
|
|
15573
|
+
const down = (e) => {
|
|
15574
|
+
if (signal.aborted) throw new WatchAbort();
|
|
15575
|
+
throw new WatchDown(redactFeedSecrets(describeError(e), [url]));
|
|
15576
|
+
};
|
|
15577
|
+
try {
|
|
15578
|
+
const res = await fetch(url, {
|
|
15579
|
+
headers: { accept: "text/event-stream" },
|
|
15580
|
+
redirect: "manual",
|
|
15581
|
+
signal: ctrl.signal
|
|
15582
|
+
});
|
|
15583
|
+
gotHeaders = true;
|
|
15584
|
+
clearTimeout(timer);
|
|
15585
|
+
const reader = res.body?.getReader() ?? null;
|
|
15586
|
+
const decoder = new TextDecoder();
|
|
15587
|
+
let flushed = false;
|
|
15588
|
+
const read = async () => {
|
|
15589
|
+
if (signal.aborted) throw new WatchAbort();
|
|
15590
|
+
if (!reader) return null;
|
|
15591
|
+
let idleHit = false;
|
|
15592
|
+
let idle;
|
|
15593
|
+
try {
|
|
15594
|
+
const chunk = await new Promise((resolve6, reject) => {
|
|
15595
|
+
idle = setTimeout(() => {
|
|
15596
|
+
idleHit = true;
|
|
15597
|
+
ctrl.abort();
|
|
15598
|
+
void reader.cancel().catch(() => {
|
|
15599
|
+
});
|
|
15600
|
+
reject(new WatchDown("\u043B\u0435\u043D\u0442\u0430 \u043C\u043E\u043B\u0447\u0438\u0442"));
|
|
15601
|
+
}, idleMs);
|
|
15602
|
+
reader.read().then(resolve6, reject);
|
|
15603
|
+
});
|
|
15604
|
+
if (chunk.done) {
|
|
15605
|
+
if (flushed) return null;
|
|
15606
|
+
flushed = true;
|
|
15607
|
+
const tail = decoder.decode();
|
|
15608
|
+
return tail.length > 0 ? tail : null;
|
|
15609
|
+
}
|
|
15610
|
+
return decoder.decode(chunk.value, { stream: true });
|
|
15611
|
+
} catch (e) {
|
|
15612
|
+
if (idleHit && !signal.aborted) throw new WatchDown("\u043B\u0435\u043D\u0442\u0430 \u043C\u043E\u043B\u0447\u0438\u0442");
|
|
15613
|
+
if (e instanceof WatchAbort || e instanceof WatchDown) throw e;
|
|
15614
|
+
return down(e);
|
|
15615
|
+
} finally {
|
|
15616
|
+
if (idle) clearTimeout(idle);
|
|
15617
|
+
}
|
|
15618
|
+
};
|
|
15619
|
+
const text = async () => {
|
|
15620
|
+
let out = "";
|
|
15621
|
+
while (out.length < 4096) {
|
|
15622
|
+
const chunk = await read();
|
|
15623
|
+
if (chunk === null) break;
|
|
15624
|
+
out += chunk;
|
|
15625
|
+
}
|
|
15626
|
+
return out;
|
|
15627
|
+
};
|
|
15628
|
+
return {
|
|
15629
|
+
status: res.status,
|
|
15630
|
+
read,
|
|
15631
|
+
text,
|
|
15632
|
+
close() {
|
|
15633
|
+
detach();
|
|
15634
|
+
ctrl.abort();
|
|
15635
|
+
void reader?.cancel().catch(() => {
|
|
15636
|
+
});
|
|
15637
|
+
}
|
|
15638
|
+
};
|
|
15639
|
+
} catch (e) {
|
|
15640
|
+
detach();
|
|
15641
|
+
if (e instanceof WatchAbort || e instanceof WatchDown) throw e;
|
|
15642
|
+
return down(e);
|
|
15643
|
+
}
|
|
15644
|
+
}
|
|
15645
|
+
async function runWatch(args, io) {
|
|
15646
|
+
const signal = args.signal ?? new AbortController().signal;
|
|
15647
|
+
const secrets = [];
|
|
15648
|
+
const hide = (text) => redactFeedSecrets(text, secrets);
|
|
15649
|
+
const remember = (url2) => {
|
|
15650
|
+
secrets.push(url2);
|
|
15651
|
+
try {
|
|
15652
|
+
const token = new URL(url2).searchParams.get("token");
|
|
15653
|
+
if (token) secrets.push(token);
|
|
15654
|
+
} catch {
|
|
15655
|
+
}
|
|
15656
|
+
};
|
|
15657
|
+
let url = args.url;
|
|
15658
|
+
if (url) remember(url);
|
|
15659
|
+
let refreshed = false;
|
|
15660
|
+
let delay = WATCH_RETRY_MS;
|
|
15661
|
+
let downSince = null;
|
|
15662
|
+
const giveUpDown = (cause) => {
|
|
15663
|
+
const t = io.now();
|
|
15664
|
+
if (downSince === null) downSince = t;
|
|
15665
|
+
if (t - downSince >= WATCH_NETWORK_DOWN_MS) {
|
|
15666
|
+
io.writeError(`\u0441\u0435\u0442\u044C \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0434\u043E\u043B\u044C\u0448\u0435 5 \u043C\u0438\u043D\u0443\u0442: ${hide(cause)}`);
|
|
15667
|
+
return 2;
|
|
15668
|
+
}
|
|
15669
|
+
return null;
|
|
15670
|
+
};
|
|
15671
|
+
const paused = async () => {
|
|
15672
|
+
if (signal.aborted) throw new WatchAbort();
|
|
15673
|
+
await io.sleep(delay);
|
|
15674
|
+
if (signal.aborted) throw new WatchAbort();
|
|
15675
|
+
delay = Math.min(delay * 2, WATCH_RETRY_MAX_MS);
|
|
15676
|
+
};
|
|
15677
|
+
const takeError = (e) => {
|
|
15678
|
+
if (e instanceof WatchAbort || e instanceof WatchDown || e instanceof WatchGaveUp) return e;
|
|
15679
|
+
if (signal.aborted) return new WatchAbort();
|
|
15680
|
+
const link2 = explainLinkFailure(e);
|
|
15681
|
+
if (link2.kind === "offline") return new WatchDown(link2.detail);
|
|
15682
|
+
return new WatchGaveUp(link2.detail);
|
|
15683
|
+
};
|
|
15684
|
+
try {
|
|
15685
|
+
while (!signal.aborted) {
|
|
15686
|
+
if (!url) {
|
|
15687
|
+
try {
|
|
15688
|
+
url = await io.obtainUrl(args.repos);
|
|
15689
|
+
remember(url);
|
|
15690
|
+
refreshed = true;
|
|
15691
|
+
} catch (e) {
|
|
15692
|
+
const err = takeError(e);
|
|
15693
|
+
if (err instanceof WatchAbort) return 130;
|
|
15694
|
+
if (err instanceof WatchGaveUp) {
|
|
15695
|
+
io.writeError(hide(err.message));
|
|
15696
|
+
return 2;
|
|
15697
|
+
}
|
|
15698
|
+
const code = giveUpDown(err.message);
|
|
15699
|
+
if (code) return code;
|
|
15700
|
+
await paused();
|
|
15701
|
+
continue;
|
|
15702
|
+
}
|
|
15703
|
+
}
|
|
15704
|
+
let step = "pause";
|
|
15705
|
+
let cause = "\u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u043E\u0431\u043E\u0440\u0432\u0430\u043B\u043E\u0441\u044C";
|
|
15706
|
+
let exit;
|
|
15707
|
+
let clearUrl = false;
|
|
15708
|
+
let body = null;
|
|
15709
|
+
try {
|
|
15710
|
+
body = await io.connect(url, signal);
|
|
15711
|
+
if (body.status === 401) {
|
|
15712
|
+
const message = errorMessage(await body.text(), "\u0430\u0434\u0440\u0435\u0441 \u043B\u0435\u043D\u0442\u044B \u043D\u0435 \u043F\u0440\u0438\u043D\u044F\u0442");
|
|
15713
|
+
if (refreshed) {
|
|
15714
|
+
io.writeError(hide(message));
|
|
15715
|
+
return 2;
|
|
15716
|
+
}
|
|
15717
|
+
clearUrl = true;
|
|
15718
|
+
step = "again";
|
|
15719
|
+
} else if (body.status === 400) {
|
|
15720
|
+
io.writeError(hide(errorMessage(await body.text(), "\u0430\u0434\u0440\u0435\u0441 \u043B\u0435\u043D\u0442\u044B \u043E\u0442\u0432\u0435\u0440\u0433\u043D\u0443\u0442")));
|
|
15721
|
+
return 2;
|
|
15722
|
+
} else if (body.status !== 200) {
|
|
15723
|
+
cause = `\u043B\u0435\u043D\u0442\u0430 \u043E\u0442\u0432\u0435\u0442\u0438\u043B\u0430 ${body.status}`;
|
|
15724
|
+
step = "down";
|
|
15725
|
+
} else {
|
|
15726
|
+
const read = await readStream(body);
|
|
15727
|
+
step = read.step;
|
|
15728
|
+
cause = read.cause;
|
|
15729
|
+
exit = read.exit;
|
|
15730
|
+
clearUrl = read.clearUrl;
|
|
15731
|
+
}
|
|
15732
|
+
} catch (e) {
|
|
15733
|
+
const err = takeError(e);
|
|
15734
|
+
if (err instanceof WatchAbort) return 130;
|
|
15735
|
+
if (err instanceof WatchGaveUp) {
|
|
15736
|
+
io.writeError(hide(err.message));
|
|
15737
|
+
return 2;
|
|
15738
|
+
}
|
|
15739
|
+
cause = err.message;
|
|
15740
|
+
step = "down";
|
|
15741
|
+
} finally {
|
|
15742
|
+
body?.close();
|
|
15743
|
+
}
|
|
15744
|
+
if (exit !== void 0) return exit;
|
|
15745
|
+
if (clearUrl) url = null;
|
|
15746
|
+
if (step === "again") continue;
|
|
15747
|
+
if (step === "down") {
|
|
15748
|
+
const code = giveUpDown(cause);
|
|
15749
|
+
if (code) return code;
|
|
15750
|
+
} else {
|
|
15751
|
+
downSince = null;
|
|
15752
|
+
}
|
|
15753
|
+
await paused();
|
|
15754
|
+
}
|
|
15755
|
+
return 130;
|
|
15756
|
+
} catch (e) {
|
|
15757
|
+
if (e instanceof WatchAbort || signal.aborted) return 130;
|
|
15758
|
+
if (e instanceof WatchGaveUp) {
|
|
15759
|
+
io.writeError(hide(e.message));
|
|
15760
|
+
return 2;
|
|
15761
|
+
}
|
|
15762
|
+
throw e;
|
|
15763
|
+
}
|
|
15764
|
+
async function readStream(stream) {
|
|
15765
|
+
const parser = new SseParser();
|
|
15766
|
+
let life = false;
|
|
15767
|
+
const noteUp = () => {
|
|
15768
|
+
life = true;
|
|
15769
|
+
downSince = null;
|
|
15770
|
+
delay = WATCH_RETRY_MS;
|
|
15771
|
+
};
|
|
15772
|
+
while (!signal.aborted) {
|
|
15773
|
+
const chunk = await stream.read();
|
|
15774
|
+
if (chunk === null) {
|
|
15775
|
+
return life ? { step: "pause", cause: "", clearUrl: false } : { step: "down", cause: "\u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u043E\u0431\u043E\u0440\u0432\u0430\u043B\u043E\u0441\u044C", clearUrl: false };
|
|
15776
|
+
}
|
|
15777
|
+
for (const ev of parser.push(chunk)) {
|
|
15778
|
+
if (ev.kind === "life") {
|
|
15779
|
+
noteUp();
|
|
15780
|
+
continue;
|
|
15781
|
+
}
|
|
15782
|
+
if (ev.kind === "item") {
|
|
15783
|
+
noteUp();
|
|
15784
|
+
refreshed = false;
|
|
15785
|
+
const line = hide(oneLine(ev.text));
|
|
15786
|
+
if (!line) continue;
|
|
15787
|
+
io.write(line);
|
|
15788
|
+
if (!args.stream) return { step: "again", cause: "", exit: 0, clearUrl: false };
|
|
15789
|
+
continue;
|
|
15790
|
+
}
|
|
15791
|
+
if (ev.kind === "stale") {
|
|
15792
|
+
if (refreshed) {
|
|
15793
|
+
io.writeError(hide(ev.message || "\u0430\u0434\u0440\u0435\u0441 \u043B\u0435\u043D\u0442\u044B \u043F\u0440\u043E\u0442\u0443\u0445"));
|
|
15794
|
+
return { step: "again", cause: "", exit: 2, clearUrl: false };
|
|
15795
|
+
}
|
|
15796
|
+
return { step: "again", cause: "", clearUrl: true };
|
|
15797
|
+
}
|
|
15798
|
+
return { step: "down", cause: ev.message || "\u043B\u0435\u043D\u0442\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430", clearUrl: false };
|
|
15799
|
+
}
|
|
15800
|
+
}
|
|
15801
|
+
return { step: "again", cause: "", exit: 130, clearUrl: false };
|
|
15802
|
+
}
|
|
15803
|
+
}
|
|
15804
|
+
function writeFd(fd, line) {
|
|
15805
|
+
try {
|
|
15806
|
+
writeSync3(fd, `${line}
|
|
15807
|
+
`);
|
|
15808
|
+
} catch (e) {
|
|
15809
|
+
const code = e.code;
|
|
15810
|
+
if (code === "EPIPE") throw new WatchAbort();
|
|
15811
|
+
throw e;
|
|
15812
|
+
}
|
|
15813
|
+
}
|
|
15814
|
+
async function sleepAbortable(ms, signal) {
|
|
15815
|
+
if (signal.aborted) throw new WatchAbort();
|
|
15816
|
+
try {
|
|
15817
|
+
await sleep2(ms, void 0, { signal });
|
|
15818
|
+
} catch (e) {
|
|
15819
|
+
if (signal.aborted) throw new WatchAbort();
|
|
15820
|
+
throw e;
|
|
15821
|
+
}
|
|
15822
|
+
}
|
|
15823
|
+
async function runWatchCli(argv) {
|
|
15824
|
+
const parsed = parseWatchArgs(argv);
|
|
15825
|
+
if (!parsed.ok) {
|
|
15826
|
+
writeFd(2, parsed.error);
|
|
15827
|
+
return 1;
|
|
15828
|
+
}
|
|
15829
|
+
const ac = new AbortController();
|
|
15830
|
+
const stop = () => ac.abort();
|
|
15831
|
+
process.on("SIGINT", stop);
|
|
15832
|
+
process.on("SIGTERM", stop);
|
|
15833
|
+
try {
|
|
15834
|
+
return await runWatch(
|
|
15835
|
+
{ repos: parsed.repos, url: parsed.url, stream: parsed.stream, signal: ac.signal },
|
|
15836
|
+
{
|
|
15837
|
+
now: () => Date.now(),
|
|
15838
|
+
sleep: (ms) => sleepAbortable(ms, ac.signal),
|
|
15839
|
+
write: (line) => writeFd(1, line),
|
|
15840
|
+
writeError: (line) => writeFd(2, line),
|
|
15841
|
+
connect: connectFeed,
|
|
15842
|
+
obtainUrl: (repos) => obtainFeedUrl(repos)
|
|
15843
|
+
}
|
|
15844
|
+
);
|
|
15845
|
+
} finally {
|
|
15846
|
+
process.off("SIGINT", stop);
|
|
15847
|
+
process.off("SIGTERM", stop);
|
|
15848
|
+
}
|
|
15849
|
+
}
|
|
15850
|
+
|
|
15301
15851
|
// src/cli.ts
|
|
15302
15852
|
init_daemonLink();
|
|
15303
15853
|
init_pauseState();
|
|
@@ -15446,7 +15996,7 @@ async function runLoginFlow(db2, opts) {
|
|
|
15446
15996
|
loadStore,
|
|
15447
15997
|
beforeToken: null,
|
|
15448
15998
|
now: Date.now,
|
|
15449
|
-
sleep:
|
|
15999
|
+
sleep: sleep3,
|
|
15450
16000
|
timeoutMs: 5 * 6e4,
|
|
15451
16001
|
pollMs: 1e3
|
|
15452
16002
|
});
|
|
@@ -15540,7 +16090,7 @@ async function waitDaemonDown(opts) {
|
|
|
15540
16090
|
console.log(lastLive ? `\u0436\u0434\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0436\u0438\u0432\u044B\u0445 \u0441\u0435\u0441\u0441\u0438\u0439: ${lastLive}\u2026` : "\u0436\u0438\u0432\u044B\u0445 \u0441\u0435\u0441\u0441\u0438\u0439 \u043D\u0435 \u043E\u0441\u0442\u0430\u043B\u043E\u0441\u044C \u2014 \u0433\u0430\u0448\u0443\u2026");
|
|
15541
16091
|
}
|
|
15542
16092
|
if (Date.now() >= until) return false;
|
|
15543
|
-
await
|
|
16093
|
+
await sleep3(pollMs);
|
|
15544
16094
|
}
|
|
15545
16095
|
}
|
|
15546
16096
|
var START_READY_TIMEOUT_MS = 45e3;
|
|
@@ -15614,7 +16164,7 @@ async function runDaemonLogs(argv) {
|
|
|
15614
16164
|
if (!follow) return 0;
|
|
15615
16165
|
let pos = statSync14(DAEMON_LOG_PATH).size;
|
|
15616
16166
|
for (; ; ) {
|
|
15617
|
-
await
|
|
16167
|
+
await sleep3(500);
|
|
15618
16168
|
let size;
|
|
15619
16169
|
try {
|
|
15620
16170
|
size = statSync14(DAEMON_LOG_PATH).size;
|
|
@@ -15851,6 +16401,15 @@ function usage() {
|
|
|
15851
16401
|
swarm logs [-n 200] [-f] \u043B\u043E\u0433 \u0414\u0415\u041C\u041E\u041D\u0410 (~/.taskless-swarm/overmind.log)
|
|
15852
16402
|
swarm log <runId> \u043B\u043E\u0433 \u043E\u0434\u043D\u043E\u0433\u043E \u041F\u0420\u041E\u0413\u041E\u041D\u0410 \u2014 \u043D\u0435 \u043F\u0443\u0442\u0430\u0442\u044C \u0441 \u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u0439
|
|
15853
16403
|
swarm web \u0432\u0435\u0431-\u043C\u043E\u0440\u0434\u0430 \u0440\u043E\u044F \u043D\u0430 127.0.0.1:${WEB_PORT}
|
|
16404
|
+
swarm watch [--repos owner/repo,\u2026] [--url <\u0430\u0434\u0440\u0435\u0441>] [--stream]
|
|
16405
|
+
\u0436\u0434\u0430\u0442\u044C \u0434\u0435\u043B\u043E \u043B\u0435\u043D\u0442\u044B \u043E\u0440\u043A\u0435\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430. \u0410\u0434\u0440\u0435\u0441 \u2014 MCP swarm_watch
|
|
16406
|
+
\u0442\u043E\u043A\u0435\u043D\u043E\u043C \u044D\u0442\u043E\u0439 \u043C\u0430\u0448\u0438\u043D\u044B \u0438\u043B\u0438 --url. \u0422\u043E\u043A\u0435\u043D \u0438\u0437 \u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0435 \u043F\u0435\u0447\u0430\u0442\u0430\u0435\u0442\u0441\u044F.
|
|
16407
|
+
\u0411\u0435\u0437 --stream \u2014 \u043F\u0435\u0440\u0432\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430 \u0434\u0435\u043B\u0430 \u0438 \u0432\u044B\u0445\u043E\u0434 0. ${WATCH_BACKGROUND_HINT}:
|
|
16408
|
+
swarm watch
|
|
16409
|
+
--stream \u2014 \u0441\u0442\u0440\u043E\u043A\u0430 \u043D\u0430 \u043A\u0430\u0436\u0434\u043E\u0435 \u0434\u0435\u043B\u043E, \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u043D\u0435 \u0432\u044B\u0445\u043E\u0434\u0438\u0442.
|
|
16410
|
+
\u041E\u0431\u0440\u044B\u0432 \u2014 \u043F\u0435\u0440\u0435\u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435. \u0410\u0434\u0440\u0435\u0441 \u043F\u0440\u043E\u0442\u0443\u0445 \u2014 \u043D\u043E\u0432\u044B\u0439 \u0447\u0435\u0440\u0435\u0437
|
|
16411
|
+
swarm_watch. \u0421\u0435\u0442\u044C \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 5 \u043C\u0438\u043D\u0443\u0442 \u2014 \u0432\u044B\u0445\u043E\u0434 2 \u0438 \u0441\u0442\u0440\u043E\u043A\u0430
|
|
16412
|
+
\u043F\u0440\u0438\u0447\u0438\u043D\u044B.
|
|
15854
16413
|
|
|
15855
16414
|
\u041F\u0420\u041E\u0427\u0415\u0415
|
|
15856
16415
|
swarm whoami \u043A\u0442\u043E \u0432\u043E\u0448\u0451\u043B \u0438 \u0432 \u043A\u0430\u043A\u043E\u043C \u0432\u043E\u0440\u043A\u0441\u043F\u0435\u0439\u0441\u0435
|
|
@@ -16309,6 +16868,9 @@ if (cmd === "shot") {
|
|
|
16309
16868
|
const code = await runShotCli(rawArgs);
|
|
16310
16869
|
process.exit(code);
|
|
16311
16870
|
}
|
|
16871
|
+
if (cmd === "watch") {
|
|
16872
|
+
process.exit(await runWatchCli(rawArgs));
|
|
16873
|
+
}
|
|
16312
16874
|
if (!cmd || cmd === "--help" || cmd === "-h") {
|
|
16313
16875
|
usage();
|
|
16314
16876
|
process.exit(0);
|
|
@@ -16466,7 +17028,7 @@ switch (cmd) {
|
|
|
16466
17028
|
// TASWM-592 (ревью): сессию ищет харнесс ПРОГОНА, а не глобальный исполнитель —
|
|
16467
17029
|
// иначе побудка codex-прогона при мёртвом демоне теряла продолжаемую сессию.
|
|
16468
17030
|
hasTranscript: (run2) => !!run2.worktree_path && executorForRun(run2, null).session.exists(run2.worktree_path),
|
|
16469
|
-
respawn: (r, mode, nudge) => respawnRun(
|
|
17031
|
+
respawn: (r, mode, nudge, note) => respawnRun(
|
|
16470
17032
|
{
|
|
16471
17033
|
db,
|
|
16472
17034
|
launch,
|
|
@@ -16478,7 +17040,8 @@ switch (cmd) {
|
|
|
16478
17040
|
},
|
|
16479
17041
|
r,
|
|
16480
17042
|
mode,
|
|
16481
|
-
nudge
|
|
17043
|
+
nudge,
|
|
17044
|
+
note
|
|
16482
17045
|
)
|
|
16483
17046
|
},
|
|
16484
17047
|
runId
|