@cloop/runner 0.3.0 → 0.3.1
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-7SVME4E5.js → box-2SVXFDHE.js} +12 -14
- package/dist/{chunk-NOABXLW3.js → chunk-4H4SIIUH.js} +1 -1
- package/dist/{chunk-J6AEO3GT.js → chunk-5FZAHWPX.js} +1 -1
- package/dist/{chunk-EN3XHHWJ.js → chunk-5LDFFQ4O.js} +700 -41
- package/dist/{chunk-NK6MHHYP.js → chunk-6LC5XH3S.js} +3 -5
- package/dist/{chunk-7CPNLUDI.js → chunk-DH6IJQG6.js} +8 -10
- package/dist/{chunk-AEWIRLRS.js → chunk-E5CKL2Q3.js} +1 -1
- package/dist/{chunk-3DIGCVL4.js → chunk-IKCGVBHA.js} +11 -0
- package/dist/{chunk-2PVKRGOX.js → chunk-N24VQSNB.js} +3 -3
- package/dist/{chunk-3ITSIARB.js → chunk-NALGGZM6.js} +3 -3
- package/dist/{chunk-JX6VG5FE.js → chunk-NUU4GXGV.js} +1 -1
- package/dist/{chunk-AG6SI6I2.js → chunk-NYGELUTR.js} +1 -1
- package/dist/{chunk-3B5JV6ZP.js → chunk-RPWSWVKD.js} +2 -2
- package/dist/{chunk-34XAQRBL.js → chunk-TJXXWEJW.js} +181 -35
- package/dist/{connect-LLURHARY.js → connect-NAHKIUBI.js} +9 -9
- package/dist/disconnect-KTTVOO6R.js +28 -0
- package/dist/{hook-activity-LBYV4WJW.js → hook-activity-I7TV7YG7.js} +4 -4
- package/dist/{hook-session-start-YSEV5DCB.js → hook-session-start-MFX6HR3W.js} +3 -3
- package/dist/index.js +17 -17
- package/dist/{install-HTDTCELB.js → install-EMEZBBK7.js} +1 -1
- package/dist/{login-XS2IFIUX.js → login-37QE2AGW.js} +4 -4
- package/dist/{mcp-server-R47CKE6A.js → mcp-server-FLCNIW4C.js} +6 -6
- package/dist/runner-EHVMTKAA.js +13 -0
- package/dist/{runs-4ZJOIB5S.js → runs-IDFJ3Z2K.js} +3 -4
- package/dist/{statusline-RI62KCQX.js → statusline-HGIHZJY2.js} +3 -3
- package/dist/{takeover-F5SEY7WI.js → takeover-YUBFKEKJ.js} +7 -8
- package/dist/{use-2OOFS53J.js → use-OLC3RTIL.js} +14 -10
- package/package.json +1 -1
- package/dist/chunk-QLCIEJ4C.js +0 -696
- package/dist/disconnect-WAQTAXN3.js +0 -159
- package/dist/runner-R4Z62XVC.js +0 -13
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
localRunsFilePath,
|
|
4
|
-
readRunRecords
|
|
5
|
-
} from "./chunk-QLCIEJ4C.js";
|
|
6
2
|
import {
|
|
7
3
|
STOPPED_SUMMARY,
|
|
8
4
|
isEndLogLine,
|
|
9
5
|
isLocal,
|
|
6
|
+
localRunsFilePath,
|
|
7
|
+
readRunRecords,
|
|
10
8
|
readRunnerConfig,
|
|
11
9
|
runLogDir,
|
|
12
10
|
runLogPath
|
|
13
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5LDFFQ4O.js";
|
|
14
12
|
import {
|
|
15
13
|
sanitizeLabel,
|
|
16
14
|
stripControl
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
findRun
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
localRunsFilePath,
|
|
7
|
-
readRunRecords,
|
|
8
|
-
takeoverSummary
|
|
9
|
-
} from "./chunk-QLCIEJ4C.js";
|
|
4
|
+
} from "./chunk-6LC5XH3S.js";
|
|
10
5
|
import {
|
|
11
6
|
lockThreadsFile,
|
|
12
7
|
threadsFilePath
|
|
13
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RPWSWVKD.js";
|
|
14
9
|
import {
|
|
15
10
|
isLocal,
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
localRunsFilePath,
|
|
12
|
+
readRunRecords,
|
|
13
|
+
readRunnerConfig,
|
|
14
|
+
takeoverSummary
|
|
15
|
+
} from "./chunk-5LDFFQ4O.js";
|
|
18
16
|
import {
|
|
19
17
|
shortMachineName
|
|
20
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-NUU4GXGV.js";
|
|
21
19
|
import {
|
|
22
20
|
sanitizeLabel
|
|
23
21
|
} from "./chunk-VK6GV757.js";
|
|
@@ -16,6 +16,15 @@ function applyEnvironmentFlag(argv) {
|
|
|
16
16
|
process.env.CLOOP_MESH_URL ??= process.env.CLOOP_ORIGIN;
|
|
17
17
|
return argv.filter((arg) => arg !== "--staging");
|
|
18
18
|
}
|
|
19
|
+
function pinRunnerEnvironment(runnerOrigin) {
|
|
20
|
+
if (!process.env.CLOOP_ORIGIN) originSource = runnerOrigin ? "runner" : "default";
|
|
21
|
+
process.env.CLOOP_ORIGIN ??= runnerOrigin ?? PRODUCTION_ORIGIN;
|
|
22
|
+
process.env.CLOOP_MESH_URL ??= process.env.CLOOP_ORIGIN;
|
|
23
|
+
}
|
|
24
|
+
var originSource;
|
|
25
|
+
function pinnedOriginSource() {
|
|
26
|
+
return originSource ?? "flag_or_env";
|
|
27
|
+
}
|
|
19
28
|
function configDir() {
|
|
20
29
|
return join(homedir(), CONFIG_DIR);
|
|
21
30
|
}
|
|
@@ -62,6 +71,8 @@ export {
|
|
|
62
71
|
CONFIG_DIR,
|
|
63
72
|
STAGING_ORIGIN,
|
|
64
73
|
applyEnvironmentFlag,
|
|
74
|
+
pinRunnerEnvironment,
|
|
75
|
+
pinnedOriginSource,
|
|
65
76
|
readCredentials,
|
|
66
77
|
writeCredentials,
|
|
67
78
|
getOrigin,
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ApiError,
|
|
4
4
|
api
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NYGELUTR.js";
|
|
6
6
|
import {
|
|
7
7
|
VERSION
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4H4SIIUH.js";
|
|
9
9
|
import {
|
|
10
10
|
getOrigin,
|
|
11
11
|
readCredentials,
|
|
12
12
|
writeCredentials
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IKCGVBHA.js";
|
|
14
14
|
|
|
15
15
|
// src/commands/login.ts
|
|
16
16
|
import { execFile } from "child_process";
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ConnectFailure,
|
|
4
4
|
deviceLogin
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-N24VQSNB.js";
|
|
6
6
|
import {
|
|
7
7
|
ApiError,
|
|
8
8
|
ReauthError,
|
|
9
9
|
api
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NYGELUTR.js";
|
|
11
11
|
import {
|
|
12
12
|
CONFIG_DIR,
|
|
13
13
|
getOrigin,
|
|
14
14
|
readCredentials,
|
|
15
15
|
writeCredentials
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-IKCGVBHA.js";
|
|
17
17
|
|
|
18
18
|
// src/commands/runner.ts
|
|
19
19
|
import { randomBytes } from "crypto";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
RUN_TEXT_MAX
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5LDFFQ4O.js";
|
|
5
5
|
import {
|
|
6
6
|
CONFIG_DIR
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IKCGVBHA.js";
|
|
8
8
|
|
|
9
9
|
// src/box-watch.ts
|
|
10
10
|
import { randomUUID } from "crypto";
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
readRunnerState
|
|
4
|
-
|
|
3
|
+
readRunnerState,
|
|
4
|
+
runnerStatePath,
|
|
5
|
+
threadsFilePath
|
|
6
|
+
} from "./chunk-RPWSWVKD.js";
|
|
5
7
|
import {
|
|
6
8
|
BoxToolError,
|
|
7
9
|
CLOOP_THREAD_PREFIX,
|
|
8
10
|
RUNTIME_MODES,
|
|
9
11
|
T3Driver,
|
|
12
|
+
boxPath,
|
|
10
13
|
defaultT3BinSources,
|
|
11
14
|
isLocal,
|
|
12
15
|
isYes,
|
|
16
|
+
localRunsFilePath,
|
|
13
17
|
otherThreadsChoice,
|
|
14
18
|
pickT3Bin,
|
|
15
19
|
questionLine,
|
|
@@ -18,7 +22,7 @@ import {
|
|
|
18
22
|
t3BaseDirArgs,
|
|
19
23
|
t3Candidates,
|
|
20
24
|
writeBoxConfig
|
|
21
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-5LDFFQ4O.js";
|
|
22
26
|
import {
|
|
23
27
|
CLAUDE_FLOOR,
|
|
24
28
|
claudeTooOld,
|
|
@@ -27,28 +31,57 @@ import {
|
|
|
27
31
|
import {
|
|
28
32
|
getMachine,
|
|
29
33
|
shortMachineName
|
|
30
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-NUU4GXGV.js";
|
|
31
35
|
import {
|
|
32
36
|
READ_TOOLS,
|
|
33
37
|
readOnlySettings
|
|
34
38
|
} from "./chunk-R3CLO2FB.js";
|
|
35
39
|
import {
|
|
36
40
|
connectWebhook
|
|
37
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-NALGGZM6.js";
|
|
38
42
|
import {
|
|
39
43
|
ConnectFailure,
|
|
40
44
|
connectReport,
|
|
41
45
|
deviceLogin,
|
|
42
46
|
newAttempt,
|
|
43
47
|
sendConnectReport
|
|
44
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-N24VQSNB.js";
|
|
45
49
|
import {
|
|
46
50
|
VERSION
|
|
47
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-4H4SIIUH.js";
|
|
48
52
|
import {
|
|
49
53
|
STAGING_ORIGIN,
|
|
50
|
-
getOrigin
|
|
51
|
-
|
|
54
|
+
getOrigin,
|
|
55
|
+
pinRunnerEnvironment,
|
|
56
|
+
pinnedOriginSource
|
|
57
|
+
} from "./chunk-IKCGVBHA.js";
|
|
58
|
+
|
|
59
|
+
// src/commands/disconnect.ts
|
|
60
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
61
|
+
import { existsSync as existsSync2, readFileSync, rmSync as rmSync2 } from "fs";
|
|
62
|
+
import { homedir as homedir2 } from "os";
|
|
63
|
+
|
|
64
|
+
// src/device-revoke.ts
|
|
65
|
+
function tokenGone(revoke) {
|
|
66
|
+
return revoke === "revoked" || revoke === "already_revoked" || revoke === "no_device";
|
|
67
|
+
}
|
|
68
|
+
async function revokeOwnDevice(origin, deviceToken, fetchFn = fetch) {
|
|
69
|
+
if (!deviceToken) return "no_device";
|
|
70
|
+
try {
|
|
71
|
+
const res = await fetchFn(`${origin}/api/agent/mesh/device-revoke`, {
|
|
72
|
+
method: "POST",
|
|
73
|
+
headers: { authorization: `Bearer ${deviceToken}` },
|
|
74
|
+
signal: AbortSignal.timeout(1e4)
|
|
75
|
+
});
|
|
76
|
+
const body = await res.json().catch(() => null);
|
|
77
|
+
if (res.ok && body?.outcome === "revoked") return "revoked";
|
|
78
|
+
if (res.ok && body?.outcome === "already_revoked") return "already_revoked";
|
|
79
|
+
if (res.status === 401 && body?.error === "unknown_device") return "unknown_device";
|
|
80
|
+
return "failed";
|
|
81
|
+
} catch {
|
|
82
|
+
return "failed";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
52
85
|
|
|
53
86
|
// src/commands/connect.ts
|
|
54
87
|
import { execFileSync } from "child_process";
|
|
@@ -328,28 +361,6 @@ async function runBoxTool(ctx, tool, args) {
|
|
|
328
361
|
}
|
|
329
362
|
}
|
|
330
363
|
|
|
331
|
-
// src/device-revoke.ts
|
|
332
|
-
function tokenGone(revoke) {
|
|
333
|
-
return revoke === "revoked" || revoke === "already_revoked" || revoke === "no_device";
|
|
334
|
-
}
|
|
335
|
-
async function revokeOwnDevice(origin, deviceToken, fetchFn = fetch) {
|
|
336
|
-
if (!deviceToken) return "no_device";
|
|
337
|
-
try {
|
|
338
|
-
const res = await fetchFn(`${origin}/api/agent/mesh/device-revoke`, {
|
|
339
|
-
method: "POST",
|
|
340
|
-
headers: { authorization: `Bearer ${deviceToken}` },
|
|
341
|
-
signal: AbortSignal.timeout(1e4)
|
|
342
|
-
});
|
|
343
|
-
const body = await res.json().catch(() => null);
|
|
344
|
-
if (res.ok && body?.outcome === "revoked") return "revoked";
|
|
345
|
-
if (res.ok && body?.outcome === "already_revoked") return "already_revoked";
|
|
346
|
-
if (res.status === 401 && body?.error === "unknown_device") return "unknown_device";
|
|
347
|
-
return "failed";
|
|
348
|
-
} catch {
|
|
349
|
-
return "failed";
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
364
|
// src/drivers/claude-code.ts
|
|
354
365
|
import { execFile } from "child_process";
|
|
355
366
|
import { basename, isAbsolute, relative, resolve } from "path";
|
|
@@ -1408,7 +1419,7 @@ async function connectT3(argv, attempt, fallback, chosen, services) {
|
|
|
1408
1419
|
...chosen ? { chosenDriver: chosen } : {}
|
|
1409
1420
|
})
|
|
1410
1421
|
});
|
|
1411
|
-
await revokeReplaced(previous, "workstation", (t) => revokeOwnDevice(getOrigin(), t), out);
|
|
1422
|
+
await revokeReplaced(previous, "workstation", (t) => revokeOwnDevice(attempt.replacedOrigin ?? getOrigin(), t), out);
|
|
1412
1423
|
out(
|
|
1413
1424
|
`${bold("Cloop runner")} T3 ${cfg.label} paired with scope ${cfg.scope}, until ${cfg.expiresAt.slice(0, 10)}.`
|
|
1414
1425
|
);
|
|
@@ -1466,7 +1477,7 @@ async function connectLocal(driver, found, argv, attempt, chosen, services) {
|
|
|
1466
1477
|
...chosen ? { chosenDriver: chosen } : {}
|
|
1467
1478
|
};
|
|
1468
1479
|
writeBoxConfig(cfg);
|
|
1469
|
-
await revokeReplaced(previous, "local", (t) => revokeOwnDevice(getOrigin(), t), out);
|
|
1480
|
+
await revokeReplaced(previous, "local", (t) => revokeOwnDevice(attempt.replacedOrigin ?? getOrigin(), t), out);
|
|
1470
1481
|
const others = [found.claude, found.codex].filter(
|
|
1471
1482
|
(h) => Boolean(h) && h !== harness
|
|
1472
1483
|
);
|
|
@@ -1580,7 +1591,13 @@ function terminalYesNo() {
|
|
|
1580
1591
|
};
|
|
1581
1592
|
}
|
|
1582
1593
|
async function runConnect(argv, deps = {}) {
|
|
1594
|
+
const replacedOrigin = runnerOrigin();
|
|
1595
|
+
pinRunnerEnvironment();
|
|
1596
|
+
console.error(
|
|
1597
|
+
`[runner:connect] origin=${getOrigin()} source=${pinnedOriginSource()} replaced_origin=${replacedOrigin ?? "none"}`
|
|
1598
|
+
);
|
|
1583
1599
|
const attempt = newAttempt();
|
|
1600
|
+
if (replacedOrigin) attempt.replacedOrigin = replacedOrigin;
|
|
1584
1601
|
let error = null;
|
|
1585
1602
|
try {
|
|
1586
1603
|
await connect(argv, attempt, deps);
|
|
@@ -1600,11 +1617,140 @@ async function connectCommand(argv) {
|
|
|
1600
1617
|
if (await runConnect(argv)) process.exit(1);
|
|
1601
1618
|
}
|
|
1602
1619
|
|
|
1620
|
+
// src/commands/disconnect.ts
|
|
1621
|
+
var DONE_LINE = "This computer is no longer a Cloop runner. To connect it again: npx -y @cloop/runner@latest connect";
|
|
1622
|
+
function unitOrigin(contents) {
|
|
1623
|
+
const plist = /<key>CLOOP_ORIGIN<\/key><string>([^<]+)<\/string>/.exec(contents)?.[1];
|
|
1624
|
+
if (plist) return plist.replace(/&/g, "&");
|
|
1625
|
+
const unit = /Environment="CLOOP_ORIGIN=([^"]+)"/.exec(contents)?.[1];
|
|
1626
|
+
return unit ? unit.replace(/%%/g, "%") : null;
|
|
1627
|
+
}
|
|
1628
|
+
function disconnectPlan(opts) {
|
|
1629
|
+
const exists = opts.exists ?? existsSync2;
|
|
1630
|
+
const read = opts.read ?? ((path) => readFileSync(path, "utf-8"));
|
|
1631
|
+
const services = ["local", "workstation"].map((kind) => installedService({ ...opts, kind })).filter((service) => exists(service.path));
|
|
1632
|
+
const fromUnit = services.map((service) => {
|
|
1633
|
+
try {
|
|
1634
|
+
return unitOrigin(read(service.path));
|
|
1635
|
+
} catch {
|
|
1636
|
+
return null;
|
|
1637
|
+
}
|
|
1638
|
+
}).find(Boolean);
|
|
1639
|
+
return {
|
|
1640
|
+
origin: opts.boxOrigin ?? fromUnit ?? opts.fallbackOrigin,
|
|
1641
|
+
deviceToken: opts.deviceToken,
|
|
1642
|
+
services,
|
|
1643
|
+
box: exists(opts.box) ? opts.box : null,
|
|
1644
|
+
files: opts.files.filter((file) => exists(file)),
|
|
1645
|
+
isBox: opts.platform !== "darwin" && services.some((s) => s.path.endsWith("/cloop-box.service"))
|
|
1646
|
+
};
|
|
1647
|
+
}
|
|
1648
|
+
function revokeLine(revoke, origin, box) {
|
|
1649
|
+
const keep = box ? ` Kept ${box}, which holds the device token, so you can try again.` : "";
|
|
1650
|
+
switch (revoke) {
|
|
1651
|
+
case "revoked":
|
|
1652
|
+
return [`Revoked this computer on Cloop (${origin}).`];
|
|
1653
|
+
case "already_revoked":
|
|
1654
|
+
return [`Cloop (${origin}) had already revoked this computer.`];
|
|
1655
|
+
case "no_device":
|
|
1656
|
+
return ["No runner device on this computer to revoke."];
|
|
1657
|
+
case "unknown_device":
|
|
1658
|
+
return [
|
|
1659
|
+
`Cloop at ${origin} never issued this computer's device token, so it belongs to the other environment.${keep}`,
|
|
1660
|
+
"Run `cloop disconnect --staging` for a staging runner, or `cloop disconnect` for production."
|
|
1661
|
+
];
|
|
1662
|
+
case "failed":
|
|
1663
|
+
return [
|
|
1664
|
+
`Could not revoke this computer at ${origin}: Cloop did not answer as expected.${keep}`,
|
|
1665
|
+
"Run `cloop disconnect` again when Cloop answers, or press Disconnect on its card on the Threads page and then delete that file."
|
|
1666
|
+
];
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
async function disconnect(plan, opts) {
|
|
1670
|
+
const { say } = opts;
|
|
1671
|
+
const run = opts.run ?? ((command) => void execFileSync2(command[0], command.slice(1), {
|
|
1672
|
+
stdio: "ignore",
|
|
1673
|
+
timeout: 15e3
|
|
1674
|
+
}));
|
|
1675
|
+
if (plan.isBox && !opts.yes) {
|
|
1676
|
+
say("This computer runs cloop-box.service, a Cloop box with T3 Code. Disconnect would:");
|
|
1677
|
+
for (const s of plan.services) say(` stop and remove ${s.path}`);
|
|
1678
|
+
if (plan.deviceToken) say(` revoke its runner device on Cloop (${plan.origin})`);
|
|
1679
|
+
for (const f of [...plan.box ? [plan.box] : [], ...plan.files]) say(` delete ${f}`);
|
|
1680
|
+
say("Run `cloop disconnect --yes` to do this.");
|
|
1681
|
+
return 1;
|
|
1682
|
+
}
|
|
1683
|
+
for (const service of plan.services) {
|
|
1684
|
+
await runSteps(service.steps, run);
|
|
1685
|
+
const stillRunning = async () => {
|
|
1686
|
+
const until = Date.now() + (opts.stopWaitMs ?? 1e4);
|
|
1687
|
+
for (; ; ) {
|
|
1688
|
+
try {
|
|
1689
|
+
run(service.running);
|
|
1690
|
+
} catch {
|
|
1691
|
+
return false;
|
|
1692
|
+
}
|
|
1693
|
+
if (Date.now() >= until) return true;
|
|
1694
|
+
await new Promise((resolve3) => setTimeout(resolve3, 250));
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
if (await stillRunning()) {
|
|
1698
|
+
say(
|
|
1699
|
+
`Could not stop the service in ${service.path}. Nothing was removed. Stop it with \`${service.steps.map((s) => s.command.join(" ")).join(" && ")}\`, then run \`cloop disconnect\` again.`
|
|
1700
|
+
);
|
|
1701
|
+
return 1;
|
|
1702
|
+
}
|
|
1703
|
+
say(`Stopped the service in ${service.path}`);
|
|
1704
|
+
}
|
|
1705
|
+
const revoked = await opts.revoke(plan.origin, plan.deviceToken);
|
|
1706
|
+
const gone = tokenGone(revoked);
|
|
1707
|
+
for (const service of plan.services) {
|
|
1708
|
+
rmSync2(service.path, { force: true });
|
|
1709
|
+
say(`Removed ${service.path}`);
|
|
1710
|
+
}
|
|
1711
|
+
for (const file of [...gone && plan.box ? [plan.box] : [], ...plan.files]) {
|
|
1712
|
+
rmSync2(file, { force: true });
|
|
1713
|
+
say(`Deleted ${file}`);
|
|
1714
|
+
}
|
|
1715
|
+
for (const line2 of revokeLine(revoked, plan.origin, plan.box)) say(line2);
|
|
1716
|
+
if (!gone) return 1;
|
|
1717
|
+
say(DONE_LINE);
|
|
1718
|
+
return 0;
|
|
1719
|
+
}
|
|
1720
|
+
function runnerOrigin() {
|
|
1721
|
+
return disconnectPlan(thisComputer(readRunnerConfig(), "")).origin || void 0;
|
|
1722
|
+
}
|
|
1723
|
+
function thisComputer(cfg, fallbackOrigin) {
|
|
1724
|
+
return {
|
|
1725
|
+
platform: process.platform,
|
|
1726
|
+
home: homedir2(),
|
|
1727
|
+
uid: process.getuid?.() ?? 0,
|
|
1728
|
+
...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {},
|
|
1729
|
+
box: boxPath(),
|
|
1730
|
+
deviceToken: cfg?.deviceToken ?? null,
|
|
1731
|
+
...cfg?.origin ? { boxOrigin: cfg.origin } : {},
|
|
1732
|
+
fallbackOrigin,
|
|
1733
|
+
files: [localRunsFilePath(), runnerStatePath(), threadsFilePath()]
|
|
1734
|
+
};
|
|
1735
|
+
}
|
|
1736
|
+
async function disconnectCommand(argv) {
|
|
1737
|
+
const plan = disconnectPlan(thisComputer(readRunnerConfig(), getOrigin()));
|
|
1738
|
+
process.exitCode = await disconnect(plan, {
|
|
1739
|
+
yes: argv.includes("--yes"),
|
|
1740
|
+
revoke: (origin, token) => revokeOwnDevice(origin, token),
|
|
1741
|
+
say: (line2) => console.log(line2)
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1603
1745
|
export {
|
|
1604
1746
|
T3Client,
|
|
1605
1747
|
runBoxTool,
|
|
1606
|
-
|
|
1607
|
-
|
|
1748
|
+
DONE_LINE,
|
|
1749
|
+
unitOrigin,
|
|
1750
|
+
disconnectPlan,
|
|
1751
|
+
disconnect,
|
|
1752
|
+
runnerOrigin,
|
|
1753
|
+
disconnectCommand,
|
|
1608
1754
|
probeClaudePermissions,
|
|
1609
1755
|
probeClaude,
|
|
1610
1756
|
DEFAULT_FALLBACK_MODEL,
|
|
@@ -39,18 +39,18 @@ import {
|
|
|
39
39
|
tilde,
|
|
40
40
|
unitEnv,
|
|
41
41
|
unitFor
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
42
|
+
} from "./chunk-TJXXWEJW.js";
|
|
43
|
+
import "./chunk-RPWSWVKD.js";
|
|
44
|
+
import "./chunk-5LDFFQ4O.js";
|
|
45
45
|
import "./chunk-UBXT5IDU.js";
|
|
46
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-NUU4GXGV.js";
|
|
47
47
|
import "./chunk-VK6GV757.js";
|
|
48
48
|
import "./chunk-R3CLO2FB.js";
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-NALGGZM6.js";
|
|
50
|
+
import "./chunk-N24VQSNB.js";
|
|
51
|
+
import "./chunk-NYGELUTR.js";
|
|
52
|
+
import "./chunk-4H4SIIUH.js";
|
|
53
|
+
import "./chunk-IKCGVBHA.js";
|
|
54
54
|
export {
|
|
55
55
|
DEFAULT_T3_URL,
|
|
56
56
|
DRIVER_NAME,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
DONE_LINE,
|
|
4
|
+
disconnect,
|
|
5
|
+
disconnectCommand,
|
|
6
|
+
disconnectPlan,
|
|
7
|
+
runnerOrigin,
|
|
8
|
+
unitOrigin
|
|
9
|
+
} from "./chunk-TJXXWEJW.js";
|
|
10
|
+
import "./chunk-RPWSWVKD.js";
|
|
11
|
+
import "./chunk-5LDFFQ4O.js";
|
|
12
|
+
import "./chunk-UBXT5IDU.js";
|
|
13
|
+
import "./chunk-NUU4GXGV.js";
|
|
14
|
+
import "./chunk-VK6GV757.js";
|
|
15
|
+
import "./chunk-R3CLO2FB.js";
|
|
16
|
+
import "./chunk-NALGGZM6.js";
|
|
17
|
+
import "./chunk-N24VQSNB.js";
|
|
18
|
+
import "./chunk-NYGELUTR.js";
|
|
19
|
+
import "./chunk-4H4SIIUH.js";
|
|
20
|
+
import "./chunk-IKCGVBHA.js";
|
|
21
|
+
export {
|
|
22
|
+
DONE_LINE,
|
|
23
|
+
disconnect,
|
|
24
|
+
disconnectCommand,
|
|
25
|
+
disconnectPlan,
|
|
26
|
+
runnerOrigin,
|
|
27
|
+
unitOrigin
|
|
28
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
pruneSessionStates,
|
|
5
5
|
toolPhrase,
|
|
6
6
|
writeSessionState
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-E5CKL2Q3.js";
|
|
8
8
|
import {
|
|
9
9
|
HeartbeatClient,
|
|
10
10
|
detectPlatform,
|
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
getName,
|
|
13
13
|
getSurface,
|
|
14
14
|
sanitizeSessionKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NUU4GXGV.js";
|
|
16
16
|
import "./chunk-VK6GV757.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-NYGELUTR.js";
|
|
18
18
|
import {
|
|
19
19
|
getToken
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IKCGVBHA.js";
|
|
21
21
|
|
|
22
22
|
// src/commands/hook-activity.ts
|
|
23
23
|
async function readStdin() {
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
getName,
|
|
7
7
|
getSurface,
|
|
8
8
|
newSessionKey
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NUU4GXGV.js";
|
|
10
10
|
import {
|
|
11
11
|
sanitizeLabel
|
|
12
12
|
} from "./chunk-VK6GV757.js";
|
|
13
13
|
import {
|
|
14
14
|
api
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NYGELUTR.js";
|
|
16
16
|
import {
|
|
17
17
|
getToken
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-IKCGVBHA.js";
|
|
19
19
|
|
|
20
20
|
// src/digest.ts
|
|
21
21
|
var CHAR_BUDGET = 1600;
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-UBXT5IDU.js";
|
|
5
5
|
import {
|
|
6
6
|
VERSION
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4H4SIIUH.js";
|
|
8
8
|
import {
|
|
9
9
|
applyEnvironmentFlag
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IKCGVBHA.js";
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
var oldNode = nodeTooOld();
|
|
@@ -65,67 +65,67 @@ async function main() {
|
|
|
65
65
|
switch (command) {
|
|
66
66
|
case "login":
|
|
67
67
|
case "auth": {
|
|
68
|
-
const { loginCommand } = await import("./login-
|
|
68
|
+
const { loginCommand } = await import("./login-37QE2AGW.js");
|
|
69
69
|
await loginCommand(argv);
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
72
|
case "install": {
|
|
73
|
-
const { installCommand } = await import("./install-
|
|
73
|
+
const { installCommand } = await import("./install-EMEZBBK7.js");
|
|
74
74
|
installCommand(argv);
|
|
75
75
|
break;
|
|
76
76
|
}
|
|
77
77
|
case "serve": {
|
|
78
|
-
const { startMcpServer } = await import("./mcp-server-
|
|
78
|
+
const { startMcpServer } = await import("./mcp-server-FLCNIW4C.js");
|
|
79
79
|
await startMcpServer();
|
|
80
80
|
break;
|
|
81
81
|
}
|
|
82
82
|
case "statusline": {
|
|
83
|
-
const { statuslineCommand } = await import("./statusline-
|
|
83
|
+
const { statuslineCommand } = await import("./statusline-HGIHZJY2.js");
|
|
84
84
|
statuslineCommand();
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
87
87
|
case "connect": {
|
|
88
|
-
const { connectCommand } = await import("./connect-
|
|
88
|
+
const { connectCommand } = await import("./connect-NAHKIUBI.js");
|
|
89
89
|
await connectCommand(argv.slice(1));
|
|
90
90
|
break;
|
|
91
91
|
}
|
|
92
92
|
case "use": {
|
|
93
|
-
const { useCommand } = await import("./use-
|
|
93
|
+
const { useCommand } = await import("./use-OLC3RTIL.js");
|
|
94
94
|
process.exitCode = await useCommand(argv.slice(1));
|
|
95
95
|
break;
|
|
96
96
|
}
|
|
97
97
|
case "disconnect": {
|
|
98
|
-
const { disconnectCommand } = await import("./disconnect-
|
|
98
|
+
const { disconnectCommand } = await import("./disconnect-KTTVOO6R.js");
|
|
99
99
|
await disconnectCommand(argv.slice(1));
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
102
|
case "box": {
|
|
103
|
-
const { boxCommand } = await import("./box-
|
|
103
|
+
const { boxCommand } = await import("./box-2SVXFDHE.js");
|
|
104
104
|
await boxCommand(argv.slice(1));
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
case "runs": {
|
|
108
|
-
const { runsCommand } = await import("./runs-
|
|
108
|
+
const { runsCommand } = await import("./runs-IDFJ3Z2K.js");
|
|
109
109
|
process.exitCode = runsCommand();
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
112
|
case "watch": {
|
|
113
|
-
const { watchCommand } = await import("./runs-
|
|
113
|
+
const { watchCommand } = await import("./runs-IDFJ3Z2K.js");
|
|
114
114
|
process.exitCode = await watchCommand(argv.slice(1));
|
|
115
115
|
break;
|
|
116
116
|
}
|
|
117
117
|
case "takeover": {
|
|
118
|
-
const { takeoverCommand } = await import("./takeover-
|
|
118
|
+
const { takeoverCommand } = await import("./takeover-YUBFKEKJ.js");
|
|
119
119
|
process.exitCode = await takeoverCommand(argv.slice(1));
|
|
120
120
|
break;
|
|
121
121
|
}
|
|
122
122
|
case "resume": {
|
|
123
|
-
const { resumeCommand } = await import("./runs-
|
|
123
|
+
const { resumeCommand } = await import("./runs-IDFJ3Z2K.js");
|
|
124
124
|
process.exitCode = await resumeCommand(argv.slice(1));
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
127
127
|
case "runner": {
|
|
128
|
-
const { runnerCommand } = await import("./runner-
|
|
128
|
+
const { runnerCommand } = await import("./runner-EHVMTKAA.js");
|
|
129
129
|
await runnerCommand(argv.slice(1));
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
@@ -134,10 +134,10 @@ async function main() {
|
|
|
134
134
|
const { runnerPermissionHook } = await import("./read-permissions-SPOKGVLO.js");
|
|
135
135
|
await runnerPermissionHook();
|
|
136
136
|
} else if (argv[1] === "session-start") {
|
|
137
|
-
const { hookSessionStart } = await import("./hook-session-start-
|
|
137
|
+
const { hookSessionStart } = await import("./hook-session-start-MFX6HR3W.js");
|
|
138
138
|
await hookSessionStart();
|
|
139
139
|
} else if (argv[1] === "activity") {
|
|
140
|
-
const { hookActivity } = await import("./hook-activity-
|
|
140
|
+
const { hookActivity } = await import("./hook-activity-I7TV7YG7.js");
|
|
141
141
|
await hookActivity();
|
|
142
142
|
} else {
|
|
143
143
|
console.error(`Unknown hook: ${argv[1] ?? "(none)"}`);
|