@cloop/runner 0.3.24 → 0.3.27

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.
Files changed (27) hide show
  1. package/README.md +2 -2
  2. package/dist/{box-OGT2NRPJ.js → box-TENZ3P6J.js} +157 -32
  3. package/dist/{chunk-YEO27QQP.js → chunk-365HFCQQ.js} +1 -1
  4. package/dist/{chunk-6F2ZM5H3.js → chunk-3OF5FEMG.js} +1 -1
  5. package/dist/{chunk-UVB722OW.js → chunk-C6EAR65U.js} +1 -1
  6. package/dist/{chunk-PQPWITU3.js → chunk-CC2S6H4W.js} +197 -54
  7. package/dist/{chunk-IXG4H623.js → chunk-KDO735VV.js} +5 -5
  8. package/dist/{chunk-IJH4O27H.js → chunk-KYGYU5G2.js} +65 -2
  9. package/dist/{chunk-F4UQ2H5F.js → chunk-MRP3S5DT.js} +1 -1
  10. package/dist/{chunk-R3CLO2FB.js → chunk-PKIEWBR7.js} +2 -0
  11. package/dist/{chunk-NVESLEXA.js → chunk-PUKYUGWD.js} +26 -7
  12. package/dist/{chunk-VH7XVQFJ.js → chunk-U57DZQSE.js} +1 -1
  13. package/dist/{chunk-MHKSBXUD.js → chunk-ZYU7Y2SE.js} +6 -6
  14. package/dist/{connect-7DUV7BMO.js → connect-YAFC76SG.js} +9 -8
  15. package/dist/{disconnect-IWGVQ2GZ.js → disconnect-AJBQUDE3.js} +9 -8
  16. package/dist/existing-runner-FWDDD3L2.js +21 -0
  17. package/dist/index.js +23 -23
  18. package/dist/{login-J3N7TYDI.js → login-TALFCKAD.js} +2 -2
  19. package/dist/{mcp-server-HPMJRI6J.js → mcp-server-RUK3JL4O.js} +5 -5
  20. package/dist/{read-permissions-SPOKGVLO.js → read-permissions-EGSGI4HL.js} +1 -1
  21. package/dist/{runner-TMR3BBL5.js → runner-GOT6CIJW.js} +3 -3
  22. package/dist/{runs-S3QKEWHY.js → runs-SUZJHP7M.js} +2 -2
  23. package/dist/{statusline-UIG25UUX.js → statusline-XHSO6GCX.js} +1 -1
  24. package/dist/{takeover-3U5V2KXY.js → takeover-B63GSUZW.js} +4 -4
  25. package/dist/{use-I2KUA64A.js → use-L4CIPDJZ.js} +10 -9
  26. package/package.json +2 -2
  27. package/dist/existing-runner-4UYED6LY.js +0 -20
@@ -1,9 +1,12 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ freshness
4
+ } from "./chunk-KYGYU5G2.js";
2
5
  import {
3
6
  readRunnerState,
4
7
  runnerStatePath,
5
8
  threadsFilePath
6
- } from "./chunk-6F2ZM5H3.js";
9
+ } from "./chunk-3OF5FEMG.js";
7
10
  import {
8
11
  BoxToolError,
9
12
  CLOOP_THREAD_PREFIX,
@@ -38,7 +41,7 @@ import {
38
41
  windowsExecutable,
39
42
  windowsPowerShellEnv,
40
43
  writeBoxConfig
41
- } from "./chunk-NVESLEXA.js";
44
+ } from "./chunk-PUKYUGWD.js";
42
45
  import {
43
46
  getMachine,
44
47
  shortMachineName
@@ -49,24 +52,24 @@ import {
49
52
  claudeTooOld,
50
53
  codexTooOld,
51
54
  olderThan
52
- } from "./chunk-YEO27QQP.js";
55
+ } from "./chunk-365HFCQQ.js";
53
56
  import {
54
57
  READ_TOOLS,
55
58
  readOnlySettings
56
- } from "./chunk-R3CLO2FB.js";
59
+ } from "./chunk-PKIEWBR7.js";
57
60
  import {
58
61
  connectWebhook
59
- } from "./chunk-IXG4H623.js";
62
+ } from "./chunk-KDO735VV.js";
60
63
  import {
61
64
  ConnectFailure,
62
65
  connectReport,
63
66
  deviceLogin,
64
67
  newAttempt,
65
68
  sendConnectReport
66
- } from "./chunk-UVB722OW.js";
69
+ } from "./chunk-C6EAR65U.js";
67
70
  import {
68
71
  VERSION
69
- } from "./chunk-VH7XVQFJ.js";
72
+ } from "./chunk-U57DZQSE.js";
70
73
  import {
71
74
  STAGING_ORIGIN,
72
75
  getOrigin,
@@ -253,14 +256,118 @@ function hasChatGptApp(home, platform = process.platform, env = process.env, fs
253
256
  return false;
254
257
  }
255
258
 
256
- // src/box-tools.ts
259
+ // src/runner-log.ts
260
+ var RUNNER_TOOLS = [
261
+ "status",
262
+ "threads.list",
263
+ "thread.read",
264
+ "thread.launch",
265
+ "thread.send",
266
+ "thread.interrupt",
267
+ "setup.share",
268
+ "diag"
269
+ ];
270
+ var RUNNER_ERRORS = [
271
+ "expired",
272
+ "bad_args",
273
+ "no_project",
274
+ "harness_unavailable",
275
+ "harness_signed_out",
276
+ "runtime_mode_unknown",
277
+ "already_finished",
278
+ "repo_busy",
279
+ "repo_unreachable",
280
+ "cannot_steer",
281
+ "cannot_share",
282
+ "t3_unauthorized",
283
+ "t3_unreachable",
284
+ "t3_error",
285
+ "harness_error",
286
+ "unknown_tool",
287
+ "registry_unreachable",
288
+ "fetch_failed",
289
+ "npx_missing",
290
+ "handover_failed"
291
+ ];
292
+ var HARNESS_IDS = ["claude-code", "codex", "claudeAgent", "opencode"];
257
293
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
294
+ var VERSION2 = /^\d{1,4}\.\d{1,4}\.\d{1,4}$/;
295
+ var oneOf = (list) => (value) => list.includes(value) ? value : void 0;
296
+ var toolCode = oneOf(RUNNER_TOOLS);
297
+ var uuid = (value) => typeof value === "string" && UUID.test(value) ? value : void 0;
298
+ var count = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e12 ? value : void 0;
299
+ var version = (value) => typeof value === "string" && VERSION2.test(value) ? value : void 0;
300
+ function errorCode(value) {
301
+ const code = typeof value === "string" && value.startsWith("unknown_tool:") ? "unknown_tool" : value;
302
+ return oneOf(RUNNER_ERRORS)(code);
303
+ }
304
+ function runnerLog(code, fields = {}) {
305
+ const shaped = {
306
+ call: uuid(fields.call),
307
+ work: uuid(fields.work),
308
+ tool: toolCode(fields.tool),
309
+ ms: count(fields.ms),
310
+ error: errorCode(fields.error),
311
+ n: count(fields.n),
312
+ ver: version(fields.ver)
313
+ };
314
+ const frame = { type: "log", code };
315
+ for (const [key, value] of Object.entries(shaped)) {
316
+ if (value !== void 0) Object.assign(frame, { [key]: value });
317
+ }
318
+ return frame;
319
+ }
320
+ function callOutcome(input) {
321
+ return {
322
+ at: new Date(input.at).toISOString(),
323
+ tool: toolCode(input.tool) ?? "other",
324
+ call: uuid(input.call) ?? null,
325
+ work: uuid(input.work) ?? null,
326
+ ms: count(Math.round(input.ms)) ?? 0,
327
+ ok: input.ok,
328
+ error: input.ok ? null : errorCode(input.error) ?? "other"
329
+ };
330
+ }
331
+ function outcomeLine(o) {
332
+ return `call tool=${o.tool} call=${o.call ?? "-"} work=${o.work ?? "-"} ms=${o.ms} ok=${o.ok}${o.error ? ` error=${o.error}` : ""}`;
333
+ }
334
+ var PLATFORMS = ["darwin", "linux", "win32", "freebsd", "openbsd", "aix", "sunos"];
335
+ var ARCHES = ["arm64", "x64", "arm", "ia32", "ppc64", "s390x"];
336
+ var iso = (value) => typeof value === "string" && !Number.isNaN(Date.parse(value)) && /^\d{4}-\d\d-\d\dT[\d:.]+Z$/.test(value) ? value : null;
337
+ function buildDiag(input) {
338
+ return {
339
+ version: version(input.version) ?? null,
340
+ platform: oneOf(PLATFORMS)(input.platform) ?? "other",
341
+ arch: oneOf(ARCHES)(input.arch) ?? "other",
342
+ uptime_ms: count(Math.round(input.uptimeMs)) ?? 0,
343
+ last_beat_at: iso(input.lastBeatAt),
344
+ last_wake: input.lastWake && iso(input.lastWake.woke_at) ? { slept_ms: count(input.lastWake.slept_ms) ?? 0, woke_at: input.lastWake.woke_at } : null,
345
+ harnesses: input.harnesses.map((h) => ({
346
+ id: oneOf(HARNESS_IDS)(h.id) ?? "other",
347
+ version: typeof h.version === "string" ? h.version.match(/\b\d{1,4}\.\d{1,4}\.\d{1,4}\b/)?.[0] ?? null : null,
348
+ ready: h.ready === true,
349
+ signed_in: h.signedIn === true
350
+ })),
351
+ update: {
352
+ checked_at: iso(input.update.checked_at),
353
+ latest: version(input.update.latest) ?? null,
354
+ error: errorCode(input.update.error) ?? null
355
+ },
356
+ unacked_results: count(input.unacked) ?? 0,
357
+ clock_offset_ms: typeof input.clockOffsetMs === "number" && Number.isInteger(input.clockOffsetMs) && Math.abs(input.clockOffsetMs) <= 1e12 ? input.clockOffsetMs : null,
358
+ // Already shaped: callOutcome is the only way to make one.
359
+ calls: input.calls
360
+ };
361
+ }
362
+
363
+ // src/box-tools.ts
364
+ var UUID2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
258
365
  function parseLaunchArgs(args) {
259
366
  const str = (v, max) => typeof v === "string" && v.trim() && v.length <= max ? v.trim() : void 0;
260
367
  const work_id = str(args.work_id, 36);
261
368
  const title = str(args.title, 200);
262
369
  const prompt = str(args.prompt, 1e5);
263
- if (!work_id || !UUID.test(work_id) || !title || !prompt) throw new BoxToolError("bad_args");
370
+ if (!work_id || !UUID2.test(work_id) || !title || !prompt) throw new BoxToolError("bad_args");
264
371
  const runtime_mode = str(args.runtime_mode, 40);
265
372
  if (runtime_mode && !RUNTIME_MODES.has(runtime_mode)) throw new BoxToolError("bad_args");
266
373
  return {
@@ -280,7 +387,7 @@ function parseThreadId(args) {
280
387
  }
281
388
  function parseCommandId(args) {
282
389
  const id = args.command_id;
283
- if (typeof id !== "string" || !UUID.test(id)) throw new BoxToolError("bad_args");
390
+ if (typeof id !== "string" || !UUID2.test(id)) throw new BoxToolError("bad_args");
284
391
  return id;
285
392
  }
286
393
  function parseSendArgs(args) {
@@ -327,6 +434,8 @@ var BOX_TOOLS = {
327
434
  return result;
328
435
  },
329
436
  "thread.interrupt": ({ driver }, args) => driver.interrupt(parseThreadId(args), parseCommandId(args)),
437
+ // Codes, ids, versions and counts only (runner-log.ts), so ops can read it without the owner.
438
+ diag: async ({ diag }) => diag ? diag() : null,
330
439
  // Packs the skills before it answers, so an empty or oversized set is refused now; the upload runs on.
331
440
  async "setup.share"({ setup }) {
332
441
  if (!setup) throw new BoxToolError("cannot_share");
@@ -357,6 +466,37 @@ async function runBoxTool(ctx, tool, args) {
357
466
  };
358
467
  }
359
468
  }
469
+ async function answerCall(ctx, frame, io) {
470
+ const now = io.now ?? Date.now;
471
+ const started = now();
472
+ const offset = io.offset();
473
+ const fresh = freshness(frame.deadline, started, offset);
474
+ if (fresh !== "fresh") {
475
+ io.send(
476
+ runnerLog(fresh === "expired" ? "call_expired" : "call_late", {
477
+ call: frame.id,
478
+ tool: frame.tool,
479
+ work: frame.args.work_id,
480
+ ms: started + (offset ?? 0) - (frame.deadline ?? started)
481
+ })
482
+ );
483
+ }
484
+ const result = fresh === "expired" ? { ok: false, error: "expired" } : await runBoxTool(ctx, frame.tool, frame.args);
485
+ io.send({ type: "result", id: frame.id, ...result });
486
+ const outcome = callOutcome({
487
+ at: started,
488
+ tool: frame.tool,
489
+ call: frame.id,
490
+ work: frame.args.work_id,
491
+ ms: now() - started,
492
+ ok: result.ok,
493
+ error: result.ok ? void 0 : result.error
494
+ });
495
+ io.log(outcomeLine(outcome));
496
+ if (!result.ok && "detail" in result && result.detail)
497
+ io.log(`call_detail call=${frame.id} ${result.detail.slice(0, 300)}`);
498
+ return outcome;
499
+ }
360
500
 
361
501
  // src/device-revoke.ts
362
502
  function tokenGone(revoke) {
@@ -429,13 +569,13 @@ async function probeClaude(bin = "claude") {
429
569
  exec(bin, ["--version"]),
430
570
  exec(bin, ["auth", "status", "--json"])
431
571
  ]);
432
- const version = versionOut?.trim().split(/\s+/)[0];
433
- if (!version) return null;
572
+ const version2 = versionOut?.trim().split(/\s+/)[0];
573
+ if (!version2) return null;
434
574
  const { signedIn, account } = claudeAccount(auth);
435
575
  return {
436
576
  id: "claude-code",
437
577
  name: "Claude Code",
438
- version,
578
+ version: version2,
439
579
  ready: signedIn,
440
580
  signedIn,
441
581
  account,
@@ -695,16 +835,16 @@ function codexAccount(ok, out2) {
695
835
  return { signedIn: true, account: /chatgpt/i.test(out2) ? "ChatGPT" : "API key" };
696
836
  }
697
837
  async function probeCodex(bin = "codex") {
698
- const [version, status] = await Promise.all([
838
+ const [version2, status] = await Promise.all([
699
839
  exec2(bin, ["--version"]),
700
840
  exec2(bin, ["login", "status"])
701
841
  ]);
702
- if (!version.ok) return null;
842
+ if (!version2.ok) return null;
703
843
  const { signedIn, account } = codexAccount(status.ok, status.out);
704
844
  return {
705
845
  id: "codex",
706
846
  name: "Codex",
707
- version: version.out.trim().split(/\s+/).at(-1) ?? null,
847
+ version: version2.out.trim().split(/\s+/).at(-1) ?? null,
708
848
  ready: signedIn,
709
849
  signedIn,
710
850
  account,
@@ -822,7 +962,7 @@ function existingRunnerEnvironment() {
822
962
  const found = runnersOnThisComputer();
823
963
  return found.length === 1 && found[0] ? found[0] : "production";
824
964
  }
825
- var BOTH_RUNNERS_LINE = "This computer has a production runner and a staging runner. This acts on the production runner. Add --staging for the staging runner.";
965
+ var BOTH_RUNNERS_LINE = "This computer is a production machine and a staging machine. This acts on the production machine. Add --staging for the staging machine.";
826
966
  function pinExistingRunner() {
827
967
  const named = Boolean(process.env.CLOOP_ORIGIN);
828
968
  const environment = existingRunnerEnvironment();
@@ -835,7 +975,7 @@ function pinExistingRunner() {
835
975
 
836
976
  // src/commands/disconnect.ts
837
977
  function doneLine(env) {
838
- return `This computer is no longer a ${env} Cloop runner. To connect it again: ${["npx -y @cloop/runner@latest connect", ENVIRONMENTS[env].flag].filter(Boolean).join(" ")}`;
978
+ return `This computer is no longer a ${env} Cloop machine. To connect it again: ${["npx -y @cloop/runner@latest connect", ENVIRONMENTS[env].flag].filter(Boolean).join(" ")}`;
839
979
  }
840
980
  function unitOrigin(contents) {
841
981
  const plist = /<key>CLOOP_ORIGIN<\/key><string>([^<]+)<\/string>/.exec(contents)?.[1];
@@ -888,11 +1028,11 @@ function revokeLine(revoke, origin, box) {
888
1028
  case "already_revoked":
889
1029
  return [`Cloop (${origin}) had already revoked this computer.`];
890
1030
  case "no_device":
891
- return ["No runner device on this computer to revoke."];
1031
+ return ["No machine device on this computer to revoke."];
892
1032
  case "unknown_device":
893
1033
  return [
894
1034
  `Cloop at ${origin} never issued this computer's device token, so it belongs to the other environment.${keep}`,
895
- "Run `cloop disconnect --staging` for a staging runner, or `cloop disconnect` for production."
1035
+ "Run `cloop disconnect --staging` for a staging machine, or `cloop disconnect` for production."
896
1036
  ];
897
1037
  case "failed":
898
1038
  return [
@@ -913,7 +1053,7 @@ async function disconnect(plan, opts) {
913
1053
  const unit = plan.services.map((s) => basename4(s.path)).find((n) => n.startsWith("cloop-box"));
914
1054
  say(`This computer runs ${unit}, the ${env} Cloop box with T3 Code. Disconnect would:`);
915
1055
  for (const s of plan.services) say(` stop and remove ${s.path}`);
916
- if (plan.deviceToken) say(` revoke its runner device on Cloop (${plan.origin})`);
1056
+ if (plan.deviceToken) say(` revoke its machine device on Cloop (${plan.origin})`);
917
1057
  for (const f of [...plan.box ? [plan.box] : [], ...plan.files]) say(` delete ${f}`);
918
1058
  say(`Run \`${cloopCommand(env, "disconnect --yes")}\` to do this.`);
919
1059
  return 1;
@@ -1016,7 +1156,7 @@ async function moveLegacyStagingRunner(services) {
1016
1156
  for (const unit of units)
1017
1157
  if (!await stopService(unit, run))
1018
1158
  throw new Error(
1019
- `Could not stop the staging runner in ${unit.path}. Stop it with \`${unit.steps.map((s) => s.command.join(" ")).join(" && ")}\`, then run this again.`
1159
+ `Could not stop the staging machine in ${unit.path}. Stop it with \`${unit.steps.map((s) => s.command.join(" ")).join(" && ")}\`, then run this again.`
1020
1160
  );
1021
1161
  for (const unit of units) rmSync2(unit.path, { force: true });
1022
1162
  moveRunnerFiles(runnerDir("production"), runnerDir("staging"));
@@ -1024,7 +1164,7 @@ async function moveLegacyStagingRunner(services) {
1024
1164
  return true;
1025
1165
  }
1026
1166
  function movedLine(connecting) {
1027
- const line2 = "Moved the staging runner from ~/.cloop to ~/.cloop/staging, so a production runner can run beside it.";
1167
+ const line2 = "Moved the staging machine from ~/.cloop to ~/.cloop/staging, so a production machine can run beside it.";
1028
1168
  return connecting === "staging" ? line2 : `${line2} It is stopped. Start it again with: cloop connect --staging`;
1029
1169
  }
1030
1170
 
@@ -1393,7 +1533,7 @@ async function connectBox(steps) {
1393
1533
  steps.writeBoxConfig(cfg);
1394
1534
  return cfg;
1395
1535
  }
1396
- var NONE = "No coding agent found on this machine. Install Claude Code or Codex, sign in, then run `cloop connect` again.";
1536
+ var NONE = "No coding agent found on this machine. Install Claude Code or the ChatGPT desktop app, sign in, then run `cloop connect` again.";
1397
1537
  var SIGNED_OUT = {
1398
1538
  "claude-code": "Claude Code is installed but not signed in. Run `claude` once and sign in, then run `cloop connect` again.",
1399
1539
  codex: "Codex is installed but not signed in. Run `codex login`, then run `cloop connect` again."
@@ -1446,12 +1586,12 @@ function boxServiceInstalled() {
1446
1586
  }).path
1447
1587
  );
1448
1588
  }
1449
- var KIND_NAME = { workstation: "a Cloop box with T3 Code", local: "a Local runner" };
1589
+ var KIND_NAME = { workstation: "a Cloop box with T3 Code", local: "a local machine" };
1450
1590
  async function revokeReplaced(previous, kind, revoke, say) {
1451
1591
  if (!previous?.deviceToken || isLocal(previous) === (kind === "local")) return;
1452
1592
  const was = isLocal(previous) ? "local" : "workstation";
1453
1593
  say(
1454
- `${bold("Cloop runner")} This computer was ${KIND_NAME[was]}. It becomes ${KIND_NAME[kind]}, so its old device goes.`
1594
+ `${bold("Cloop machine")} This computer was ${KIND_NAME[was]}. It becomes ${KIND_NAME[kind]}, so its old device goes.`
1455
1595
  );
1456
1596
  say(
1457
1597
  tokenGone(await revoke(previous.deviceToken)) ? " Revoked the old device on Cloop." : " Could not revoke the old device. Press Disconnect on its card on the Threads page."
@@ -1531,11 +1671,11 @@ var endDaemonStep = (environment) => ({
1531
1671
  ],
1532
1672
  mayFail: true
1533
1673
  });
1534
- function programFor(script, node, npx, version) {
1674
+ function programFor(script, node, npx, version2) {
1535
1675
  if (!/[\\/]_npx[\\/]/.test(script)) return [node, script, "box", "run"];
1536
1676
  if (!npx)
1537
1677
  return "npx is not on PATH, so the service cannot run Cloop. Install it with `npm install -g @cloop/runner` and run `cloop connect` again.";
1538
- return [npx, "-y", `@cloop/runner@${version}`, "box", "run"];
1678
+ return [npx, "-y", `@cloop/runner@${version2}`, "box", "run"];
1539
1679
  }
1540
1680
  function findNpx() {
1541
1681
  const name = process.platform === "win32" ? "npx.cmd" : "npx";
@@ -1798,7 +1938,7 @@ function workFolderLine(found, home, argv, terminal) {
1798
1938
  }
1799
1939
  async function askRepos(found, home, ask, say) {
1800
1940
  const work = workFolder(home);
1801
- say(`${bold("Cloop runner")} This folder is not a git checkout. Recent ones:`);
1941
+ say(`${bold("Cloop machine")} This folder is not a git checkout. Recent ones:`);
1802
1942
  found.forEach((r, i) => say(` ${i + 1} ${r.label} ${dim(tilde(r.path, home))}`));
1803
1943
  for (; ; ) {
1804
1944
  const answer = (await ask(
@@ -1838,7 +1978,7 @@ async function reposFor(argv) {
1838
1978
  } finally {
1839
1979
  prompt.close();
1840
1980
  }
1841
- } else out(`${bold("Cloop runner")} ${workFolderLine(found, home, argv, terminal)}`);
1981
+ } else out(`${bold("Cloop machine")} ${workFolderLine(found, home, argv, terminal)}`);
1842
1982
  if (repos.some((r) => r.path === work.path)) mkdirSync2(work.path, { recursive: true });
1843
1983
  return repos;
1844
1984
  }
@@ -1877,9 +2017,9 @@ async function t3Answers(t3Url) {
1877
2017
  }
1878
2018
  }
1879
2019
  function harnessLine(h) {
1880
- const version = h.version ? ` ${h.version}` : "";
2020
+ const version2 = h.version ? ` ${h.version}` : "";
1881
2021
  const account = h.signedIn ? h.account ?? "signed in" : "signed out";
1882
- return `${h.name}${version}, ${account}${h.experimental ? " (experimental)" : ""}`;
2022
+ return `${h.name}${version2}, ${account}${h.experimental ? " (experimental)" : ""}`;
1883
2023
  }
1884
2024
  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))) {
1885
2025
  for (const step of steps) {
@@ -1958,7 +2098,7 @@ async function installService(kind, argv, attempt, services = systemServices) {
1958
2098
  try {
1959
2099
  if (existsSync5(unit.retire.path)) {
1960
2100
  out(
1961
- ` This computer has one ${environment} runner, so connect stops and removes ${unit.retire.path}.`
2101
+ ` This computer is already a ${environment} machine, so connect stops and removes ${unit.retire.path}.`
1962
2102
  );
1963
2103
  await runSteps(unit.retire.steps, run);
1964
2104
  rmSync3(unit.retire.path, { force: true });
@@ -1973,21 +2113,21 @@ async function installService(kind, argv, attempt, services = systemServices) {
1973
2113
  attempt.step = "first_connect";
1974
2114
  if (!await services.awaitUp(since)) {
1975
2115
  out(
1976
- `${red("\u2717")} ${unit.path} started, but the runner did not reach Cloop within 15 s. Its last log lines:`
2116
+ `${red("\u2717")} ${unit.path} started, but the machine did not reach Cloop within 15 s. Its last log lines:`
1977
2117
  );
1978
2118
  try {
1979
2119
  out(services.run(unit.tail));
1980
2120
  } catch {
1981
2121
  out(` (no log yet; run ${unit.logs})`);
1982
2122
  }
1983
- throw new ConnectFailure("first_connect_timeout", "the runner did not reach Cloop", true);
2123
+ throw new ConnectFailure("first_connect_timeout", "the machine did not reach Cloop", true);
1984
2124
  }
1985
2125
  if (services.platform === "linux") {
1986
2126
  const user = userInfo().username;
1987
2127
  const linger = ensureLinger(user, services.run);
1988
2128
  if (!linger.ok) {
1989
2129
  out(
1990
- `${red("\u2717")} The runner is up, but it stops when you log out of this machine. Run this, then run cloop connect again: ${bold(linger.command)}`
2130
+ `${red("\u2717")} The machine is up, but it stops when you log out of this computer. Run this, then run cloop connect again: ${bold(linger.command)}`
1991
2131
  );
1992
2132
  throw new ConnectFailure(
1993
2133
  "service_start_failed",
@@ -1996,10 +2136,10 @@ async function installService(kind, argv, attempt, services = systemServices) {
1996
2136
  );
1997
2137
  }
1998
2138
  if (linger.changed)
1999
- out(` Linger: turned on for ${user}, so the runner keeps running after you log out.`);
2139
+ out(` Linger: turned on for ${user}, so the machine keeps running after you log out.`);
2000
2140
  }
2001
2141
  out(` Service: ${unit.path}, started and connected. Logs: ${dim(unit.logs)}`);
2002
- out(`${bold("Cloop runner")} Connected the ${environment} runner.`);
2142
+ out(`${bold("Cloop machine")} Connected the ${environment} machine.`);
2003
2143
  }
2004
2144
  async function connectT3(argv, attempt, fallback, chosen, services) {
2005
2145
  const previous = readRunnerConfig();
@@ -2016,7 +2156,7 @@ async function connectT3(argv, attempt, fallback, chosen, services) {
2016
2156
  readEnvironment: async () => {
2017
2157
  const environment = await readEnvironment(t3Url);
2018
2158
  out(
2019
- `${bold("Cloop runner")} Connecting ${shortMachineName(environment.label)} (T3 ${environment.serverVersion}) to Cloop with @cloop/runner ${VERSION}.`
2159
+ `${bold("Cloop machine")} Connecting ${shortMachineName(environment.label)} (T3 ${environment.serverVersion}) to Cloop with @cloop/runner ${VERSION}.`
2020
2160
  );
2021
2161
  return environment;
2022
2162
  },
@@ -2067,7 +2207,7 @@ async function connectT3(argv, attempt, fallback, chosen, services) {
2067
2207
  out
2068
2208
  );
2069
2209
  out(
2070
- `${bold("Cloop runner")} T3 ${cfg.label} paired with scope ${cfg.scope}, until ${cfg.expiresAt.slice(0, 10)}.`
2210
+ `${bold("Cloop machine")} T3 ${cfg.label} paired with scope ${cfg.scope}, until ${cfg.expiresAt.slice(0, 10)}.`
2071
2211
  );
2072
2212
  if (byLink)
2073
2213
  out(
@@ -2106,7 +2246,7 @@ async function connectLocal(driver, found, argv, attempt, chosen, services) {
2106
2246
  version: `${harness.name} ${harness.version ?? ""}`.trim()
2107
2247
  };
2108
2248
  out(
2109
- `${bold("Cloop runner")} Connecting ${deviceName} as a Local runner with ${harnessLine(harness)}, using @cloop/runner ${VERSION}.`
2249
+ `${bold("Cloop machine")} Connecting ${deviceName} as a local machine with ${harnessLine(harness)}, using @cloop/runner ${VERSION}.`
2110
2250
  );
2111
2251
  attempt.step = "login";
2112
2252
  const deviceToken = await deviceLogin({ origin: getOrigin(), deviceName, device });
@@ -2135,7 +2275,7 @@ async function connectLocal(driver, found, argv, attempt, chosen, services) {
2135
2275
  (h) => Boolean(h) && h !== harness
2136
2276
  );
2137
2277
  out(
2138
- `${bold("Cloop runner")} ${deviceName} is a Local runner: ${[harness, ...others].map(harnessLine).join("; ")}.`
2278
+ `${bold("Cloop machine")} ${deviceName} is a local machine: ${[harness, ...others].map(harnessLine).join("; ")}.`
2139
2279
  );
2140
2280
  out(` Folders: ${repos.map((r) => `${r.label} (${r.path})`).join(", ")}`);
2141
2281
  out(
@@ -2176,7 +2316,7 @@ async function connect(argv, attempt, deps = {}) {
2176
2316
  const forced = named ?? rememberedDriver(previous);
2177
2317
  if (forced && !named)
2178
2318
  out(
2179
- `${bold("Cloop runner")} This machine runs Cloop work in ${DRIVER_NAME[forced]}, as you chose. Change it with: cloop use <t3|claude-code|codex>`
2319
+ `${bold("Cloop machine")} This machine runs Cloop work in ${DRIVER_NAME[forced]}, as you chose. Change it with: cloop use <t3|claude-code|codex>`
2180
2320
  );
2181
2321
  const fallback = flag(argv, "--fallback-model");
2182
2322
  if (fallback !== void 0 && !MODEL_LIST.test(fallback))
@@ -2225,7 +2365,7 @@ async function connect(argv, attempt, deps = {}) {
2225
2365
  t3: () => connectT3(argv, attempt, local ? HARNESS_NAME[local] : null, forced, deps.services),
2226
2366
  local: (driver) => connectLocal(driver, current, argv, attempt, forced, deps.services),
2227
2367
  fallback: () => fallbackDriver(current, forced, workstation),
2228
- say: (line2) => out(`${bold("Cloop runner")} ${line2}`)
2368
+ say: (line2) => out(`${bold("Cloop machine")} ${line2}`)
2229
2369
  });
2230
2370
  const harnesses = [];
2231
2371
  if (current.claude) harnesses.push({ harness: "claude-code", bin: harnessBin("claude") });
@@ -2237,7 +2377,7 @@ var MCP_STEP_MS = 6 * 6e4;
2237
2377
  async function addCloopMcpLast(found, attempt, mcp, terminal) {
2238
2378
  if (!found.length) return;
2239
2379
  const server = mcpServer(runnerEnvironment());
2240
- const say = (line2) => out(`${bold("Cloop runner")} ${line2}`);
2380
+ const say = (line2) => out(`${bold("Cloop machine")} ${line2}`);
2241
2381
  const left = new Set(found.map(({ harness }) => harness));
2242
2382
  const byHand = () => [...left].flatMap((harness) => mcpByHand(harness, server)).join(", then: ");
2243
2383
  let late = false;
@@ -2252,7 +2392,7 @@ async function addCloopMcpLast(found, attempt, mcp, terminal) {
2252
2392
  `[runner:mcp] harness=${harness} registered=${result.registered} signed_in=${result.signedIn} reason=${result.reason ?? "none"}`
2253
2393
  );
2254
2394
  out(
2255
- result.registered ? `${bold("Cloop runner")} ${mcpLine(result)}` : `${red("\u2717")} ${mcpLine(result)}`
2395
+ result.registered ? `${bold("Cloop machine")} ${mcpLine(result)}` : `${red("\u2717")} ${mcpLine(result)}`
2256
2396
  );
2257
2397
  }
2258
2398
  })();
@@ -2279,7 +2419,7 @@ async function addCloopMcpLast(found, attempt, mcp, terminal) {
2279
2419
  async function prepareAgents(found, forced, workstation, deps) {
2280
2420
  if (workstation || forced === "t3") return found;
2281
2421
  let current = found;
2282
- const say = (line2) => out(`${bold("Cloop runner")} ${line2}`);
2422
+ const say = (line2) => out(`${bold("Cloop machine")} ${line2}`);
2283
2423
  const chatGptApp = forced !== "claude-code" && deps.chatGptApp();
2284
2424
  const getCodex = async (why, reason) => {
2285
2425
  say(`${why} Installing the latest Codex from ${CODEX_RELEASES}.`);
@@ -2351,17 +2491,17 @@ function signInClaude(bin) {
2351
2491
  return runShown2([bin, "auth", "login"], true).status === 0 ? probeClaude(bin) : Promise.resolve(null);
2352
2492
  }
2353
2493
  async function claudeAtFloor(found, forced, update) {
2354
- const version = found.claude?.version;
2494
+ const version2 = found.claude?.version;
2355
2495
  const codex = forced === "codex" || !forced && !found.claude?.signedIn && Boolean(found.codex?.signedIn);
2356
- if (!version || codex || !olderThan(version, CLAUDE_FLOOR)) return found;
2357
- out(`${bold("Cloop runner")} ${claudeTooOld(version)} Updating it.`);
2496
+ if (!version2 || codex || !olderThan(version2, CLAUDE_FLOOR)) return found;
2497
+ out(`${bold("Cloop machine")} ${claudeTooOld(version2)} Updating it.`);
2358
2498
  const claude = await update();
2359
2499
  if (!claude?.version || olderThan(claude.version, CLAUDE_FLOOR))
2360
2500
  throw new ConnectFailure(
2361
2501
  "harness_outdated",
2362
2502
  "Claude Code did not update. Run `claude update`, then run `cloop connect` again."
2363
2503
  );
2364
- out(`${bold("Cloop runner")} Claude Code updated to ${claude.version}.`);
2504
+ out(`${bold("Cloop machine")} Claude Code updated to ${claude.version}.`);
2365
2505
  return { ...found, claude };
2366
2506
  }
2367
2507
  var WINGET_MANAGED = /winget upgrade Anthropic\.ClaudeCode/;
@@ -2378,7 +2518,7 @@ async function updateClaude(run = runShown2, probe = probeClaude) {
2378
2518
  const update = run(["claude", "update"], false);
2379
2519
  if (WINGET_MANAGED.test(update.output)) {
2380
2520
  out(
2381
- `${bold("Cloop runner")} winget installed Claude Code, so connect updates it with winget.`
2521
+ `${bold("Cloop machine")} winget installed Claude Code, so connect updates it with winget.`
2382
2522
  );
2383
2523
  if (run(WINGET_UPDATE, true).status !== 0) return null;
2384
2524
  } else {
@@ -2409,7 +2549,7 @@ async function runConnect(argv, deps = {}) {
2409
2549
  attempt.step = "legacy_move";
2410
2550
  try {
2411
2551
  if (await moveLegacyStagingRunner(deps.services ?? systemServices))
2412
- out(`${bold("Cloop runner")} ${movedLine(environment)}`);
2552
+ out(`${bold("Cloop machine")} ${movedLine(environment)}`);
2413
2553
  } catch (err) {
2414
2554
  throw new ConnectFailure(
2415
2555
  "legacy_move_failed",
@@ -2440,7 +2580,10 @@ async function connectCommand(argv) {
2440
2580
  }
2441
2581
 
2442
2582
  export {
2443
- runBoxTool,
2583
+ runnerLog,
2584
+ buildDiag,
2585
+ classifyError,
2586
+ answerCall,
2444
2587
  SUBSCRIPTIONS,
2445
2588
  probeClaudePermissions,
2446
2589
  probeClaude,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ConnectFailure,
4
4
  deviceLogin
5
- } from "./chunk-UVB722OW.js";
5
+ } from "./chunk-C6EAR65U.js";
6
6
  import {
7
7
  ApiError,
8
8
  ReauthError,
@@ -51,14 +51,14 @@ function storedLabel(path) {
51
51
  } catch {
52
52
  }
53
53
  throw new Error(
54
- `local_file_unreadable: Cannot read the existing runner file at ${path}. Run cloop connect --webhook <endpoint> --name <different-name>.`
54
+ `local_file_unreadable: Cannot read the existing cloud agent file at ${path}. Run cloop connect --webhook <endpoint> --name <different-name>.`
55
55
  );
56
56
  }
57
57
  function assertNoPathCollision(path, label) {
58
58
  const existingLabel = storedLabel(path);
59
59
  if (existingLabel && existingLabel !== label) {
60
60
  throw new Error(
61
- `local_file_collision: Runner labels "${existingLabel}" and "${label}" use the same local file ${path}. Run cloop connect --webhook <endpoint> --name <different-name>.`
61
+ `local_file_collision: Cloud agent labels "${existingLabel}" and "${label}" use the same local file ${path}. Run cloop connect --webhook <endpoint> --name <different-name>.`
62
62
  );
63
63
  }
64
64
  }
@@ -259,7 +259,7 @@ async function connectWebhook(argv, attempt) {
259
259
  );
260
260
  }
261
261
  if (existing?.verified) {
262
- console.log(`Cloop runner ${name} is already a verified cloud agent.`);
262
+ console.log(`Cloop machine ${name} is already a verified cloud agent.`);
263
263
  return;
264
264
  }
265
265
  if (!existing || argv.includes("--rotate-secret")) {
@@ -303,7 +303,7 @@ The command will now wait for your endpoint to answer while you set it up.`
303
303
  attempt.step = "webhook_verify";
304
304
  await waitForVerification(name);
305
305
  console.log(`[workstation:cloud-connect] Verified ${name}.`);
306
- console.log(`Cloop runner ${name} is a verified cloud agent.`);
306
+ console.log(`Cloop machine ${name} is a verified cloud agent.`);
307
307
  }
308
308
  async function runnerCommand(argv) {
309
309
  switch (argv[0]) {