@cloop/runner 0.3.2 → 0.3.7
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/README.md +4 -0
- package/dist/{box-VE2WJH3A.js → box-IWMUX74G.js} +315 -39
- package/dist/{chunk-6SRPPUR2.js → chunk-3IP5XIPV.js} +3 -3
- package/dist/{chunk-43GTYT5U.js → chunk-3TDL6X5T.js} +1 -1
- package/dist/{chunk-NEGKYXHS.js → chunk-3WD7S6VI.js} +235 -87
- package/dist/{chunk-UIFPQQCQ.js → chunk-5L76PKXT.js} +1 -1
- package/dist/{chunk-CKFWWGDD.js → chunk-EQTFHMUJ.js} +1 -1
- package/dist/{chunk-LAQSZU6I.js → chunk-PSUEFPEA.js} +3 -1
- package/dist/{chunk-23ZHP4EN.js → chunk-QP6ZNGU3.js} +214 -64
- package/dist/{chunk-LOSZGPY4.js → chunk-VYM5NYS6.js} +1 -1
- package/dist/{connect-YCCLIBTL.js → connect-QKQAJECG.js} +22 -10
- package/dist/{disconnect-TVAN3LLV.js → disconnect-5FEZUWJP.js} +6 -6
- package/dist/index.js +15 -14
- package/dist/{login-OF62R2RQ.js → login-3IJKY6EZ.js} +2 -2
- package/dist/{mcp-server-V2M6VOQP.js → mcp-server-H2DF37BP.js} +1 -1
- package/dist/{runner-64HZZDG6.js → runner-5G4CLAXF.js} +3 -3
- package/dist/{runs-4DXIUYDF.js → runs-RZL34AFT.js} +2 -2
- package/dist/{statusline-354ALD5T.js → statusline-I3MT77CR.js} +1 -1
- package/dist/{takeover-Y7ZKSHGQ.js → takeover-V2IHVUAB.js} +4 -4
- package/dist/{use-AECELCU6.js → use-PB7RVN6H.js} +6 -6
- package/package.json +1 -1
|
@@ -3,13 +3,14 @@ import {
|
|
|
3
3
|
readRunnerState,
|
|
4
4
|
runnerStatePath,
|
|
5
5
|
threadsFilePath
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EQTFHMUJ.js";
|
|
7
7
|
import {
|
|
8
8
|
BoxToolError,
|
|
9
9
|
CLOOP_THREAD_PREFIX,
|
|
10
10
|
RUNTIME_MODES,
|
|
11
11
|
T3Driver,
|
|
12
12
|
boxPath,
|
|
13
|
+
commandFor,
|
|
13
14
|
defaultT3BinSources,
|
|
14
15
|
isLocal,
|
|
15
16
|
isYes,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
t3BaseDirArgs,
|
|
23
24
|
t3Candidates,
|
|
24
25
|
writeBoxConfig
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-3WD7S6VI.js";
|
|
26
27
|
import {
|
|
27
28
|
CLAUDE_FLOOR,
|
|
28
29
|
claudeTooOld,
|
|
@@ -38,17 +39,17 @@ import {
|
|
|
38
39
|
} from "./chunk-R3CLO2FB.js";
|
|
39
40
|
import {
|
|
40
41
|
connectWebhook
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-VYM5NYS6.js";
|
|
42
43
|
import {
|
|
43
44
|
ConnectFailure,
|
|
44
45
|
connectReport,
|
|
45
46
|
deviceLogin,
|
|
46
47
|
newAttempt,
|
|
47
48
|
sendConnectReport
|
|
48
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-PSUEFPEA.js";
|
|
49
50
|
import {
|
|
50
51
|
VERSION
|
|
51
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-5L76PKXT.js";
|
|
52
53
|
import {
|
|
53
54
|
STAGING_ORIGIN,
|
|
54
55
|
getOrigin,
|
|
@@ -86,7 +87,14 @@ async function revokeOwnDevice(origin, deviceToken, fetchFn = fetch) {
|
|
|
86
87
|
// src/commands/connect.ts
|
|
87
88
|
import { execFileSync } from "child_process";
|
|
88
89
|
import { randomUUID } from "crypto";
|
|
89
|
-
import {
|
|
90
|
+
import {
|
|
91
|
+
existsSync,
|
|
92
|
+
mkdirSync,
|
|
93
|
+
readdirSync,
|
|
94
|
+
rmSync,
|
|
95
|
+
statSync,
|
|
96
|
+
writeFileSync
|
|
97
|
+
} from "fs";
|
|
90
98
|
import { homedir, userInfo } from "os";
|
|
91
99
|
import { basename as basename3, dirname, join, resolve as resolve2 } from "path";
|
|
92
100
|
import { createInterface } from "readline/promises";
|
|
@@ -371,11 +379,16 @@ var SUBSCRIPTIONS = {
|
|
|
371
379
|
enterprise: "Claude Enterprise"
|
|
372
380
|
};
|
|
373
381
|
function exec(bin, args) {
|
|
382
|
+
const command = commandFor(bin, args);
|
|
374
383
|
return new Promise(
|
|
375
384
|
(resolve3) => execFile(
|
|
376
|
-
|
|
377
|
-
args,
|
|
378
|
-
{
|
|
385
|
+
command.file,
|
|
386
|
+
command.args,
|
|
387
|
+
{
|
|
388
|
+
timeout: 1e4,
|
|
389
|
+
encoding: "utf-8",
|
|
390
|
+
...command.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
391
|
+
},
|
|
379
392
|
(err, out2) => resolve3(err ? null : String(out2))
|
|
380
393
|
)
|
|
381
394
|
);
|
|
@@ -644,11 +657,16 @@ function claudeDialect(bin = "claude", fallback = DEFAULT_FALLBACK_MODEL, askEve
|
|
|
644
657
|
import { execFile as execFile2 } from "child_process";
|
|
645
658
|
import { basename as basename2 } from "path";
|
|
646
659
|
function exec2(bin, args) {
|
|
660
|
+
const command = commandFor(bin, args);
|
|
647
661
|
return new Promise(
|
|
648
662
|
(resolve3) => execFile2(
|
|
649
|
-
|
|
650
|
-
args,
|
|
651
|
-
{
|
|
663
|
+
command.file,
|
|
664
|
+
command.args,
|
|
665
|
+
{
|
|
666
|
+
timeout: 1e4,
|
|
667
|
+
encoding: "utf-8",
|
|
668
|
+
...command.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
669
|
+
},
|
|
652
670
|
(err, out2, errOut) => resolve3({ ok: !err, out: `${out2}${errOut}` })
|
|
653
671
|
)
|
|
654
672
|
);
|
|
@@ -727,7 +745,7 @@ function codexDialect(bin = "codex") {
|
|
|
727
745
|
keepsStdin: false,
|
|
728
746
|
args(run, resume) {
|
|
729
747
|
const model = run.model ? ["--model", run.model] : [];
|
|
730
|
-
const policy = ["--dangerously-bypass-approvals-and-sandbox"];
|
|
748
|
+
const policy = ["--dangerously-bypass-approvals-and-sandbox", "--skip-git-repo-check"];
|
|
731
749
|
return resume && run.session_id ? ["exec", ...policy, "resume", run.session_id, "--json", ...model, "-"] : ["exec", "--cd", run.repo, "--json", ...policy, ...model, "-"];
|
|
732
750
|
},
|
|
733
751
|
opening: (_run, prompt) => prompt,
|
|
@@ -777,12 +795,32 @@ function flags(argv, name) {
|
|
|
777
795
|
return argv.flatMap((a, i) => a === name && argv[i + 1] ? [argv[i + 1]] : []);
|
|
778
796
|
}
|
|
779
797
|
function which(bin) {
|
|
798
|
+
return process.platform === "win32" ? where(bin) : whichPosix(bin);
|
|
799
|
+
}
|
|
800
|
+
function whichPosix(bin) {
|
|
780
801
|
try {
|
|
781
802
|
return execFileSync("which", [bin], { encoding: "utf-8", env: CLEAN_ENV }).trim() || null;
|
|
782
803
|
} catch {
|
|
783
804
|
return null;
|
|
784
805
|
}
|
|
785
806
|
}
|
|
807
|
+
function where(bin) {
|
|
808
|
+
try {
|
|
809
|
+
const found = execFileSync("where", [bin], {
|
|
810
|
+
encoding: "utf-8",
|
|
811
|
+
// `where` matches extensions through PATHEXT, which CLEAN_ENV alone drops.
|
|
812
|
+
env: { ...CLEAN_ENV, PATHEXT: process.env.PATHEXT, SystemRoot: process.env.SystemRoot }
|
|
813
|
+
});
|
|
814
|
+
return preferExecutable(
|
|
815
|
+
found.split(/\r?\n/).map((line2) => line2.trim()).filter(Boolean)
|
|
816
|
+
);
|
|
817
|
+
} catch {
|
|
818
|
+
return null;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
function preferExecutable(lines) {
|
|
822
|
+
return lines.find((line2) => /\.exe$/i.test(line2)) ?? lines.find((line2) => /\.(cmd|bat)$/i.test(line2)) ?? lines[0] ?? null;
|
|
823
|
+
}
|
|
786
824
|
var T3PairError = class extends Error {
|
|
787
825
|
name = "T3PairError";
|
|
788
826
|
};
|
|
@@ -972,12 +1010,23 @@ function systemdWord(arg) {
|
|
|
972
1010
|
const escaped = arg.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/%/g, "%%").replace(/\$/g, "$$$$");
|
|
973
1011
|
return `"${escaped}"`;
|
|
974
1012
|
}
|
|
1013
|
+
function cmdValue(value) {
|
|
1014
|
+
return value.replace(/%/g, "%%");
|
|
1015
|
+
}
|
|
1016
|
+
function cmdWord(arg) {
|
|
1017
|
+
return `"${cmdValue(arg)}"`;
|
|
1018
|
+
}
|
|
975
1019
|
function programFor(script, node, npx, version) {
|
|
976
|
-
if (
|
|
1020
|
+
if (!/[\\/]_npx[\\/]/.test(script)) return [node, script, "box", "run"];
|
|
977
1021
|
if (!npx)
|
|
978
1022
|
return "npx is not on PATH, so the service cannot run Cloop. Install it with `npm install -g @cloop/runner` and run `cloop connect` again.";
|
|
979
1023
|
return [npx, "-y", `@cloop/runner@${version}`, "box", "run"];
|
|
980
1024
|
}
|
|
1025
|
+
function findNpx() {
|
|
1026
|
+
const name = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
1027
|
+
const beside = join(dirname(process.execPath), name);
|
|
1028
|
+
return existsSync(beside) ? beside : which(name);
|
|
1029
|
+
}
|
|
981
1030
|
async function awaitDaemon(since, read = readRunnerState, { timeoutMs = 15e3, pollMs = 500 } = {}) {
|
|
982
1031
|
for (let waited = 0; ; waited += pollMs) {
|
|
983
1032
|
const state = read();
|
|
@@ -991,6 +1040,7 @@ var UNIT_ENV = [
|
|
|
991
1040
|
"CLOOP_BOX_FILE",
|
|
992
1041
|
"CLOOP_BOX_THREADS_FILE",
|
|
993
1042
|
"CLOOP_LOCAL_RUNS_FILE",
|
|
1043
|
+
"CLOOP_UPDATE_DIR",
|
|
994
1044
|
"CLOOP_MESH_URL",
|
|
995
1045
|
"CLOOP_ORIGIN",
|
|
996
1046
|
"T3CODE_HOME"
|
|
@@ -1013,6 +1063,17 @@ function installedService(opts) {
|
|
|
1013
1063
|
running: ["launchctl", "print", `gui/${opts.uid}/${label}`]
|
|
1014
1064
|
};
|
|
1015
1065
|
}
|
|
1066
|
+
if (opts.platform === "win32") {
|
|
1067
|
+
const task = name === "box" ? "Cloop Box" : "Cloop Runner";
|
|
1068
|
+
return {
|
|
1069
|
+
path: join(opts.dir ?? join(opts.home, "AppData", "Local", "Cloop"), `cloop-${name}.cmd`),
|
|
1070
|
+
steps: [
|
|
1071
|
+
{ command: ["schtasks", "/end", "/tn", task], mayFail: true },
|
|
1072
|
+
{ command: ["schtasks", "/delete", "/tn", task, "/f"], mayFail: true }
|
|
1073
|
+
],
|
|
1074
|
+
running: ["schtasks", "/query", "/tn", task]
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1016
1077
|
const unit = `cloop-${name}.service`;
|
|
1017
1078
|
return {
|
|
1018
1079
|
path: join(opts.dir ?? join(opts.home, ".config", "systemd", "user"), unit),
|
|
@@ -1067,6 +1128,65 @@ function unitFor(opts) {
|
|
|
1067
1128
|
tail: ["tail", "-n", "20", log]
|
|
1068
1129
|
};
|
|
1069
1130
|
}
|
|
1131
|
+
if (opts.platform === "win32") {
|
|
1132
|
+
const task = name === "box" ? "Cloop Box" : "Cloop Runner";
|
|
1133
|
+
const dir = opts.dir ?? join(opts.home, "AppData", "Local", "Cloop");
|
|
1134
|
+
const path2 = join(dir, `cloop-${name}.cmd`);
|
|
1135
|
+
const log = join(dir, `cloop-${name}.log`);
|
|
1136
|
+
const psLog = log.replace(/'/g, "''");
|
|
1137
|
+
const contents2 = [
|
|
1138
|
+
"@echo off",
|
|
1139
|
+
...env.map(([key, value]) => `set "${key}=${cmdValue(value)}"`),
|
|
1140
|
+
":run",
|
|
1141
|
+
`call ${opts.program.map(cmdWord).join(" ")} >> ${cmdWord(log)} 2>&1`,
|
|
1142
|
+
"rem timeout needs a console, and a scheduled task has none.",
|
|
1143
|
+
"ping -n 6 127.0.0.1 >nul",
|
|
1144
|
+
"goto run",
|
|
1145
|
+
""
|
|
1146
|
+
].join("\r\n");
|
|
1147
|
+
return {
|
|
1148
|
+
path: path2,
|
|
1149
|
+
contents: contents2,
|
|
1150
|
+
start: [
|
|
1151
|
+
{ command: ["schtasks", "/end", "/tn", task], mayFail: true },
|
|
1152
|
+
{
|
|
1153
|
+
command: [
|
|
1154
|
+
"schtasks",
|
|
1155
|
+
"/create",
|
|
1156
|
+
"/tn",
|
|
1157
|
+
task,
|
|
1158
|
+
"/tr",
|
|
1159
|
+
`"${path2}"`,
|
|
1160
|
+
"/sc",
|
|
1161
|
+
"onlogon",
|
|
1162
|
+
"/rl",
|
|
1163
|
+
"limited",
|
|
1164
|
+
"/f"
|
|
1165
|
+
]
|
|
1166
|
+
},
|
|
1167
|
+
// schtasks /create gives the task a 72 h execution limit, which would stop the runner.
|
|
1168
|
+
{
|
|
1169
|
+
command: [
|
|
1170
|
+
"powershell",
|
|
1171
|
+
"-NoProfile",
|
|
1172
|
+
"-NonInteractive",
|
|
1173
|
+
"-Command",
|
|
1174
|
+
`Set-ScheduledTask -TaskName '${task}' -Settings (New-ScheduledTaskSettingsSet -ExecutionTimeLimit ([TimeSpan]::Zero) -MultipleInstances IgnoreNew -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable) | Out-Null`
|
|
1175
|
+
]
|
|
1176
|
+
},
|
|
1177
|
+
{ command: ["schtasks", "/run", "/tn", task] }
|
|
1178
|
+
],
|
|
1179
|
+
retire,
|
|
1180
|
+
logs: `Get-Content -Wait '${psLog}'`,
|
|
1181
|
+
tail: [
|
|
1182
|
+
"powershell",
|
|
1183
|
+
"-NoProfile",
|
|
1184
|
+
"-NonInteractive",
|
|
1185
|
+
"-Command",
|
|
1186
|
+
`Get-Content -Tail 20 '${psLog}'`
|
|
1187
|
+
]
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1070
1190
|
const unit = `cloop-${name}.service`;
|
|
1071
1191
|
const units = opts.dir ?? join(opts.home, ".config", "systemd", "user");
|
|
1072
1192
|
const path = join(units, unit);
|
|
@@ -1103,16 +1223,24 @@ function unitFor(opts) {
|
|
|
1103
1223
|
tail: ["journalctl", "--user", "-u", unit, "-n", "20", "--no-pager"]
|
|
1104
1224
|
};
|
|
1105
1225
|
}
|
|
1106
|
-
function resolveRepos(paths, toplevel) {
|
|
1226
|
+
function resolveRepos(paths, toplevel, isFolder = folderAt) {
|
|
1107
1227
|
const repos = [];
|
|
1108
1228
|
for (const p of paths) {
|
|
1109
|
-
const
|
|
1110
|
-
if (!
|
|
1111
|
-
return `${p} is not a
|
|
1229
|
+
const full = resolve2(p);
|
|
1230
|
+
if (!isFolder(full))
|
|
1231
|
+
return `${p} is not a folder. Pass --repo <path> for each folder Cloop may work in.`;
|
|
1232
|
+
const top = toplevel(full) ?? full;
|
|
1112
1233
|
if (!repos.some((r) => r.path === top)) repos.push({ label: basename3(top), path: top });
|
|
1113
1234
|
}
|
|
1114
1235
|
return repos;
|
|
1115
1236
|
}
|
|
1237
|
+
function folderAt(path) {
|
|
1238
|
+
try {
|
|
1239
|
+
return statSync(path).isDirectory();
|
|
1240
|
+
} catch {
|
|
1241
|
+
return false;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1116
1244
|
var CHECKOUT_ROOTS = ["projects", "code", "repos", "src", "Developer", "dev", "work"];
|
|
1117
1245
|
function lastCommitAt(path) {
|
|
1118
1246
|
try {
|
|
@@ -1157,49 +1285,56 @@ function rerunCommand(argv, script = process.argv[1] ?? "") {
|
|
|
1157
1285
|
const staging = process.env.CLOOP_ORIGIN === STAGING_ORIGIN ? ["--staging"] : [];
|
|
1158
1286
|
return [base, "connect", ...staging, ...argv].join(" ");
|
|
1159
1287
|
}
|
|
1160
|
-
function
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1288
|
+
function workFolder(home) {
|
|
1289
|
+
return { label: "Cloop", path: join(home, "Cloop") };
|
|
1290
|
+
}
|
|
1291
|
+
function workFolderLine(found, home, rerun) {
|
|
1292
|
+
const here = `Cloop works in ${tilde(workFolder(home).path, home)}.`;
|
|
1293
|
+
if (!found.length) return `${here} To let it work in a checkout, run: ${rerun} --repo <path>`;
|
|
1164
1294
|
const list = found.map((r) => `${r.label} (${tilde(r.path, home)})`).join(", ");
|
|
1165
|
-
return `${here} Recent checkouts: ${list}.
|
|
1295
|
+
return `${here} Recent checkouts: ${list}. To let it work in one, run: ${rerun} --repo ${tilde(found[0]?.path ?? "", home)}`;
|
|
1166
1296
|
}
|
|
1167
|
-
async function askRepos(found, home,
|
|
1297
|
+
async function askRepos(found, home, ask, say) {
|
|
1298
|
+
const work = workFolder(home);
|
|
1168
1299
|
say(`${bold("Cloop runner")} This folder is not a git checkout. Recent ones:`);
|
|
1169
1300
|
found.forEach((r, i) => say(` ${i + 1} ${r.label} ${dim(tilde(r.path, home))}`));
|
|
1170
1301
|
for (; ; ) {
|
|
1171
|
-
const answer = (await ask(
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
`No folder chosen. Run ${rerun} --repo <path> to name one.`
|
|
1176
|
-
);
|
|
1302
|
+
const answer = (await ask(
|
|
1303
|
+
`Which may Cloop work in? Numbers, comma-separated, or Enter for ${tilde(work.path, home)} only: `
|
|
1304
|
+
)).trim();
|
|
1305
|
+
if (!answer) return [work];
|
|
1177
1306
|
const picks = parsePicks(answer, found.length);
|
|
1178
1307
|
if (picks) return picks.map((n) => found[n - 1]);
|
|
1179
|
-
say(` Type numbers from 1 to ${found.length}, like 1,3.`);
|
|
1308
|
+
say(` Type numbers from 1 to ${found.length}, like 1,3, or press Enter.`);
|
|
1180
1309
|
}
|
|
1181
1310
|
}
|
|
1182
1311
|
async function reposFor(argv) {
|
|
1183
1312
|
const given = flags(argv, "--repo");
|
|
1184
1313
|
if (given.length) {
|
|
1185
|
-
const
|
|
1186
|
-
if (typeof
|
|
1187
|
-
return
|
|
1314
|
+
const repos2 = resolveRepos(given, gitTop);
|
|
1315
|
+
if (typeof repos2 === "string") throw new ConnectFailure("no_repo", repos2);
|
|
1316
|
+
return repos2;
|
|
1188
1317
|
}
|
|
1189
1318
|
const here = gitTop(process.cwd());
|
|
1190
1319
|
if (here) return [{ label: basename3(here), path: here }];
|
|
1191
1320
|
const home = homedir();
|
|
1321
|
+
const work = workFolder(home);
|
|
1192
1322
|
const found = findCheckouts(home);
|
|
1193
|
-
|
|
1194
|
-
if (
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1323
|
+
let repos = [work];
|
|
1324
|
+
if (found.length && process.stdin.isTTY && process.stdout.isTTY) {
|
|
1325
|
+
const prompt = createInterface({ input: process.stdin, output: process.stdout });
|
|
1326
|
+
const closed = () => new ConnectFailure(
|
|
1327
|
+
"no_repo",
|
|
1328
|
+
`No folder chosen. Run ${rerunCommand(argv)} --repo <path> to name one.`
|
|
1329
|
+
);
|
|
1330
|
+
try {
|
|
1331
|
+
repos = await askRepos(found, home, askOrClosed(prompt, closed), out);
|
|
1332
|
+
} finally {
|
|
1333
|
+
prompt.close();
|
|
1334
|
+
}
|
|
1335
|
+
} else out(`${bold("Cloop runner")} ${workFolderLine(found, home, rerunCommand(argv))}`);
|
|
1336
|
+
if (repos.some((r) => r.path === work.path)) mkdirSync(work.path, { recursive: true });
|
|
1337
|
+
return repos;
|
|
1203
1338
|
}
|
|
1204
1339
|
function askOrClosed(prompt, closed) {
|
|
1205
1340
|
return (question) => new Promise((resolve3, reject) => {
|
|
@@ -1289,13 +1424,7 @@ async function installService(kind, argv, attempt, services = systemServices) {
|
|
|
1289
1424
|
return;
|
|
1290
1425
|
}
|
|
1291
1426
|
attempt.step = "service_write";
|
|
1292
|
-
const
|
|
1293
|
-
const program = programFor(
|
|
1294
|
-
process.argv[1] ?? "cloop",
|
|
1295
|
-
process.execPath,
|
|
1296
|
-
existsSync(npxBeside) ? npxBeside : which("npx"),
|
|
1297
|
-
VERSION
|
|
1298
|
-
);
|
|
1427
|
+
const program = programFor(process.argv[1] ?? "cloop", process.execPath, findNpx(), VERSION);
|
|
1299
1428
|
if (typeof program === "string") throw new ConnectFailure("npx_missing", program);
|
|
1300
1429
|
const unit = unitFor({
|
|
1301
1430
|
platform: services.platform,
|
|
@@ -1419,7 +1548,12 @@ async function connectT3(argv, attempt, fallback, chosen, services) {
|
|
|
1419
1548
|
...chosen ? { chosenDriver: chosen } : {}
|
|
1420
1549
|
})
|
|
1421
1550
|
});
|
|
1422
|
-
await revokeReplaced(
|
|
1551
|
+
await revokeReplaced(
|
|
1552
|
+
previous,
|
|
1553
|
+
"workstation",
|
|
1554
|
+
(t) => revokeOwnDevice(attempt.replacedOrigin ?? getOrigin(), t),
|
|
1555
|
+
out
|
|
1556
|
+
);
|
|
1423
1557
|
out(
|
|
1424
1558
|
`${bold("Cloop runner")} T3 ${cfg.label} paired with scope ${cfg.scope}, until ${cfg.expiresAt.slice(0, 10)}.`
|
|
1425
1559
|
);
|
|
@@ -1446,6 +1580,8 @@ async function connectT3(argv, attempt, fallback, chosen, services) {
|
|
|
1446
1580
|
async function connectLocal(driver, found, argv, attempt, chosen, services) {
|
|
1447
1581
|
attempt.step = "repos";
|
|
1448
1582
|
const repos = await reposFor(argv);
|
|
1583
|
+
const work = workFolder(homedir()).path;
|
|
1584
|
+
attempt.workFolder = repos.every((r) => r.path === work);
|
|
1449
1585
|
const harness = driver === "claude-code" ? found.claude : found.codex;
|
|
1450
1586
|
const bin = which(driver === "claude-code" ? "claude" : "codex") ?? (driver === "claude-code" ? "claude" : "codex");
|
|
1451
1587
|
const previous = readRunnerConfig();
|
|
@@ -1477,14 +1613,19 @@ async function connectLocal(driver, found, argv, attempt, chosen, services) {
|
|
|
1477
1613
|
...chosen ? { chosenDriver: chosen } : {}
|
|
1478
1614
|
};
|
|
1479
1615
|
writeBoxConfig(cfg);
|
|
1480
|
-
await revokeReplaced(
|
|
1616
|
+
await revokeReplaced(
|
|
1617
|
+
previous,
|
|
1618
|
+
"local",
|
|
1619
|
+
(t) => revokeOwnDevice(attempt.replacedOrigin ?? getOrigin(), t),
|
|
1620
|
+
out
|
|
1621
|
+
);
|
|
1481
1622
|
const others = [found.claude, found.codex].filter(
|
|
1482
1623
|
(h) => Boolean(h) && h !== harness
|
|
1483
1624
|
);
|
|
1484
1625
|
out(
|
|
1485
1626
|
`${bold("Cloop runner")} ${deviceName} is a Local runner: ${[harness, ...others].map(harnessLine).join("; ")}.`
|
|
1486
1627
|
);
|
|
1487
|
-
out(`
|
|
1628
|
+
out(` Folders: ${repos.map((r) => `${r.label} (${r.path})`).join(", ")}`);
|
|
1488
1629
|
out(
|
|
1489
1630
|
` ${driver === "codex" ? "Full access: Codex always runs every Task without permission checks. --ask-everything applies to Claude Code only." : cfg.askEverything ? "Asks before actions except allowlisted reads." : "Full access: every Task runs without permission checks. Add --ask-everything to approve each step."}`
|
|
1490
1631
|
);
|
|
@@ -1532,11 +1673,12 @@ async function connect(argv, attempt, deps = {}) {
|
|
|
1532
1673
|
"--fallback-model takes model names, comma-separated, like opus or opus,sonnet."
|
|
1533
1674
|
);
|
|
1534
1675
|
const t3Url = (flag(argv, "--t3-url") ?? DEFAULT_T3_URL).replace(/\/+$/, "");
|
|
1676
|
+
const harnessBin = (name) => process.platform === "win32" ? which(name) ?? name : name;
|
|
1535
1677
|
const found = await detect(
|
|
1536
1678
|
deps.probes ?? {
|
|
1537
1679
|
t3: () => forced && forced !== "t3" ? Promise.resolve(false) : t3Answers(t3Url),
|
|
1538
|
-
claude: () => probeClaude(),
|
|
1539
|
-
codex: () => probeCodex()
|
|
1680
|
+
claude: () => probeClaude(harnessBin("claude")),
|
|
1681
|
+
codex: () => probeCodex(harnessBin("codex"))
|
|
1540
1682
|
}
|
|
1541
1683
|
);
|
|
1542
1684
|
attempt.harnesses = harnessesFound(found);
|
|
@@ -1623,7 +1765,9 @@ function unitOrigin(contents) {
|
|
|
1623
1765
|
const plist = /<key>CLOOP_ORIGIN<\/key><string>([^<]+)<\/string>/.exec(contents)?.[1];
|
|
1624
1766
|
if (plist) return plist.replace(/&/g, "&");
|
|
1625
1767
|
const unit = /Environment="CLOOP_ORIGIN=([^"]+)"/.exec(contents)?.[1];
|
|
1626
|
-
|
|
1768
|
+
if (unit) return unit.replace(/%%/g, "%");
|
|
1769
|
+
const launcher = /^set "CLOOP_ORIGIN=(.+)"\r?$/m.exec(contents)?.[1];
|
|
1770
|
+
return launcher ? launcher.replace(/%%/g, "%") : null;
|
|
1627
1771
|
}
|
|
1628
1772
|
function disconnectPlan(opts) {
|
|
1629
1773
|
const exists = opts.exists ?? existsSync2;
|
|
@@ -1745,19 +1889,21 @@ async function disconnectCommand(argv) {
|
|
|
1745
1889
|
export {
|
|
1746
1890
|
T3Client,
|
|
1747
1891
|
runBoxTool,
|
|
1748
|
-
DONE_LINE,
|
|
1749
|
-
unitOrigin,
|
|
1750
|
-
disconnectPlan,
|
|
1751
|
-
disconnect,
|
|
1752
|
-
runnerOrigin,
|
|
1753
|
-
disconnectCommand,
|
|
1754
1892
|
probeClaudePermissions,
|
|
1755
1893
|
probeClaude,
|
|
1756
1894
|
DEFAULT_FALLBACK_MODEL,
|
|
1757
1895
|
claudeDialect,
|
|
1758
1896
|
probeCodex,
|
|
1759
1897
|
codexDialect,
|
|
1898
|
+
DONE_LINE,
|
|
1899
|
+
unitOrigin,
|
|
1900
|
+
disconnectPlan,
|
|
1901
|
+
disconnect,
|
|
1902
|
+
runnerOrigin,
|
|
1903
|
+
disconnectCommand,
|
|
1760
1904
|
DEFAULT_T3_URL,
|
|
1905
|
+
which,
|
|
1906
|
+
preferExecutable,
|
|
1761
1907
|
T3PairError,
|
|
1762
1908
|
mintSession,
|
|
1763
1909
|
sessionFromLink,
|
|
@@ -1774,7 +1920,10 @@ export {
|
|
|
1774
1920
|
connectChosen,
|
|
1775
1921
|
systemdAssignment,
|
|
1776
1922
|
systemdWord,
|
|
1923
|
+
cmdValue,
|
|
1924
|
+
cmdWord,
|
|
1777
1925
|
programFor,
|
|
1926
|
+
findNpx,
|
|
1778
1927
|
awaitDaemon,
|
|
1779
1928
|
unitEnv,
|
|
1780
1929
|
installedService,
|
|
@@ -1784,7 +1933,8 @@ export {
|
|
|
1784
1933
|
tilde,
|
|
1785
1934
|
parsePicks,
|
|
1786
1935
|
rerunCommand,
|
|
1787
|
-
|
|
1936
|
+
workFolder,
|
|
1937
|
+
workFolderLine,
|
|
1788
1938
|
askRepos,
|
|
1789
1939
|
askOrClosed,
|
|
1790
1940
|
runSteps,
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
awaitDaemon,
|
|
10
10
|
chooseDriver,
|
|
11
11
|
claudeAtFloor,
|
|
12
|
+
cmdValue,
|
|
13
|
+
cmdWord,
|
|
12
14
|
connectBox,
|
|
13
15
|
connectChosen,
|
|
14
16
|
connectCommand,
|
|
@@ -17,14 +19,15 @@ import {
|
|
|
17
19
|
fallbackDriver,
|
|
18
20
|
fallbackLine,
|
|
19
21
|
findCheckouts,
|
|
22
|
+
findNpx,
|
|
20
23
|
harnessesFound,
|
|
21
24
|
installedService,
|
|
22
25
|
isWorkstation,
|
|
23
26
|
mintSession,
|
|
24
|
-
notACheckoutLine,
|
|
25
27
|
pairPrompt,
|
|
26
28
|
pairT3,
|
|
27
29
|
parsePicks,
|
|
30
|
+
preferExecutable,
|
|
28
31
|
programFor,
|
|
29
32
|
rememberedDriver,
|
|
30
33
|
rerunCommand,
|
|
@@ -38,18 +41,21 @@ import {
|
|
|
38
41
|
systemdWord,
|
|
39
42
|
tilde,
|
|
40
43
|
unitEnv,
|
|
41
|
-
unitFor
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
unitFor,
|
|
45
|
+
which,
|
|
46
|
+
workFolder,
|
|
47
|
+
workFolderLine
|
|
48
|
+
} from "./chunk-QP6ZNGU3.js";
|
|
49
|
+
import "./chunk-EQTFHMUJ.js";
|
|
50
|
+
import "./chunk-3WD7S6VI.js";
|
|
45
51
|
import "./chunk-UBXT5IDU.js";
|
|
46
52
|
import "./chunk-NUU4GXGV.js";
|
|
47
53
|
import "./chunk-VK6GV757.js";
|
|
48
54
|
import "./chunk-R3CLO2FB.js";
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
55
|
+
import "./chunk-VYM5NYS6.js";
|
|
56
|
+
import "./chunk-PSUEFPEA.js";
|
|
51
57
|
import "./chunk-NYGELUTR.js";
|
|
52
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-5L76PKXT.js";
|
|
53
59
|
import "./chunk-IKCGVBHA.js";
|
|
54
60
|
export {
|
|
55
61
|
DEFAULT_T3_URL,
|
|
@@ -61,6 +67,8 @@ export {
|
|
|
61
67
|
awaitDaemon,
|
|
62
68
|
chooseDriver,
|
|
63
69
|
claudeAtFloor,
|
|
70
|
+
cmdValue,
|
|
71
|
+
cmdWord,
|
|
64
72
|
connectBox,
|
|
65
73
|
connectChosen,
|
|
66
74
|
connectCommand,
|
|
@@ -69,14 +77,15 @@ export {
|
|
|
69
77
|
fallbackDriver,
|
|
70
78
|
fallbackLine,
|
|
71
79
|
findCheckouts,
|
|
80
|
+
findNpx,
|
|
72
81
|
harnessesFound,
|
|
73
82
|
installedService,
|
|
74
83
|
isWorkstation,
|
|
75
84
|
mintSession,
|
|
76
|
-
notACheckoutLine,
|
|
77
85
|
pairPrompt,
|
|
78
86
|
pairT3,
|
|
79
87
|
parsePicks,
|
|
88
|
+
preferExecutable,
|
|
80
89
|
programFor,
|
|
81
90
|
rememberedDriver,
|
|
82
91
|
rerunCommand,
|
|
@@ -90,5 +99,8 @@ export {
|
|
|
90
99
|
systemdWord,
|
|
91
100
|
tilde,
|
|
92
101
|
unitEnv,
|
|
93
|
-
unitFor
|
|
102
|
+
unitFor,
|
|
103
|
+
which,
|
|
104
|
+
workFolder,
|
|
105
|
+
workFolderLine
|
|
94
106
|
};
|
|
@@ -6,17 +6,17 @@ import {
|
|
|
6
6
|
disconnectPlan,
|
|
7
7
|
runnerOrigin,
|
|
8
8
|
unitOrigin
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-QP6ZNGU3.js";
|
|
10
|
+
import "./chunk-EQTFHMUJ.js";
|
|
11
|
+
import "./chunk-3WD7S6VI.js";
|
|
12
12
|
import "./chunk-UBXT5IDU.js";
|
|
13
13
|
import "./chunk-NUU4GXGV.js";
|
|
14
14
|
import "./chunk-VK6GV757.js";
|
|
15
15
|
import "./chunk-R3CLO2FB.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-VYM5NYS6.js";
|
|
17
|
+
import "./chunk-PSUEFPEA.js";
|
|
18
18
|
import "./chunk-NYGELUTR.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-5L76PKXT.js";
|
|
20
20
|
import "./chunk-IKCGVBHA.js";
|
|
21
21
|
export {
|
|
22
22
|
DONE_LINE,
|