@cloop/runner 0.3.10 → 0.3.12
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-4DQFGS7E.js → box-V3CQHA36.js} +8 -8
- package/dist/{chunk-NNVHI2C4.js → chunk-6IQ3ABBS.js} +1 -1
- package/dist/{chunk-X4KNL76Q.js → chunk-7SELZL6Z.js} +1 -1
- package/dist/{chunk-LPEDYXWI.js → chunk-GNNGDCKP.js} +67 -33
- package/dist/{chunk-W2BHZLOG.js → chunk-JUQALHVZ.js} +75 -52
- package/dist/{chunk-VVKUUNUJ.js → chunk-Q4TAV5GV.js} +3 -3
- package/dist/{chunk-UST7TWCL.js → chunk-UZYPDPGL.js} +1 -1
- package/dist/{chunk-UAMXZ6YX.js → chunk-WRSJZ5WD.js} +1 -1
- package/dist/{chunk-XPWFSXPS.js → chunk-YULXWTUB.js} +1 -1
- package/dist/{connect-TH2W7C7U.js → connect-XMPA7BZG.js} +12 -8
- package/dist/{disconnect-JDBXNTQP.js → disconnect-ATKLCLYO.js} +6 -6
- package/dist/{existing-runner-Z3GFUJXD.js → existing-runner-LS2M5OAF.js} +6 -6
- package/dist/index.js +14 -14
- package/dist/{login-6UZCLDYL.js → login-4ZGAE7QV.js} +2 -2
- package/dist/{mcp-server-RWLW6SJI.js → mcp-server-4EH6Z5Z3.js} +1 -1
- package/dist/{runner-TPPZAOE5.js → runner-7PUTRUFX.js} +3 -3
- package/dist/{runs-5UEAFWLJ.js → runs-IVQRNCF5.js} +2 -2
- package/dist/{statusline-MITA5QJF.js → statusline-NDXFVGUT.js} +1 -1
- package/dist/{takeover-Z365HOFM.js → takeover-3RVPILL7.js} +4 -4
- package/dist/{use-JKRWT2TU.js → use-QN3OGZGP.js} +6 -6
- package/package.json +1 -1
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
} from "./chunk-IJH4O27H.js";
|
|
6
6
|
import {
|
|
7
7
|
serveTakeovers
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-Q4TAV5GV.js";
|
|
9
|
+
import "./chunk-YULXWTUB.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_FALLBACK_MODEL,
|
|
12
12
|
T3Client,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
systemServices,
|
|
33
33
|
unitFor,
|
|
34
34
|
which
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-JUQALHVZ.js";
|
|
36
36
|
import {
|
|
37
37
|
BoxWatch,
|
|
38
38
|
lockThreadsFile,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
runnerStatePath,
|
|
41
41
|
threadsFilePath,
|
|
42
42
|
writeRunnerState
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-WRSJZ5WD.js";
|
|
44
44
|
import {
|
|
45
45
|
LocalDriver,
|
|
46
46
|
T3Driver,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
runnerPath,
|
|
52
52
|
showsOtherThreads,
|
|
53
53
|
writeBoxConfig
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-GNNGDCKP.js";
|
|
55
55
|
import {
|
|
56
56
|
getMachine
|
|
57
57
|
} from "./chunk-NTXQLEMQ.js";
|
|
@@ -60,12 +60,12 @@ import {
|
|
|
60
60
|
olderThan
|
|
61
61
|
} from "./chunk-UBXT5IDU.js";
|
|
62
62
|
import "./chunk-R3CLO2FB.js";
|
|
63
|
-
import "./chunk-
|
|
64
|
-
import "./chunk-
|
|
63
|
+
import "./chunk-UZYPDPGL.js";
|
|
64
|
+
import "./chunk-7SELZL6Z.js";
|
|
65
65
|
import "./chunk-ES5BRAKJ.js";
|
|
66
66
|
import {
|
|
67
67
|
VERSION
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-6IQ3ABBS.js";
|
|
69
69
|
import {
|
|
70
70
|
getMeshUrl,
|
|
71
71
|
getToken,
|
|
@@ -363,8 +363,63 @@ function stamp(now) {
|
|
|
363
363
|
return [d.getHours(), d.getMinutes(), d.getSeconds()].map((n) => String(n).padStart(2, "0")).join(":");
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
// src/
|
|
366
|
+
// src/spawn-command.ts
|
|
367
367
|
import { execFileSync } from "child_process";
|
|
368
|
+
function commandFor(bin, args, platform = process.platform, comspec = process.env.ComSpec) {
|
|
369
|
+
if (platform !== "win32") return { file: bin, args };
|
|
370
|
+
const executable = windowsExecutable(bin) ?? bin;
|
|
371
|
+
if (!/\.(cmd|bat)$/i.test(executable)) return { file: executable, args };
|
|
372
|
+
return {
|
|
373
|
+
file: comspec ?? "cmd.exe",
|
|
374
|
+
args: ["/d", "/s", "/c", `"${[executable, ...args].map(quoteWindowsArg).join(" ")}"`],
|
|
375
|
+
windowsVerbatimArguments: true
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
function quoteWindowsArg(arg) {
|
|
379
|
+
if (arg && !/[ \t"]/.test(arg)) return arg;
|
|
380
|
+
let quoted = '"';
|
|
381
|
+
let backslashes = 0;
|
|
382
|
+
for (const ch of arg) {
|
|
383
|
+
if (ch === "\\") {
|
|
384
|
+
backslashes++;
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
quoted += "\\".repeat(ch === '"' ? backslashes * 2 + 1 : backslashes) + ch;
|
|
388
|
+
backslashes = 0;
|
|
389
|
+
}
|
|
390
|
+
return `${quoted}${"\\".repeat(backslashes * 2)}"`;
|
|
391
|
+
}
|
|
392
|
+
function preferExecutable(lines) {
|
|
393
|
+
return lines.find((line) => /\.exe$/i.test(line)) ?? lines.find((line) => /\.(cmd|bat)$/i.test(line)) ?? null;
|
|
394
|
+
}
|
|
395
|
+
var windowsExecutables = /* @__PURE__ */ new Map();
|
|
396
|
+
function windowsExecutable(bin) {
|
|
397
|
+
if (/[\\/]/.test(bin)) return bin;
|
|
398
|
+
if (process.platform !== "win32") return null;
|
|
399
|
+
const key = JSON.stringify([bin, process.env.PATH, process.env.PATHEXT]);
|
|
400
|
+
if (windowsExecutables.has(key)) return windowsExecutables.get(key) ?? null;
|
|
401
|
+
let resolved = null;
|
|
402
|
+
try {
|
|
403
|
+
resolved = preferExecutable(
|
|
404
|
+
execFileSync("where.exe", [bin], { encoding: "utf-8", timeout: 5e3 }).split(/\r?\n/).map((line) => line.trim()).filter(Boolean)
|
|
405
|
+
);
|
|
406
|
+
} catch {
|
|
407
|
+
}
|
|
408
|
+
windowsExecutables.set(key, resolved);
|
|
409
|
+
if (!resolved)
|
|
410
|
+
console.error(
|
|
411
|
+
`[runner:spawn] Could not resolve ${bin} to an executable on PATH. Install the agent and reconnect the runner.`
|
|
412
|
+
);
|
|
413
|
+
return resolved;
|
|
414
|
+
}
|
|
415
|
+
function windowsPowerShellEnv(env = process.env) {
|
|
416
|
+
return Object.fromEntries(
|
|
417
|
+
Object.entries(env).filter(([key]) => key.toLowerCase() !== "psmodulepath")
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// src/t3-bin.ts
|
|
422
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
368
423
|
import { existsSync, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
|
|
369
424
|
import { join as join3 } from "path";
|
|
370
425
|
var CLEAN_ENV = () => ({
|
|
@@ -434,7 +489,7 @@ function t3BaseDirArgs(env = process.env) {
|
|
|
434
489
|
}
|
|
435
490
|
function runT3(bin, args, timeout = 15e3) {
|
|
436
491
|
try {
|
|
437
|
-
return
|
|
492
|
+
return execFileSync2(bin, args, {
|
|
438
493
|
encoding: "utf-8",
|
|
439
494
|
env: CLEAN_ENV(),
|
|
440
495
|
timeout,
|
|
@@ -449,7 +504,7 @@ function runT3(bin, args, timeout = 15e3) {
|
|
|
449
504
|
}
|
|
450
505
|
function whichAll(bin) {
|
|
451
506
|
try {
|
|
452
|
-
return
|
|
507
|
+
return execFileSync2("which", ["-a", bin], {
|
|
453
508
|
encoding: "utf-8",
|
|
454
509
|
env: CLEAN_ENV(),
|
|
455
510
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -460,7 +515,7 @@ function whichAll(bin) {
|
|
|
460
515
|
}
|
|
461
516
|
|
|
462
517
|
// src/drivers/t3.ts
|
|
463
|
-
import { execFile, execFileSync as
|
|
518
|
+
import { execFile, execFileSync as execFileSync3 } from "child_process";
|
|
464
519
|
import { randomUUID } from "crypto";
|
|
465
520
|
function isUnsettled(t) {
|
|
466
521
|
return !t.settledAt && !t.archivedAt && !isChild(t);
|
|
@@ -944,7 +999,7 @@ ${RESULT_INSTRUCTION}`, attachments: [] }
|
|
|
944
999
|
try {
|
|
945
1000
|
value = tailscaleServed(
|
|
946
1001
|
String(
|
|
947
|
-
(this.deps.exec ??
|
|
1002
|
+
(this.deps.exec ?? execFileSync3)("tailscale", ["serve", "status", "--json"], {
|
|
948
1003
|
encoding: "utf-8",
|
|
949
1004
|
stdio: ["ignore", "pipe", "ignore"],
|
|
950
1005
|
timeout: 3e3
|
|
@@ -1288,7 +1343,7 @@ ${RESULT_INSTRUCTION}`
|
|
|
1288
1343
|
*/
|
|
1289
1344
|
baseRefFor(root) {
|
|
1290
1345
|
const git = (args) => String(
|
|
1291
|
-
(this.deps.exec ??
|
|
1346
|
+
(this.deps.exec ?? execFileSync3)("git", ["-C", root, ...args], {
|
|
1292
1347
|
encoding: "utf-8",
|
|
1293
1348
|
env: { HOME: process.env.HOME, USER: process.env.USER, PATH: process.env.PATH },
|
|
1294
1349
|
timeout: 5e3
|
|
@@ -1311,36 +1366,12 @@ ${RESULT_INSTRUCTION}`
|
|
|
1311
1366
|
};
|
|
1312
1367
|
|
|
1313
1368
|
// src/drivers/local.ts
|
|
1314
|
-
import { execFile as execFile2, execFileSync as
|
|
1369
|
+
import { execFile as execFile2, execFileSync as execFileSync4, spawn } from "child_process";
|
|
1315
1370
|
import { chmodSync as chmodSync2, mkdirSync as mkdirSync2, readFileSync, renameSync as renameSync2, writeFileSync } from "fs";
|
|
1316
1371
|
import { hostname } from "os";
|
|
1317
1372
|
import { basename, dirname as dirname2, join as join4 } from "path";
|
|
1318
1373
|
import { createInterface } from "readline";
|
|
1319
1374
|
|
|
1320
|
-
// src/spawn-command.ts
|
|
1321
|
-
function commandFor(bin, args, platform = process.platform, comspec = process.env.ComSpec) {
|
|
1322
|
-
if (platform !== "win32" || !/\.(cmd|bat)$/i.test(bin)) return { file: bin, args };
|
|
1323
|
-
return {
|
|
1324
|
-
file: comspec ?? "cmd.exe",
|
|
1325
|
-
args: ["/d", "/s", "/c", `"${[bin, ...args].map(quoteWindowsArg).join(" ")}"`],
|
|
1326
|
-
windowsVerbatimArguments: true
|
|
1327
|
-
};
|
|
1328
|
-
}
|
|
1329
|
-
function quoteWindowsArg(arg) {
|
|
1330
|
-
if (arg && !/[ \t"]/.test(arg)) return arg;
|
|
1331
|
-
let quoted = '"';
|
|
1332
|
-
let backslashes = 0;
|
|
1333
|
-
for (const ch of arg) {
|
|
1334
|
-
if (ch === "\\") {
|
|
1335
|
-
backslashes++;
|
|
1336
|
-
continue;
|
|
1337
|
-
}
|
|
1338
|
-
quoted += "\\".repeat(ch === '"' ? backslashes * 2 + 1 : backslashes) + ch;
|
|
1339
|
-
backslashes = 0;
|
|
1340
|
-
}
|
|
1341
|
-
return `${quoted}${"\\".repeat(backslashes * 2)}"`;
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
1375
|
// src/drivers/harness-check.ts
|
|
1345
1376
|
var HARNESS_STALE_MS = 5 * 6e4;
|
|
1346
1377
|
var FIRST_CHECK_WAIT_MS = 3e3;
|
|
@@ -1469,9 +1500,10 @@ function harnessAlive(pid, r, dialect) {
|
|
|
1469
1500
|
}
|
|
1470
1501
|
try {
|
|
1471
1502
|
const [file, ...args] = processCommandLine(pid);
|
|
1472
|
-
const command =
|
|
1503
|
+
const command = execFileSync4(file, args, {
|
|
1473
1504
|
encoding: "utf-8",
|
|
1474
|
-
timeout: 2e3
|
|
1505
|
+
timeout: 2e3,
|
|
1506
|
+
...file === "powershell" ? { env: windowsPowerShellEnv() } : {}
|
|
1475
1507
|
});
|
|
1476
1508
|
return dialect.owns(r, command);
|
|
1477
1509
|
} catch {
|
|
@@ -2143,6 +2175,8 @@ export {
|
|
|
2143
2175
|
STOPPED_SUMMARY,
|
|
2144
2176
|
isEndLogLine,
|
|
2145
2177
|
commandFor,
|
|
2178
|
+
windowsExecutable,
|
|
2179
|
+
windowsPowerShellEnv,
|
|
2146
2180
|
defaultT3BinSources,
|
|
2147
2181
|
t3Candidates,
|
|
2148
2182
|
pickT3Bin,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
readRunnerState,
|
|
4
4
|
runnerStatePath,
|
|
5
5
|
threadsFilePath
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WRSJZ5WD.js";
|
|
7
7
|
import {
|
|
8
8
|
BoxToolError,
|
|
9
9
|
CLOOP_THREAD_PREFIX,
|
|
@@ -28,8 +28,10 @@ import {
|
|
|
28
28
|
serviceIdentity,
|
|
29
29
|
t3BaseDirArgs,
|
|
30
30
|
t3Candidates,
|
|
31
|
+
windowsExecutable,
|
|
32
|
+
windowsPowerShellEnv,
|
|
31
33
|
writeBoxConfig
|
|
32
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-GNNGDCKP.js";
|
|
33
35
|
import {
|
|
34
36
|
getMachine,
|
|
35
37
|
shortMachineName
|
|
@@ -45,17 +47,17 @@ import {
|
|
|
45
47
|
} from "./chunk-R3CLO2FB.js";
|
|
46
48
|
import {
|
|
47
49
|
connectWebhook
|
|
48
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-UZYPDPGL.js";
|
|
49
51
|
import {
|
|
50
52
|
ConnectFailure,
|
|
51
53
|
connectReport,
|
|
52
54
|
deviceLogin,
|
|
53
55
|
newAttempt,
|
|
54
56
|
sendConnectReport
|
|
55
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-7SELZL6Z.js";
|
|
56
58
|
import {
|
|
57
59
|
VERSION
|
|
58
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-6IQ3ABBS.js";
|
|
59
61
|
import {
|
|
60
62
|
STAGING_ORIGIN,
|
|
61
63
|
getOrigin,
|
|
@@ -64,7 +66,7 @@ import {
|
|
|
64
66
|
} from "./chunk-D5UZW42X.js";
|
|
65
67
|
|
|
66
68
|
// src/commands/connect.ts
|
|
67
|
-
import { execFileSync as execFileSync2 } from "child_process";
|
|
69
|
+
import { execFileSync as execFileSync2, spawnSync } from "child_process";
|
|
68
70
|
import { randomUUID } from "crypto";
|
|
69
71
|
import {
|
|
70
72
|
existsSync as existsSync4,
|
|
@@ -1025,7 +1027,7 @@ function flags(argv, name) {
|
|
|
1025
1027
|
return argv.flatMap((a, i) => a === name && argv[i + 1] ? [argv[i + 1]] : []);
|
|
1026
1028
|
}
|
|
1027
1029
|
function which(bin) {
|
|
1028
|
-
return process.platform === "win32" ?
|
|
1030
|
+
return process.platform === "win32" ? windowsExecutable(bin) : whichPosix(bin);
|
|
1029
1031
|
}
|
|
1030
1032
|
function whichPosix(bin) {
|
|
1031
1033
|
try {
|
|
@@ -1034,23 +1036,6 @@ function whichPosix(bin) {
|
|
|
1034
1036
|
return null;
|
|
1035
1037
|
}
|
|
1036
1038
|
}
|
|
1037
|
-
function where(bin) {
|
|
1038
|
-
try {
|
|
1039
|
-
const found = execFileSync2("where", [bin], {
|
|
1040
|
-
encoding: "utf-8",
|
|
1041
|
-
// `where` matches extensions through PATHEXT, which CLEAN_ENV alone drops.
|
|
1042
|
-
env: { ...CLEAN_ENV, PATHEXT: process.env.PATHEXT, SystemRoot: process.env.SystemRoot }
|
|
1043
|
-
});
|
|
1044
|
-
return preferExecutable(
|
|
1045
|
-
found.split(/\r?\n/).map((line2) => line2.trim()).filter(Boolean)
|
|
1046
|
-
);
|
|
1047
|
-
} catch {
|
|
1048
|
-
return null;
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
function preferExecutable(lines) {
|
|
1052
|
-
return lines.find((line2) => /\.exe$/i.test(line2)) ?? lines.find((line2) => /\.(cmd|bat)$/i.test(line2)) ?? lines[0] ?? null;
|
|
1053
|
-
}
|
|
1054
1039
|
var T3PairError = class extends Error {
|
|
1055
1040
|
name = "T3PairError";
|
|
1056
1041
|
};
|
|
@@ -1247,6 +1232,27 @@ function cmdValue(value) {
|
|
|
1247
1232
|
function cmdWord(arg) {
|
|
1248
1233
|
return `"${cmdValue(arg)}"`;
|
|
1249
1234
|
}
|
|
1235
|
+
var psQuote = (value) => `'${value.replace(/'/g, "''")}'`;
|
|
1236
|
+
function registerTaskScript(task, launcher) {
|
|
1237
|
+
return [
|
|
1238
|
+
"$ErrorActionPreference = 'Stop'",
|
|
1239
|
+
"$user = [Security.Principal.WindowsIdentity]::GetCurrent().Name",
|
|
1240
|
+
`$launcher = ${psQuote(launcher)}`,
|
|
1241
|
+
[
|
|
1242
|
+
"try {",
|
|
1243
|
+
`Register-ScheduledTask -TaskName ${psQuote(task)} -Force`,
|
|
1244
|
+
"-Action (New-ScheduledTaskAction -Execute (Join-Path $env:WINDIR 'System32\\cmd.exe') -Argument ('/d /c ' + [char]34 + $launcher + [char]34))",
|
|
1245
|
+
"-Trigger (New-ScheduledTaskTrigger -AtLogOn -User $user)",
|
|
1246
|
+
"-Principal (New-ScheduledTaskPrincipal -UserId $user -LogonType Interactive -RunLevel Limited)",
|
|
1247
|
+
"-Settings (New-ScheduledTaskSettingsSet -ExecutionTimeLimit ([TimeSpan]::Zero) -MultipleInstances IgnoreNew -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable)",
|
|
1248
|
+
"| Out-Null",
|
|
1249
|
+
"} catch {",
|
|
1250
|
+
`$kept = Get-ScheduledTask -TaskName ${psQuote(task)} -ErrorAction SilentlyContinue;`,
|
|
1251
|
+
"if (-not ($kept.Actions | Where-Object { ($_.Execute + ' ' + $_.Arguments).Contains($launcher) })) { throw }",
|
|
1252
|
+
"}"
|
|
1253
|
+
].join(" ")
|
|
1254
|
+
].join("; ");
|
|
1255
|
+
}
|
|
1250
1256
|
function programFor(script, node, npx, version) {
|
|
1251
1257
|
if (!/[\\/]_npx[\\/]/.test(script)) return [node, script, "box", "run"];
|
|
1252
1258
|
if (!npx)
|
|
@@ -1278,8 +1284,9 @@ var UNIT_ENV = [
|
|
|
1278
1284
|
];
|
|
1279
1285
|
function unitEnv(env) {
|
|
1280
1286
|
const picked = { PATH: "/usr/bin:/bin" };
|
|
1287
|
+
const byName = new Map(Object.entries(env).map(([key, value]) => [key.toUpperCase(), value]));
|
|
1281
1288
|
for (const key of UNIT_ENV) {
|
|
1282
|
-
const value = env[key];
|
|
1289
|
+
const value = env[key] ?? byName.get(key);
|
|
1283
1290
|
if (value) picked[key] = value;
|
|
1284
1291
|
}
|
|
1285
1292
|
return picked;
|
|
@@ -1379,29 +1386,13 @@ function unitFor(opts) {
|
|
|
1379
1386
|
contents: contents2,
|
|
1380
1387
|
start: [
|
|
1381
1388
|
{ command: ["schtasks", "/end", "/tn", task], mayFail: true },
|
|
1382
|
-
{
|
|
1383
|
-
command: [
|
|
1384
|
-
"schtasks",
|
|
1385
|
-
"/create",
|
|
1386
|
-
"/tn",
|
|
1387
|
-
task,
|
|
1388
|
-
"/tr",
|
|
1389
|
-
`"${path2}"`,
|
|
1390
|
-
"/sc",
|
|
1391
|
-
"onlogon",
|
|
1392
|
-
"/rl",
|
|
1393
|
-
"limited",
|
|
1394
|
-
"/f"
|
|
1395
|
-
]
|
|
1396
|
-
},
|
|
1397
|
-
// schtasks /create gives the task a 72 h execution limit, which would stop the runner.
|
|
1398
1389
|
{
|
|
1399
1390
|
command: [
|
|
1400
1391
|
"powershell",
|
|
1401
1392
|
"-NoProfile",
|
|
1402
1393
|
"-NonInteractive",
|
|
1403
1394
|
"-Command",
|
|
1404
|
-
|
|
1395
|
+
registerTaskScript(task, path2)
|
|
1405
1396
|
]
|
|
1406
1397
|
},
|
|
1407
1398
|
{ command: ["schtasks", "/run", "/tn", task] }
|
|
@@ -1630,7 +1621,8 @@ var systemServices = {
|
|
|
1630
1621
|
run: (command) => execFileSync2(command[0], command.slice(1), {
|
|
1631
1622
|
encoding: "utf-8",
|
|
1632
1623
|
stdio: ["ignore", "pipe", "ignore"],
|
|
1633
|
-
timeout: 15e3
|
|
1624
|
+
timeout: 15e3,
|
|
1625
|
+
...command[0] === "powershell" ? { env: windowsPowerShellEnv() } : {}
|
|
1634
1626
|
}),
|
|
1635
1627
|
awaitUp: (since) => awaitDaemon(since)
|
|
1636
1628
|
};
|
|
@@ -1939,7 +1931,8 @@ async function connect(argv, attempt, deps = {}) {
|
|
|
1939
1931
|
}
|
|
1940
1932
|
async function claudeAtFloor(found, forced, deps) {
|
|
1941
1933
|
const version = found.claude?.version;
|
|
1942
|
-
|
|
1934
|
+
const codex = forced === "codex" || !forced && !found.claude?.signedIn && Boolean(found.codex?.signedIn);
|
|
1935
|
+
if (!version || codex || !olderThan(version, CLAUDE_FLOOR)) return found;
|
|
1943
1936
|
const fix = "Run `claude update`, then run `cloop connect` again.";
|
|
1944
1937
|
const answer = deps.ask ? await deps.ask(`${claudeTooOld(version)} Update it now with \`claude update\`? (Y/n) `) : null;
|
|
1945
1938
|
if (answer === null || answer.trim() && !isYes(answer))
|
|
@@ -1950,13 +1943,41 @@ async function claudeAtFloor(found, forced, deps) {
|
|
|
1950
1943
|
out(`${bold("Cloop runner")} Claude Code updated to ${claude.version}.`);
|
|
1951
1944
|
return { ...found, claude };
|
|
1952
1945
|
}
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1946
|
+
var WINGET_MANAGED = /winget upgrade Anthropic\.ClaudeCode/;
|
|
1947
|
+
var WINGET_UPDATE = [
|
|
1948
|
+
"winget",
|
|
1949
|
+
"upgrade",
|
|
1950
|
+
"--id",
|
|
1951
|
+
"Anthropic.ClaudeCode",
|
|
1952
|
+
"--exact",
|
|
1953
|
+
"--accept-source-agreements",
|
|
1954
|
+
"--accept-package-agreements"
|
|
1955
|
+
];
|
|
1956
|
+
async function updateClaude(run = runShown, probe = probeClaude) {
|
|
1957
|
+
const update = run(["claude", "update"], false);
|
|
1958
|
+
if (WINGET_MANAGED.test(update.output)) {
|
|
1959
|
+
out(
|
|
1960
|
+
`${bold("Cloop runner")} winget installed Claude Code, so connect updates it with winget.`
|
|
1961
|
+
);
|
|
1962
|
+
if (run(WINGET_UPDATE, true).status !== 0) return null;
|
|
1963
|
+
} else {
|
|
1964
|
+
process.stdout.write(update.output);
|
|
1965
|
+
if (update.status !== 0) return null;
|
|
1958
1966
|
}
|
|
1959
|
-
return
|
|
1967
|
+
return probe();
|
|
1968
|
+
}
|
|
1969
|
+
function runShown(command, show) {
|
|
1970
|
+
const { file, args, windowsVerbatimArguments } = commandFor(
|
|
1971
|
+
command[0],
|
|
1972
|
+
command.slice(1)
|
|
1973
|
+
);
|
|
1974
|
+
const result = spawnSync(file, args, {
|
|
1975
|
+
encoding: "utf-8",
|
|
1976
|
+
stdio: show ? "inherit" : ["inherit", "pipe", "pipe"],
|
|
1977
|
+
timeout: 6e5,
|
|
1978
|
+
...windowsVerbatimArguments ? { windowsVerbatimArguments } : {}
|
|
1979
|
+
});
|
|
1980
|
+
return { status: result.status, output: `${result.stdout ?? ""}${result.stderr ?? ""}` };
|
|
1960
1981
|
}
|
|
1961
1982
|
function terminalYesNo() {
|
|
1962
1983
|
if (!process.stdin.isTTY || !process.stdout.isTTY) return null;
|
|
@@ -2008,7 +2029,7 @@ async function runConnect(argv, deps = {}) {
|
|
|
2008
2029
|
return error;
|
|
2009
2030
|
}
|
|
2010
2031
|
async function connectCommand(argv) {
|
|
2011
|
-
if (await runConnect(argv)) process.
|
|
2032
|
+
if (await runConnect(argv)) process.exitCode = 1;
|
|
2012
2033
|
}
|
|
2013
2034
|
|
|
2014
2035
|
export {
|
|
@@ -2022,7 +2043,6 @@ export {
|
|
|
2022
2043
|
codexDialect,
|
|
2023
2044
|
DEFAULT_T3_URL,
|
|
2024
2045
|
which,
|
|
2025
|
-
preferExecutable,
|
|
2026
2046
|
T3PairError,
|
|
2027
2047
|
mintSession,
|
|
2028
2048
|
sessionFromLink,
|
|
@@ -2041,6 +2061,7 @@ export {
|
|
|
2041
2061
|
systemdWord,
|
|
2042
2062
|
cmdValue,
|
|
2043
2063
|
cmdWord,
|
|
2064
|
+
registerTaskScript,
|
|
2044
2065
|
programFor,
|
|
2045
2066
|
findNpx,
|
|
2046
2067
|
awaitDaemon,
|
|
@@ -2065,6 +2086,8 @@ export {
|
|
|
2065
2086
|
harnessesFound,
|
|
2066
2087
|
rememberedDriver,
|
|
2067
2088
|
claudeAtFloor,
|
|
2089
|
+
WINGET_UPDATE,
|
|
2090
|
+
updateClaude,
|
|
2068
2091
|
runConnect,
|
|
2069
2092
|
connectCommand,
|
|
2070
2093
|
legacyStagingRunner,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
findRun
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YULXWTUB.js";
|
|
5
5
|
import {
|
|
6
6
|
lockThreadsFile,
|
|
7
7
|
threadsFilePath
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WRSJZ5WD.js";
|
|
9
9
|
import {
|
|
10
10
|
isLocal,
|
|
11
11
|
localRunsFilePath,
|
|
12
12
|
readRunRecords,
|
|
13
13
|
readRunnerConfig,
|
|
14
14
|
takeoverSummary
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GNNGDCKP.js";
|
|
16
16
|
import {
|
|
17
17
|
shortMachineName
|
|
18
18
|
} from "./chunk-NTXQLEMQ.js";
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DEFAULT_T3_URL,
|
|
4
4
|
DRIVER_NAME,
|
|
5
5
|
T3PairError,
|
|
6
|
+
WINGET_UPDATE,
|
|
6
7
|
askHidden,
|
|
7
8
|
askOrClosed,
|
|
8
9
|
askRepos,
|
|
@@ -28,8 +29,8 @@ import {
|
|
|
28
29
|
pairPrompt,
|
|
29
30
|
pairT3,
|
|
30
31
|
parsePicks,
|
|
31
|
-
preferExecutable,
|
|
32
32
|
programFor,
|
|
33
|
+
registerTaskScript,
|
|
33
34
|
rememberedDriver,
|
|
34
35
|
rerunCommand,
|
|
35
36
|
resolveRepos,
|
|
@@ -44,25 +45,27 @@ import {
|
|
|
44
45
|
tilde,
|
|
45
46
|
unitEnv,
|
|
46
47
|
unitFor,
|
|
48
|
+
updateClaude,
|
|
47
49
|
which,
|
|
48
50
|
workFolder,
|
|
49
51
|
workFolderLine
|
|
50
|
-
} from "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
52
|
+
} from "./chunk-JUQALHVZ.js";
|
|
53
|
+
import "./chunk-WRSJZ5WD.js";
|
|
54
|
+
import "./chunk-GNNGDCKP.js";
|
|
53
55
|
import "./chunk-NTXQLEMQ.js";
|
|
54
56
|
import "./chunk-VK6GV757.js";
|
|
55
57
|
import "./chunk-UBXT5IDU.js";
|
|
56
58
|
import "./chunk-R3CLO2FB.js";
|
|
57
|
-
import "./chunk-
|
|
58
|
-
import "./chunk-
|
|
59
|
+
import "./chunk-UZYPDPGL.js";
|
|
60
|
+
import "./chunk-7SELZL6Z.js";
|
|
59
61
|
import "./chunk-ES5BRAKJ.js";
|
|
60
|
-
import "./chunk-
|
|
62
|
+
import "./chunk-6IQ3ABBS.js";
|
|
61
63
|
import "./chunk-D5UZW42X.js";
|
|
62
64
|
export {
|
|
63
65
|
DEFAULT_T3_URL,
|
|
64
66
|
DRIVER_NAME,
|
|
65
67
|
T3PairError,
|
|
68
|
+
WINGET_UPDATE,
|
|
66
69
|
askHidden,
|
|
67
70
|
askOrClosed,
|
|
68
71
|
askRepos,
|
|
@@ -88,8 +91,8 @@ export {
|
|
|
88
91
|
pairPrompt,
|
|
89
92
|
pairT3,
|
|
90
93
|
parsePicks,
|
|
91
|
-
preferExecutable,
|
|
92
94
|
programFor,
|
|
95
|
+
registerTaskScript,
|
|
93
96
|
rememberedDriver,
|
|
94
97
|
rerunCommand,
|
|
95
98
|
resolveRepos,
|
|
@@ -104,6 +107,7 @@ export {
|
|
|
104
107
|
tilde,
|
|
105
108
|
unitEnv,
|
|
106
109
|
unitFor,
|
|
110
|
+
updateClaude,
|
|
107
111
|
which,
|
|
108
112
|
workFolder,
|
|
109
113
|
workFolderLine
|
|
@@ -7,17 +7,17 @@ import {
|
|
|
7
7
|
runnerOrigin,
|
|
8
8
|
stopService,
|
|
9
9
|
unitOrigin
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-JUQALHVZ.js";
|
|
11
|
+
import "./chunk-WRSJZ5WD.js";
|
|
12
|
+
import "./chunk-GNNGDCKP.js";
|
|
13
13
|
import "./chunk-NTXQLEMQ.js";
|
|
14
14
|
import "./chunk-VK6GV757.js";
|
|
15
15
|
import "./chunk-UBXT5IDU.js";
|
|
16
16
|
import "./chunk-R3CLO2FB.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-UZYPDPGL.js";
|
|
18
|
+
import "./chunk-7SELZL6Z.js";
|
|
19
19
|
import "./chunk-ES5BRAKJ.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-6IQ3ABBS.js";
|
|
21
21
|
import "./chunk-D5UZW42X.js";
|
|
22
22
|
export {
|
|
23
23
|
disconnect,
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
existingRunnerEnvironment,
|
|
4
4
|
pinExistingRunner
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-JUQALHVZ.js";
|
|
6
|
+
import "./chunk-WRSJZ5WD.js";
|
|
7
|
+
import "./chunk-GNNGDCKP.js";
|
|
8
8
|
import "./chunk-NTXQLEMQ.js";
|
|
9
9
|
import "./chunk-VK6GV757.js";
|
|
10
10
|
import "./chunk-UBXT5IDU.js";
|
|
11
11
|
import "./chunk-R3CLO2FB.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-UZYPDPGL.js";
|
|
13
|
+
import "./chunk-7SELZL6Z.js";
|
|
14
14
|
import "./chunk-ES5BRAKJ.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-6IQ3ABBS.js";
|
|
16
16
|
import "./chunk-D5UZW42X.js";
|
|
17
17
|
export {
|
|
18
18
|
existingRunnerEnvironment,
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-UBXT5IDU.js";
|
|
5
5
|
import {
|
|
6
6
|
VERSION
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6IQ3ABBS.js";
|
|
8
8
|
import {
|
|
9
9
|
applyEnvironmentFlag
|
|
10
10
|
} from "./chunk-D5UZW42X.js";
|
|
@@ -65,7 +65,7 @@ Add --staging to any command to use Cloop staging instead of production.
|
|
|
65
65
|
A production runner and a staging runner can run side by side on one machine.
|
|
66
66
|
`;
|
|
67
67
|
async function pinExistingRunner() {
|
|
68
|
-
const { pinExistingRunner: pin } = await import("./existing-runner-
|
|
68
|
+
const { pinExistingRunner: pin } = await import("./existing-runner-LS2M5OAF.js");
|
|
69
69
|
const { note } = pin();
|
|
70
70
|
if (note) console.error(note);
|
|
71
71
|
}
|
|
@@ -73,7 +73,7 @@ async function main() {
|
|
|
73
73
|
switch (command) {
|
|
74
74
|
case "login":
|
|
75
75
|
case "auth": {
|
|
76
|
-
const { loginCommand } = await import("./login-
|
|
76
|
+
const { loginCommand } = await import("./login-4ZGAE7QV.js");
|
|
77
77
|
await loginCommand(argv);
|
|
78
78
|
break;
|
|
79
79
|
}
|
|
@@ -83,61 +83,61 @@ async function main() {
|
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
case "serve": {
|
|
86
|
-
const { startMcpServer } = await import("./mcp-server-
|
|
86
|
+
const { startMcpServer } = await import("./mcp-server-4EH6Z5Z3.js");
|
|
87
87
|
await startMcpServer();
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
90
|
case "statusline": {
|
|
91
|
-
const { statuslineCommand } = await import("./statusline-
|
|
91
|
+
const { statuslineCommand } = await import("./statusline-NDXFVGUT.js");
|
|
92
92
|
statuslineCommand();
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
95
|
case "connect": {
|
|
96
|
-
const { connectCommand } = await import("./connect-
|
|
96
|
+
const { connectCommand } = await import("./connect-XMPA7BZG.js");
|
|
97
97
|
await connectCommand(argv.slice(1));
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
case "use": {
|
|
101
|
-
const { useCommand } = await import("./use-
|
|
101
|
+
const { useCommand } = await import("./use-QN3OGZGP.js");
|
|
102
102
|
process.exitCode = await useCommand(argv.slice(1));
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
105
|
case "disconnect": {
|
|
106
|
-
const { disconnectCommand } = await import("./disconnect-
|
|
106
|
+
const { disconnectCommand } = await import("./disconnect-ATKLCLYO.js");
|
|
107
107
|
await disconnectCommand(argv.slice(1));
|
|
108
108
|
break;
|
|
109
109
|
}
|
|
110
110
|
case "box": {
|
|
111
|
-
const { boxCommand } = await import("./box-
|
|
111
|
+
const { boxCommand } = await import("./box-V3CQHA36.js");
|
|
112
112
|
await boxCommand(argv.slice(1));
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
115
|
case "runs": {
|
|
116
116
|
await pinExistingRunner();
|
|
117
|
-
const { runsCommand } = await import("./runs-
|
|
117
|
+
const { runsCommand } = await import("./runs-IVQRNCF5.js");
|
|
118
118
|
process.exitCode = runsCommand();
|
|
119
119
|
break;
|
|
120
120
|
}
|
|
121
121
|
case "watch": {
|
|
122
122
|
await pinExistingRunner();
|
|
123
|
-
const { watchCommand } = await import("./runs-
|
|
123
|
+
const { watchCommand } = await import("./runs-IVQRNCF5.js");
|
|
124
124
|
process.exitCode = await watchCommand(argv.slice(1));
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
127
127
|
case "takeover": {
|
|
128
128
|
await pinExistingRunner();
|
|
129
|
-
const { takeoverCommand } = await import("./takeover-
|
|
129
|
+
const { takeoverCommand } = await import("./takeover-3RVPILL7.js");
|
|
130
130
|
process.exitCode = await takeoverCommand(argv.slice(1));
|
|
131
131
|
break;
|
|
132
132
|
}
|
|
133
133
|
case "resume": {
|
|
134
134
|
await pinExistingRunner();
|
|
135
|
-
const { resumeCommand } = await import("./runs-
|
|
135
|
+
const { resumeCommand } = await import("./runs-IVQRNCF5.js");
|
|
136
136
|
process.exitCode = await resumeCommand(argv.slice(1));
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
139
|
case "runner": {
|
|
140
|
-
const { runnerCommand } = await import("./runner-
|
|
140
|
+
const { runnerCommand } = await import("./runner-7PUTRUFX.js");
|
|
141
141
|
await runnerCommand(argv.slice(1));
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
deviceLogin,
|
|
4
4
|
loginCommand,
|
|
5
5
|
refusalSentence
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7SELZL6Z.js";
|
|
7
7
|
import "./chunk-ES5BRAKJ.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-6IQ3ABBS.js";
|
|
9
9
|
import "./chunk-D5UZW42X.js";
|
|
10
10
|
export {
|
|
11
11
|
deviceLogin,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
connectWebhook,
|
|
4
4
|
runnerCommand
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-UZYPDPGL.js";
|
|
6
|
+
import "./chunk-7SELZL6Z.js";
|
|
7
7
|
import "./chunk-ES5BRAKJ.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-6IQ3ABBS.js";
|
|
9
9
|
import "./chunk-D5UZW42X.js";
|
|
10
10
|
export {
|
|
11
11
|
connectWebhook,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
runsCommand,
|
|
9
9
|
sessionFolder,
|
|
10
10
|
watchCommand
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-YULXWTUB.js";
|
|
12
|
+
import "./chunk-GNNGDCKP.js";
|
|
13
13
|
import "./chunk-VK6GV757.js";
|
|
14
14
|
import "./chunk-D5UZW42X.js";
|
|
15
15
|
export {
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
takeoverDir,
|
|
10
10
|
writeTakeoverReply,
|
|
11
11
|
writeTakeoverRequest
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-Q4TAV5GV.js";
|
|
13
|
+
import "./chunk-YULXWTUB.js";
|
|
14
|
+
import "./chunk-WRSJZ5WD.js";
|
|
15
|
+
import "./chunk-GNNGDCKP.js";
|
|
16
16
|
import "./chunk-NTXQLEMQ.js";
|
|
17
17
|
import "./chunk-VK6GV757.js";
|
|
18
18
|
import "./chunk-ES5BRAKJ.js";
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
DRIVER_NAME,
|
|
4
4
|
pinExistingRunner,
|
|
5
5
|
runConnect
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-JUQALHVZ.js";
|
|
7
|
+
import "./chunk-WRSJZ5WD.js";
|
|
8
8
|
import {
|
|
9
9
|
isLocal,
|
|
10
10
|
readRunnerConfig
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GNNGDCKP.js";
|
|
12
12
|
import "./chunk-NTXQLEMQ.js";
|
|
13
13
|
import "./chunk-VK6GV757.js";
|
|
14
14
|
import "./chunk-UBXT5IDU.js";
|
|
15
15
|
import "./chunk-R3CLO2FB.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-UZYPDPGL.js";
|
|
17
|
+
import "./chunk-7SELZL6Z.js";
|
|
18
18
|
import "./chunk-ES5BRAKJ.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-6IQ3ABBS.js";
|
|
20
20
|
import "./chunk-D5UZW42X.js";
|
|
21
21
|
|
|
22
22
|
// src/commands/use.ts
|
package/package.json
CHANGED