@taskless-app/swarm 0.4.3 → 0.4.4
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 +19 -11
- package/dist/overmind.js +27 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1464,7 +1464,19 @@ import { randomUUID } from "crypto";
|
|
|
1464
1464
|
|
|
1465
1465
|
// src/resources.ts
|
|
1466
1466
|
import os from "os";
|
|
1467
|
+
|
|
1468
|
+
// src/quietExec.ts
|
|
1467
1469
|
import { execFileSync } from "child_process";
|
|
1470
|
+
function execQuiet(file, args = [], opts = {}) {
|
|
1471
|
+
return execFileSync(file, args, {
|
|
1472
|
+
encoding: "utf8",
|
|
1473
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1474
|
+
...opts.maxBuffer ? { maxBuffer: opts.maxBuffer } : {}
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
var PROC_SNAPSHOT_MAX_BUFFER = 16 * 1024 * 1024;
|
|
1478
|
+
|
|
1479
|
+
// src/resources.ts
|
|
1468
1480
|
import { readFileSync as readFileSync2, statfsSync } from "fs";
|
|
1469
1481
|
function isTransientResourceError(e) {
|
|
1470
1482
|
const code = e?.code;
|
|
@@ -1489,7 +1501,7 @@ function parseVmStatAvailableBytes(vmStatOut) {
|
|
|
1489
1501
|
function availableMemBytes() {
|
|
1490
1502
|
if (process.platform === "darwin") {
|
|
1491
1503
|
try {
|
|
1492
|
-
const bytes = parseVmStatAvailableBytes(
|
|
1504
|
+
const bytes = parseVmStatAvailableBytes(execQuiet("vm_stat"));
|
|
1493
1505
|
if (bytes > 0) return bytes;
|
|
1494
1506
|
} catch (e) {
|
|
1495
1507
|
logTransientSpawnError("vm_stat", e);
|
|
@@ -1503,7 +1515,7 @@ function parseSysctlInt(out) {
|
|
|
1503
1515
|
}
|
|
1504
1516
|
function readSysctlPair(nameA, nameB) {
|
|
1505
1517
|
try {
|
|
1506
|
-
const lines =
|
|
1518
|
+
const lines = execQuiet("sysctl", ["-n", nameA, nameB]).trim().split("\n");
|
|
1507
1519
|
return [parseSysctlInt(lines[0] ?? ""), parseSysctlInt(lines[1] ?? "")];
|
|
1508
1520
|
} catch (e) {
|
|
1509
1521
|
logTransientSpawnError(`sysctl ${nameA}/${nameB}`, e);
|
|
@@ -3364,11 +3376,7 @@ function tailFile(path, lines) {
|
|
|
3364
3376
|
}
|
|
3365
3377
|
}
|
|
3366
3378
|
|
|
3367
|
-
// src/procCleanup.ts
|
|
3368
|
-
import { execFileSync as execFileSync3 } from "child_process";
|
|
3369
|
-
|
|
3370
3379
|
// src/procList.ts
|
|
3371
|
-
import { execFileSync as execFileSync2 } from "child_process";
|
|
3372
3380
|
function parsePsRows(out) {
|
|
3373
3381
|
const rows = [];
|
|
3374
3382
|
for (const line of out.split("\n")) {
|
|
@@ -3404,7 +3412,7 @@ function parseWinProcRows(out) {
|
|
|
3404
3412
|
}
|
|
3405
3413
|
var WIN_PS_COMMAND = "Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,CommandLine | ConvertTo-Json -Depth 2 -Compress";
|
|
3406
3414
|
function realExec(file, args) {
|
|
3407
|
-
return
|
|
3415
|
+
return execQuiet(file, args, { maxBuffer: PROC_SNAPSHOT_MAX_BUFFER });
|
|
3408
3416
|
}
|
|
3409
3417
|
function listProcs(opts = {}) {
|
|
3410
3418
|
const platform = opts.platform ?? process.platform;
|
|
@@ -3472,7 +3480,7 @@ function pidsWithCwdUnder(dir, opts = {}) {
|
|
|
3472
3480
|
if ((opts.platform ?? process.platform) === "win32") return winProcsUnder(dir, opts.procs ?? listProcs);
|
|
3473
3481
|
let out;
|
|
3474
3482
|
try {
|
|
3475
|
-
out =
|
|
3483
|
+
out = execQuiet("lsof", ["-w", "-a", "-d", "cwd", "-F", "pn"], { maxBuffer: PROC_SNAPSHOT_MAX_BUFFER });
|
|
3476
3484
|
} catch (e) {
|
|
3477
3485
|
logTransientSpawnError("lsof", e);
|
|
3478
3486
|
return [];
|
|
@@ -3555,7 +3563,7 @@ function containerBelongsToPrefix(name, prefix) {
|
|
|
3555
3563
|
}
|
|
3556
3564
|
function dockerContainerNames() {
|
|
3557
3565
|
try {
|
|
3558
|
-
return
|
|
3566
|
+
return execQuiet("docker", ["ps", "-a", "--format", "{{.Names}}"]).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
3559
3567
|
} catch (e) {
|
|
3560
3568
|
logTransientSpawnError("docker ps", e);
|
|
3561
3569
|
return [];
|
|
@@ -3565,7 +3573,7 @@ function removeContainers(names) {
|
|
|
3565
3573
|
const removed = [];
|
|
3566
3574
|
for (const name of names) {
|
|
3567
3575
|
try {
|
|
3568
|
-
|
|
3576
|
+
execQuiet("docker", ["rm", "-f", name]);
|
|
3569
3577
|
removed.push(name);
|
|
3570
3578
|
} catch (e) {
|
|
3571
3579
|
console.warn(`[procCleanup] docker rm -f ${name} \u0441\u043E\u0440\u0432\u0430\u043B\u0441\u044F: ${String(e)}`);
|
|
@@ -3932,7 +3940,7 @@ async function collectRunDiff(worktree, opts = {}) {
|
|
|
3932
3940
|
// package.json
|
|
3933
3941
|
var package_default = {
|
|
3934
3942
|
name: "@taskless-app/swarm",
|
|
3935
|
-
version: "0.4.
|
|
3943
|
+
version: "0.4.4",
|
|
3936
3944
|
type: "module",
|
|
3937
3945
|
description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
|
|
3938
3946
|
keywords: [
|
package/dist/overmind.js
CHANGED
|
@@ -1910,9 +1910,25 @@ CREATE TABLE IF NOT EXISTS imports (
|
|
|
1910
1910
|
}
|
|
1911
1911
|
});
|
|
1912
1912
|
|
|
1913
|
+
// src/quietExec.ts
|
|
1914
|
+
import { execFileSync } from "child_process";
|
|
1915
|
+
function execQuiet(file, args = [], opts = {}) {
|
|
1916
|
+
return execFileSync(file, args, {
|
|
1917
|
+
encoding: "utf8",
|
|
1918
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1919
|
+
...opts.maxBuffer ? { maxBuffer: opts.maxBuffer } : {}
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
var PROC_SNAPSHOT_MAX_BUFFER;
|
|
1923
|
+
var init_quietExec = __esm({
|
|
1924
|
+
"src/quietExec.ts"() {
|
|
1925
|
+
"use strict";
|
|
1926
|
+
PROC_SNAPSHOT_MAX_BUFFER = 16 * 1024 * 1024;
|
|
1927
|
+
}
|
|
1928
|
+
});
|
|
1929
|
+
|
|
1913
1930
|
// src/resources.ts
|
|
1914
1931
|
import os from "os";
|
|
1915
|
-
import { execFileSync } from "child_process";
|
|
1916
1932
|
import { readFileSync as readFileSync3, statfsSync } from "fs";
|
|
1917
1933
|
function isTransientResourceError(e) {
|
|
1918
1934
|
const code = e?.code;
|
|
@@ -1943,7 +1959,7 @@ function parseVmStatAvailableBytes(vmStatOut) {
|
|
|
1943
1959
|
function availableMemBytes() {
|
|
1944
1960
|
if (process.platform === "darwin") {
|
|
1945
1961
|
try {
|
|
1946
|
-
const bytes = parseVmStatAvailableBytes(
|
|
1962
|
+
const bytes = parseVmStatAvailableBytes(execQuiet("vm_stat"));
|
|
1947
1963
|
if (bytes > 0) return bytes;
|
|
1948
1964
|
} catch (e) {
|
|
1949
1965
|
logTransientSpawnError("vm_stat", e);
|
|
@@ -1957,7 +1973,7 @@ function parseSysctlInt(out) {
|
|
|
1957
1973
|
}
|
|
1958
1974
|
function readSysctlPair(nameA, nameB) {
|
|
1959
1975
|
try {
|
|
1960
|
-
const lines =
|
|
1976
|
+
const lines = execQuiet("sysctl", ["-n", nameA, nameB]).trim().split("\n");
|
|
1961
1977
|
return [parseSysctlInt(lines[0] ?? ""), parseSysctlInt(lines[1] ?? "")];
|
|
1962
1978
|
} catch (e) {
|
|
1963
1979
|
logTransientSpawnError(`sysctl ${nameA}/${nameB}`, e);
|
|
@@ -2099,6 +2115,7 @@ var prevCpuTicks, RESOURCES_CACHE_MS, readingCache;
|
|
|
2099
2115
|
var init_resources = __esm({
|
|
2100
2116
|
"src/resources.ts"() {
|
|
2101
2117
|
"use strict";
|
|
2118
|
+
init_quietExec();
|
|
2102
2119
|
init_config();
|
|
2103
2120
|
prevCpuTicks = null;
|
|
2104
2121
|
RESOURCES_CACHE_MS = 250;
|
|
@@ -2133,7 +2150,6 @@ var init_heartbeat = __esm({
|
|
|
2133
2150
|
});
|
|
2134
2151
|
|
|
2135
2152
|
// src/procList.ts
|
|
2136
|
-
import { execFileSync as execFileSync2 } from "child_process";
|
|
2137
2153
|
function parsePsRows(out) {
|
|
2138
2154
|
const rows = [];
|
|
2139
2155
|
for (const line of out.split("\n")) {
|
|
@@ -2168,7 +2184,7 @@ function parseWinProcRows(out) {
|
|
|
2168
2184
|
return rows;
|
|
2169
2185
|
}
|
|
2170
2186
|
function realExec(file, args) {
|
|
2171
|
-
return
|
|
2187
|
+
return execQuiet(file, args, { maxBuffer: PROC_SNAPSHOT_MAX_BUFFER });
|
|
2172
2188
|
}
|
|
2173
2189
|
function listProcs(opts = {}) {
|
|
2174
2190
|
const platform = opts.platform ?? process.platform;
|
|
@@ -2226,13 +2242,13 @@ var WIN_PS_COMMAND;
|
|
|
2226
2242
|
var init_procList = __esm({
|
|
2227
2243
|
"src/procList.ts"() {
|
|
2228
2244
|
"use strict";
|
|
2245
|
+
init_quietExec();
|
|
2229
2246
|
init_resources();
|
|
2230
2247
|
WIN_PS_COMMAND = "Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,CommandLine | ConvertTo-Json -Depth 2 -Compress";
|
|
2231
2248
|
}
|
|
2232
2249
|
});
|
|
2233
2250
|
|
|
2234
2251
|
// src/procCleanup.ts
|
|
2235
|
-
import { execFileSync as execFileSync3 } from "child_process";
|
|
2236
2252
|
function sleep(ms) {
|
|
2237
2253
|
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
2238
2254
|
}
|
|
@@ -2262,7 +2278,7 @@ function pidsWithCwdUnder(dir, opts = {}) {
|
|
|
2262
2278
|
if ((opts.platform ?? process.platform) === "win32") return winProcsUnder(dir, opts.procs ?? listProcs);
|
|
2263
2279
|
let out;
|
|
2264
2280
|
try {
|
|
2265
|
-
out =
|
|
2281
|
+
out = execQuiet("lsof", ["-w", "-a", "-d", "cwd", "-F", "pn"], { maxBuffer: PROC_SNAPSHOT_MAX_BUFFER });
|
|
2266
2282
|
} catch (e) {
|
|
2267
2283
|
logTransientSpawnError("lsof", e);
|
|
2268
2284
|
return [];
|
|
@@ -2373,7 +2389,7 @@ function findOrphanContainers(containerNames, runs) {
|
|
|
2373
2389
|
}
|
|
2374
2390
|
function dockerContainerNames() {
|
|
2375
2391
|
try {
|
|
2376
|
-
return
|
|
2392
|
+
return execQuiet("docker", ["ps", "-a", "--format", "{{.Names}}"]).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
2377
2393
|
} catch (e) {
|
|
2378
2394
|
logTransientSpawnError("docker ps", e);
|
|
2379
2395
|
return [];
|
|
@@ -2383,7 +2399,7 @@ function removeContainers(names) {
|
|
|
2383
2399
|
const removed = [];
|
|
2384
2400
|
for (const name of names) {
|
|
2385
2401
|
try {
|
|
2386
|
-
|
|
2402
|
+
execQuiet("docker", ["rm", "-f", name]);
|
|
2387
2403
|
removed.push(name);
|
|
2388
2404
|
} catch (e) {
|
|
2389
2405
|
console.warn(`[procCleanup] docker rm -f ${name} \u0441\u043E\u0440\u0432\u0430\u043B\u0441\u044F: ${String(e)}`);
|
|
@@ -2445,6 +2461,7 @@ async function sweepOrphans(params) {
|
|
|
2445
2461
|
var init_procCleanup = __esm({
|
|
2446
2462
|
"src/procCleanup.ts"() {
|
|
2447
2463
|
"use strict";
|
|
2464
|
+
init_quietExec();
|
|
2448
2465
|
init_resources();
|
|
2449
2466
|
init_procList();
|
|
2450
2467
|
}
|
|
@@ -9035,7 +9052,7 @@ async function collectRunDiff(worktree, opts = {}) {
|
|
|
9035
9052
|
// package.json
|
|
9036
9053
|
var package_default = {
|
|
9037
9054
|
name: "@taskless-app/swarm",
|
|
9038
|
-
version: "0.4.
|
|
9055
|
+
version: "0.4.4",
|
|
9039
9056
|
type: "module",
|
|
9040
9057
|
description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
|
|
9041
9058
|
keywords: [
|
package/package.json
CHANGED