@cloop/runner 0.3.41 → 0.3.43

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.
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  serveTakeovers
4
- } from "./chunk-LMW4JHRH.js";
5
- import "./chunk-NPTLMG3V.js";
4
+ } from "./chunk-XHUV7QKK.js";
5
+ import "./chunk-IBDQB2LI.js";
6
6
  import {
7
7
  CAPTURE_TICK_MS,
8
8
  DEFAULT_FALLBACK_MODEL,
@@ -38,7 +38,7 @@ import {
38
38
  systemServices,
39
39
  unitFor,
40
40
  which
41
- } from "./chunk-3XQ44U27.js";
41
+ } from "./chunk-ZYNYUDRR.js";
42
42
  import {
43
43
  MeshSocket,
44
44
  WAKE_TICK_MS,
@@ -46,7 +46,7 @@ import {
46
46
  defaultSocketFactory,
47
47
  runnerLog,
48
48
  wakeWatch
49
- } from "./chunk-KDTPUD2Y.js";
49
+ } from "./chunk-CVVYCLZ6.js";
50
50
  import {
51
51
  BoxWatch,
52
52
  hostedThreadsFilePath,
@@ -56,7 +56,7 @@ import {
56
56
  runnerStatePath,
57
57
  threadsFilePath,
58
58
  writeRunnerState
59
- } from "./chunk-WIAWWXGP.js";
59
+ } from "./chunk-KFMO7ASY.js";
60
60
  import {
61
61
  BackgroundReading,
62
62
  BoxToolError,
@@ -101,20 +101,20 @@ import {
101
101
  utcWindow,
102
102
  windowsPowerShellEnv,
103
103
  writeBoxConfig
104
- } from "./chunk-SDVTQCW7.js";
104
+ } from "./chunk-ABVM7DFO.js";
105
105
  import "./chunk-VK6GV757.js";
106
106
  import {
107
107
  olderThan
108
108
  } from "./chunk-365HFCQQ.js";
109
109
  import "./chunk-PKIEWBR7.js";
110
- import "./chunk-LGKSLIU2.js";
111
- import "./chunk-4MMTNAPM.js";
110
+ import "./chunk-3G3DFLOP.js";
111
+ import "./chunk-OQWYXCLI.js";
112
112
  import {
113
113
  getMachine
114
114
  } from "./chunk-SBYSVZ7J.js";
115
115
  import {
116
116
  VERSION
117
- } from "./chunk-ILLDES3M.js";
117
+ } from "./chunk-NR6STR7Q.js";
118
118
  import {
119
119
  getMeshUrl,
120
120
  getOrigin,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ConnectFailure,
4
4
  deviceLogin
5
- } from "./chunk-4MMTNAPM.js";
5
+ } from "./chunk-OQWYXCLI.js";
6
6
  import {
7
7
  ApiError,
8
8
  ReauthError,
@@ -820,7 +820,7 @@ var RESULT_INSTRUCTION = [
820
820
  "```cloop-result",
821
821
  '{"summary": "One or two sentences on what you did.", "outputs": [{"kind": "pr", "title": "fix: the thing", "url": "https://github.com/org/repo/pull/1"}], "checks": [{"name": "Tests", "outcome": "passed"}]}',
822
822
  "```",
823
- "An output kind is one of: pr or link (title, url), draft (title, body, optional to, optional url), doc (title, optional url or body), file (title, path), wizard (title, steps). A check outcome is passed, failed or skipped.",
823
+ "An output kind is one of: pr or link (title, url), draft (title, body, optional to, optional url), doc (title, optional url or body), wizard (title, steps). A check outcome is passed, failed or skipped.",
824
824
  "A draft's body is the message itself, as the recipient will read it; if you saved it somewhere (a Gmail draft), put that link in url, never in body. A doc's body is the whole page in GitHub Markdown: headings, lists, bold and tables all show; a table suits one row per item. Give every product, page or source you mention as a full https link.",
825
825
  `A wizard is for ${WIZARD_FOR}. When the work needs such a step, return a wizard for it, not only words. A wizard has 1 to ${WIZARD_STEPS_MAX} steps in order, each {"title", "body" in Markdown, optional https "url"}. Never ask the user to paste a password, key or other secret anywhere. The user sees a wizard as a walkthrough: in your own words, call it a walkthrough, never a wizard.`,
826
826
  "List as outputs only what this run made. A PR or page you only read, checked or cited goes in the summary, never in outputs.",
@@ -884,8 +884,6 @@ function readOutput(o) {
884
884
  ...body !== void 0 ? { body } : {}
885
885
  };
886
886
  }
887
- case "file":
888
- return text(out.path, 400) ? { kind: "file", title, path: out.path } : null;
889
887
  case "image":
890
888
  if (!text(out.path, 400)) return null;
891
889
  return {
@@ -1568,13 +1566,14 @@ function providerName(instanceId, cfg) {
1568
1566
  if (displayName) return displayName;
1569
1567
  return instanceId && PROVIDER_NAMES[instanceId] || instanceId || "The harness";
1570
1568
  }
1571
- function readyProvider(cfg, driver) {
1569
+ function readyProvider(cfg, driver, skip = () => false) {
1572
1570
  const candidates = [...cfg.providers].sort(
1573
1571
  (a, b) => Number(b.instanceId === driver) - Number(a.instanceId === driver)
1574
1572
  );
1575
1573
  for (const p of candidates) {
1576
1574
  if ((p.driver ?? p.instanceId) !== driver || !p.enabled || !p.installed) continue;
1577
1575
  if (p.auth && p.auth.status !== "authenticated") continue;
1576
+ if (skip(p)) continue;
1578
1577
  const model = p.models?.find((m) => m.isDefault)?.slug ?? p.models?.[0]?.slug;
1579
1578
  if (model) return { instanceId: p.instanceId, model };
1580
1579
  }
@@ -1596,9 +1595,44 @@ function signedOutWords(p, run2) {
1596
1595
  const signedOut = failure.code === "unauthorized" || /^Claude could not authenticate\b/.test(message) || HARNESS_SIGNED_OUT.test(message);
1597
1596
  return signedOut ? words ?? (message || null) : null;
1598
1597
  }
1599
- function launchMove(cfg, own, permission, held) {
1600
- const codex = held && own !== CODEX_PROVIDER ? readyProvider(cfg, CODEX_PROVIDER) : null;
1601
- if (codex) return { to: codex, reason: "limit" };
1598
+ function planSpentUntil(p, now) {
1599
+ const quota = quotaFromT3(p.usageLimits);
1600
+ if (quota.status !== "ok") return 0;
1601
+ let until = 0;
1602
+ for (const w of quota.windows) {
1603
+ const reset = w.resetsAt ? Date.parse(w.resetsAt) : Number.NaN;
1604
+ if (w.usedPercent >= 100 && !w.label.includes("\xB7") && reset > now)
1605
+ until = Math.max(until, reset);
1606
+ }
1607
+ return until;
1608
+ }
1609
+ var PLAN_AUTH = /* @__PURE__ */ new Set(["CLAUDE_CODE_OAUTH_TOKEN"]);
1610
+ var BUILT_IN = /* @__PURE__ */ new Set([CLAUDE_PROVIDER, CODEX_PROVIDER]);
1611
+ function overridesAuth(cfg, instanceId) {
1612
+ const entry = cfg.settings?.providerInstances?.[instanceId];
1613
+ if (!entry) return !BUILT_IN.has(instanceId);
1614
+ const env = entry.environment ?? [];
1615
+ return env.some(
1616
+ (e) => !PLAN_AUTH.has(e.name) && /KEY|TOKEN|SECRET|BEDROCK|VERTEX|FOUNDRY|AZURE|BASE_URL|PROVIDER/i.test(e.name)
1617
+ );
1618
+ }
1619
+ function limitMove(cfg, from, a) {
1620
+ const p = cfg.providers.find((x) => x.instanceId === from);
1621
+ const own = p?.driver ?? p?.instanceId ?? from;
1622
+ const other = otherDriver(cfg, from);
1623
+ const skip = (x) => a.tried.has(x.instanceId) || a.spent(x) || overridesAuth(cfg, x.instanceId);
1624
+ for (const driver of a.sameHarness ? [own] : [own, other]) {
1625
+ if (!driver || driver === CODEX_PROVIDER && a.permission !== "full") continue;
1626
+ const to = readyProvider(cfg, driver, skip);
1627
+ if (to) return to;
1628
+ }
1629
+ return null;
1630
+ }
1631
+ function launchMove(cfg, own, permission, spent, sameHarness = false) {
1632
+ const ownProvider = cfg.providers.find((p) => p.instanceId === own && p.enabled);
1633
+ const free = ownProvider && spent(ownProvider) ? limitMove(cfg, own, { tried: /* @__PURE__ */ new Set([own]), permission, spent, sameHarness }) : null;
1634
+ if (free) return { to: free, reason: "limit" };
1635
+ if (sameHarness) return null;
1602
1636
  const auth = cfg.providers.find((p) => p.instanceId === own && p.enabled)?.auth;
1603
1637
  if (!auth || auth.status === "authenticated") return null;
1604
1638
  const driver = otherDriver(cfg, own);
@@ -1707,8 +1741,8 @@ var T3Driver = class {
1707
1741
  launched = /* @__PURE__ */ new Map();
1708
1742
  /** The box's providers as last read, so a run's end names a custom provider by its driver. */
1709
1743
  providers = [];
1710
- /** Until then, a launch that names no harness starts on Codex: the Claude account is at its limit. */
1711
- limitedUntil = 0;
1744
+ /** Until when each instance is held at its usage limit, by the runs that stopped there. */
1745
+ limitedUntil = /* @__PURE__ */ new Map();
1712
1746
  get capabilities() {
1713
1747
  return boxCapabilities(this.deps.scope?.());
1714
1748
  }
@@ -1768,6 +1802,8 @@ var T3Driver = class {
1768
1802
  },
1769
1803
  harnesses: cfg.providers.filter((p) => p.enabled).map((p) => ({
1770
1804
  id: p.instanceId,
1805
+ ...p.driver && p.driver !== p.instanceId ? { driver: p.driver } : {},
1806
+ ...overridesAuth(cfg, p.instanceId) ? { perToken: true } : {},
1771
1807
  name: p.displayName ?? p.instanceId,
1772
1808
  version: p.version,
1773
1809
  ready: p.status === "ready",
@@ -1891,12 +1927,14 @@ var T3Driver = class {
1891
1927
  if (!runtimeMode || !RUNTIME_MODES.has(runtimeMode))
1892
1928
  throw new BoxToolError("runtime_mode_unknown");
1893
1929
  const permission = permissionOf(runtimeMode);
1894
- const named = Boolean(a.harness || a.model);
1895
- const held = !named && permission === "full" && this.now() < this.limitedUntil;
1896
1930
  const own = cfg.settings?.defaultModelSelection?.instanceId ?? CLAUDE_PROVIDER;
1897
- const move = named ? null : launchMove(cfg, own, permission, held);
1898
- const fallback = move?.to ?? cfg.settings?.defaultModelSelection;
1899
- const harness = a.harness ?? fallback?.instanceId ?? "claudeAgent";
1931
+ const sameHarness = !a.model && a.harness !== void 0 && BUILT_IN.has(a.harness);
1932
+ const named = Boolean(a.model) || a.harness !== void 0 && !sameHarness;
1933
+ const ownDriver = cfg.providers.find((p) => p.instanceId === own)?.driver ?? own;
1934
+ const start = sameHarness && (ownDriver !== a.harness || overridesAuth(cfg, own)) ? a.harness : own;
1935
+ const move = named ? null : launchMove(cfg, start, permission, this.spent, sameHarness);
1936
+ const fallback = move?.to ?? (start === own ? cfg.settings?.defaultModelSelection : void 0);
1937
+ const harness = (named ? a.harness : void 0) ?? fallback?.instanceId ?? start;
1900
1938
  const provider = cfg.providers.find((p) => p.instanceId === harness && p.enabled);
1901
1939
  if (!provider) throw new BoxToolError("harness_unavailable");
1902
1940
  if (provider.auth && provider.auth.status !== "authenticated")
@@ -1935,12 +1973,13 @@ var T3Driver = class {
1935
1973
  if (!this.launched.has(launched.threadId))
1936
1974
  this.launched.set(launched.threadId, {
1937
1975
  named,
1976
+ sameHarness,
1938
1977
  permission,
1978
+ tried: /* @__PURE__ */ new Set([modelSelection.instanceId, ...move ? [start] : []]),
1939
1979
  ...move ? {
1940
- movedFrom: "",
1941
1980
  switched: movedLine(
1942
1981
  move.reason,
1943
- providerName(own, cfg),
1982
+ providerName(start, cfg),
1944
1983
  providerName(move.to.instanceId, cfg),
1945
1984
  "is"
1946
1985
  )
@@ -2080,6 +2119,25 @@ var T3Driver = class {
2080
2119
  }
2081
2120
  return { ok: true, was_running: true };
2082
2121
  }
2122
+ /**
2123
+ * T3's Settle, for a thread this runner started (`cloop:` title) whose
2124
+ * latest run completed and that waits on nothing. Routine runs left a
2125
+ * "cloop: ..." thread on the owner's list after every run (3 Nov 2026).
2126
+ * A thread a person started or adopted keeps its own title and stays.
2127
+ */
2128
+ async settle(threadId, commandId) {
2129
+ const p = await this.readProjection(threadId);
2130
+ if (!(p.thread.title ?? "").startsWith(CLOOP_THREAD_PREFIX))
2131
+ return { settled: false, refused: "not_cloop" };
2132
+ if (p.thread.settledAt) return { settled: true, already: true };
2133
+ if (latestRun(p.runs ?? [])?.status !== "completed")
2134
+ return { settled: false, refused: "not_finished" };
2135
+ if ((p.runtimeRequests ?? []).some((r) => r.status === "pending"))
2136
+ return { settled: false, refused: "waiting" };
2137
+ await this.dispatch({ type: "thread.settle", commandId, threadId });
2138
+ this.log(`settled thread=${threadId}`);
2139
+ return { settled: true, already: false };
2140
+ }
2083
2141
  async readThread(id) {
2084
2142
  const projection = await this.readProjection(id);
2085
2143
  const { status, settled, pr_url, last_assistant_text } = outcomeOf(projection);
@@ -2268,7 +2326,7 @@ var T3Driver = class {
2268
2326
  const said = outcome.last_assistant_text?.replace(/\s+/g, " ").trim();
2269
2327
  const limited = outcome.status === "failed" && HARNESS_LIMIT.test(said ?? "");
2270
2328
  const signedOut = !limited && turn ? signedOutWords(p, turn) : null;
2271
- const quoted = (words) => `${opening}${providerName(turn?.providerInstanceId)} said: "${words}"`.slice(
2329
+ const quoted = (words) => `${opening}${providerName(turn?.providerInstanceId, { providers: this.providers })} said: "${words}"`.slice(
2272
2330
  0,
2273
2331
  RUN_TEXT_MAX
2274
2332
  );
@@ -2374,14 +2432,16 @@ var T3Driver = class {
2374
2432
  };
2375
2433
  }
2376
2434
  /**
2377
- * Once per thread: a run that failed at a Claude usage limit carries on in
2378
- * the same thread on Codex, and a run whose harness could not sign in
2379
- * carries on with the other harness, Claude Code or Codex, either way. T3
2435
+ * A run that failed at a usage limit carries on in the same thread on the
2436
+ * next instance with usage (`limitMove`): another Claude subscription, then
2437
+ * Codex. A run whose harness could not sign in carries on with the other
2438
+ * harness, Claude Code or Codex, either way. Each thread moves to an
2439
+ * instance once at most, so the chain ends when every option is out. T3
2380
2440
  * switches the thread's provider and hands it the thread so far; the
2381
- * worktree, with any edits, stays. A limit that names no model holds the
2382
- * account, so launches start on Codex for LIMIT_HOLD_MS; a sign-in failure
2383
- * holds nothing. A thread whose Task named its harness or model stays, and
2384
- * so does one without full access that would move to Codex, because Codex
2441
+ * worktree, with any edits, stays. A limit that names no model holds that
2442
+ * instance, so launches skip it for LIMIT_HOLD_MS; a sign-in failure holds
2443
+ * nothing. A thread whose Task named its harness or model stays, and so
2444
+ * does one without full access that would move to Codex, because Codex
2385
2445
  * asks nothing. So does a thread this daemon did not launch: a restart
2386
2446
  * forgets what the Task named. Returns the progress line of the move.
2387
2447
  */
@@ -2391,12 +2451,11 @@ var T3Driver = class {
2391
2451
  const reason = HARNESS_LIMIT.test(said) ? "limit" : signedOutWords(p, turn) ? "signed_out" : null;
2392
2452
  if (!reason) return null;
2393
2453
  const from = turn.providerInstanceId;
2394
- if (reason === "limit") {
2395
- if (from === CODEX_PROVIDER) return null;
2396
- if (!limitedModel(said)) this.limitedUntil = this.now() + LIMIT_HOLD_MS;
2397
- }
2454
+ if (reason === "limit" && from && !limitedModel(said))
2455
+ this.limitedUntil.set(from, this.now() + LIMIT_HOLD_MS);
2398
2456
  const entry = this.launched.get(threadId);
2399
- if (!entry || entry.named || entry.movedFrom !== void 0) return null;
2457
+ if (!entry || entry.named) return null;
2458
+ if (from) entry.tried.add(from);
2400
2459
  try {
2401
2460
  return await this.dispatchHandover(threadId, turn, entry, reason);
2402
2461
  } catch (err) {
@@ -2409,13 +2468,17 @@ var T3Driver = class {
2409
2468
  async dispatchHandover(threadId, turn, entry, reason) {
2410
2469
  const cfg = await this.t3.rpc("server.getConfig", {});
2411
2470
  this.providers = cfg.providers;
2412
- const driver = reason === "limit" ? CODEX_PROVIDER : otherDriver(cfg, turn.providerInstanceId);
2413
- if (!driver || driver === CODEX_PROVIDER && entry.permission !== "full") return null;
2414
- const to = readyProvider(cfg, driver);
2471
+ const from = turn.providerInstanceId ?? CLAUDE_PROVIDER;
2415
2472
  const name = providerName(turn.providerInstanceId, cfg);
2473
+ const to = reason === "limit" ? limitMove(cfg, from, {
2474
+ tried: entry.tried,
2475
+ permission: entry.permission,
2476
+ spent: this.spent,
2477
+ sameHarness: entry.sameHarness
2478
+ }) : this.signedOutMove(cfg, from, entry);
2416
2479
  if (!to) {
2417
2480
  this.log(
2418
- `${reason} thread=${threadId}: ${providerName(driver)} is not on or not signed in; the run fails`
2481
+ `${reason} thread=${threadId}: no other instance on this box is on, signed in and free; the run fails`
2419
2482
  );
2420
2483
  return null;
2421
2484
  }
@@ -2437,6 +2500,7 @@ ${MACHINE_RESULT_INSTRUCTION}`
2437
2500
  creationSource: "mcp"
2438
2501
  });
2439
2502
  const toName = providerName(to.instanceId, cfg);
2503
+ entry.tried.add(to.instanceId);
2440
2504
  entry.movedFrom = turn.id;
2441
2505
  entry.switched = movedLine(reason, name, toName, "was");
2442
2506
  this.log(
@@ -2447,6 +2511,18 @@ ${MACHINE_RESULT_INSTRUCTION}`
2447
2511
  now() {
2448
2512
  return this.deps.now?.() ?? Date.now();
2449
2513
  }
2514
+ /** An instance at its usage limit now: a run stopped there within the hold, or T3 reads its plan as spent. */
2515
+ spent = (p) => {
2516
+ const now = this.now();
2517
+ return (this.limitedUntil.get(p.instanceId) ?? 0) > now || planSpentUntil(p, now) > now;
2518
+ };
2519
+ /** The other harness a signed-out run moves to, never one it already ran on. */
2520
+ signedOutMove(cfg, from, entry) {
2521
+ if (entry.sameHarness) return null;
2522
+ const driver = otherDriver(cfg, from);
2523
+ if (!driver || driver === CODEX_PROVIDER && entry.permission !== "full") return null;
2524
+ return readyProvider(cfg, driver, (p) => entry.tried.has(p.instanceId));
2525
+ }
2450
2526
  readProjection(threadId) {
2451
2527
  return this.t3.rpc("orchestration.getThreadProjection", { threadId });
2452
2528
  }
@@ -8,6 +8,7 @@ var RUNNER_TOOLS = [
8
8
  "thread.launch",
9
9
  "thread.send",
10
10
  "thread.interrupt",
11
+ "thread.settle",
11
12
  "setup.share",
12
13
  "diag"
13
14
  ];
@@ -9,7 +9,7 @@ import {
9
9
  runHarness,
10
10
  runLogDir,
11
11
  runLogPath
12
- } from "./chunk-SDVTQCW7.js";
12
+ } from "./chunk-ABVM7DFO.js";
13
13
  import {
14
14
  sanitizeLabel,
15
15
  stripControl
@@ -9,7 +9,7 @@ import {
9
9
  commandFor,
10
10
  imageExt,
11
11
  runnerPath
12
- } from "./chunk-SDVTQCW7.js";
12
+ } from "./chunk-ABVM7DFO.js";
13
13
 
14
14
  // src/run-previews.ts
15
15
  import { execFile as execFile2, spawn } from "child_process";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/version.ts
4
- var VERSION = true ? "0.3.41" : "0.0.0-dev";
4
+ var VERSION = true ? "0.3.43" : "0.0.0-dev";
5
5
 
6
6
  export {
7
7
  VERSION
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-SBYSVZ7J.js";
7
7
  import {
8
8
  VERSION
9
- } from "./chunk-ILLDES3M.js";
9
+ } from "./chunk-NR6STR7Q.js";
10
10
  import {
11
11
  getOrigin,
12
12
  readCredentials,
@@ -2,17 +2,17 @@
2
2
  import {
3
3
  findRun,
4
4
  ownHarness
5
- } from "./chunk-NPTLMG3V.js";
5
+ } from "./chunk-IBDQB2LI.js";
6
6
  import {
7
7
  lockThreadsFile,
8
8
  threadsFilePath
9
- } from "./chunk-WIAWWXGP.js";
9
+ } from "./chunk-KFMO7ASY.js";
10
10
  import {
11
11
  localRunsFilePath,
12
12
  readRunRecords,
13
13
  runHarness,
14
14
  takeoverSummary
15
- } from "./chunk-SDVTQCW7.js";
15
+ } from "./chunk-ABVM7DFO.js";
16
16
  import {
17
17
  sanitizeLabel
18
18
  } from "./chunk-VK6GV757.js";
@@ -4,12 +4,12 @@ import {
4
4
  freshness,
5
5
  outcomeLine,
6
6
  runnerLog
7
- } from "./chunk-KDTPUD2Y.js";
7
+ } from "./chunk-CVVYCLZ6.js";
8
8
  import {
9
9
  readRunnerState,
10
10
  runnerStatePath,
11
11
  threadsFilePath
12
- } from "./chunk-WIAWWXGP.js";
12
+ } from "./chunk-KFMO7ASY.js";
13
13
  import {
14
14
  BoxToolError,
15
15
  CLOOP_THREAD_PREFIX,
@@ -48,7 +48,7 @@ import {
48
48
  windowsExecutable,
49
49
  windowsPowerShellEnv,
50
50
  writeBoxConfig
51
- } from "./chunk-SDVTQCW7.js";
51
+ } from "./chunk-ABVM7DFO.js";
52
52
  import {
53
53
  CLAUDE_FLOOR,
54
54
  CODEX_FLOOR,
@@ -62,14 +62,14 @@ import {
62
62
  } from "./chunk-PKIEWBR7.js";
63
63
  import {
64
64
  connectWebhook
65
- } from "./chunk-LGKSLIU2.js";
65
+ } from "./chunk-3G3DFLOP.js";
66
66
  import {
67
67
  ConnectFailure,
68
68
  connectReport,
69
69
  deviceLogin,
70
70
  newAttempt,
71
71
  sendConnectReport
72
- } from "./chunk-4MMTNAPM.js";
72
+ } from "./chunk-OQWYXCLI.js";
73
73
  import {
74
74
  defaultDeviceName,
75
75
  getMachine,
@@ -77,7 +77,7 @@ import {
77
77
  } from "./chunk-SBYSVZ7J.js";
78
78
  import {
79
79
  VERSION
80
- } from "./chunk-ILLDES3M.js";
80
+ } from "./chunk-NR6STR7Q.js";
81
81
  import {
82
82
  STAGING_ORIGIN,
83
83
  getOrigin,
@@ -344,6 +344,8 @@ var BOX_TOOLS = {
344
344
  return result;
345
345
  },
346
346
  "thread.interrupt": ({ driver }, args) => driver.interrupt(parseThreadId(args), parseCommandId(args)),
347
+ // The app calls it once a run is Done with nothing to review. A driver with no thread list says so.
348
+ "thread.settle": async ({ driver }, args) => driver.settle ? driver.settle(parseThreadId(args), parseCommandId(args)) : { settled: false, refused: "unsupported" },
347
349
  // Codes, ids, versions and counts only (runner-log.ts), so ops can read it without the owner.
348
350
  diag: async ({ diag }) => diag ? diag() : null,
349
351
  // Packs the skills before it answers, so an empty or oversized set is refused now; the upload runs on.
@@ -53,17 +53,17 @@ import {
53
53
  which,
54
54
  workFolder,
55
55
  workFolderLine
56
- } from "./chunk-3XQ44U27.js";
57
- import "./chunk-KDTPUD2Y.js";
58
- import "./chunk-WIAWWXGP.js";
59
- import "./chunk-SDVTQCW7.js";
56
+ } from "./chunk-ZYNYUDRR.js";
57
+ import "./chunk-CVVYCLZ6.js";
58
+ import "./chunk-KFMO7ASY.js";
59
+ import "./chunk-ABVM7DFO.js";
60
60
  import "./chunk-VK6GV757.js";
61
61
  import "./chunk-365HFCQQ.js";
62
62
  import "./chunk-PKIEWBR7.js";
63
- import "./chunk-LGKSLIU2.js";
64
- import "./chunk-4MMTNAPM.js";
63
+ import "./chunk-3G3DFLOP.js";
64
+ import "./chunk-OQWYXCLI.js";
65
65
  import "./chunk-SBYSVZ7J.js";
66
- import "./chunk-ILLDES3M.js";
66
+ import "./chunk-NR6STR7Q.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-3XQ44U27.js";
11
- import "./chunk-KDTPUD2Y.js";
12
- import "./chunk-WIAWWXGP.js";
13
- import "./chunk-SDVTQCW7.js";
10
+ } from "./chunk-ZYNYUDRR.js";
11
+ import "./chunk-CVVYCLZ6.js";
12
+ import "./chunk-KFMO7ASY.js";
13
+ import "./chunk-ABVM7DFO.js";
14
14
  import "./chunk-VK6GV757.js";
15
15
  import "./chunk-365HFCQQ.js";
16
16
  import "./chunk-PKIEWBR7.js";
17
- import "./chunk-LGKSLIU2.js";
18
- import "./chunk-4MMTNAPM.js";
17
+ import "./chunk-3G3DFLOP.js";
18
+ import "./chunk-OQWYXCLI.js";
19
19
  import "./chunk-SBYSVZ7J.js";
20
- import "./chunk-ILLDES3M.js";
20
+ import "./chunk-NR6STR7Q.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-3XQ44U27.js";
6
- import "./chunk-KDTPUD2Y.js";
7
- import "./chunk-WIAWWXGP.js";
8
- import "./chunk-SDVTQCW7.js";
5
+ } from "./chunk-ZYNYUDRR.js";
6
+ import "./chunk-CVVYCLZ6.js";
7
+ import "./chunk-KFMO7ASY.js";
8
+ import "./chunk-ABVM7DFO.js";
9
9
  import "./chunk-VK6GV757.js";
10
10
  import "./chunk-365HFCQQ.js";
11
11
  import "./chunk-PKIEWBR7.js";
12
- import "./chunk-LGKSLIU2.js";
13
- import "./chunk-4MMTNAPM.js";
12
+ import "./chunk-3G3DFLOP.js";
13
+ import "./chunk-OQWYXCLI.js";
14
14
  import "./chunk-SBYSVZ7J.js";
15
- import "./chunk-ILLDES3M.js";
15
+ import "./chunk-NR6STR7Q.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-ILLDES3M.js";
7
+ } from "./chunk-NR6STR7Q.js";
8
8
  import {
9
9
  applyEnvironmentFlag
10
10
  } from "./chunk-D5UZW42X.js";
@@ -68,7 +68,7 @@ Add --staging to any command to use Cloop staging instead of production.
68
68
  A production machine and a staging machine can run side by side on one computer.
69
69
  `;
70
70
  async function pinExistingRunner() {
71
- const { pinExistingRunner: pin } = await import("./existing-runner-HI4DFKSW.js");
71
+ const { pinExistingRunner: pin } = await import("./existing-runner-R5OAGMNB.js");
72
72
  const { note } = pin();
73
73
  if (note) console.error(note);
74
74
  }
@@ -76,7 +76,7 @@ async function main() {
76
76
  switch (command) {
77
77
  case "login":
78
78
  case "auth": {
79
- const { loginCommand } = await import("./login-UURPRX5F.js");
79
+ const { loginCommand } = await import("./login-7RUFMJDP.js");
80
80
  await loginCommand(argv);
81
81
  break;
82
82
  }
@@ -86,61 +86,61 @@ async function main() {
86
86
  break;
87
87
  }
88
88
  case "serve": {
89
- const { startMcpServer } = await import("./mcp-server-MTDAMQ7C.js");
89
+ const { startMcpServer } = await import("./mcp-server-KWU23FKU.js");
90
90
  await startMcpServer();
91
91
  break;
92
92
  }
93
93
  case "statusline": {
94
- const { statuslineCommand } = await import("./statusline-BV2IXFDB.js");
94
+ const { statuslineCommand } = await import("./statusline-TLEJTE4B.js");
95
95
  statuslineCommand();
96
96
  break;
97
97
  }
98
98
  case "connect": {
99
- const { connectCommand } = await import("./connect-SFAOSHIO.js");
99
+ const { connectCommand } = await import("./connect-G6KCIXAZ.js");
100
100
  await connectCommand(argv.slice(1));
101
101
  break;
102
102
  }
103
103
  case "use": {
104
- const { useCommand } = await import("./use-6OHXWE5L.js");
104
+ const { useCommand } = await import("./use-W2JTPJKF.js");
105
105
  process.exitCode = await useCommand(argv.slice(1));
106
106
  break;
107
107
  }
108
108
  case "disconnect": {
109
- const { disconnectCommand } = await import("./disconnect-ERRRZY25.js");
109
+ const { disconnectCommand } = await import("./disconnect-Y6YWU3GK.js");
110
110
  await disconnectCommand(argv.slice(1));
111
111
  break;
112
112
  }
113
113
  case "box": {
114
- const { boxCommand } = await import("./box-G664ZM6O.js");
114
+ const { boxCommand } = await import("./box-NHY2X4ZU.js");
115
115
  await boxCommand(argv.slice(1));
116
116
  break;
117
117
  }
118
118
  case "runs": {
119
119
  await pinExistingRunner();
120
- const { runsCommand } = await import("./runs-XR4MYK4X.js");
120
+ const { runsCommand } = await import("./runs-SUTQQYRZ.js");
121
121
  process.exitCode = runsCommand();
122
122
  break;
123
123
  }
124
124
  case "watch": {
125
125
  await pinExistingRunner();
126
- const { watchCommand } = await import("./runs-XR4MYK4X.js");
126
+ const { watchCommand } = await import("./runs-SUTQQYRZ.js");
127
127
  process.exitCode = await watchCommand(argv.slice(1));
128
128
  break;
129
129
  }
130
130
  case "takeover": {
131
131
  await pinExistingRunner();
132
- const { takeoverCommand } = await import("./takeover-H5YOSKV5.js");
132
+ const { takeoverCommand } = await import("./takeover-ULKBCUED.js");
133
133
  process.exitCode = await takeoverCommand(argv.slice(1));
134
134
  break;
135
135
  }
136
136
  case "resume": {
137
137
  await pinExistingRunner();
138
- const { resumeCommand } = await import("./runs-XR4MYK4X.js");
138
+ const { resumeCommand } = await import("./runs-SUTQQYRZ.js");
139
139
  process.exitCode = await resumeCommand(argv.slice(1));
140
140
  break;
141
141
  }
142
142
  case "runner": {
143
- const { runnerCommand } = await import("./runner-GMHC5FE7.js");
143
+ const { runnerCommand } = await import("./runner-4NWFDNHU.js");
144
144
  await runnerCommand(argv.slice(1));
145
145
  break;
146
146
  }
@@ -3,9 +3,9 @@ import {
3
3
  deviceLogin,
4
4
  loginCommand,
5
5
  refusalSentence
6
- } from "./chunk-4MMTNAPM.js";
6
+ } from "./chunk-OQWYXCLI.js";
7
7
  import "./chunk-SBYSVZ7J.js";
8
- import "./chunk-ILLDES3M.js";
8
+ import "./chunk-NR6STR7Q.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-KDTPUD2Y.js";
17
+ } from "./chunk-CVVYCLZ6.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-ILLDES3M.js";
34
+ } from "./chunk-NR6STR7Q.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-LGKSLIU2.js";
6
- import "./chunk-4MMTNAPM.js";
5
+ } from "./chunk-3G3DFLOP.js";
6
+ import "./chunk-OQWYXCLI.js";
7
7
  import "./chunk-SBYSVZ7J.js";
8
- import "./chunk-ILLDES3M.js";
8
+ import "./chunk-NR6STR7Q.js";
9
9
  import "./chunk-D5UZW42X.js";
10
10
  export {
11
11
  connectWebhook,
@@ -9,8 +9,8 @@ import {
9
9
  runsCommand,
10
10
  sessionFolder,
11
11
  watchCommand
12
- } from "./chunk-NPTLMG3V.js";
13
- import "./chunk-SDVTQCW7.js";
12
+ } from "./chunk-IBDQB2LI.js";
13
+ import "./chunk-ABVM7DFO.js";
14
14
  import "./chunk-VK6GV757.js";
15
15
  import "./chunk-D5UZW42X.js";
16
16
  export {
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VK6GV757.js";
8
8
  import {
9
9
  VERSION
10
- } from "./chunk-ILLDES3M.js";
10
+ } from "./chunk-NR6STR7Q.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-LMW4JHRH.js";
13
- import "./chunk-NPTLMG3V.js";
14
- import "./chunk-WIAWWXGP.js";
15
- import "./chunk-SDVTQCW7.js";
12
+ } from "./chunk-XHUV7QKK.js";
13
+ import "./chunk-IBDQB2LI.js";
14
+ import "./chunk-KFMO7ASY.js";
15
+ import "./chunk-ABVM7DFO.js";
16
16
  import "./chunk-VK6GV757.js";
17
17
  import "./chunk-SBYSVZ7J.js";
18
18
  import "./chunk-D5UZW42X.js";
@@ -3,20 +3,20 @@ import {
3
3
  DRIVER_NAME,
4
4
  pinExistingRunner,
5
5
  runConnect
6
- } from "./chunk-3XQ44U27.js";
7
- import "./chunk-KDTPUD2Y.js";
8
- import "./chunk-WIAWWXGP.js";
6
+ } from "./chunk-ZYNYUDRR.js";
7
+ import "./chunk-CVVYCLZ6.js";
8
+ import "./chunk-KFMO7ASY.js";
9
9
  import {
10
10
  isLocal,
11
11
  readRunnerConfig
12
- } from "./chunk-SDVTQCW7.js";
12
+ } from "./chunk-ABVM7DFO.js";
13
13
  import "./chunk-VK6GV757.js";
14
14
  import "./chunk-365HFCQQ.js";
15
15
  import "./chunk-PKIEWBR7.js";
16
- import "./chunk-LGKSLIU2.js";
17
- import "./chunk-4MMTNAPM.js";
16
+ import "./chunk-3G3DFLOP.js";
17
+ import "./chunk-OQWYXCLI.js";
18
18
  import "./chunk-SBYSVZ7J.js";
19
- import "./chunk-ILLDES3M.js";
19
+ import "./chunk-NR6STR7Q.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.41",
3
+ "version": "0.3.43",
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.",