@cloop/runner 0.3.31 → 0.3.34
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/{box-RFAHCXZS.js → box-RALT6JDU.js} +39 -112
- package/dist/{chunk-R73PVAM2.js → chunk-3ZZLIPFM.js} +363 -38
- package/dist/{chunk-YLVOEZWH.js → chunk-75AQLUDA.js} +28 -8
- package/dist/{chunk-UERK5AHI.js → chunk-BCH4VHKZ.js} +3 -3
- package/dist/{chunk-7AHYPGSU.js → chunk-BDAZQQ74.js} +1 -1
- package/dist/{chunk-FKYVJUIR.js → chunk-CQZQENZD.js} +1 -1
- package/dist/{chunk-52CUSFDQ.js → chunk-KDTPUD2Y.js} +1 -0
- package/dist/{chunk-MEAVT5SJ.js → chunk-MAUIATJ5.js} +14 -9
- package/dist/{chunk-GL77IQQE.js → chunk-SDE2XSO3.js} +1 -1
- package/dist/{chunk-WYU74GLG.js → chunk-YOMSLSLT.js} +1 -1
- package/dist/{connect-WRTLQW5H.js → connect-LQ6YI4G5.js} +7 -7
- package/dist/{disconnect-I44BWWFB.js → disconnect-JPS5XMUL.js} +7 -7
- package/dist/{existing-runner-SP6SNFH4.js → existing-runner-ZP3IR3TZ.js} +7 -7
- package/dist/index.js +14 -14
- package/dist/{login-LH2KF7N2.js → login-ENRZEOHE.js} +2 -2
- package/dist/{mcp-server-SGIWNLLL.js → mcp-server-SXUOR4AK.js} +2 -2
- package/dist/{runner-SXUQH5IU.js → runner-DFKLSJ4C.js} +3 -3
- package/dist/{runs-3YZO57MX.js → runs-J3F6FFL7.js} +2 -2
- package/dist/{statusline-UHZTCNCB.js → statusline-J3ZN3PGM.js} +1 -1
- package/dist/{takeover-M4QHMXTZ.js → takeover-2ONTESR6.js} +4 -4
- package/dist/{use-YB75NHTE.js → use-6MRJ2V5I.js} +7 -7
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
serveTakeovers
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-BCH4VHKZ.js";
|
|
5
|
+
import "./chunk-CQZQENZD.js";
|
|
6
6
|
import {
|
|
7
7
|
CAPTURE_TICK_MS,
|
|
8
8
|
DEFAULT_FALLBACK_MODEL,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
systemServices,
|
|
39
39
|
unitFor,
|
|
40
40
|
which
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-MAUIATJ5.js";
|
|
42
42
|
import {
|
|
43
43
|
MeshSocket,
|
|
44
44
|
WAKE_TICK_MS,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
defaultSocketFactory,
|
|
47
47
|
runnerLog,
|
|
48
48
|
wakeWatch
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-KDTPUD2Y.js";
|
|
50
50
|
import {
|
|
51
51
|
BoxWatch,
|
|
52
52
|
hostedThreadsFilePath,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
runnerStatePath,
|
|
56
56
|
threadsFilePath,
|
|
57
57
|
writeRunnerState
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-75AQLUDA.js";
|
|
59
59
|
import {
|
|
60
60
|
BackgroundReading,
|
|
61
61
|
BoxToolError,
|
|
@@ -81,6 +81,7 @@ import {
|
|
|
81
81
|
isHosted,
|
|
82
82
|
isLocal,
|
|
83
83
|
isT3,
|
|
84
|
+
listOutsideSessions,
|
|
84
85
|
nextProgress,
|
|
85
86
|
orderThreads,
|
|
86
87
|
quotaFromClaude,
|
|
@@ -99,20 +100,20 @@ import {
|
|
|
99
100
|
utcWindow,
|
|
100
101
|
windowsPowerShellEnv,
|
|
101
102
|
writeBoxConfig
|
|
102
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-3ZZLIPFM.js";
|
|
103
104
|
import "./chunk-VK6GV757.js";
|
|
104
105
|
import {
|
|
105
106
|
olderThan
|
|
106
107
|
} from "./chunk-365HFCQQ.js";
|
|
107
108
|
import "./chunk-PKIEWBR7.js";
|
|
108
|
-
import "./chunk-
|
|
109
|
-
import "./chunk-
|
|
109
|
+
import "./chunk-BDAZQQ74.js";
|
|
110
|
+
import "./chunk-YOMSLSLT.js";
|
|
110
111
|
import {
|
|
111
112
|
getMachine
|
|
112
113
|
} from "./chunk-SBYSVZ7J.js";
|
|
113
114
|
import {
|
|
114
115
|
VERSION
|
|
115
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-SDE2XSO3.js";
|
|
116
117
|
import {
|
|
117
118
|
getMeshUrl,
|
|
118
119
|
getOrigin,
|
|
@@ -1470,8 +1471,8 @@ function claudeReader(window, days) {
|
|
|
1470
1471
|
if (typeof m.id !== "string") addTokens(days, day, "claude", call);
|
|
1471
1472
|
else {
|
|
1472
1473
|
const key = `${m.id} ${String(d.requestId ?? "")}`;
|
|
1473
|
-
const
|
|
1474
|
-
if (!
|
|
1474
|
+
const seen = calls.get(key);
|
|
1475
|
+
if (!seen || call.output >= seen.output) calls.set(key, call);
|
|
1475
1476
|
}
|
|
1476
1477
|
return true;
|
|
1477
1478
|
},
|
|
@@ -1679,80 +1680,6 @@ function lastKnown(read, initial, { ms, what, onFail }) {
|
|
|
1679
1680
|
};
|
|
1680
1681
|
}
|
|
1681
1682
|
|
|
1682
|
-
// src/outside-sessions.ts
|
|
1683
|
-
import { createReadStream as createReadStream2 } from "fs";
|
|
1684
|
-
import { readdir as readdir2, stat as stat2 } from "fs/promises";
|
|
1685
|
-
import { homedir } from "os";
|
|
1686
|
-
import { join as join4 } from "path";
|
|
1687
|
-
import { createInterface as createInterface2 } from "readline";
|
|
1688
|
-
var seen = /* @__PURE__ */ new Map();
|
|
1689
|
-
var UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;
|
|
1690
|
-
async function listOutsideSessions(root = join4(homedir(), ".claude", "projects"), own = /* @__PURE__ */ new Set(), now = Date.now()) {
|
|
1691
|
-
const files = [];
|
|
1692
|
-
for (const project of await readdir2(root, { withFileTypes: true }).catch(() => [])) {
|
|
1693
|
-
if (!project.isDirectory()) continue;
|
|
1694
|
-
for (const entry of await readdir2(join4(root, project.name), { withFileTypes: true }).catch(
|
|
1695
|
-
() => []
|
|
1696
|
-
)) {
|
|
1697
|
-
if (!entry.isFile() || !entry.name.endsWith(".jsonl")) continue;
|
|
1698
|
-
const id = entry.name.slice(0, -6);
|
|
1699
|
-
if (!UUID.test(id) || own.has(id)) continue;
|
|
1700
|
-
const path = join4(root, project.name, entry.name);
|
|
1701
|
-
const info = await stat2(path).catch(() => null);
|
|
1702
|
-
if (info && info.mtimeMs >= now - 7 * 864e5)
|
|
1703
|
-
files.push({ id, project: project.name.slice(0, 200), file: path, mtime: info.mtimeMs });
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
const results = [];
|
|
1707
|
-
const newest = files.sort((a, b) => b.mtime - a.mtime).slice(0, 20);
|
|
1708
|
-
for (const path of seen.keys()) if (!newest.some((file) => file.file === path)) seen.delete(path);
|
|
1709
|
-
for (const file of newest) {
|
|
1710
|
-
const known = seen.get(file.file);
|
|
1711
|
-
let title = known?.mtime === file.mtime ? known.title : void 0;
|
|
1712
|
-
let cwd = known?.mtime === file.mtime ? known.cwd : void 0;
|
|
1713
|
-
if (known?.mtime !== file.mtime) {
|
|
1714
|
-
const stream = createReadStream2(file.file, { encoding: "utf8" });
|
|
1715
|
-
const lines = createInterface2({ input: stream, crlfDelay: Number.POSITIVE_INFINITY });
|
|
1716
|
-
try {
|
|
1717
|
-
for await (const line of lines) {
|
|
1718
|
-
if (!cwd && line.includes('"cwd"')) {
|
|
1719
|
-
try {
|
|
1720
|
-
const record = JSON.parse(line);
|
|
1721
|
-
if (typeof record.cwd === "string" && record.cwd.startsWith("/") && record.cwd.length <= 500)
|
|
1722
|
-
cwd = record.cwd;
|
|
1723
|
-
} catch {
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
if (!/^\s*\{\s*"type"\s*:\s*"(?:summary|custom-title|title)"/.test(line)) continue;
|
|
1727
|
-
try {
|
|
1728
|
-
const record = JSON.parse(line);
|
|
1729
|
-
const value = record.type === "summary" ? record.summary : record.type === "custom-title" ? record.customTitle : record.title;
|
|
1730
|
-
if (typeof value === "string" && value.trim()) title = value.trim().slice(0, 120);
|
|
1731
|
-
} catch {
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
} finally {
|
|
1735
|
-
lines.close();
|
|
1736
|
-
stream.destroy();
|
|
1737
|
-
}
|
|
1738
|
-
seen.set(file.file, {
|
|
1739
|
-
mtime: file.mtime,
|
|
1740
|
-
...title ? { title } : {},
|
|
1741
|
-
...cwd ? { cwd } : {}
|
|
1742
|
-
});
|
|
1743
|
-
}
|
|
1744
|
-
results.push({
|
|
1745
|
-
id: file.id,
|
|
1746
|
-
project: file.project,
|
|
1747
|
-
updatedAt: new Date(file.mtime).toISOString(),
|
|
1748
|
-
status: "idle",
|
|
1749
|
-
...cwd ? { cwd } : {},
|
|
1750
|
-
...title ? { title } : {}
|
|
1751
|
-
});
|
|
1752
|
-
}
|
|
1753
|
-
return results;
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
1683
|
// src/result-outbox.ts
|
|
1757
1684
|
var OUTBOX_MAX = 50;
|
|
1758
1685
|
var OUTBOX_KEEP_MS = 24 * 36e5;
|
|
@@ -1812,8 +1739,8 @@ import {
|
|
|
1812
1739
|
rmSync as rmSync2,
|
|
1813
1740
|
symlinkSync
|
|
1814
1741
|
} from "fs";
|
|
1815
|
-
import { homedir
|
|
1816
|
-
import { join as
|
|
1742
|
+
import { homedir, tmpdir as tmpdir2 } from "os";
|
|
1743
|
+
import { join as join4 } from "path";
|
|
1817
1744
|
var SKILL_DIRS = [".agents/skills", ".claude/skills", ".codex/skills"];
|
|
1818
1745
|
var GUIDE_FILES = [".agents/AGENTS.md", ".claude/CLAUDE.md", ".codex/AGENTS.md"];
|
|
1819
1746
|
var SKILLS_CAP_BYTES = 25 * 1024 * 1024;
|
|
@@ -1831,13 +1758,13 @@ function findSetup(home) {
|
|
|
1831
1758
|
for (const dir of SKILL_DIRS) {
|
|
1832
1759
|
let entries;
|
|
1833
1760
|
try {
|
|
1834
|
-
entries = readdirSync(
|
|
1761
|
+
entries = readdirSync(join4(home, dir)).sort();
|
|
1835
1762
|
} catch {
|
|
1836
1763
|
continue;
|
|
1837
1764
|
}
|
|
1838
1765
|
for (const name of entries) {
|
|
1839
|
-
const path =
|
|
1840
|
-
if (names.has(name) || !existsSync2(
|
|
1766
|
+
const path = join4(home, dir, name);
|
|
1767
|
+
if (names.has(name) || !existsSync2(join4(path, "SKILL.md"))) continue;
|
|
1841
1768
|
const real = realpath2(path);
|
|
1842
1769
|
if (!real || reals.has(real)) continue;
|
|
1843
1770
|
names.add(name);
|
|
@@ -1845,18 +1772,18 @@ function findSetup(home) {
|
|
|
1845
1772
|
skills.push({ name, path: real });
|
|
1846
1773
|
}
|
|
1847
1774
|
}
|
|
1848
|
-
const guide = GUIDE_FILES.map((file) => realpath2(
|
|
1775
|
+
const guide = GUIDE_FILES.map((file) => realpath2(join4(home, file))).find((p) => p !== null) ?? null;
|
|
1849
1776
|
return { skills, guide };
|
|
1850
1777
|
}
|
|
1851
1778
|
function stage(setup) {
|
|
1852
|
-
const dir = mkdtempSync(
|
|
1853
|
-
mkdirSync2(
|
|
1779
|
+
const dir = mkdtempSync(join4(tmpdir2(), "cloop-setup-"));
|
|
1780
|
+
mkdirSync2(join4(dir, ".agents", "skills"), { recursive: true });
|
|
1854
1781
|
for (const skill of setup.skills)
|
|
1855
|
-
symlinkSync(skill.path,
|
|
1856
|
-
if (setup.guide) copyFileSync(setup.guide,
|
|
1782
|
+
symlinkSync(skill.path, join4(dir, ".agents", "skills", skill.name), "junction");
|
|
1783
|
+
if (setup.guide) copyFileSync(setup.guide, join4(dir, ".agents", "owner-guide.md"));
|
|
1857
1784
|
return dir;
|
|
1858
1785
|
}
|
|
1859
|
-
async function packSkills(home =
|
|
1786
|
+
async function packSkills(home = homedir(), capBytes = SKILLS_CAP_BYTES, tarBin = "tar") {
|
|
1860
1787
|
const setup = findSetup(home);
|
|
1861
1788
|
if (setup.skills.length === 0 && !setup.guide) return { ok: false, reason: "no_skills" };
|
|
1862
1789
|
let dir;
|
|
@@ -2000,8 +1927,8 @@ function remoteMcp(found) {
|
|
|
2000
1927
|
const url = httpUrl(entry.url);
|
|
2001
1928
|
const name = mcpName(entry.name);
|
|
2002
1929
|
if (!url || !name) continue;
|
|
2003
|
-
const
|
|
2004
|
-
if (
|
|
1930
|
+
const seen = byUrl.get(url);
|
|
1931
|
+
if (seen) seen.keyed ||= entry.keyed;
|
|
2005
1932
|
else byUrl.set(url, { name, url, keyed: entry.keyed });
|
|
2006
1933
|
}
|
|
2007
1934
|
return [...byUrl.values()].slice(0, MAX_REMOTE_MCP);
|
|
@@ -2013,10 +1940,10 @@ function readText(path) {
|
|
|
2013
1940
|
return "";
|
|
2014
1941
|
}
|
|
2015
1942
|
}
|
|
2016
|
-
function readRemoteMcp(home =
|
|
1943
|
+
function readRemoteMcp(home = homedir(), codexHome2 = process.env.CODEX_HOME || join4(home, ".codex")) {
|
|
2017
1944
|
return remoteMcp([
|
|
2018
|
-
...claudeRemoteMcp(readText(
|
|
2019
|
-
...codexRemoteMcp(readText(
|
|
1945
|
+
...claudeRemoteMcp(readText(join4(home, ".claude.json"))),
|
|
1946
|
+
...codexRemoteMcp(readText(join4(codexHome2, "config.toml")))
|
|
2020
1947
|
]);
|
|
2021
1948
|
}
|
|
2022
1949
|
async function sendSkills(tar, deps) {
|
|
@@ -2096,7 +2023,7 @@ var T3_REFRESH_MS = 2 * 6e4;
|
|
|
2096
2023
|
var LOOKBACK_MS = 48 * 60 * 6e4;
|
|
2097
2024
|
var PROJECTIONS_PER_READ = 25;
|
|
2098
2025
|
var SHELL_HEADERS = { "x-t3-orchestration-protocol": "2" };
|
|
2099
|
-
var
|
|
2026
|
+
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
2100
2027
|
function isSettled(t) {
|
|
2101
2028
|
if (t.archivedAt || t.deletedAt) return true;
|
|
2102
2029
|
if (t.settledOverride === "settled") return true;
|
|
@@ -2176,7 +2103,7 @@ var T3Threads = class {
|
|
|
2176
2103
|
});
|
|
2177
2104
|
const ids = (projection.providerThreads ?? []).flatMap((p) => {
|
|
2178
2105
|
const id = p.nativeThreadRef?.nativeId;
|
|
2179
|
-
return typeof id === "string" &&
|
|
2106
|
+
return typeof id === "string" && UUID.test(id) ? [id.toLowerCase()] : [];
|
|
2180
2107
|
});
|
|
2181
2108
|
if (ids.length === 0) continue;
|
|
2182
2109
|
this.resolvedAt.set(thread.id, harnessKey(thread));
|
|
@@ -2200,8 +2127,8 @@ import {
|
|
|
2200
2127
|
rmSync as rmSync3,
|
|
2201
2128
|
writeFileSync
|
|
2202
2129
|
} from "fs";
|
|
2203
|
-
import { homedir as
|
|
2204
|
-
import { dirname, join as
|
|
2130
|
+
import { homedir as homedir2 } from "os";
|
|
2131
|
+
import { dirname, join as join5 } from "path";
|
|
2205
2132
|
var REGISTRY_LATEST = "https://registry.npmjs.org/@cloop/runner/latest";
|
|
2206
2133
|
var FIRST_CHECK_MS = 10 * 6e4;
|
|
2207
2134
|
var CHECK_EVERY_MS = 6 * 36e5;
|
|
@@ -2241,10 +2168,10 @@ function updateDir(env) {
|
|
|
2241
2168
|
return runnerPath(env, process.env.CLOOP_UPDATE_DIR, (dir) => dir);
|
|
2242
2169
|
}
|
|
2243
2170
|
function updateLogPath() {
|
|
2244
|
-
return
|
|
2171
|
+
return join5(updateDir(), "update.log");
|
|
2245
2172
|
}
|
|
2246
2173
|
function statePath(env) {
|
|
2247
|
-
return
|
|
2174
|
+
return join5(updateDir(env), "update.json");
|
|
2248
2175
|
}
|
|
2249
2176
|
function readFailed() {
|
|
2250
2177
|
try {
|
|
@@ -2292,7 +2219,7 @@ var adoptWords = (npx, to, kind) => [
|
|
|
2292
2219
|
kind
|
|
2293
2220
|
];
|
|
2294
2221
|
function adoptScriptPath() {
|
|
2295
|
-
return
|
|
2222
|
+
return join5(updateDir(), "adopt.cmd");
|
|
2296
2223
|
}
|
|
2297
2224
|
function adoptScript(npx, to, kind, log3) {
|
|
2298
2225
|
return [
|
|
@@ -2306,7 +2233,7 @@ function servicePath(kind, platform) {
|
|
|
2306
2233
|
platform,
|
|
2307
2234
|
kind,
|
|
2308
2235
|
environment: runnerEnvironment(),
|
|
2309
|
-
home:
|
|
2236
|
+
home: homedir2(),
|
|
2310
2237
|
uid: process.getuid?.() ?? 0,
|
|
2311
2238
|
...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {}
|
|
2312
2239
|
}).path;
|
|
@@ -2448,7 +2375,7 @@ async function adopt(from, kind, { services: given, script = process.argv[1] ??
|
|
|
2448
2375
|
const where = {
|
|
2449
2376
|
platform: services.platform,
|
|
2450
2377
|
kind,
|
|
2451
|
-
home:
|
|
2378
|
+
home: homedir2(),
|
|
2452
2379
|
uid: process.getuid?.() ?? 0,
|
|
2453
2380
|
...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {}
|
|
2454
2381
|
};
|
|
@@ -2665,7 +2592,7 @@ async function run2() {
|
|
|
2665
2592
|
{
|
|
2666
2593
|
driver,
|
|
2667
2594
|
onLaunch: (workId, threadId) => watch.add(workId, threadId),
|
|
2668
|
-
|
|
2595
|
+
onSend: (threadId, workId) => watch.follow(threadId, workId),
|
|
2669
2596
|
...setup ? { setup } : {},
|
|
2670
2597
|
diag: async () => buildDiag({
|
|
2671
2598
|
version: VERSION,
|
|
@@ -2788,7 +2715,7 @@ async function run2() {
|
|
|
2788
2715
|
if (own)
|
|
2789
2716
|
outsideThreads = await listOutsideSessions(
|
|
2790
2717
|
void 0,
|
|
2791
|
-
new Set(listed.threads.map((t) => t.id))
|
|
2718
|
+
new Set(listed.threads.filter((t) => t.cloop).map((t) => t.id))
|
|
2792
2719
|
);
|
|
2793
2720
|
return { shown, running: listed.running, outsideThreads };
|
|
2794
2721
|
},
|