@cloop/runner 0.3.9 → 0.3.11

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.
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  MeshSocket,
4
4
  defaultSocketFactory
5
- } from "./chunk-ZILLDYL4.js";
5
+ } from "./chunk-IJH4O27H.js";
6
6
  import {
7
7
  serveTakeovers
8
- } from "./chunk-FNJ74LO3.js";
9
- import "./chunk-TEEFTSXG.js";
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-AA2SZUIY.js";
35
+ } from "./chunk-LYB5H7VQ.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-5SUC54R3.js";
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-S3AB7HKD.js";
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-3SIF2NNR.js";
64
- import "./chunk-XQZO3UE6.js";
63
+ import "./chunk-RSKVW2PT.js";
64
+ import "./chunk-JO6TUYVI.js";
65
65
  import "./chunk-ES5BRAKJ.js";
66
66
  import {
67
67
  VERSION
68
- } from "./chunk-GPQ2MSET.js";
68
+ } from "./chunk-RMXD3BW4.js";
69
69
  import {
70
70
  getMeshUrl,
71
71
  getToken,
@@ -43,7 +43,7 @@ function resultPrUrl(finalMessage) {
43
43
  const prs = result.outputs.flatMap((o) => o.kind === "pr" ? [o.url] : []);
44
44
  return prs.at(-1) ?? null;
45
45
  }
46
- var SUMMARY_MAX = 500;
46
+ var SUMMARY_MAX = 4e3;
47
47
  var DOC_BODY_MAX = 8e3;
48
48
  function addressOutput(url) {
49
49
  const pr = url.match(/\/pull\/(\d+)$/);
@@ -111,7 +111,8 @@ function readRunResult(message) {
111
111
  result: {
112
112
  summary: summary.length > SUMMARY_MAX ? `${summary.slice(0, SUMMARY_MAX - 1)}\u2026` : summary,
113
113
  outputs: outputs.slice(0, 10),
114
- checks: checks.slice(0, 10)
114
+ checks: checks.slice(0, 10),
115
+ ...value.nothing_new === true ? { nothing_new: true } : {}
115
116
  },
116
117
  dropped: {
117
118
  outputs: list(value.outputs).length - outputs.length,
@@ -362,8 +363,63 @@ function stamp(now) {
362
363
  return [d.getHours(), d.getMinutes(), d.getSeconds()].map((n) => String(n).padStart(2, "0")).join(":");
363
364
  }
364
365
 
365
- // src/t3-bin.ts
366
+ // src/spawn-command.ts
366
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";
367
423
  import { existsSync, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
368
424
  import { join as join3 } from "path";
369
425
  var CLEAN_ENV = () => ({
@@ -433,7 +489,7 @@ function t3BaseDirArgs(env = process.env) {
433
489
  }
434
490
  function runT3(bin, args, timeout = 15e3) {
435
491
  try {
436
- return execFileSync(bin, args, {
492
+ return execFileSync2(bin, args, {
437
493
  encoding: "utf-8",
438
494
  env: CLEAN_ENV(),
439
495
  timeout,
@@ -448,7 +504,7 @@ function runT3(bin, args, timeout = 15e3) {
448
504
  }
449
505
  function whichAll(bin) {
450
506
  try {
451
- return execFileSync("which", ["-a", bin], {
507
+ return execFileSync2("which", ["-a", bin], {
452
508
  encoding: "utf-8",
453
509
  env: CLEAN_ENV(),
454
510
  stdio: ["ignore", "pipe", "ignore"]
@@ -459,7 +515,7 @@ function whichAll(bin) {
459
515
  }
460
516
 
461
517
  // src/drivers/t3.ts
462
- import { execFile, execFileSync as execFileSync2 } from "child_process";
518
+ import { execFile, execFileSync as execFileSync3 } from "child_process";
463
519
  import { randomUUID } from "crypto";
464
520
  function isUnsettled(t) {
465
521
  return !t.settledAt && !t.archivedAt && !isChild(t);
@@ -943,7 +999,7 @@ ${RESULT_INSTRUCTION}`, attachments: [] }
943
999
  try {
944
1000
  value = tailscaleServed(
945
1001
  String(
946
- (this.deps.exec ?? execFileSync2)("tailscale", ["serve", "status", "--json"], {
1002
+ (this.deps.exec ?? execFileSync3)("tailscale", ["serve", "status", "--json"], {
947
1003
  encoding: "utf-8",
948
1004
  stdio: ["ignore", "pipe", "ignore"],
949
1005
  timeout: 3e3
@@ -1287,7 +1343,7 @@ ${RESULT_INSTRUCTION}`
1287
1343
  */
1288
1344
  baseRefFor(root) {
1289
1345
  const git = (args) => String(
1290
- (this.deps.exec ?? execFileSync2)("git", ["-C", root, ...args], {
1346
+ (this.deps.exec ?? execFileSync3)("git", ["-C", root, ...args], {
1291
1347
  encoding: "utf-8",
1292
1348
  env: { HOME: process.env.HOME, USER: process.env.USER, PATH: process.env.PATH },
1293
1349
  timeout: 5e3
@@ -1310,36 +1366,12 @@ ${RESULT_INSTRUCTION}`
1310
1366
  };
1311
1367
 
1312
1368
  // src/drivers/local.ts
1313
- import { execFile as execFile2, execFileSync as execFileSync3, spawn } from "child_process";
1369
+ import { execFile as execFile2, execFileSync as execFileSync4, spawn } from "child_process";
1314
1370
  import { chmodSync as chmodSync2, mkdirSync as mkdirSync2, readFileSync, renameSync as renameSync2, writeFileSync } from "fs";
1315
1371
  import { hostname } from "os";
1316
1372
  import { basename, dirname as dirname2, join as join4 } from "path";
1317
1373
  import { createInterface } from "readline";
1318
1374
 
1319
- // src/spawn-command.ts
1320
- function commandFor(bin, args, platform = process.platform, comspec = process.env.ComSpec) {
1321
- if (platform !== "win32" || !/\.(cmd|bat)$/i.test(bin)) return { file: bin, args };
1322
- return {
1323
- file: comspec ?? "cmd.exe",
1324
- args: ["/d", "/s", "/c", `"${[bin, ...args].map(quoteWindowsArg).join(" ")}"`],
1325
- windowsVerbatimArguments: true
1326
- };
1327
- }
1328
- function quoteWindowsArg(arg) {
1329
- if (arg && !/[ \t"]/.test(arg)) return arg;
1330
- let quoted = '"';
1331
- let backslashes = 0;
1332
- for (const ch of arg) {
1333
- if (ch === "\\") {
1334
- backslashes++;
1335
- continue;
1336
- }
1337
- quoted += "\\".repeat(ch === '"' ? backslashes * 2 + 1 : backslashes) + ch;
1338
- backslashes = 0;
1339
- }
1340
- return `${quoted}${"\\".repeat(backslashes * 2)}"`;
1341
- }
1342
-
1343
1375
  // src/drivers/harness-check.ts
1344
1376
  var HARNESS_STALE_MS = 5 * 6e4;
1345
1377
  var FIRST_CHECK_WAIT_MS = 3e3;
@@ -1468,9 +1500,10 @@ function harnessAlive(pid, r, dialect) {
1468
1500
  }
1469
1501
  try {
1470
1502
  const [file, ...args] = processCommandLine(pid);
1471
- const command = execFileSync3(file, args, {
1503
+ const command = execFileSync4(file, args, {
1472
1504
  encoding: "utf-8",
1473
- timeout: 2e3
1505
+ timeout: 2e3,
1506
+ ...file === "powershell" ? { env: windowsPowerShellEnv() } : {}
1474
1507
  });
1475
1508
  return dialect.owns(r, command);
1476
1509
  } catch {
@@ -2142,6 +2175,8 @@ export {
2142
2175
  STOPPED_SUMMARY,
2143
2176
  isEndLogLine,
2144
2177
  commandFor,
2178
+ windowsExecutable,
2179
+ windowsPowerShellEnv,
2145
2180
  defaultT3BinSources,
2146
2181
  t3Candidates,
2147
2182
  pickT3Bin,
@@ -24,6 +24,8 @@ var MeshSocket = class {
24
24
  stopped = false;
25
25
  open = false;
26
26
  token;
27
+ /** The newest beat the caller gave, sent again each time the socket opens. */
28
+ presence = null;
27
29
  /** Connect again with a new device token, after a refusal of the old one. */
28
30
  restart(token) {
29
31
  this.token = token;
@@ -51,6 +53,7 @@ var MeshSocket = class {
51
53
  ws.on("open", () => {
52
54
  this.open = true;
53
55
  this.attempt = 0;
56
+ if (this.presence) this.send({ type: "presence", ...this.presence });
54
57
  this.opts.onOpen?.();
55
58
  });
56
59
  ws.on("message", (data) => this.handleMessage(data));
@@ -112,8 +115,12 @@ var MeshSocket = class {
112
115
  isConnected() {
113
116
  return this.open && this.ws?.readyState === WS_OPEN;
114
117
  }
115
- /** Send a presence beat over the socket. Returns false if not connected. */
118
+ /**
119
+ * Send a presence beat over the socket. Returns false if not connected;
120
+ * the socket still keeps the beat and sends it when it opens.
121
+ */
116
122
  sendPresence(body) {
123
+ this.presence = body;
117
124
  return this.send({ type: "presence", ...body });
118
125
  }
119
126
  /** Send any client frame. Returns false if not connected. */
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-ES5BRAKJ.js";
6
6
  import {
7
7
  VERSION
8
- } from "./chunk-GPQ2MSET.js";
8
+ } from "./chunk-RMXD3BW4.js";
9
9
  import {
10
10
  getOrigin,
11
11
  readCredentials,
@@ -3,7 +3,7 @@ import {
3
3
  readRunnerState,
4
4
  runnerStatePath,
5
5
  threadsFilePath
6
- } from "./chunk-5SUC54R3.js";
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-S3AB7HKD.js";
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-3SIF2NNR.js";
50
+ } from "./chunk-RSKVW2PT.js";
49
51
  import {
50
52
  ConnectFailure,
51
53
  connectReport,
52
54
  deviceLogin,
53
55
  newAttempt,
54
56
  sendConnectReport
55
- } from "./chunk-XQZO3UE6.js";
57
+ } from "./chunk-JO6TUYVI.js";
56
58
  import {
57
59
  VERSION
58
- } from "./chunk-GPQ2MSET.js";
60
+ } from "./chunk-RMXD3BW4.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" ? where(bin) : whichPosix(bin);
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)
@@ -1379,29 +1385,13 @@ function unitFor(opts) {
1379
1385
  contents: contents2,
1380
1386
  start: [
1381
1387
  { 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
1388
  {
1399
1389
  command: [
1400
1390
  "powershell",
1401
1391
  "-NoProfile",
1402
1392
  "-NonInteractive",
1403
1393
  "-Command",
1404
- `Set-ScheduledTask -TaskName '${task}' -Settings (New-ScheduledTaskSettingsSet -ExecutionTimeLimit ([TimeSpan]::Zero) -MultipleInstances IgnoreNew -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable) | Out-Null`
1394
+ registerTaskScript(task, path2)
1405
1395
  ]
1406
1396
  },
1407
1397
  { command: ["schtasks", "/run", "/tn", task] }
@@ -1630,7 +1620,8 @@ var systemServices = {
1630
1620
  run: (command) => execFileSync2(command[0], command.slice(1), {
1631
1621
  encoding: "utf-8",
1632
1622
  stdio: ["ignore", "pipe", "ignore"],
1633
- timeout: 15e3
1623
+ timeout: 15e3,
1624
+ ...command[0] === "powershell" ? { env: windowsPowerShellEnv() } : {}
1634
1625
  }),
1635
1626
  awaitUp: (since) => awaitDaemon(since)
1636
1627
  };
@@ -1939,7 +1930,8 @@ async function connect(argv, attempt, deps = {}) {
1939
1930
  }
1940
1931
  async function claudeAtFloor(found, forced, deps) {
1941
1932
  const version = found.claude?.version;
1942
- if (!version || forced === "codex" || !olderThan(version, CLAUDE_FLOOR)) return found;
1933
+ const codex = forced === "codex" || !forced && !found.claude?.signedIn && Boolean(found.codex?.signedIn);
1934
+ if (!version || codex || !olderThan(version, CLAUDE_FLOOR)) return found;
1943
1935
  const fix = "Run `claude update`, then run `cloop connect` again.";
1944
1936
  const answer = deps.ask ? await deps.ask(`${claudeTooOld(version)} Update it now with \`claude update\`? (Y/n) `) : null;
1945
1937
  if (answer === null || answer.trim() && !isYes(answer))
@@ -1950,13 +1942,41 @@ async function claudeAtFloor(found, forced, deps) {
1950
1942
  out(`${bold("Cloop runner")} Claude Code updated to ${claude.version}.`);
1951
1943
  return { ...found, claude };
1952
1944
  }
1953
- async function updateClaude() {
1954
- try {
1955
- execFileSync2("claude", ["update"], { stdio: "inherit", timeout: 3e5 });
1956
- } catch {
1957
- return null;
1945
+ var WINGET_MANAGED = /winget upgrade Anthropic\.ClaudeCode/;
1946
+ var WINGET_UPDATE = [
1947
+ "winget",
1948
+ "upgrade",
1949
+ "--id",
1950
+ "Anthropic.ClaudeCode",
1951
+ "--exact",
1952
+ "--accept-source-agreements",
1953
+ "--accept-package-agreements"
1954
+ ];
1955
+ async function updateClaude(run = runShown, probe = probeClaude) {
1956
+ const update = run(["claude", "update"], false);
1957
+ if (WINGET_MANAGED.test(update.output)) {
1958
+ out(
1959
+ `${bold("Cloop runner")} winget installed Claude Code, so connect updates it with winget.`
1960
+ );
1961
+ if (run(WINGET_UPDATE, true).status !== 0) return null;
1962
+ } else {
1963
+ process.stdout.write(update.output);
1964
+ if (update.status !== 0) return null;
1958
1965
  }
1959
- return probeClaude();
1966
+ return probe();
1967
+ }
1968
+ function runShown(command, show) {
1969
+ const { file, args, windowsVerbatimArguments } = commandFor(
1970
+ command[0],
1971
+ command.slice(1)
1972
+ );
1973
+ const result = spawnSync(file, args, {
1974
+ encoding: "utf-8",
1975
+ stdio: show ? "inherit" : ["inherit", "pipe", "pipe"],
1976
+ timeout: 6e5,
1977
+ ...windowsVerbatimArguments ? { windowsVerbatimArguments } : {}
1978
+ });
1979
+ return { status: result.status, output: `${result.stdout ?? ""}${result.stderr ?? ""}` };
1960
1980
  }
1961
1981
  function terminalYesNo() {
1962
1982
  if (!process.stdin.isTTY || !process.stdout.isTTY) return null;
@@ -2008,7 +2028,7 @@ async function runConnect(argv, deps = {}) {
2008
2028
  return error;
2009
2029
  }
2010
2030
  async function connectCommand(argv) {
2011
- if (await runConnect(argv)) process.exit(1);
2031
+ if (await runConnect(argv)) process.exitCode = 1;
2012
2032
  }
2013
2033
 
2014
2034
  export {
@@ -2022,7 +2042,6 @@ export {
2022
2042
  codexDialect,
2023
2043
  DEFAULT_T3_URL,
2024
2044
  which,
2025
- preferExecutable,
2026
2045
  T3PairError,
2027
2046
  mintSession,
2028
2047
  sessionFromLink,
@@ -2041,6 +2060,7 @@ export {
2041
2060
  systemdWord,
2042
2061
  cmdValue,
2043
2062
  cmdWord,
2063
+ registerTaskScript,
2044
2064
  programFor,
2045
2065
  findNpx,
2046
2066
  awaitDaemon,
@@ -2065,6 +2085,8 @@ export {
2065
2085
  harnessesFound,
2066
2086
  rememberedDriver,
2067
2087
  claudeAtFloor,
2088
+ WINGET_UPDATE,
2089
+ updateClaude,
2068
2090
  runConnect,
2069
2091
  connectCommand,
2070
2092
  legacyStagingRunner,
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  findRun
4
- } from "./chunk-TEEFTSXG.js";
4
+ } from "./chunk-YULXWTUB.js";
5
5
  import {
6
6
  lockThreadsFile,
7
7
  threadsFilePath
8
- } from "./chunk-5SUC54R3.js";
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-S3AB7HKD.js";
15
+ } from "./chunk-GNNGDCKP.js";
16
16
  import {
17
17
  shortMachineName
18
18
  } from "./chunk-NTXQLEMQ.js";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/version.ts
4
- var VERSION = true ? "0.3.9" : "0.0.0-dev";
4
+ var VERSION = true ? "0.3.11" : "0.0.0-dev";
5
5
 
6
6
  export {
7
7
  VERSION
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ConnectFailure,
4
4
  deviceLogin
5
- } from "./chunk-XQZO3UE6.js";
5
+ } from "./chunk-JO6TUYVI.js";
6
6
  import {
7
7
  ApiError,
8
8
  ReauthError,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  RUN_TEXT_MAX,
4
4
  runnerPath
5
- } from "./chunk-S3AB7HKD.js";
5
+ } from "./chunk-GNNGDCKP.js";
6
6
 
7
7
  // src/box-watch.ts
8
8
  import { randomUUID } from "crypto";
@@ -8,7 +8,7 @@ import {
8
8
  readRunnerConfig,
9
9
  runLogDir,
10
10
  runLogPath
11
- } from "./chunk-S3AB7HKD.js";
11
+ } from "./chunk-GNNGDCKP.js";
12
12
  import {
13
13
  sanitizeLabel,
14
14
  stripControl
@@ -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-AA2SZUIY.js";
51
- import "./chunk-5SUC54R3.js";
52
- import "./chunk-S3AB7HKD.js";
52
+ } from "./chunk-LYB5H7VQ.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-3SIF2NNR.js";
58
- import "./chunk-XQZO3UE6.js";
59
+ import "./chunk-RSKVW2PT.js";
60
+ import "./chunk-JO6TUYVI.js";
59
61
  import "./chunk-ES5BRAKJ.js";
60
- import "./chunk-GPQ2MSET.js";
62
+ import "./chunk-RMXD3BW4.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-AA2SZUIY.js";
11
- import "./chunk-5SUC54R3.js";
12
- import "./chunk-S3AB7HKD.js";
10
+ } from "./chunk-LYB5H7VQ.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-3SIF2NNR.js";
18
- import "./chunk-XQZO3UE6.js";
17
+ import "./chunk-RSKVW2PT.js";
18
+ import "./chunk-JO6TUYVI.js";
19
19
  import "./chunk-ES5BRAKJ.js";
20
- import "./chunk-GPQ2MSET.js";
20
+ import "./chunk-RMXD3BW4.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-AA2SZUIY.js";
6
- import "./chunk-5SUC54R3.js";
7
- import "./chunk-S3AB7HKD.js";
5
+ } from "./chunk-LYB5H7VQ.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-3SIF2NNR.js";
13
- import "./chunk-XQZO3UE6.js";
12
+ import "./chunk-RSKVW2PT.js";
13
+ import "./chunk-JO6TUYVI.js";
14
14
  import "./chunk-ES5BRAKJ.js";
15
- import "./chunk-GPQ2MSET.js";
15
+ import "./chunk-RMXD3BW4.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-GPQ2MSET.js";
7
+ } from "./chunk-RMXD3BW4.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-DYL2ZND4.js");
68
+ const { pinExistingRunner: pin } = await import("./existing-runner-RIA6NDFN.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-67UJOSXI.js");
76
+ const { loginCommand } = await import("./login-LLHZ3GEB.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-BQIXVJYD.js");
86
+ const { startMcpServer } = await import("./mcp-server-FLDX42SN.js");
87
87
  await startMcpServer();
88
88
  break;
89
89
  }
90
90
  case "statusline": {
91
- const { statuslineCommand } = await import("./statusline-G6SQFIVR.js");
91
+ const { statuslineCommand } = await import("./statusline-6F2Q4UEE.js");
92
92
  statuslineCommand();
93
93
  break;
94
94
  }
95
95
  case "connect": {
96
- const { connectCommand } = await import("./connect-3IS2XXSU.js");
96
+ const { connectCommand } = await import("./connect-FG2XEPHS.js");
97
97
  await connectCommand(argv.slice(1));
98
98
  break;
99
99
  }
100
100
  case "use": {
101
- const { useCommand } = await import("./use-XTJPDK4Y.js");
101
+ const { useCommand } = await import("./use-Z2T43IM6.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-IMVUEDIP.js");
106
+ const { disconnectCommand } = await import("./disconnect-MATUPTML.js");
107
107
  await disconnectCommand(argv.slice(1));
108
108
  break;
109
109
  }
110
110
  case "box": {
111
- const { boxCommand } = await import("./box-V3DFX5TB.js");
111
+ const { boxCommand } = await import("./box-4G3Z6BGK.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-CMRLRCTD.js");
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-CMRLRCTD.js");
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-HFQOQTLP.js");
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-CMRLRCTD.js");
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-2O56SWXN.js");
140
+ const { runnerCommand } = await import("./runner-4YA72EPY.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-XQZO3UE6.js";
6
+ } from "./chunk-JO6TUYVI.js";
7
7
  import "./chunk-ES5BRAKJ.js";
8
- import "./chunk-GPQ2MSET.js";
8
+ import "./chunk-RMXD3BW4.js";
9
9
  import "./chunk-D5UZW42X.js";
10
10
  export {
11
11
  deviceLogin,
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  MeshSocket,
11
11
  defaultSocketFactory
12
- } from "./chunk-ZILLDYL4.js";
12
+ } from "./chunk-IJH4O27H.js";
13
13
  import {
14
14
  readSessionState,
15
15
  toolPhrase,
@@ -33,7 +33,7 @@ import {
33
33
  } from "./chunk-ES5BRAKJ.js";
34
34
  import {
35
35
  VERSION
36
- } from "./chunk-GPQ2MSET.js";
36
+ } from "./chunk-RMXD3BW4.js";
37
37
  import {
38
38
  getMeshUrl,
39
39
  getToken
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  connectWebhook,
4
4
  runnerCommand
5
- } from "./chunk-3SIF2NNR.js";
6
- import "./chunk-XQZO3UE6.js";
5
+ } from "./chunk-RSKVW2PT.js";
6
+ import "./chunk-JO6TUYVI.js";
7
7
  import "./chunk-ES5BRAKJ.js";
8
- import "./chunk-GPQ2MSET.js";
8
+ import "./chunk-RMXD3BW4.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-TEEFTSXG.js";
12
- import "./chunk-S3AB7HKD.js";
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 {
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VK6GV757.js";
8
8
  import {
9
9
  VERSION
10
- } from "./chunk-GPQ2MSET.js";
10
+ } from "./chunk-RMXD3BW4.js";
11
11
  import {
12
12
  getToken
13
13
  } from "./chunk-D5UZW42X.js";
@@ -9,10 +9,10 @@ import {
9
9
  takeoverDir,
10
10
  writeTakeoverReply,
11
11
  writeTakeoverRequest
12
- } from "./chunk-FNJ74LO3.js";
13
- import "./chunk-TEEFTSXG.js";
14
- import "./chunk-5SUC54R3.js";
15
- import "./chunk-S3AB7HKD.js";
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-AA2SZUIY.js";
7
- import "./chunk-5SUC54R3.js";
6
+ } from "./chunk-LYB5H7VQ.js";
7
+ import "./chunk-WRSJZ5WD.js";
8
8
  import {
9
9
  isLocal,
10
10
  readRunnerConfig
11
- } from "./chunk-S3AB7HKD.js";
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-3SIF2NNR.js";
17
- import "./chunk-XQZO3UE6.js";
16
+ import "./chunk-RSKVW2PT.js";
17
+ import "./chunk-JO6TUYVI.js";
18
18
  import "./chunk-ES5BRAKJ.js";
19
- import "./chunk-GPQ2MSET.js";
19
+ import "./chunk-RMXD3BW4.js";
20
20
  import "./chunk-D5UZW42X.js";
21
21
 
22
22
  // src/commands/use.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloop/runner",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Make your machine and your agents Cloop runners: device login, the runner daemon, the Cloop MCP server, and Claude Code hooks.",