@cloop/runner 0.2.0 → 0.2.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-SQVB3OUM.js → box-HBQ4ZM2Y.js} +13 -12
- package/dist/{chunk-IIUHGZKX.js → chunk-2ZVYM4JU.js} +561 -122
- package/dist/{chunk-SQJ7ZO4G.js → chunk-3DIGCVL4.js} +1 -0
- package/dist/{chunk-4UE33DYW.js → chunk-AG6SI6I2.js} +1 -1
- package/dist/{chunk-CMOMRXTA.js → chunk-AQGBNKUG.js} +92 -14
- package/dist/{chunk-UYTSOW2C.js → chunk-J6AEO3GT.js} +1 -1
- package/dist/{chunk-HS5CIDQF.js → chunk-JX6VG5FE.js} +5 -1
- package/dist/{chunk-IR3P526R.js → chunk-OJ5AREUC.js} +1 -1
- package/dist/{chunk-7K5W6ELQ.js → chunk-OKF4BDBH.js} +1 -1
- package/dist/connect-LRQ4C3KK.js +66 -0
- package/dist/disconnect-FQ6ODTTE.js +143 -0
- package/dist/{hook-activity-JHLSVNFG.js → hook-activity-O2NNKTOE.js} +4 -4
- package/dist/{hook-session-start-BIO5QJKT.js → hook-session-start-MT67MMDM.js} +3 -3
- package/dist/index.js +20 -12
- package/dist/{install-2AYAXFYF.js → install-HTDTCELB.js} +1 -1
- package/dist/{login-TLO4ZXLI.js → login-4GUYT5MR.js} +4 -3
- package/dist/{mcp-server-VGCZ6AGJ.js → mcp-server-TV7MHVHZ.js} +8 -8
- package/dist/{runner-TOCZ4RXC.js → runner-5H7ECAZ6.js} +2 -2
- package/dist/{statusline-YIRFJQWY.js → statusline-6JMHIL54.js} +3 -3
- package/package.json +1 -1
- package/dist/connect-SFXN3UHJ.js +0 -41
|
@@ -2,16 +2,79 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ApiError,
|
|
4
4
|
api
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AG6SI6I2.js";
|
|
6
|
+
import {
|
|
7
|
+
VERSION
|
|
8
|
+
} from "./chunk-OKF4BDBH.js";
|
|
6
9
|
import {
|
|
7
10
|
getOrigin,
|
|
8
11
|
readCredentials,
|
|
9
12
|
writeCredentials
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3DIGCVL4.js";
|
|
11
14
|
|
|
12
15
|
// src/commands/login.ts
|
|
13
16
|
import { execFile } from "child_process";
|
|
14
17
|
import { hostname } from "os";
|
|
18
|
+
|
|
19
|
+
// src/connect-report.ts
|
|
20
|
+
import { randomUUID } from "crypto";
|
|
21
|
+
var ConnectFailure = class extends Error {
|
|
22
|
+
constructor(code, message, shown = false) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.code = code;
|
|
25
|
+
this.shown = shown;
|
|
26
|
+
this.name = "ConnectFailure";
|
|
27
|
+
}
|
|
28
|
+
code;
|
|
29
|
+
shown;
|
|
30
|
+
};
|
|
31
|
+
function newAttempt(now = Date.now()) {
|
|
32
|
+
return {
|
|
33
|
+
id: randomUUID(),
|
|
34
|
+
startedAt: now,
|
|
35
|
+
step: "detect",
|
|
36
|
+
harnesses: [],
|
|
37
|
+
driver: null,
|
|
38
|
+
fellBack: false,
|
|
39
|
+
deviceToken: null
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function shortMachineLabel(machine) {
|
|
43
|
+
return machine.split(".")[0]?.replace(/[^A-Za-z0-9-]/g, "-").slice(0, 63) || "unknown";
|
|
44
|
+
}
|
|
45
|
+
function connectReport(attempt, error, machine, now = Date.now()) {
|
|
46
|
+
return {
|
|
47
|
+
attempt_id: attempt.id,
|
|
48
|
+
cli_version: VERSION,
|
|
49
|
+
os: process.platform,
|
|
50
|
+
arch: process.arch,
|
|
51
|
+
node_version: process.version,
|
|
52
|
+
machine: shortMachineLabel(machine),
|
|
53
|
+
harnesses: attempt.harnesses,
|
|
54
|
+
driver: attempt.driver,
|
|
55
|
+
fell_back: attempt.fellBack,
|
|
56
|
+
step: attempt.step,
|
|
57
|
+
outcome: error ? "failed" : "ok",
|
|
58
|
+
error_code: error,
|
|
59
|
+
seconds: Math.round((now - attempt.startedAt) / 1e3)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
async function sendConnectReport(origin, report, deviceToken, fetchFn = fetch) {
|
|
63
|
+
try {
|
|
64
|
+
await fetchFn(`${origin}/api/agent/mesh/connect-report`, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: {
|
|
67
|
+
"content-type": "application/json",
|
|
68
|
+
...deviceToken ? { authorization: `Bearer ${deviceToken}` } : {}
|
|
69
|
+
},
|
|
70
|
+
body: JSON.stringify(report),
|
|
71
|
+
signal: AbortSignal.timeout(3e3)
|
|
72
|
+
});
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/commands/login.ts
|
|
15
78
|
var POLL_INTERVAL_MS = 3e3;
|
|
16
79
|
var POLL_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
17
80
|
var BOUND_ELSEWHERE = "This box is connected to another Cloop account. Disconnect it there first.";
|
|
@@ -69,7 +132,14 @@ async function loginCommand(argv = process.argv.slice(2)) {
|
|
|
69
132
|
const origin = getOrigin();
|
|
70
133
|
const deviceName = parseDeviceName(argv) ?? hostname();
|
|
71
134
|
const existing = readCredentials();
|
|
72
|
-
|
|
135
|
+
let token;
|
|
136
|
+
try {
|
|
137
|
+
token = await deviceLogin({ origin, deviceName });
|
|
138
|
+
} catch (err) {
|
|
139
|
+
if (!(err instanceof ConnectFailure)) throw err;
|
|
140
|
+
out(`${red("\u2717")} ${err.message}`);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
73
143
|
const chosen = process.env.CLOOP_ORIGIN ? origin : existing?.origin ?? origin;
|
|
74
144
|
const creds = { origin: chosen, token, deviceName };
|
|
75
145
|
writeCredentials(creds);
|
|
@@ -95,8 +165,10 @@ async function deviceLogin(opts) {
|
|
|
95
165
|
}
|
|
96
166
|
});
|
|
97
167
|
} catch (err) {
|
|
98
|
-
|
|
99
|
-
|
|
168
|
+
throw new ConnectFailure(
|
|
169
|
+
"login_failed",
|
|
170
|
+
`Could not start login: ${err instanceof Error ? err.message : String(err)}`
|
|
171
|
+
);
|
|
100
172
|
}
|
|
101
173
|
const code = formatCode(start.code);
|
|
102
174
|
out(`${mark} Approve ${deviceName} in your browser. Code ${code}.`);
|
|
@@ -116,13 +188,12 @@ async function deviceLogin(opts) {
|
|
|
116
188
|
body: { action: "poll", code: start.code, poll_token: start.poll_token }
|
|
117
189
|
});
|
|
118
190
|
} catch (err) {
|
|
119
|
-
if (err instanceof ApiError && err.status === 410) {
|
|
120
|
-
wait.stop(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
process.exit(1);
|
|
191
|
+
if (err instanceof ApiError && (err.status === 410 || err.status === 409)) {
|
|
192
|
+
wait.stop();
|
|
193
|
+
throw new ConnectFailure(
|
|
194
|
+
"login_failed",
|
|
195
|
+
err.status === 410 ? "Code expired. Run the command again." : refusalSentence(err.body)
|
|
196
|
+
);
|
|
126
197
|
}
|
|
127
198
|
continue;
|
|
128
199
|
}
|
|
@@ -132,8 +203,11 @@ async function deviceLogin(opts) {
|
|
|
132
203
|
}
|
|
133
204
|
}
|
|
134
205
|
if (!token) {
|
|
135
|
-
wait.stop(
|
|
136
|
-
|
|
206
|
+
wait.stop();
|
|
207
|
+
throw new ConnectFailure(
|
|
208
|
+
"login_failed",
|
|
209
|
+
"No approval within 5 minutes. Run the command again."
|
|
210
|
+
);
|
|
137
211
|
}
|
|
138
212
|
wait.stop(`${mark} Linked as ${deviceName}.`);
|
|
139
213
|
return token;
|
|
@@ -155,6 +229,10 @@ function parseDeviceName(argv) {
|
|
|
155
229
|
}
|
|
156
230
|
|
|
157
231
|
export {
|
|
232
|
+
ConnectFailure,
|
|
233
|
+
newAttempt,
|
|
234
|
+
connectReport,
|
|
235
|
+
sendConnectReport,
|
|
158
236
|
loginCommand,
|
|
159
237
|
deviceLogin,
|
|
160
238
|
refusalSentence
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
api
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AG6SI6I2.js";
|
|
5
5
|
|
|
6
6
|
// src/presence.ts
|
|
7
7
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -70,6 +70,9 @@ function resolveMachine() {
|
|
|
70
70
|
}
|
|
71
71
|
return hostname().replace(/\.local$/i, "");
|
|
72
72
|
}
|
|
73
|
+
function shortMachineName(machine = getMachine()) {
|
|
74
|
+
return machine.split(".")[0] || machine;
|
|
75
|
+
}
|
|
73
76
|
var PLATFORM_LABELS = {
|
|
74
77
|
claude: "Claude Code",
|
|
75
78
|
codex: "Codex",
|
|
@@ -137,6 +140,7 @@ var HeartbeatClient = class {
|
|
|
137
140
|
|
|
138
141
|
export {
|
|
139
142
|
getMachine,
|
|
143
|
+
shortMachineName,
|
|
140
144
|
getName,
|
|
141
145
|
getSurface,
|
|
142
146
|
detectPlatform,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_T3_URL,
|
|
4
|
+
askOrClosed,
|
|
5
|
+
askRepos,
|
|
6
|
+
awaitDaemon,
|
|
7
|
+
chooseDriver,
|
|
8
|
+
connectBox,
|
|
9
|
+
connectChosen,
|
|
10
|
+
connectCommand,
|
|
11
|
+
detect,
|
|
12
|
+
fallbackDriver,
|
|
13
|
+
fallbackLine,
|
|
14
|
+
findCheckouts,
|
|
15
|
+
harnessesFound,
|
|
16
|
+
installedService,
|
|
17
|
+
isWorkstation,
|
|
18
|
+
mintSession,
|
|
19
|
+
notACheckoutLine,
|
|
20
|
+
parsePicks,
|
|
21
|
+
programFor,
|
|
22
|
+
rerunCommand,
|
|
23
|
+
resolveRepos,
|
|
24
|
+
revokeReplaced,
|
|
25
|
+
runSteps,
|
|
26
|
+
systemdAssignment,
|
|
27
|
+
systemdWord,
|
|
28
|
+
tilde,
|
|
29
|
+
unitEnv,
|
|
30
|
+
unitFor
|
|
31
|
+
} from "./chunk-2ZVYM4JU.js";
|
|
32
|
+
import "./chunk-AQGBNKUG.js";
|
|
33
|
+
import "./chunk-JX6VG5FE.js";
|
|
34
|
+
import "./chunk-AG6SI6I2.js";
|
|
35
|
+
import "./chunk-OKF4BDBH.js";
|
|
36
|
+
import "./chunk-3DIGCVL4.js";
|
|
37
|
+
export {
|
|
38
|
+
DEFAULT_T3_URL,
|
|
39
|
+
askOrClosed,
|
|
40
|
+
askRepos,
|
|
41
|
+
awaitDaemon,
|
|
42
|
+
chooseDriver,
|
|
43
|
+
connectBox,
|
|
44
|
+
connectChosen,
|
|
45
|
+
connectCommand,
|
|
46
|
+
detect,
|
|
47
|
+
fallbackDriver,
|
|
48
|
+
fallbackLine,
|
|
49
|
+
findCheckouts,
|
|
50
|
+
harnessesFound,
|
|
51
|
+
installedService,
|
|
52
|
+
isWorkstation,
|
|
53
|
+
mintSession,
|
|
54
|
+
notACheckoutLine,
|
|
55
|
+
parsePicks,
|
|
56
|
+
programFor,
|
|
57
|
+
rerunCommand,
|
|
58
|
+
resolveRepos,
|
|
59
|
+
revokeReplaced,
|
|
60
|
+
runSteps,
|
|
61
|
+
systemdAssignment,
|
|
62
|
+
systemdWord,
|
|
63
|
+
tilde,
|
|
64
|
+
unitEnv,
|
|
65
|
+
unitFor
|
|
66
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
boxPath,
|
|
4
|
+
installedService,
|
|
5
|
+
localRunsFilePath,
|
|
6
|
+
readRunnerConfig,
|
|
7
|
+
revokeOwnDevice,
|
|
8
|
+
runSteps,
|
|
9
|
+
runnerStatePath,
|
|
10
|
+
threadsFilePath,
|
|
11
|
+
tokenGone
|
|
12
|
+
} from "./chunk-2ZVYM4JU.js";
|
|
13
|
+
import "./chunk-AQGBNKUG.js";
|
|
14
|
+
import "./chunk-JX6VG5FE.js";
|
|
15
|
+
import "./chunk-AG6SI6I2.js";
|
|
16
|
+
import "./chunk-OKF4BDBH.js";
|
|
17
|
+
import {
|
|
18
|
+
getOrigin
|
|
19
|
+
} from "./chunk-3DIGCVL4.js";
|
|
20
|
+
|
|
21
|
+
// src/commands/disconnect.ts
|
|
22
|
+
import { execFileSync } from "child_process";
|
|
23
|
+
import { existsSync, readFileSync, rmSync } from "fs";
|
|
24
|
+
import { homedir } from "os";
|
|
25
|
+
var DONE_LINE = "This computer is no longer a Cloop runner. To connect it again: npx -y @cloop/runner connect";
|
|
26
|
+
function unitOrigin(contents) {
|
|
27
|
+
const plist = /<key>CLOOP_ORIGIN<\/key><string>([^<]+)<\/string>/.exec(contents)?.[1];
|
|
28
|
+
if (plist) return plist.replace(/&/g, "&");
|
|
29
|
+
const unit = /Environment="CLOOP_ORIGIN=([^"]+)"/.exec(contents)?.[1];
|
|
30
|
+
return unit ? unit.replace(/%%/g, "%") : null;
|
|
31
|
+
}
|
|
32
|
+
function disconnectPlan(opts) {
|
|
33
|
+
const exists = opts.exists ?? existsSync;
|
|
34
|
+
const read = opts.read ?? ((path) => readFileSync(path, "utf-8"));
|
|
35
|
+
const services = ["local", "workstation"].map((kind) => installedService({ ...opts, kind })).filter((service) => exists(service.path));
|
|
36
|
+
const fromUnit = services.map((service) => {
|
|
37
|
+
try {
|
|
38
|
+
return unitOrigin(read(service.path));
|
|
39
|
+
} catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}).find(Boolean);
|
|
43
|
+
return {
|
|
44
|
+
origin: opts.boxOrigin ?? fromUnit ?? opts.fallbackOrigin,
|
|
45
|
+
deviceToken: opts.deviceToken,
|
|
46
|
+
services,
|
|
47
|
+
box: exists(opts.box) ? opts.box : null,
|
|
48
|
+
files: opts.files.filter((file) => exists(file)),
|
|
49
|
+
isBox: opts.platform !== "darwin" && services.some((s) => s.path.endsWith("/cloop-box.service"))
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function revokeLine(revoke, origin, box) {
|
|
53
|
+
const keep = box ? ` Kept ${box}, which holds the device token, so you can try again.` : "";
|
|
54
|
+
switch (revoke) {
|
|
55
|
+
case "revoked":
|
|
56
|
+
return [`Revoked this computer on Cloop (${origin}).`];
|
|
57
|
+
case "already_revoked":
|
|
58
|
+
return [`Cloop (${origin}) had already revoked this computer.`];
|
|
59
|
+
case "no_device":
|
|
60
|
+
return ["No runner device on this computer to revoke."];
|
|
61
|
+
case "unknown_device":
|
|
62
|
+
return [
|
|
63
|
+
`Cloop at ${origin} never issued this computer's device token, so it belongs to the other environment.${keep}`,
|
|
64
|
+
"Run `cloop disconnect --staging` for a staging runner, or `cloop disconnect` for production."
|
|
65
|
+
];
|
|
66
|
+
case "failed":
|
|
67
|
+
return [
|
|
68
|
+
`Could not revoke this computer at ${origin}: Cloop did not answer as expected.${keep}`,
|
|
69
|
+
"Run `cloop disconnect` again when Cloop answers, or press Disconnect on its card on the Threads page and then delete that file."
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function disconnect(plan, opts) {
|
|
74
|
+
const { say } = opts;
|
|
75
|
+
const run = opts.run ?? ((command) => void execFileSync(command[0], command.slice(1), {
|
|
76
|
+
stdio: "ignore",
|
|
77
|
+
timeout: 15e3
|
|
78
|
+
}));
|
|
79
|
+
if (plan.isBox && !opts.yes) {
|
|
80
|
+
say("This computer runs cloop-box.service, a Cloop box with T3 Code. Disconnect would:");
|
|
81
|
+
for (const s of plan.services) say(` stop and remove ${s.path}`);
|
|
82
|
+
if (plan.deviceToken) say(` revoke its runner device on Cloop (${plan.origin})`);
|
|
83
|
+
for (const f of [...plan.box ? [plan.box] : [], ...plan.files]) say(` delete ${f}`);
|
|
84
|
+
say("Run `cloop disconnect --yes` to do this.");
|
|
85
|
+
return 1;
|
|
86
|
+
}
|
|
87
|
+
for (const service of plan.services) {
|
|
88
|
+
await runSteps(service.steps, run);
|
|
89
|
+
let stillRunning = true;
|
|
90
|
+
try {
|
|
91
|
+
run(service.running);
|
|
92
|
+
} catch {
|
|
93
|
+
stillRunning = false;
|
|
94
|
+
}
|
|
95
|
+
if (stillRunning) {
|
|
96
|
+
say(
|
|
97
|
+
`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.`
|
|
98
|
+
);
|
|
99
|
+
return 1;
|
|
100
|
+
}
|
|
101
|
+
say(`Stopped the service in ${service.path}`);
|
|
102
|
+
}
|
|
103
|
+
const revoked = await opts.revoke(plan.origin, plan.deviceToken);
|
|
104
|
+
const gone = tokenGone(revoked);
|
|
105
|
+
for (const service of plan.services) {
|
|
106
|
+
rmSync(service.path, { force: true });
|
|
107
|
+
say(`Removed ${service.path}`);
|
|
108
|
+
}
|
|
109
|
+
for (const file of [...gone && plan.box ? [plan.box] : [], ...plan.files]) {
|
|
110
|
+
rmSync(file, { force: true });
|
|
111
|
+
say(`Deleted ${file}`);
|
|
112
|
+
}
|
|
113
|
+
for (const line of revokeLine(revoked, plan.origin, plan.box)) say(line);
|
|
114
|
+
if (!gone) return 1;
|
|
115
|
+
say(DONE_LINE);
|
|
116
|
+
return 0;
|
|
117
|
+
}
|
|
118
|
+
async function disconnectCommand(argv) {
|
|
119
|
+
const cfg = readRunnerConfig();
|
|
120
|
+
const plan = disconnectPlan({
|
|
121
|
+
platform: process.platform,
|
|
122
|
+
home: homedir(),
|
|
123
|
+
uid: process.getuid?.() ?? 0,
|
|
124
|
+
...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {},
|
|
125
|
+
box: boxPath(),
|
|
126
|
+
deviceToken: cfg?.deviceToken ?? null,
|
|
127
|
+
...cfg?.origin ? { boxOrigin: cfg.origin } : {},
|
|
128
|
+
fallbackOrigin: getOrigin(),
|
|
129
|
+
files: [localRunsFilePath(), runnerStatePath(), threadsFilePath()]
|
|
130
|
+
});
|
|
131
|
+
process.exitCode = await disconnect(plan, {
|
|
132
|
+
yes: argv.includes("--yes"),
|
|
133
|
+
revoke: (origin, token) => revokeOwnDevice(origin, token),
|
|
134
|
+
say: (line) => console.log(line)
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
DONE_LINE,
|
|
139
|
+
disconnect,
|
|
140
|
+
disconnectCommand,
|
|
141
|
+
disconnectPlan,
|
|
142
|
+
unitOrigin
|
|
143
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
pruneSessionStates,
|
|
5
5
|
toolPhrase,
|
|
6
6
|
writeSessionState
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OJ5AREUC.js";
|
|
8
8
|
import "./chunk-4LFQXBWP.js";
|
|
9
9
|
import {
|
|
10
10
|
HeartbeatClient,
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
getName,
|
|
14
14
|
getSurface,
|
|
15
15
|
sanitizeSessionKey
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-JX6VG5FE.js";
|
|
17
|
+
import "./chunk-AG6SI6I2.js";
|
|
18
18
|
import {
|
|
19
19
|
getToken
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3DIGCVL4.js";
|
|
21
21
|
|
|
22
22
|
// src/commands/hook-activity.ts
|
|
23
23
|
async function readStdin() {
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
getName,
|
|
10
10
|
getSurface,
|
|
11
11
|
newSessionKey
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JX6VG5FE.js";
|
|
13
13
|
import {
|
|
14
14
|
api
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-AG6SI6I2.js";
|
|
16
16
|
import {
|
|
17
17
|
getToken
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3DIGCVL4.js";
|
|
19
19
|
|
|
20
20
|
// src/digest.ts
|
|
21
21
|
var CHAR_BUDGET = 1600;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OKF4BDBH.js";
|
|
5
5
|
import {
|
|
6
6
|
applyEnvironmentFlag
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3DIGCVL4.js";
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
10
|
var argv = applyEnvironmentFlag(process.argv.slice(2));
|
|
@@ -18,9 +18,12 @@ Usage:
|
|
|
18
18
|
cloop statusline Render the Claude Code status line (reads local state)
|
|
19
19
|
cloop hook session-start Claude Code SessionStart hook (reads JSON on stdin)
|
|
20
20
|
cloop hook activity Lifecycle hook: records what this session is doing
|
|
21
|
-
cloop connect [--repo <path>]... [--driver t3|claude-code|codex] [--
|
|
21
|
+
cloop connect [--repo <path>]... [--driver t3|claude-code|codex] [--fallback-model <list>]
|
|
22
|
+
[--no-service] [--no-start]
|
|
22
23
|
Make this machine a Cloop runner: T3 Code, else
|
|
23
24
|
Claude Code or Codex in the repos you name
|
|
25
|
+
cloop disconnect [--yes] Stop being a Cloop runner: revoke this computer on
|
|
26
|
+
Cloop, remove its service and runner files
|
|
24
27
|
cloop box connect cloop connect with T3 Code forced
|
|
25
28
|
cloop box run Answer the Cloop Agent's runner calls (daemon)
|
|
26
29
|
cloop runner register --webhook <url> --label <name> [--reactivate]
|
|
@@ -37,46 +40,51 @@ async function main() {
|
|
|
37
40
|
switch (command) {
|
|
38
41
|
case "login":
|
|
39
42
|
case "auth": {
|
|
40
|
-
const { loginCommand } = await import("./login-
|
|
43
|
+
const { loginCommand } = await import("./login-4GUYT5MR.js");
|
|
41
44
|
await loginCommand(argv);
|
|
42
45
|
break;
|
|
43
46
|
}
|
|
44
47
|
case "install": {
|
|
45
|
-
const { installCommand } = await import("./install-
|
|
48
|
+
const { installCommand } = await import("./install-HTDTCELB.js");
|
|
46
49
|
installCommand(argv);
|
|
47
50
|
break;
|
|
48
51
|
}
|
|
49
52
|
case "serve": {
|
|
50
|
-
const { startMcpServer } = await import("./mcp-server-
|
|
53
|
+
const { startMcpServer } = await import("./mcp-server-TV7MHVHZ.js");
|
|
51
54
|
await startMcpServer();
|
|
52
55
|
break;
|
|
53
56
|
}
|
|
54
57
|
case "statusline": {
|
|
55
|
-
const { statuslineCommand } = await import("./statusline-
|
|
58
|
+
const { statuslineCommand } = await import("./statusline-6JMHIL54.js");
|
|
56
59
|
statuslineCommand();
|
|
57
60
|
break;
|
|
58
61
|
}
|
|
59
62
|
case "connect": {
|
|
60
|
-
const { connectCommand } = await import("./connect-
|
|
63
|
+
const { connectCommand } = await import("./connect-LRQ4C3KK.js");
|
|
61
64
|
await connectCommand(argv.slice(1));
|
|
62
65
|
break;
|
|
63
66
|
}
|
|
67
|
+
case "disconnect": {
|
|
68
|
+
const { disconnectCommand } = await import("./disconnect-FQ6ODTTE.js");
|
|
69
|
+
await disconnectCommand(argv.slice(1));
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
64
72
|
case "box": {
|
|
65
|
-
const { boxCommand } = await import("./box-
|
|
73
|
+
const { boxCommand } = await import("./box-HBQ4ZM2Y.js");
|
|
66
74
|
await boxCommand(argv.slice(1));
|
|
67
75
|
break;
|
|
68
76
|
}
|
|
69
77
|
case "runner": {
|
|
70
|
-
const { runnerCommand } = await import("./runner-
|
|
78
|
+
const { runnerCommand } = await import("./runner-5H7ECAZ6.js");
|
|
71
79
|
await runnerCommand(argv.slice(1));
|
|
72
80
|
break;
|
|
73
81
|
}
|
|
74
82
|
case "hook": {
|
|
75
83
|
if (argv[1] === "session-start") {
|
|
76
|
-
const { hookSessionStart } = await import("./hook-session-start-
|
|
84
|
+
const { hookSessionStart } = await import("./hook-session-start-MT67MMDM.js");
|
|
77
85
|
await hookSessionStart();
|
|
78
86
|
} else if (argv[1] === "activity") {
|
|
79
|
-
const { hookActivity } = await import("./hook-activity-
|
|
87
|
+
const { hookActivity } = await import("./hook-activity-O2NNKTOE.js");
|
|
80
88
|
await hookActivity();
|
|
81
89
|
} else {
|
|
82
90
|
console.error(`Unknown hook: ${argv[1] ?? "(none)"}`);
|
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
deviceLogin,
|
|
4
4
|
loginCommand,
|
|
5
5
|
refusalSentence
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-AQGBNKUG.js";
|
|
7
|
+
import "./chunk-AG6SI6I2.js";
|
|
8
|
+
import "./chunk-OKF4BDBH.js";
|
|
9
|
+
import "./chunk-3DIGCVL4.js";
|
|
9
10
|
export {
|
|
10
11
|
deviceLogin,
|
|
11
12
|
loginCommand,
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
readSessionState,
|
|
4
4
|
toolPhrase,
|
|
5
5
|
writeSessionState
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OJ5AREUC.js";
|
|
7
7
|
import {
|
|
8
8
|
appendInbox,
|
|
9
9
|
drainInbox,
|
|
10
10
|
readInbox,
|
|
11
11
|
syncInboxPending,
|
|
12
12
|
writeState
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-J6AEO3GT.js";
|
|
14
14
|
import {
|
|
15
15
|
sanitizeLabel,
|
|
16
16
|
sanitizeUntrusted
|
|
@@ -26,18 +26,18 @@ import {
|
|
|
26
26
|
getName,
|
|
27
27
|
getSurface,
|
|
28
28
|
newSessionKey
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import {
|
|
31
|
-
VERSION
|
|
32
|
-
} from "./chunk-7K5W6ELQ.js";
|
|
29
|
+
} from "./chunk-JX6VG5FE.js";
|
|
33
30
|
import {
|
|
34
31
|
ReauthError,
|
|
35
32
|
api
|
|
36
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-AG6SI6I2.js";
|
|
34
|
+
import {
|
|
35
|
+
VERSION
|
|
36
|
+
} from "./chunk-OKF4BDBH.js";
|
|
37
37
|
import {
|
|
38
38
|
getMeshUrl,
|
|
39
39
|
getToken
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-3DIGCVL4.js";
|
|
41
41
|
|
|
42
42
|
// src/mcp-server.ts
|
|
43
43
|
import { Server } from "@modelcontextprotocol/server";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
api
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AG6SI6I2.js";
|
|
5
5
|
import {
|
|
6
6
|
CONFIG_DIR
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3DIGCVL4.js";
|
|
8
8
|
|
|
9
9
|
// src/commands/runner.ts
|
|
10
10
|
import { randomBytes } from "crypto";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
readState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-J6AEO3GT.js";
|
|
5
5
|
import {
|
|
6
6
|
sanitizeLabel
|
|
7
7
|
} from "./chunk-4LFQXBWP.js";
|
|
8
8
|
import {
|
|
9
9
|
VERSION
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OKF4BDBH.js";
|
|
11
11
|
import {
|
|
12
12
|
getToken
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3DIGCVL4.js";
|
|
14
14
|
|
|
15
15
|
// src/commands/statusline.ts
|
|
16
16
|
var FRESH_MS = 2 * 60 * 1e3;
|
package/package.json
CHANGED