@cloop/runner 0.3.45 → 0.3.46

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.
@@ -39,7 +39,7 @@ import {
39
39
  systemServices,
40
40
  unitFor,
41
41
  which
42
- } from "./chunk-HHNLRNOM.js";
42
+ } from "./chunk-42ABTDLJ.js";
43
43
  import {
44
44
  MeshSocket,
45
45
  WAKE_TICK_MS,
@@ -47,7 +47,7 @@ import {
47
47
  defaultSocketFactory,
48
48
  runnerLog,
49
49
  wakeWatch
50
- } from "./chunk-CVVYCLZ6.js";
50
+ } from "./chunk-BI2Y5ZCL.js";
51
51
  import {
52
52
  BoxWatch,
53
53
  hostedThreadsFilePath,
@@ -112,14 +112,14 @@ import {
112
112
  olderThan
113
113
  } from "./chunk-365HFCQQ.js";
114
114
  import "./chunk-PKIEWBR7.js";
115
- import "./chunk-L763FCD7.js";
116
- import "./chunk-EPWLBMCR.js";
115
+ import "./chunk-NTUUR5CD.js";
116
+ import "./chunk-A3YMWMAP.js";
117
117
  import {
118
118
  getMachine
119
119
  } from "./chunk-SBYSVZ7J.js";
120
120
  import {
121
121
  VERSION
122
- } from "./chunk-AAHVP23O.js";
122
+ } from "./chunk-2YAX6QVI.js";
123
123
  import {
124
124
  getMeshUrl,
125
125
  getOrigin,
@@ -2762,6 +2762,7 @@ function boxPresence(beat) {
2762
2762
  surface: {
2763
2763
  driver: beat.driver,
2764
2764
  version: VERSION,
2765
+ os: process.platform,
2765
2766
  outsideThreads: beat.outsideThreads,
2766
2767
  otherThreads: beat.otherThreads,
2767
2768
  ...beat.t3 ? { t3: beat.t3 } : {},
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/version.ts
4
- var VERSION = true ? "0.3.45" : "0.0.0-dev";
4
+ var VERSION = true ? "0.3.46" : "0.0.0-dev";
5
5
 
6
6
  export {
7
7
  VERSION
@@ -4,7 +4,7 @@ import {
4
4
  freshness,
5
5
  outcomeLine,
6
6
  runnerLog
7
- } from "./chunk-CVVYCLZ6.js";
7
+ } from "./chunk-BI2Y5ZCL.js";
8
8
  import {
9
9
  readRunnerState,
10
10
  runnerStatePath,
@@ -63,14 +63,14 @@ import {
63
63
  } from "./chunk-PKIEWBR7.js";
64
64
  import {
65
65
  connectWebhook
66
- } from "./chunk-L763FCD7.js";
66
+ } from "./chunk-NTUUR5CD.js";
67
67
  import {
68
68
  ConnectFailure,
69
69
  connectReport,
70
70
  deviceLogin,
71
71
  newAttempt,
72
72
  sendConnectReport
73
- } from "./chunk-EPWLBMCR.js";
73
+ } from "./chunk-A3YMWMAP.js";
74
74
  import {
75
75
  defaultDeviceName,
76
76
  getMachine,
@@ -78,7 +78,7 @@ import {
78
78
  } from "./chunk-SBYSVZ7J.js";
79
79
  import {
80
80
  VERSION
81
- } from "./chunk-AAHVP23O.js";
81
+ } from "./chunk-2YAX6QVI.js";
82
82
  import {
83
83
  STAGING_ORIGIN,
84
84
  getOrigin,
@@ -90,15 +90,15 @@ import {
90
90
  import { execFileSync as execFileSync2, spawnSync } from "child_process";
91
91
  import { randomUUID } from "crypto";
92
92
  import {
93
- existsSync as existsSync5,
93
+ existsSync as existsSync6,
94
94
  mkdirSync as mkdirSync3,
95
95
  readdirSync as readdirSync4,
96
96
  rmSync as rmSync3,
97
97
  statSync as statSync2,
98
98
  writeFileSync as writeFileSync2
99
99
  } from "fs";
100
- import { homedir as homedir5, userInfo } from "os";
101
- import { basename as basename5, dirname as dirname3, join as join7, resolve as resolve2 } from "path";
100
+ import { homedir as homedir6, userInfo } from "os";
101
+ import { basename as basename5, dirname as dirname3, join as join8, resolve as resolve2 } from "path";
102
102
  import { createInterface } from "readline/promises";
103
103
  import { Writable } from "stream";
104
104
 
@@ -197,9 +197,9 @@ var POSIX_INSTALL = [
197
197
  'rm -rf "$1.old"',
198
198
  'rm -f "$7"'
199
199
  ].join(" && ");
200
- async function installCodex(home, run = runShown) {
200
+ async function installCodex(home, run2 = runShown) {
201
201
  const command = codexInstallCommand(home);
202
- if (!command || !await run(command)) return false;
202
+ if (!command || !await run2(command)) return false;
203
203
  findLocalCodex(home);
204
204
  return true;
205
205
  }
@@ -213,8 +213,8 @@ function claudeInstallCommand(platform = process.platform) {
213
213
  "irm https://claude.ai/install.ps1 | iex"
214
214
  ] : ["sh", "-c", "curl -fsSL https://claude.ai/install.sh | bash"];
215
215
  }
216
- async function installClaude(home, run = runShown) {
217
- if (!await run(claudeInstallCommand())) return false;
216
+ async function installClaude(home, run2 = runShown) {
217
+ if (!await run2(claudeInstallCommand())) return false;
218
218
  findLocalClaude(home);
219
219
  return true;
220
220
  }
@@ -265,6 +265,176 @@ function hasChatGptApp(home, platform = process.platform, env = process.env, fs
265
265
  return false;
266
266
  }
267
267
 
268
+ // src/chrome-cookies.ts
269
+ import { createDecipheriv, pbkdf2Sync } from "crypto";
270
+
271
+ // ../clo0p-app/contracts/site-jar.ts
272
+ var JAR_MAX_COOKIES = 300;
273
+ function onSite(domain, site) {
274
+ const host = domain.replace(/^\./, "").toLowerCase();
275
+ return host === site || host.endsWith(`.${site}`);
276
+ }
277
+
278
+ // src/chrome-cookies.ts
279
+ var KeychainRefused = class extends Error {
280
+ constructor() {
281
+ super("keychain_refused");
282
+ this.name = "KeychainRefused";
283
+ }
284
+ };
285
+ var LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
286
+ var TLD = "(?:[a-z]{2,63}|xn--[a-z0-9-]{1,59})";
287
+ var SITE = new RegExp(`^(?:${LABEL}\\.)+${TLD}$`);
288
+ function parseSite(raw) {
289
+ return typeof raw === "string" && raw.length <= 253 && SITE.test(raw) ? raw : null;
290
+ }
291
+ var keyFrom = (password) => pbkdf2Sync(password, "saltysalt", 1003, 16, "sha1");
292
+ function decrypt(hex, key, version) {
293
+ const buf = Buffer.from(hex, "hex");
294
+ if (buf.subarray(0, 3).toString() !== "v10") return null;
295
+ const d = createDecipheriv("aes-128-cbc", key, Buffer.alloc(16, 32));
296
+ const plain = Buffer.concat([d.update(buf.subarray(3)), d.final()]);
297
+ return (version >= 24 ? plain.subarray(32) : plain).toString("utf8");
298
+ }
299
+ var SAME_SITE = { 0: "None", 1: "Lax", 2: "Strict" };
300
+ var CHROME_EPOCH_S = 11644473600;
301
+ function cookieOf(row, value) {
302
+ const us = Number(row.expires_utc);
303
+ const sameSite = SAME_SITE[row.samesite];
304
+ return {
305
+ name: row.name,
306
+ value,
307
+ domain: row.host_key,
308
+ path: row.path,
309
+ expires: us > 0 ? Math.floor(us / 1e6 - CHROME_EPOCH_S) : -1,
310
+ httpOnly: row.is_httponly === 1,
311
+ secure: row.is_secure === 1,
312
+ ...sameSite ? { sameSite } : {}
313
+ };
314
+ }
315
+ function pickProfile(dbs) {
316
+ let best = null;
317
+ for (const db of dbs) {
318
+ if (db.rows.length === 0) continue;
319
+ if (!best || db.rows.length > best.rows.length || db.rows.length === best.rows.length && db.profile === "Default")
320
+ best = db;
321
+ }
322
+ return best;
323
+ }
324
+ function jarOf(db, key, site) {
325
+ const jar = [];
326
+ for (const row of db.rows) {
327
+ if (!onSite(row.host_key, site)) continue;
328
+ const value = row.value || decrypt(row.ev, key, db.version);
329
+ if (value) jar.push(cookieOf(row, value));
330
+ }
331
+ return jar.slice(0, JAR_MAX_COOKIES);
332
+ }
333
+ function errorCode(err) {
334
+ const code = err?.code;
335
+ if (typeof code === "string" || typeof code === "number") return String(code);
336
+ return err instanceof Error ? err.name : "unknown";
337
+ }
338
+ async function importCookies(args, io) {
339
+ const site = parseSite(args.site);
340
+ const refuse = (because) => {
341
+ io.log(`[runner:cookies] site=${site ?? "-"} because=${because}`);
342
+ return { ok: false, because };
343
+ };
344
+ if (!site) return refuse("bad_site");
345
+ if (io.platform !== "darwin") return refuse("unsupported_os");
346
+ let step = "read";
347
+ try {
348
+ const dbs = await io.readSite(site);
349
+ if (!dbs) return refuse("no_chrome");
350
+ const best = pickProfile(dbs);
351
+ let cookies = [];
352
+ if (best) {
353
+ step = "keychain";
354
+ const key = keyFrom(await io.safeStoragePassword());
355
+ step = "decrypt";
356
+ cookies = jarOf(best, key, site);
357
+ }
358
+ if (!best || cookies.length === 0) {
359
+ if (args.open !== true) return refuse("not_signed_in");
360
+ step = "open";
361
+ await io.openChrome(`https://${site}`);
362
+ return refuse("opened_chrome");
363
+ }
364
+ io.log(`[runner:cookies] site=${site} profile=${best.profile} cookies=${cookies.length}`);
365
+ return { ok: true, profile: best.profile, cookies };
366
+ } catch (err) {
367
+ if (err instanceof KeychainRefused) return refuse("keychain_refused");
368
+ io.log(`[runner:cookies] site=${site} step=${step} error=${errorCode(err)}`);
369
+ return { ok: false, because: "failed" };
370
+ }
371
+ }
372
+
373
+ // src/chrome-mac.ts
374
+ import { execFile } from "child_process";
375
+ import { existsSync as existsSync2 } from "fs";
376
+ import { copyFile, mkdtemp, readdir, rm } from "fs/promises";
377
+ import { homedir, tmpdir } from "os";
378
+ import { join as join2 } from "path";
379
+ import { promisify } from "util";
380
+ var run = promisify(execFile);
381
+ var execText = async (file, args, opts) => (await run(file, args, { ...opts, maxBuffer: 16 * 1024 * 1024 })).stdout;
382
+ var CHROME = "Library/Application Support/Google/Chrome";
383
+ var JARS = ["Network/Cookies", "Cookies"];
384
+ function macChrome(over = {}) {
385
+ const root = join2(over.home ?? homedir(), CHROME);
386
+ const exec3 = over.exec ?? execText;
387
+ const sql = async (db, query) => JSON.parse(
388
+ await exec3("sqlite3", ["-readonly", "-json", db, query], { timeout: 15e3 }) || "[]"
389
+ );
390
+ async function readCopy(profile, file, site) {
391
+ const dir = await mkdtemp(join2(tmpdir(), "cloop-jar-"));
392
+ try {
393
+ const db = join2(dir, "Cookies");
394
+ await copyFile(file, db);
395
+ const rows = await sql(
396
+ db,
397
+ `select host_key, name, path, expires_utc, is_secure, is_httponly, samesite, value, hex(encrypted_value) as ev from cookies where host_key = '${site}' or host_key like '%.${site}'`
398
+ );
399
+ const meta = await sql(db, `select value from meta where key = 'version'`);
400
+ return { profile, version: Number(meta[0]?.value ?? 0), rows };
401
+ } finally {
402
+ await rm(dir, { recursive: true, force: true });
403
+ }
404
+ }
405
+ return {
406
+ platform: over.platform ?? process.platform,
407
+ async readSite(site) {
408
+ if (!existsSync2(root)) return null;
409
+ const profiles = (await readdir(root, { withFileTypes: true })).filter((d) => d.isDirectory()).map((d) => d.name).sort();
410
+ const dbs = [];
411
+ for (const profile of profiles)
412
+ for (const jar of JARS) {
413
+ const file = join2(root, profile, jar);
414
+ if (existsSync2(file)) dbs.push(await readCopy(profile, file, site));
415
+ }
416
+ return dbs;
417
+ },
418
+ async safeStoragePassword() {
419
+ try {
420
+ const out2 = await exec3(
421
+ "security",
422
+ ["find-generic-password", "-w", "-s", "Chrome Safe Storage"],
423
+ { timeout: 12e4 }
424
+ );
425
+ return out2.trim();
426
+ } catch (err) {
427
+ if (typeof err.code === "number") throw new KeychainRefused();
428
+ throw err;
429
+ }
430
+ },
431
+ async openChrome(url) {
432
+ await exec3("open", ["-a", "Google Chrome", url], { timeout: 15e3 });
433
+ },
434
+ log: (line2) => console.error(line2)
435
+ };
436
+ }
437
+
268
438
  // src/box-tools.ts
269
439
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
270
440
  function parseLaunchArgs(args) {
@@ -353,7 +523,9 @@ var BOX_TOOLS = {
353
523
  async "setup.share"({ setup }) {
354
524
  if (!setup) throw new BoxToolError("cannot_share");
355
525
  return setup.start();
356
- }
526
+ },
527
+ // One site's sign-in from the owner's Chrome, for the app to keep. Every refusal is an answer, not an error.
528
+ "cookies.import": ({ chrome }, args) => importCookies(args, chrome ?? macChrome())
357
529
  };
358
530
  function classifyError(err, driver = "t3") {
359
531
  if (err instanceof BoxToolError) return err.code;
@@ -434,7 +606,7 @@ async function revokeOwnDevice(origin, deviceToken, fetchFn = fetch) {
434
606
  }
435
607
 
436
608
  // src/drivers/claude-code.ts
437
- import { execFile } from "child_process";
609
+ import { execFile as execFile2 } from "child_process";
438
610
  import { readFileSync } from "fs";
439
611
  import { basename as basename2, extname, isAbsolute, relative, resolve } from "path";
440
612
  var SUBSCRIPTIONS = {
@@ -446,7 +618,7 @@ var SUBSCRIPTIONS = {
446
618
  function exec(bin, args) {
447
619
  const command = commandFor(bin, args);
448
620
  return new Promise(
449
- (resolve3) => execFile(
621
+ (resolve3) => execFile2(
450
622
  command.file,
451
623
  command.args,
452
624
  {
@@ -599,16 +771,16 @@ function imageBlock(path) {
599
771
  var IMAGE_TYPE_OF = Object.fromEntries(
600
772
  Object.entries(IMAGE_TYPES).map(([type, ext]) => [ext, type])
601
773
  );
602
- function userMessage(run, text, priority, images = []) {
774
+ function userMessage(run2, text, priority, images = []) {
603
775
  return {
604
776
  type: "user",
605
777
  message: { role: "user", content: [...images.flatMap(imageBlock), { type: "text", text }] },
606
778
  parent_tool_use_id: null,
607
- session_id: run.session_id ?? run.work_id,
779
+ session_id: run2.session_id ?? run2.work_id,
608
780
  ...priority ? { priority } : {}
609
781
  };
610
782
  }
611
- function parseClaudeLine(raw, run) {
783
+ function parseClaudeLine(raw, run2) {
612
784
  let msg;
613
785
  try {
614
786
  msg = JSON.parse(raw);
@@ -633,7 +805,7 @@ function parseClaudeLine(raw, run) {
633
805
  const path = pathOf(block.input);
634
806
  const description = block.input?.description;
635
807
  const summary = typeof description === "string" ? cut(description, 200) : TOOL_WORDS[block.name];
636
- const detail = toolDetail(block.name, block.input, run.repo);
808
+ const detail = toolDetail(block.name, block.input, run2.repo);
637
809
  return [
638
810
  {
639
811
  type: "tool",
@@ -658,7 +830,7 @@ function parseClaudeLine(raw, run) {
658
830
  request_id: msg.request_id,
659
831
  tool,
660
832
  input: request.input ?? {},
661
- summary: askSummary(tool, request.input, run.repo)
833
+ summary: askSummary(tool, request.input, run2.repo)
662
834
  }
663
835
  ];
664
836
  }
@@ -692,7 +864,7 @@ function claudeDialect(bin = "claude", fallback = DEFAULT_FALLBACK_MODEL, askEve
692
864
  capabilities: ["view", "start", "steer", "report"],
693
865
  env: { CLAUDE_CODE_MCP_STARTUP_WAIT_MS: String(MCP_STARTUP_WAIT_MS) },
694
866
  keepsStdin: true,
695
- args(run, resume) {
867
+ args(run2, resume) {
696
868
  return [
697
869
  "--print",
698
870
  "--verbose",
@@ -711,20 +883,20 @@ function claudeDialect(bin = "claude", fallback = DEFAULT_FALLBACK_MODEL, askEve
711
883
  JSON.stringify(readOnlySettings(askEverything))
712
884
  ],
713
885
  "--add-dir",
714
- run.repo,
715
- ...resume ? ["--resume", run.session_id ?? run.work_id] : ["--session-id", run.session_id ?? run.work_id],
716
- ...run.model ? ["--model", run.model] : fallback ? ["--fallback-model", fallback] : []
886
+ run2.repo,
887
+ ...resume ? ["--resume", run2.session_id ?? run2.work_id] : ["--session-id", run2.session_id ?? run2.work_id],
888
+ ...run2.model ? ["--model", run2.model] : fallback ? ["--fallback-model", fallback] : []
717
889
  ];
718
890
  },
719
- opening(run, prompt, images = []) {
891
+ opening(run2, prompt, images = []) {
720
892
  return line({
721
893
  type: "control_request",
722
894
  request_id: "cloop-init",
723
895
  request: { subtype: "initialize" }
724
- }) + line(userMessage(run, prompt, void 0, images));
896
+ }) + line(userMessage(run2, prompt, void 0, images));
725
897
  },
726
- userLine(run, text, mode) {
727
- return line(userMessage(run, text, mode === "steer" ? "now" : "next"));
898
+ userLine(run2, text, mode) {
899
+ return line(userMessage(run2, text, mode === "steer" ? "now" : "next"));
728
900
  },
729
901
  answerLine(ask, text) {
730
902
  const input = ask.input ?? {};
@@ -741,18 +913,18 @@ function claudeDialect(bin = "claude", fallback = DEFAULT_FALLBACK_MODEL, askEve
741
913
  });
742
914
  },
743
915
  parse: parseClaudeLine,
744
- owns: (run, command) => command.includes(basename2(bin)) && [run.work_id, run.session_id].some((id) => id !== null && command.includes(id)),
916
+ owns: (run2, command) => command.includes(basename2(bin)) && [run2.work_id, run2.session_id].some((id) => id !== null && command.includes(id)),
745
917
  probe: () => probeClaude(bin)
746
918
  };
747
919
  }
748
920
 
749
921
  // src/drivers/codex.ts
750
- import { execFile as execFile2 } from "child_process";
922
+ import { execFile as execFile3 } from "child_process";
751
923
  import { basename as basename3 } from "path";
752
924
  function exec2(bin, args, timeout = 1e4) {
753
925
  const command = commandFor(bin, args);
754
926
  return new Promise(
755
- (resolve3) => execFile2(
927
+ (resolve3) => execFile3(
756
928
  command.file,
757
929
  command.args,
758
930
  {
@@ -850,38 +1022,38 @@ function codexDialect(bin = "codex") {
850
1022
  bin,
851
1023
  capabilities: ["view", "start", "report"],
852
1024
  keepsStdin: false,
853
- args(run, resume, images = []) {
854
- const model = run.model ? ["--model", run.model] : [];
1025
+ args(run2, resume, images = []) {
1026
+ const model = run2.model ? ["--model", run2.model] : [];
855
1027
  const attach = images.length ? [`--image=${images.join(",")}`] : [];
856
1028
  const policy = ["--dangerously-bypass-approvals-and-sandbox", "--skip-git-repo-check"];
857
- return resume && run.session_id ? ["exec", ...policy, "resume", run.session_id, "--json", ...model, "-"] : ["exec", "--cd", run.repo, "--json", ...policy, ...model, ...attach, "-"];
1029
+ return resume && run2.session_id ? ["exec", ...policy, "resume", run2.session_id, "--json", ...model, "-"] : ["exec", "--cd", run2.repo, "--json", ...policy, ...model, ...attach, "-"];
858
1030
  },
859
1031
  opening: (_run, prompt) => prompt,
860
1032
  models: () => codexModels(bin),
861
1033
  parse: parseCodexLine,
862
1034
  // A fresh run's command line names no id: Codex makes its session id after the start. So a run is also matched by its exact repository, which one open run per repository makes unique.
863
- owns: (run, command) => command.includes(basename3(bin)) && command.includes("exec") && command.includes("--json") && (run.session_id !== null && command.includes(run.session_id) || command.includes(`--cd ${run.repo} `)),
1035
+ owns: (run2, command) => command.includes(basename3(bin)) && command.includes("exec") && command.includes("--json") && (run2.session_id !== null && command.includes(run2.session_id) || command.includes(`--cd ${run2.repo} `)),
864
1036
  probe: () => probeCodex(bin)
865
1037
  };
866
1038
  }
867
1039
 
868
1040
  // src/legacy-staging.ts
869
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, renameSync as renameSync2, rmSync as rmSync2 } from "fs";
870
- import { homedir as homedir3 } from "os";
871
- import { join as join6 } from "path";
1041
+ import { existsSync as existsSync5, mkdirSync as mkdirSync2, renameSync as renameSync2, rmSync as rmSync2 } from "fs";
1042
+ import { homedir as homedir4 } from "os";
1043
+ import { join as join7 } from "path";
872
1044
 
873
1045
  // src/commands/disconnect.ts
874
1046
  import { execFileSync } from "child_process";
875
- import { existsSync as existsSync3, readFileSync as readFileSync3, rmSync } from "fs";
876
- import { homedir as homedir2 } from "os";
1047
+ import { existsSync as existsSync4, readFileSync as readFileSync3, rmSync } from "fs";
1048
+ import { homedir as homedir3 } from "os";
877
1049
  import { basename as basename4 } from "path";
878
1050
 
879
1051
  // src/existing-runner.ts
880
- import { existsSync as existsSync2 } from "fs";
1052
+ import { existsSync as existsSync3 } from "fs";
881
1053
  var ALL = Object.keys(ENVIRONMENTS);
882
1054
  function runnersOnThisComputer() {
883
1055
  if (legacyStagingRunner()) return ["staging"];
884
- return ALL.filter((env) => existsSync2(boxPath(env)));
1056
+ return ALL.filter((env) => existsSync3(boxPath(env)));
885
1057
  }
886
1058
  function existingRunnerEnvironment() {
887
1059
  const named = process.env.CLOOP_ORIGIN;
@@ -913,20 +1085,20 @@ import {
913
1085
  unlinkSync,
914
1086
  writeFileSync
915
1087
  } from "fs";
916
- import { dirname as dirname2, join as join5 } from "path";
1088
+ import { dirname as dirname2, join as join6 } from "path";
917
1089
 
918
1090
  // src/threads/claude-code.ts
919
1091
  import { readdirSync as readdirSync2 } from "fs";
920
- import { join as join3 } from "path";
1092
+ import { join as join4 } from "path";
921
1093
 
922
1094
  // src/harness-home.ts
923
- import { homedir } from "os";
924
- import { join as join2 } from "path";
1095
+ import { homedir as homedir2 } from "os";
1096
+ import { join as join3 } from "path";
925
1097
  function claudeHome() {
926
- return process.env.CLAUDE_CONFIG_DIR || join2(homedir(), ".claude");
1098
+ return process.env.CLAUDE_CONFIG_DIR || join3(homedir2(), ".claude");
927
1099
  }
928
1100
  function codexHome2() {
929
- return process.env.CODEX_HOME || join2(homedir(), ".codex");
1101
+ return process.env.CODEX_HOME || join3(homedir2(), ".codex");
930
1102
  }
931
1103
 
932
1104
  // src/threads/turns.ts
@@ -1005,14 +1177,14 @@ var EDIT_TOOLS = {
1005
1177
  NotebookEdit: "notebook_path"
1006
1178
  };
1007
1179
  function files(home) {
1008
- const root = join3(home, "projects");
1180
+ const root = join4(home, "projects");
1009
1181
  const out2 = [];
1010
1182
  for (const project of safeDir(root)) {
1011
1183
  if (!project.isDirectory()) continue;
1012
- for (const entry of safeDir(join3(root, project.name))) {
1184
+ for (const entry of safeDir(join4(root, project.name))) {
1013
1185
  if (!entry.isFile() || !entry.name.endsWith(".jsonl")) continue;
1014
1186
  const sessionId = entry.name.slice(0, -6);
1015
- if (UUID3.test(sessionId)) out2.push({ path: join3(root, project.name, entry.name), sessionId });
1187
+ if (UUID3.test(sessionId)) out2.push({ path: join4(root, project.name, entry.name), sessionId });
1016
1188
  }
1017
1189
  }
1018
1190
  return out2;
@@ -1120,7 +1292,7 @@ var claudeCodeLogs = { home: claudeHome, files, parse };
1120
1292
 
1121
1293
  // src/threads/codex.ts
1122
1294
  import { readdirSync as readdirSync3 } from "fs";
1123
- import { join as join4 } from "path";
1295
+ import { join as join5 } from "path";
1124
1296
  var ROLLOUT = /^rollout-.*([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})\.jsonl$/i;
1125
1297
  var INJECTED = [
1126
1298
  "<environment_context",
@@ -1141,7 +1313,7 @@ function files2(home) {
1141
1313
  const out2 = [];
1142
1314
  const walk = (dir, depth) => {
1143
1315
  for (const entry of safeDir2(dir)) {
1144
- const path = join4(dir, entry.name);
1316
+ const path = join5(dir, entry.name);
1145
1317
  if (entry.isDirectory() && depth < 3) walk(path, depth + 1);
1146
1318
  else if (entry.isFile() && depth === 3) {
1147
1319
  const m = ROLLOUT.exec(entry.name);
@@ -1149,7 +1321,7 @@ function files2(home) {
1149
1321
  }
1150
1322
  }
1151
1323
  };
1152
- walk(join4(home, "sessions"), 0);
1324
+ walk(join5(home, "sessions"), 0);
1153
1325
  return out2;
1154
1326
  }
1155
1327
  function safeDir2(dir) {
@@ -1350,7 +1522,7 @@ var GATE_OFF_PAUSE_MS = 60 * 6e4;
1350
1522
  var BODY_BYTES_MAX = 512 * 1024;
1351
1523
  var READ_CHUNK = 1024 * 1024;
1352
1524
  function captureCursorPath(threadsFile) {
1353
- return join5(dirname2(threadsFile), "thread-capture.json");
1525
+ return join6(dirname2(threadsFile), "thread-capture.json");
1354
1526
  }
1355
1527
  var ThreadCapture = class {
1356
1528
  constructor(deps) {
@@ -1778,7 +1950,7 @@ function unitOrigin(contents) {
1778
1950
  return launcher ? launcher.replace(/%%/g, "%") : null;
1779
1951
  }
1780
1952
  function disconnectPlan(opts) {
1781
- const exists = opts.exists ?? existsSync3;
1953
+ const exists = opts.exists ?? existsSync4;
1782
1954
  const read = opts.read ?? ((path) => readFileSync3(path, "utf-8"));
1783
1955
  const installed = ["local", "workstation"].map((kind) => ({ kind, service: installedService({ ...opts, kind }) })).filter(({ service }) => exists(service.path));
1784
1956
  const services = installed.map(({ service }) => service);
@@ -1798,12 +1970,12 @@ function disconnectPlan(opts) {
1798
1970
  isBox: opts.platform !== "darwin" && opts.platform !== "win32" && installed.some(({ kind }) => kind === "workstation")
1799
1971
  };
1800
1972
  }
1801
- async function stopService(service, run, waitMs = 1e4) {
1802
- await runSteps(service.steps, run);
1973
+ async function stopService(service, run2, waitMs = 1e4) {
1974
+ await runSteps(service.steps, run2);
1803
1975
  const until = Date.now() + waitMs;
1804
1976
  for (; ; ) {
1805
1977
  try {
1806
- run(service.running);
1978
+ run2(service.running);
1807
1979
  } catch {
1808
1980
  return true;
1809
1981
  }
@@ -1836,7 +2008,7 @@ function revokeLine(revoke, origin, box) {
1836
2008
  async function disconnect(plan, opts) {
1837
2009
  const { say } = opts;
1838
2010
  const env = environmentOf(plan.origin);
1839
- const run = opts.run ?? ((command) => void execFileSync(command[0], command.slice(1), {
2011
+ const run2 = opts.run ?? ((command) => void execFileSync(command[0], command.slice(1), {
1840
2012
  stdio: "ignore",
1841
2013
  timeout: 15e3,
1842
2014
  ...command[0] === "powershell" ? { env: windowsPowerShellEnv() } : {}
@@ -1851,7 +2023,7 @@ async function disconnect(plan, opts) {
1851
2023
  return 1;
1852
2024
  }
1853
2025
  for (const service of plan.services) {
1854
- if (!await stopService(service, run, opts.stopWaitMs)) {
2026
+ if (!await stopService(service, run2, opts.stopWaitMs)) {
1855
2027
  say(
1856
2028
  `Could not stop the service in ${service.path}. Nothing was removed. Stop it with \`${service.steps.map((s) => s.command.join(" ")).join(" && ")}\`, then run \`${cloopCommand(env, "disconnect")}\` again.`
1857
2029
  );
@@ -1882,7 +2054,7 @@ function thisComputer(env, fallbackOrigin) {
1882
2054
  return {
1883
2055
  platform: process.platform,
1884
2056
  environment: env,
1885
- home: homedir2(),
2057
+ home: homedir3(),
1886
2058
  uid: process.getuid?.() ?? 0,
1887
2059
  ...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {},
1888
2060
  box: boxPath(env),
@@ -1922,16 +2094,16 @@ var MOVED = [
1922
2094
  "box.json"
1923
2095
  ];
1924
2096
  function legacyStagingRunner() {
1925
- if (existsSync4(boxPath("staging"))) return false;
2097
+ if (existsSync5(boxPath("staging"))) return false;
1926
2098
  const origin = runnerOrigin("production");
1927
2099
  return origin !== void 0 && environmentOf(origin) === "staging";
1928
2100
  }
1929
2101
  function moveRunnerFiles(from, to) {
1930
2102
  mkdirSync2(to, { recursive: true, mode: 448 });
1931
2103
  for (const name of MOVED) {
1932
- const source = join6(from, name);
1933
- const target = join6(to, name);
1934
- if (existsSync4(source) && !existsSync4(target)) renameSync2(source, target);
2104
+ const source = join7(from, name);
2105
+ const target = join7(to, name);
2106
+ if (existsSync5(source) && !existsSync5(target)) renameSync2(source, target);
1935
2107
  }
1936
2108
  }
1937
2109
  function legacyServices(platform) {
@@ -1940,18 +2112,18 @@ function legacyServices(platform) {
1940
2112
  platform,
1941
2113
  kind,
1942
2114
  environment: "production",
1943
- home: homedir3(),
2115
+ home: homedir4(),
1944
2116
  uid: process.getuid?.() ?? 0,
1945
2117
  ...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {}
1946
2118
  })
1947
- ).filter((service) => existsSync4(service.path));
2119
+ ).filter((service) => existsSync5(service.path));
1948
2120
  }
1949
2121
  async function moveLegacyStagingRunner(services) {
1950
2122
  if (!legacyStagingRunner()) return false;
1951
- const run = (command) => void services.run(command);
2123
+ const run2 = (command) => void services.run(command);
1952
2124
  const units = legacyServices(services.platform);
1953
2125
  for (const unit of units)
1954
- if (!await stopService(unit, run))
2126
+ if (!await stopService(unit, run2))
1955
2127
  throw new Error(
1956
2128
  `Could not stop the staging machine in ${unit.path}. Stop it with \`${unit.steps.map((s) => s.command.join(" ")).join(" && ")}\`, then run this again.`
1957
2129
  );
@@ -1966,8 +2138,8 @@ function movedLine(connecting) {
1966
2138
  }
1967
2139
 
1968
2140
  // src/mcp-registration.ts
1969
- import { execFile as execFile3, spawn as spawn2 } from "child_process";
1970
- import { homedir as homedir4 } from "os";
2141
+ import { execFile as execFile4, spawn as spawn2 } from "child_process";
2142
+ import { homedir as homedir5 } from "os";
1971
2143
  var MCP_HARNESS_NAME = {
1972
2144
  "claude-code": "Claude Code",
1973
2145
  codex: "Codex"
@@ -2009,12 +2181,12 @@ var systemMcpCli = {
2009
2181
  run: ([bin = "", ...args], env) => {
2010
2182
  const command = commandFor(bin, args);
2011
2183
  return new Promise(
2012
- (resolve3, reject) => execFile3(
2184
+ (resolve3, reject) => execFile4(
2013
2185
  command.file,
2014
2186
  command.args,
2015
2187
  {
2016
2188
  // A project's own MCP config under the folder connect ran in must not stand in for the user's.
2017
- cwd: homedir4(),
2189
+ cwd: homedir5(),
2018
2190
  timeout: 45e3,
2019
2191
  encoding: "utf-8",
2020
2192
  env: { ...process.env, ...env },
@@ -2031,7 +2203,7 @@ var systemMcpCli = {
2031
2203
  };
2032
2204
  process.on("SIGINT", ignore);
2033
2205
  const child = spawn2(command.file, command.args, {
2034
- cwd: homedir4(),
2206
+ cwd: homedir5(),
2035
2207
  stdio: "inherit",
2036
2208
  ...command.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
2037
2209
  });
@@ -2167,15 +2339,15 @@ function mcpByHand(harness, server, platform = process.platform, env = process.e
2167
2339
  }
2168
2340
  function mcpLine(result) {
2169
2341
  const name = MCP_HARNESS_NAME[result.harness];
2170
- const run = result.byHand.length ? ` Run: ${result.byHand.join(", then: ")}` : "";
2342
+ const run2 = result.byHand.length ? ` Run: ${result.byHand.join(", then: ")}` : "";
2171
2343
  if (!result.registered)
2172
- return `Could not add the Cloop MCP server to ${name} (${result.reason}).${run}`;
2344
+ return `Could not add the Cloop MCP server to ${name} (${result.reason}).${run2}`;
2173
2345
  if (result.found) {
2174
2346
  const head = `${name} already has the Cloop MCP server as ${result.as}`;
2175
- return result.signedIn ? `${head}, signed in.` : `${head}. It is not signed in.${run}`;
2347
+ return result.signedIn ? `${head}, signed in.` : `${head}. It is not signed in.${run2}`;
2176
2348
  }
2177
2349
  if (result.signedIn) return `${name} has the Cloop MCP server at ${result.url}, signed in.`;
2178
- return `${name} has the Cloop MCP server at ${result.url}. It is not signed in (${result.reason}).${run}`;
2350
+ return `${name} has the Cloop MCP server at ${result.url}. It is not signed in (${result.reason}).${run2}`;
2179
2351
  }
2180
2352
 
2181
2353
  // src/t3-pair-link.ts
@@ -2255,7 +2427,7 @@ function boxSession(t3Url, t3Bin, env, token) {
2255
2427
  }
2256
2428
  async function mintSession(t3Url, opts = {}) {
2257
2429
  const env = await workstationEnvironment(t3Url, opts.fetchFn);
2258
- const sources = opts.sources ?? defaultT3BinSources(homedir5(), opts.stored);
2430
+ const sources = opts.sources ?? defaultT3BinSources(homedir6(), opts.stored);
2259
2431
  try {
2260
2432
  const t3Bin = opts.bin ?? pickT3Bin(t3Candidates(env.serverVersion, sources), env.serverVersion);
2261
2433
  if (!t3Bin) throw new Error("no t3 binary found; pass --t3-bin or set T3_BIN");
@@ -2372,12 +2544,12 @@ function isWorkstation(previous, boxServiceInstalled2) {
2372
2544
  return boxServiceInstalled2 || Boolean(previous && !isLocal(previous));
2373
2545
  }
2374
2546
  function boxServiceInstalled() {
2375
- return existsSync5(
2547
+ return existsSync6(
2376
2548
  installedService({
2377
2549
  platform: process.platform,
2378
2550
  kind: "workstation",
2379
2551
  environment: runnerEnvironment(),
2380
- home: homedir5(),
2552
+ home: homedir6(),
2381
2553
  uid: process.getuid?.() ?? 0,
2382
2554
  ...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {}
2383
2555
  }).path
@@ -2397,19 +2569,19 @@ async function revokeReplaced(previous, kind, revoke, say) {
2397
2569
  function fallbackLine(reason, driver) {
2398
2570
  return `T3 Code is running but would not pair (${reason}). Connecting ${HARNESS_NAME[driver]} instead. To use T3, create a pairing link in T3 Code (Settings, Connections) and run: cloop connect --t3-pair <link>`;
2399
2571
  }
2400
- async function connectChosen(driver, attempt, run) {
2572
+ async function connectChosen(driver, attempt, run2) {
2401
2573
  attempt.driver = driver;
2402
- if (driver !== "t3") return run.local(driver);
2574
+ if (driver !== "t3") return run2.local(driver);
2403
2575
  try {
2404
- await run.t3();
2576
+ await run2.t3();
2405
2577
  } catch (err) {
2406
2578
  if (!(err instanceof ConnectFailure) || err.code !== "t3_pair_failed") throw err;
2407
- const local = run.fallback();
2579
+ const local = run2.fallback();
2408
2580
  if (!local) throw err;
2409
- run.say(fallbackLine(err.message, local));
2581
+ run2.say(fallbackLine(err.message, local));
2410
2582
  attempt.fellBack = true;
2411
2583
  attempt.driver = local;
2412
- await run.local(local);
2584
+ await run2.local(local);
2413
2585
  }
2414
2586
  }
2415
2587
  function systemdAssignment(assignment) {
@@ -2476,8 +2648,8 @@ function programFor(script, node, npx, version) {
2476
2648
  }
2477
2649
  function findNpx() {
2478
2650
  const name = process.platform === "win32" ? "npx.cmd" : "npx";
2479
- const beside = join7(dirname3(process.execPath), name);
2480
- return existsSync5(beside) ? beside : which(name);
2651
+ const beside = join8(dirname3(process.execPath), name);
2652
+ return existsSync6(beside) ? beside : which(name);
2481
2653
  }
2482
2654
  var FIRST_CONNECT_MS = 9e4;
2483
2655
  async function awaitDaemon(since, read = readRunnerState, { timeoutMs = FIRST_CONNECT_MS, pollMs = 500 } = {}) {
@@ -2515,14 +2687,14 @@ function installedService(opts) {
2515
2687
  const { label, unit, task, file } = serviceIdentity(opts.kind, opts.environment);
2516
2688
  if (opts.platform === "darwin") {
2517
2689
  return {
2518
- path: join7(opts.dir ?? join7(opts.home, "Library", "LaunchAgents"), `${label}.plist`),
2690
+ path: join8(opts.dir ?? join8(opts.home, "Library", "LaunchAgents"), `${label}.plist`),
2519
2691
  steps: [{ command: ["launchctl", "bootout", `gui/${opts.uid}/${label}`], mayFail: true }],
2520
2692
  running: ["launchctl", "print", `gui/${opts.uid}/${label}`]
2521
2693
  };
2522
2694
  }
2523
2695
  if (opts.platform === "win32") {
2524
2696
  return {
2525
- path: join7(opts.dir ?? join7(opts.home, "AppData", "Local", "Cloop"), `${file}.cmd`),
2697
+ path: join8(opts.dir ?? join8(opts.home, "AppData", "Local", "Cloop"), `${file}.cmd`),
2526
2698
  steps: [
2527
2699
  { command: ["schtasks", "/end", "/tn", task], mayFail: true },
2528
2700
  endDaemonStep(opts.environment),
@@ -2532,7 +2704,7 @@ function installedService(opts) {
2532
2704
  };
2533
2705
  }
2534
2706
  return {
2535
- path: join7(opts.dir ?? join7(opts.home, ".config", "systemd", "user"), unit),
2707
+ path: join8(opts.dir ?? join8(opts.home, ".config", "systemd", "user"), unit),
2536
2708
  steps: [{ command: ["systemctl", "--user", "disable", "--now", unit], mayFail: true }],
2537
2709
  running: ["systemctl", "--user", "is-active", "--quiet", unit]
2538
2710
  };
@@ -2545,9 +2717,9 @@ function unitFor(opts) {
2545
2717
  kind: opts.kind === "workstation" ? "local" : "workstation"
2546
2718
  });
2547
2719
  if (opts.platform === "darwin") {
2548
- const agents = opts.dir ?? join7(opts.home, "Library", "LaunchAgents");
2549
- const path2 = join7(agents, `${label}.plist`);
2550
- const log = join7(opts.home, "Library", "Logs", `${file}.log`);
2720
+ const agents = opts.dir ?? join8(opts.home, "Library", "LaunchAgents");
2721
+ const path2 = join8(agents, `${label}.plist`);
2722
+ const log = join8(opts.home, "Library", "Logs", `${file}.log`);
2551
2723
  const xml = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2552
2724
  const contents2 = [
2553
2725
  '<?xml version="1.0" encoding="UTF-8"?>',
@@ -2584,9 +2756,9 @@ function unitFor(opts) {
2584
2756
  };
2585
2757
  }
2586
2758
  if (opts.platform === "win32") {
2587
- const dir = opts.dir ?? join7(opts.home, "AppData", "Local", "Cloop");
2588
- const path2 = join7(dir, `${file}.cmd`);
2589
- const log = join7(dir, `${file}.log`);
2759
+ const dir = opts.dir ?? join8(opts.home, "AppData", "Local", "Cloop");
2760
+ const path2 = join8(dir, `${file}.cmd`);
2761
+ const log = join8(dir, `${file}.log`);
2590
2762
  const psLog = log.replace(/'/g, "''");
2591
2763
  const contents2 = [
2592
2764
  "@echo off",
@@ -2626,8 +2798,8 @@ function unitFor(opts) {
2626
2798
  ]
2627
2799
  };
2628
2800
  }
2629
- const units = opts.dir ?? join7(opts.home, ".config", "systemd", "user");
2630
- const path = join7(units, unit);
2801
+ const units = opts.dir ?? join8(opts.home, ".config", "systemd", "user");
2802
+ const path = join8(units, unit);
2631
2803
  const contents = [
2632
2804
  "[Unit]",
2633
2805
  `Description=${task}: answers the Cloop Agent over the mesh`,
@@ -2698,13 +2870,13 @@ function findCheckouts(home, limit = 8) {
2698
2870
  for (const root of CHECKOUT_ROOTS) {
2699
2871
  let entries;
2700
2872
  try {
2701
- entries = readdirSync4(join7(home, root), { withFileTypes: true });
2873
+ entries = readdirSync4(join8(home, root), { withFileTypes: true });
2702
2874
  } catch {
2703
2875
  continue;
2704
2876
  }
2705
2877
  for (const entry of entries) {
2706
- const path = join7(home, root, entry.name);
2707
- if (!entry.isDirectory() || !existsSync5(join7(path, ".git"))) continue;
2878
+ const path = join8(home, root, entry.name);
2879
+ if (!entry.isDirectory() || !existsSync6(join8(path, ".git"))) continue;
2708
2880
  found.push({ repo: { label: entry.name, path }, at: lastCommitAt(path) });
2709
2881
  }
2710
2882
  }
@@ -2724,7 +2896,7 @@ function rerunCommand(argv, script = process.argv[1] ?? "") {
2724
2896
  return [base, "connect", ...staging, ...argv].join(" ");
2725
2897
  }
2726
2898
  function workFolder(home) {
2727
- return { label: "Cloop", path: join7(home, "Cloop") };
2899
+ return { label: "Cloop", path: join8(home, "Cloop") };
2728
2900
  }
2729
2901
  function workFolderLine(found, home, argv, terminal) {
2730
2902
  const rerun = rerunCommand(argv.filter((a) => a !== "--ask"));
@@ -2760,7 +2932,7 @@ async function reposFor(argv) {
2760
2932
  }
2761
2933
  const here = gitTop(process.cwd());
2762
2934
  if (here) return [{ label: basename5(here), path: here }];
2763
- const home = homedir5();
2935
+ const home = homedir6();
2764
2936
  const work = workFolder(home);
2765
2937
  const found = findCheckouts(home);
2766
2938
  let repos = [work];
@@ -2819,12 +2991,12 @@ function harnessLine(h) {
2819
2991
  const account = h.signedIn ? h.account ?? "signed in" : "signed out";
2820
2992
  return `${h.name}${version}, ${account}${h.experimental ? " (experimental)" : ""}`;
2821
2993
  }
2822
- async function runSteps(steps, run = (command) => void execFileSync2(command[0], command.slice(1), { stdio: "ignore", timeout: 15e3 }), wait = (ms) => new Promise((r) => setTimeout(r, ms))) {
2994
+ async function runSteps(steps, run2 = (command) => void execFileSync2(command[0], command.slice(1), { stdio: "ignore", timeout: 15e3 }), wait = (ms) => new Promise((r) => setTimeout(r, ms))) {
2823
2995
  for (const step of steps) {
2824
2996
  const tries = step.tries ?? 1;
2825
2997
  for (let attempt = 1; ; attempt++) {
2826
2998
  try {
2827
- run(step.command);
2999
+ run2(step.command);
2828
3000
  break;
2829
3001
  } catch (err) {
2830
3002
  if (step.mayFail) break;
@@ -2844,9 +3016,9 @@ var systemServices = {
2844
3016
  }),
2845
3017
  awaitUp: (since) => awaitDaemon(since)
2846
3018
  };
2847
- function ensureLinger(user, run) {
3019
+ function ensureLinger(user, run2) {
2848
3020
  try {
2849
- if (/Linger=yes/.test(run(["loginctl", "show-user", user, "-p", "Linger"]))) {
3021
+ if (/Linger=yes/.test(run2(["loginctl", "show-user", user, "-p", "Linger"]))) {
2850
3022
  return { ok: true, changed: false };
2851
3023
  }
2852
3024
  } catch {
@@ -2856,7 +3028,7 @@ function ensureLinger(user, run) {
2856
3028
  ["sudo", "-n", "loginctl", "enable-linger", user]
2857
3029
  ]) {
2858
3030
  try {
2859
- run(command);
3031
+ run2(command);
2860
3032
  return { ok: true, changed: true };
2861
3033
  } catch {
2862
3034
  }
@@ -2876,13 +3048,13 @@ async function installService(kind, argv, attempt, services = systemServices) {
2876
3048
  platform: services.platform,
2877
3049
  kind,
2878
3050
  environment,
2879
- home: homedir5(),
3051
+ home: homedir6(),
2880
3052
  program,
2881
3053
  env: serviceEnv(),
2882
3054
  uid: process.getuid?.() ?? 0,
2883
3055
  ...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {}
2884
3056
  });
2885
- mkdirSync3(join7(unit.path, ".."), { recursive: true });
3057
+ mkdirSync3(join8(unit.path, ".."), { recursive: true });
2886
3058
  writeFileSync2(unit.path, unit.contents);
2887
3059
  if (argv.includes("--no-start")) {
2888
3060
  out(
@@ -2892,16 +3064,16 @@ async function installService(kind, argv, attempt, services = systemServices) {
2892
3064
  }
2893
3065
  attempt.step = "service_start";
2894
3066
  const since = Date.now();
2895
- const run = (command) => void services.run(command);
3067
+ const run2 = (command) => void services.run(command);
2896
3068
  try {
2897
- if (existsSync5(unit.retire.path)) {
3069
+ if (existsSync6(unit.retire.path)) {
2898
3070
  out(
2899
3071
  ` This computer is already a ${environment} machine, so connect stops and removes ${unit.retire.path}.`
2900
3072
  );
2901
- await runSteps(unit.retire.steps, run);
3073
+ await runSteps(unit.retire.steps, run2);
2902
3074
  rmSync3(unit.retire.path, { force: true });
2903
3075
  }
2904
- await runSteps(unit.start, run);
3076
+ await runSteps(unit.start, run2);
2905
3077
  } catch (err) {
2906
3078
  throw new ConnectFailure(
2907
3079
  "service_start_failed",
@@ -3033,7 +3205,7 @@ async function connectT3(argv, attempt, fallback, chosen, services) {
3033
3205
  async function connectLocal(driver, found, argv, attempt, chosen, services) {
3034
3206
  attempt.step = "repos";
3035
3207
  const repos = await reposFor(argv);
3036
- const work = workFolder(homedir5()).path;
3208
+ const work = workFolder(homedir6()).path;
3037
3209
  attempt.workFolder = repos.every((r) => r.path === work);
3038
3210
  const harness = driver === "claude-code" ? found.claude : found.codex;
3039
3211
  const bin = which(driver === "claude-code" ? "claude" : "codex") ?? (driver === "claude-code" ? "claude" : "codex");
@@ -3127,8 +3299,8 @@ async function connect(argv, attempt, deps = {}) {
3127
3299
  );
3128
3300
  const t3Url = (flag(argv, "--t3-url") ?? DEFAULT_T3_URL).replace(/\/+$/, "");
3129
3301
  const harnessBin = (name) => process.platform === "win32" ? which(name) ?? name : name;
3130
- findLocalCodex(homedir5());
3131
- findLocalClaude(homedir5());
3302
+ findLocalCodex(homedir6());
3303
+ findLocalClaude(homedir6());
3132
3304
  const readCodex = deps.probes?.codex ?? (() => probeCodex(harnessBin("codex")));
3133
3305
  const readClaude = deps.probes?.claude ?? (() => probeClaude(harnessBin("claude")));
3134
3306
  const found = await detect(
@@ -3143,10 +3315,10 @@ async function connect(argv, attempt, deps = {}) {
3143
3315
  const machine = !deps.probes;
3144
3316
  const terminal = deps.terminal ?? Boolean(process.stdin.isTTY && process.stdout.isTTY);
3145
3317
  const current = await prepareAgents(found, forced, workstation, {
3146
- chatGptApp: deps.chatGptApp ?? (() => machine && hasChatGptApp(homedir5())),
3318
+ chatGptApp: deps.chatGptApp ?? (() => machine && hasChatGptApp(homedir6())),
3147
3319
  codexHostMissing: deps.codexHostMissing ?? (() => machine && codexHostMissing(which("codex"))),
3148
- installCodex: deps.installCodex ?? (async () => machine && installCodex(homedir5())),
3149
- installClaude: deps.installClaude ?? (async () => machine && installClaude(homedir5())),
3320
+ installCodex: deps.installCodex ?? (async () => machine && installCodex(homedir6())),
3321
+ installClaude: deps.installClaude ?? (async () => machine && installClaude(homedir6())),
3150
3322
  readCodex,
3151
3323
  readClaude,
3152
3324
  updateClaude: deps.updateClaude ?? updateClaude,
@@ -3315,13 +3487,13 @@ var WINGET_UPDATE = [
3315
3487
  "--accept-source-agreements",
3316
3488
  "--accept-package-agreements"
3317
3489
  ];
3318
- async function updateClaude(run = runShown2, probe = probeClaude) {
3319
- const update = run(["claude", "update"], false);
3490
+ async function updateClaude(run2 = runShown2, probe = probeClaude) {
3491
+ const update = run2(["claude", "update"], false);
3320
3492
  if (WINGET_MANAGED.test(update.output)) {
3321
3493
  out(
3322
3494
  `${bold("Cloop machine")} winget installed Claude Code, so connect updates it with winget.`
3323
3495
  );
3324
- if (run(WINGET_UPDATE, true).status !== 0) return null;
3496
+ if (run2(WINGET_UPDATE, true).status !== 0) return null;
3325
3497
  } else {
3326
3498
  process.stdout.write(update.output);
3327
3499
  if (update.status !== 0) return null;
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-SBYSVZ7J.js";
7
7
  import {
8
8
  VERSION
9
- } from "./chunk-AAHVP23O.js";
9
+ } from "./chunk-2YAX6QVI.js";
10
10
  import {
11
11
  getOrigin,
12
12
  readCredentials,
@@ -10,7 +10,8 @@ var RUNNER_TOOLS = [
10
10
  "thread.interrupt",
11
11
  "thread.settle",
12
12
  "setup.share",
13
- "diag"
13
+ "diag",
14
+ "cookies.import"
14
15
  ];
15
16
  var RUNNER_ERRORS = [
16
17
  "expired",
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ConnectFailure,
4
4
  deviceLogin
5
- } from "./chunk-EPWLBMCR.js";
5
+ } from "./chunk-A3YMWMAP.js";
6
6
  import {
7
7
  ApiError,
8
8
  ReauthError,
@@ -53,17 +53,17 @@ import {
53
53
  which,
54
54
  workFolder,
55
55
  workFolderLine
56
- } from "./chunk-HHNLRNOM.js";
57
- import "./chunk-CVVYCLZ6.js";
56
+ } from "./chunk-42ABTDLJ.js";
57
+ import "./chunk-BI2Y5ZCL.js";
58
58
  import "./chunk-UXMDNJ3O.js";
59
59
  import "./chunk-RRRV64ZB.js";
60
60
  import "./chunk-VK6GV757.js";
61
61
  import "./chunk-365HFCQQ.js";
62
62
  import "./chunk-PKIEWBR7.js";
63
- import "./chunk-L763FCD7.js";
64
- import "./chunk-EPWLBMCR.js";
63
+ import "./chunk-NTUUR5CD.js";
64
+ import "./chunk-A3YMWMAP.js";
65
65
  import "./chunk-SBYSVZ7J.js";
66
- import "./chunk-AAHVP23O.js";
66
+ import "./chunk-2YAX6QVI.js";
67
67
  import "./chunk-D5UZW42X.js";
68
68
  export {
69
69
  DEFAULT_T3_URL,
@@ -7,17 +7,17 @@ import {
7
7
  runnerOrigin,
8
8
  stopService,
9
9
  unitOrigin
10
- } from "./chunk-HHNLRNOM.js";
11
- import "./chunk-CVVYCLZ6.js";
10
+ } from "./chunk-42ABTDLJ.js";
11
+ import "./chunk-BI2Y5ZCL.js";
12
12
  import "./chunk-UXMDNJ3O.js";
13
13
  import "./chunk-RRRV64ZB.js";
14
14
  import "./chunk-VK6GV757.js";
15
15
  import "./chunk-365HFCQQ.js";
16
16
  import "./chunk-PKIEWBR7.js";
17
- import "./chunk-L763FCD7.js";
18
- import "./chunk-EPWLBMCR.js";
17
+ import "./chunk-NTUUR5CD.js";
18
+ import "./chunk-A3YMWMAP.js";
19
19
  import "./chunk-SBYSVZ7J.js";
20
- import "./chunk-AAHVP23O.js";
20
+ import "./chunk-2YAX6QVI.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-HHNLRNOM.js";
6
- import "./chunk-CVVYCLZ6.js";
5
+ } from "./chunk-42ABTDLJ.js";
6
+ import "./chunk-BI2Y5ZCL.js";
7
7
  import "./chunk-UXMDNJ3O.js";
8
8
  import "./chunk-RRRV64ZB.js";
9
9
  import "./chunk-VK6GV757.js";
10
10
  import "./chunk-365HFCQQ.js";
11
11
  import "./chunk-PKIEWBR7.js";
12
- import "./chunk-L763FCD7.js";
13
- import "./chunk-EPWLBMCR.js";
12
+ import "./chunk-NTUUR5CD.js";
13
+ import "./chunk-A3YMWMAP.js";
14
14
  import "./chunk-SBYSVZ7J.js";
15
- import "./chunk-AAHVP23O.js";
15
+ import "./chunk-2YAX6QVI.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-365HFCQQ.js";
5
5
  import {
6
6
  VERSION
7
- } from "./chunk-AAHVP23O.js";
7
+ } from "./chunk-2YAX6QVI.js";
8
8
  import {
9
9
  applyEnvironmentFlag
10
10
  } from "./chunk-D5UZW42X.js";
@@ -69,7 +69,7 @@ Add --staging to any command to use Cloop staging instead of production.
69
69
  A production machine and a staging machine can run side by side on one computer.
70
70
  `;
71
71
  async function pinExistingRunner() {
72
- const { pinExistingRunner: pin } = await import("./existing-runner-Z4RKD2BE.js");
72
+ const { pinExistingRunner: pin } = await import("./existing-runner-R3U2RIRS.js");
73
73
  const { note } = pin();
74
74
  if (note) console.error(note);
75
75
  }
@@ -77,7 +77,7 @@ async function main() {
77
77
  switch (command) {
78
78
  case "login":
79
79
  case "auth": {
80
- const { loginCommand } = await import("./login-6OSXQMFR.js");
80
+ const { loginCommand } = await import("./login-LX3UQGJA.js");
81
81
  await loginCommand(argv);
82
82
  break;
83
83
  }
@@ -87,32 +87,32 @@ async function main() {
87
87
  break;
88
88
  }
89
89
  case "serve": {
90
- const { startMcpServer } = await import("./mcp-server-TFME5MG7.js");
90
+ const { startMcpServer } = await import("./mcp-server-MFHKJ7WR.js");
91
91
  await startMcpServer();
92
92
  break;
93
93
  }
94
94
  case "statusline": {
95
- const { statuslineCommand } = await import("./statusline-ZRRZ3QEM.js");
95
+ const { statuslineCommand } = await import("./statusline-LK3NK4AN.js");
96
96
  statuslineCommand();
97
97
  break;
98
98
  }
99
99
  case "connect": {
100
- const { connectCommand } = await import("./connect-4FRXNGYW.js");
100
+ const { connectCommand } = await import("./connect-RB6AE2BT.js");
101
101
  await connectCommand(argv.slice(1));
102
102
  break;
103
103
  }
104
104
  case "use": {
105
- const { useCommand } = await import("./use-S6M2FOPX.js");
105
+ const { useCommand } = await import("./use-TKCUBBUO.js");
106
106
  process.exitCode = await useCommand(argv.slice(1));
107
107
  break;
108
108
  }
109
109
  case "disconnect": {
110
- const { disconnectCommand } = await import("./disconnect-KTPNFDF4.js");
110
+ const { disconnectCommand } = await import("./disconnect-CMPHFSPV.js");
111
111
  await disconnectCommand(argv.slice(1));
112
112
  break;
113
113
  }
114
114
  case "box": {
115
- const { boxCommand } = await import("./box-X5UV2WYQ.js");
115
+ const { boxCommand } = await import("./box-LSZRJRRB.js");
116
116
  await boxCommand(argv.slice(1));
117
117
  break;
118
118
  }
@@ -141,7 +141,7 @@ async function main() {
141
141
  break;
142
142
  }
143
143
  case "runner": {
144
- const { runnerCommand } = await import("./runner-G5JMZDKA.js");
144
+ const { runnerCommand } = await import("./runner-VTJH554V.js");
145
145
  await runnerCommand(argv.slice(1));
146
146
  break;
147
147
  }
@@ -3,9 +3,9 @@ import {
3
3
  deviceLogin,
4
4
  loginCommand,
5
5
  refusalSentence
6
- } from "./chunk-EPWLBMCR.js";
6
+ } from "./chunk-A3YMWMAP.js";
7
7
  import "./chunk-SBYSVZ7J.js";
8
- import "./chunk-AAHVP23O.js";
8
+ import "./chunk-2YAX6QVI.js";
9
9
  import "./chunk-D5UZW42X.js";
10
10
  export {
11
11
  deviceLogin,
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  MeshSocket,
16
16
  defaultSocketFactory
17
- } from "./chunk-CVVYCLZ6.js";
17
+ } from "./chunk-BI2Y5ZCL.js";
18
18
  import {
19
19
  sanitizeLabel,
20
20
  sanitizeUntrusted
@@ -31,7 +31,7 @@ import {
31
31
  } from "./chunk-SBYSVZ7J.js";
32
32
  import {
33
33
  VERSION
34
- } from "./chunk-AAHVP23O.js";
34
+ } from "./chunk-2YAX6QVI.js";
35
35
  import {
36
36
  getMeshUrl,
37
37
  getToken
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  connectWebhook,
4
4
  runnerCommand
5
- } from "./chunk-L763FCD7.js";
6
- import "./chunk-EPWLBMCR.js";
5
+ } from "./chunk-NTUUR5CD.js";
6
+ import "./chunk-A3YMWMAP.js";
7
7
  import "./chunk-SBYSVZ7J.js";
8
- import "./chunk-AAHVP23O.js";
8
+ import "./chunk-2YAX6QVI.js";
9
9
  import "./chunk-D5UZW42X.js";
10
10
  export {
11
11
  connectWebhook,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VK6GV757.js";
8
8
  import {
9
9
  VERSION
10
- } from "./chunk-AAHVP23O.js";
10
+ } from "./chunk-2YAX6QVI.js";
11
11
  import {
12
12
  getToken
13
13
  } from "./chunk-D5UZW42X.js";
@@ -3,8 +3,8 @@ import {
3
3
  DRIVER_NAME,
4
4
  pinExistingRunner,
5
5
  runConnect
6
- } from "./chunk-HHNLRNOM.js";
7
- import "./chunk-CVVYCLZ6.js";
6
+ } from "./chunk-42ABTDLJ.js";
7
+ import "./chunk-BI2Y5ZCL.js";
8
8
  import "./chunk-UXMDNJ3O.js";
9
9
  import {
10
10
  isLocal,
@@ -13,10 +13,10 @@ import {
13
13
  import "./chunk-VK6GV757.js";
14
14
  import "./chunk-365HFCQQ.js";
15
15
  import "./chunk-PKIEWBR7.js";
16
- import "./chunk-L763FCD7.js";
17
- import "./chunk-EPWLBMCR.js";
16
+ import "./chunk-NTUUR5CD.js";
17
+ import "./chunk-A3YMWMAP.js";
18
18
  import "./chunk-SBYSVZ7J.js";
19
- import "./chunk-AAHVP23O.js";
19
+ import "./chunk-2YAX6QVI.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.45",
3
+ "version": "0.3.46",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Make your computer and your agents Cloop machines: device login, the machine daemon, the Cloop MCP server, and Claude Code hooks.",