@cloop/runner 0.3.23 → 0.3.24

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,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  RUN_TEXT_MAX,
4
+ boxPath,
4
5
  runnerPath
5
- } from "./chunk-TNNAPOD5.js";
6
+ } from "./chunk-NVESLEXA.js";
6
7
 
7
8
  // src/box-watch.ts
8
9
  import { randomUUID } from "crypto";
@@ -16,8 +17,11 @@ function threadsFilePath(env) {
16
17
  (dir) => join(dir, "box-threads.json")
17
18
  );
18
19
  }
19
- function runnerStatePath(env) {
20
- return join(dirname(threadsFilePath(env)), "runner-state.json");
20
+ function hostedThreadsFilePath(harness) {
21
+ return join(dirname(boxPath()), `hosted-${harness}`, "box-threads.json");
22
+ }
23
+ function runnerStatePath(env, threadsFile = threadsFilePath(env)) {
24
+ return join(dirname(threadsFile), "runner-state.json");
21
25
  }
22
26
  function writeRunnerState(state, path = runnerStatePath()) {
23
27
  mkdirSync(dirname(path), { recursive: true, mode: 448 });
@@ -220,6 +224,7 @@ var BoxWatch = class {
220
224
 
221
225
  export {
222
226
  threadsFilePath,
227
+ hostedThreadsFilePath,
223
228
  runnerStatePath,
224
229
  writeRunnerState,
225
230
  readRunnerState,
@@ -9,7 +9,7 @@ import {
9
9
  runHarness,
10
10
  runLogDir,
11
11
  runLogPath
12
- } from "./chunk-TNNAPOD5.js";
12
+ } from "./chunk-NVESLEXA.js";
13
13
  import {
14
14
  sanitizeLabel,
15
15
  stripControl
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ConnectFailure,
4
4
  deviceLogin
5
- } from "./chunk-RKR55PPC.js";
5
+ } from "./chunk-UVB722OW.js";
6
6
  import {
7
7
  ApiError,
8
8
  ReauthError,
@@ -2,17 +2,17 @@
2
2
  import {
3
3
  findRun,
4
4
  ownHarness
5
- } from "./chunk-A5SHBJHU.js";
5
+ } from "./chunk-F4UQ2H5F.js";
6
6
  import {
7
7
  lockThreadsFile,
8
8
  threadsFilePath
9
- } from "./chunk-Z7WF67JW.js";
9
+ } from "./chunk-6F2ZM5H3.js";
10
10
  import {
11
11
  localRunsFilePath,
12
12
  readRunRecords,
13
13
  runHarness,
14
14
  takeoverSummary
15
- } from "./chunk-TNNAPOD5.js";
15
+ } from "./chunk-NVESLEXA.js";
16
16
  import {
17
17
  shortMachineName
18
18
  } from "./chunk-NTXQLEMQ.js";
@@ -63,26 +63,80 @@ function serviceIdentity(kind, env) {
63
63
  };
64
64
  }
65
65
 
66
+ // src/runner-config.ts
67
+ import { chmodSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
68
+ import { dirname, join as join2 } from "path";
69
+ var BOX_FILE = "box.json";
70
+ function boxPath(env = runnerEnvironment()) {
71
+ return runnerPath(env, process.env.CLOOP_BOX_FILE, (dir) => join2(dir, BOX_FILE));
72
+ }
73
+ function isLocal(cfg) {
74
+ return cfg.driver === "claude-code" || cfg.driver === "codex";
75
+ }
76
+ function isHosted(cfg) {
77
+ return cfg.driver === "cloudroom";
78
+ }
79
+ function isT3(cfg) {
80
+ return cfg.driver === void 0 || cfg.driver === "t3";
81
+ }
82
+ function showsOtherThreads(cfg) {
83
+ return cfg?.hideOtherThreads !== true;
84
+ }
85
+ function otherThreadsChoice(argv, previous) {
86
+ if (argv.includes("--hide-other-threads")) return true;
87
+ if (argv.includes("--show-other-threads")) return false;
88
+ return previous?.hideOtherThreads === true;
89
+ }
90
+ function readRunnerConfig(env) {
91
+ let parsed;
92
+ try {
93
+ parsed = JSON.parse(readFileSync(boxPath(env), "utf-8"));
94
+ } catch {
95
+ return null;
96
+ }
97
+ if (parsed.driver === "claude-code" || parsed.driver === "codex") {
98
+ const ok = typeof parsed.deviceToken === "string" && typeof parsed.environmentId === "string" && typeof parsed.bin === "string" && Array.isArray(parsed.repos);
99
+ return ok ? parsed : null;
100
+ }
101
+ if (parsed.driver === "cloudroom") {
102
+ const ok = ["harness", "coreUrl", "coreToken", "deviceToken", "origin", "environmentId"].every(
103
+ (key) => typeof parsed[key] === "string" && parsed[key]
104
+ );
105
+ return ok && /^[a-z0-9-]{1,40}$/.test(parsed.harness) ? parsed : null;
106
+ }
107
+ if (typeof parsed.t3Url !== "string" || typeof parsed.token !== "string") return null;
108
+ return parsed;
109
+ }
110
+ function writeBoxConfig(cfg) {
111
+ const path = boxPath();
112
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
113
+ const temp = `${path}.${process.pid}.tmp`;
114
+ writeFileSync(temp, `${JSON.stringify(cfg, null, 2)}
115
+ `, { mode: 384 });
116
+ chmodSync(temp, 384);
117
+ renameSync(temp, path);
118
+ }
119
+
66
120
  // src/run-log.ts
67
121
  import {
68
122
  appendFileSync,
69
- chmodSync,
70
- mkdirSync,
123
+ chmodSync as chmodSync2,
124
+ mkdirSync as mkdirSync2,
71
125
  readdirSync,
72
- renameSync,
126
+ renameSync as renameSync2,
73
127
  statSync,
74
128
  unlinkSync
75
129
  } from "fs";
76
- import { dirname, join as join2 } from "path";
130
+ import { dirname as dirname2, join as join3 } from "path";
77
131
  var RUN_LOG_LINE_MAX = 500;
78
132
  var RUN_LOG_MAX_BYTES = 5 * 1024 * 1024;
79
133
  var RUN_LOG_KEEP_MS = 14 * 24 * 36e5;
80
134
  var SAFE_ID = /^[\w-]{1,100}$/;
81
135
  function runLogDir(runsFile) {
82
- return join2(dirname(runsFile), "runs");
136
+ return join3(dirname2(runsFile), "runs");
83
137
  }
84
138
  function runLogPath(dir, workId) {
85
- return SAFE_ID.test(workId) ? join2(dir, `${workId}.log`) : null;
139
+ return SAFE_ID.test(workId) ? join3(dir, `${workId}.log`) : null;
86
140
  }
87
141
  var SECRETS = [
88
142
  [/-----BEGIN [A-Z ]*PRIVATE KEY-----.*/g, "[redacted private key]"],
@@ -143,18 +197,18 @@ function appendRunLog(dir, workId, text3, { now = Date.now(), maxBytes = RUN_LOG
143
197
  if (!path) return;
144
198
  const line = `${stamp(now)} ${logText(text3)}
145
199
  `;
146
- mkdirSync(dir, { recursive: true, mode: 448 });
200
+ mkdirSync2(dir, { recursive: true, mode: 448 });
147
201
  const size = sizeOf(path);
148
- if (size > 0 && size + Buffer.byteLength(line) > maxBytes) renameSync(path, `${path}.1`);
202
+ if (size > 0 && size + Buffer.byteLength(line) > maxBytes) renameSync2(path, `${path}.1`);
149
203
  appendFileSync(path, line, { mode: 384 });
150
204
  }
151
205
  function pruneRunLogs(dir, now = Date.now(), keepMs = RUN_LOG_KEEP_MS) {
152
- mkdirSync(dir, { recursive: true, mode: 448 });
153
- chmodSync(dir, 448);
206
+ mkdirSync2(dir, { recursive: true, mode: 448 });
207
+ chmodSync2(dir, 448);
154
208
  let removed = 0;
155
209
  for (const name of readdirSync(dir)) {
156
210
  if (!/\.log(\.1)?$/.test(name)) continue;
157
- const path = join2(dir, name);
211
+ const path = join3(dir, name);
158
212
  try {
159
213
  if (statSync(path).mtimeMs < now - keepMs) {
160
214
  unlinkSync(path);
@@ -242,7 +296,7 @@ function windowsPowerShellEnv(env = process.env) {
242
296
  // src/t3-bin.ts
243
297
  import { execFileSync as execFileSync2 } from "child_process";
244
298
  import { existsSync, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
245
- import { join as join3 } from "path";
299
+ import { join as join4 } from "path";
246
300
  var CLEAN_ENV = () => ({
247
301
  HOME: process.env.HOME,
248
302
  USER: process.env.USER,
@@ -252,7 +306,7 @@ function defaultT3BinSources(home, stored) {
252
306
  return {
253
307
  env: process.env,
254
308
  home,
255
- appDirs: process.platform === "darwin" ? ["/Applications", join3(home, "Applications")] : [],
309
+ appDirs: process.platform === "darwin" ? ["/Applications", join4(home, "Applications")] : [],
256
310
  onPath: () => whichAll("t3"),
257
311
  ...stored ? { stored } : {}
258
312
  };
@@ -273,9 +327,9 @@ function bundleBinaries(appDir) {
273
327
  return [];
274
328
  }
275
329
  return bundles.flatMap((bundle) => {
276
- const root = join3(appDir, bundle);
330
+ const root = join4(appDir, bundle);
277
331
  try {
278
- return readdirSync2(root, { recursive: true }).filter((rel) => rel === "t3" || rel.endsWith("/t3")).map((rel) => join3(root, rel)).filter(isExecutable);
332
+ return readdirSync2(root, { recursive: true }).filter((rel) => rel === "t3" || rel.endsWith("/t3")).map((rel) => join4(root, rel)).filter(isExecutable);
279
333
  } catch {
280
334
  return [];
281
335
  }
@@ -284,8 +338,8 @@ function bundleBinaries(appDir) {
284
338
  function t3Candidates(serverVersion, sources) {
285
339
  const ordered = [
286
340
  sources.env.T3_BIN,
287
- join3(sources.home, ".t3", "runtime", "versions", serverVersion, "t3"),
288
- join3(sources.env.T3CODE_HOME || join3(sources.home, ".t3"), "bin", "t3"),
341
+ join4(sources.home, ".t3", "runtime", "versions", serverVersion, "t3"),
342
+ join4(sources.env.T3CODE_HOME || join4(sources.home, ".t3"), "bin", "t3"),
289
343
  ...sources.appDirs.flatMap(bundleBinaries),
290
344
  ...sources.onPath(),
291
345
  sources.stored
@@ -1880,9 +1934,9 @@ ${RESULT_INSTRUCTION}`
1880
1934
 
1881
1935
  // src/drivers/local.ts
1882
1936
  import { execFile as execFile2, execFileSync as execFileSync4, spawn } from "child_process";
1883
- import { chmodSync as chmodSync2, mkdirSync as mkdirSync2, readFileSync, renameSync as renameSync2, writeFileSync } from "fs";
1937
+ import { chmodSync as chmodSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync2, renameSync as renameSync3, writeFileSync as writeFileSync2 } from "fs";
1884
1938
  import { hostname } from "os";
1885
- import { basename, dirname as dirname2, join as join4 } from "path";
1939
+ import { basename, dirname as dirname3, join as join5 } from "path";
1886
1940
  import { createInterface } from "readline";
1887
1941
 
1888
1942
  // src/drivers/harness-check.ts
@@ -1968,7 +2022,7 @@ function failedEnd(harness, run2) {
1968
2022
  return { summary: `${lead}${quoted}"`, ...error };
1969
2023
  }
1970
2024
  function localRunsFilePath(env) {
1971
- return runnerPath(env, process.env.CLOOP_LOCAL_RUNS_FILE, (dir) => join4(dir, "local-runs.json"));
2025
+ return runnerPath(env, process.env.CLOOP_LOCAL_RUNS_FILE, (dir) => join5(dir, "local-runs.json"));
1972
2026
  }
1973
2027
  function pickRepo(repos, repository) {
1974
2028
  if (!repository) {
@@ -2677,17 +2731,17 @@ ${RESULT_INSTRUCTION}`));
2677
2731
  return readRunRecords(this.file).filter((r) => !(r.end && Date.parse(r.end.at) < cutoff));
2678
2732
  }
2679
2733
  save() {
2680
- mkdirSync2(dirname2(this.file), { recursive: true, mode: 448 });
2734
+ mkdirSync3(dirname3(this.file), { recursive: true, mode: 448 });
2681
2735
  const tmp = `${this.file}.tmp`;
2682
- writeFileSync(tmp, `${JSON.stringify([...this.runs.values()], null, 2)}
2736
+ writeFileSync2(tmp, `${JSON.stringify([...this.runs.values()], null, 2)}
2683
2737
  `, { mode: 384 });
2684
- chmodSync2(tmp, 384);
2685
- renameSync2(tmp, this.file);
2738
+ chmodSync3(tmp, 384);
2739
+ renameSync3(tmp, this.file);
2686
2740
  }
2687
2741
  };
2688
2742
  function readRunRecords(file = localRunsFilePath()) {
2689
2743
  try {
2690
- const raw = JSON.parse(readFileSync(file, "utf-8"));
2744
+ const raw = JSON.parse(readFileSync2(file, "utf-8"));
2691
2745
  return Array.isArray(raw) ? raw.filter(
2692
2746
  (r) => typeof r?.work_id === "string" && typeof r?.repo === "string"
2693
2747
  ) : [];
@@ -2696,55 +2750,18 @@ function readRunRecords(file = localRunsFilePath()) {
2696
2750
  }
2697
2751
  }
2698
2752
 
2699
- // src/runner-config.ts
2700
- import { chmodSync as chmodSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync2, renameSync as renameSync3, writeFileSync as writeFileSync2 } from "fs";
2701
- import { dirname as dirname3, join as join5 } from "path";
2702
- var BOX_FILE = "box.json";
2703
- function boxPath(env = runnerEnvironment()) {
2704
- return runnerPath(env, process.env.CLOOP_BOX_FILE, (dir) => join5(dir, BOX_FILE));
2705
- }
2706
- function isLocal(cfg) {
2707
- return cfg.driver === "claude-code" || cfg.driver === "codex";
2708
- }
2709
- function showsOtherThreads(cfg) {
2710
- return cfg?.hideOtherThreads !== true;
2711
- }
2712
- function otherThreadsChoice(argv, previous) {
2713
- if (argv.includes("--hide-other-threads")) return true;
2714
- if (argv.includes("--show-other-threads")) return false;
2715
- return previous?.hideOtherThreads === true;
2716
- }
2717
- function readRunnerConfig(env) {
2718
- let parsed;
2719
- try {
2720
- parsed = JSON.parse(readFileSync2(boxPath(env), "utf-8"));
2721
- } catch {
2722
- return null;
2723
- }
2724
- if (parsed.driver === "claude-code" || parsed.driver === "codex") {
2725
- const ok = typeof parsed.deviceToken === "string" && typeof parsed.environmentId === "string" && typeof parsed.bin === "string" && Array.isArray(parsed.repos);
2726
- return ok ? parsed : null;
2727
- }
2728
- if (typeof parsed.t3Url !== "string" || typeof parsed.token !== "string") return null;
2729
- return parsed;
2730
- }
2731
- function writeBoxConfig(cfg) {
2732
- const path = boxPath();
2733
- mkdirSync3(dirname3(path), { recursive: true, mode: 448 });
2734
- const temp = `${path}.${process.pid}.tmp`;
2735
- writeFileSync2(temp, `${JSON.stringify(cfg, null, 2)}
2736
- `, { mode: 384 });
2737
- chmodSync3(temp, 384);
2738
- renameSync3(temp, path);
2739
- }
2740
-
2741
2753
  export {
2754
+ RESULT_INSTRUCTION,
2755
+ resultPrUrl,
2756
+ readRunResult,
2742
2757
  RUNTIME_MODES,
2743
2758
  BoxToolError,
2744
2759
  CLOOP_THREAD_PREFIX,
2745
2760
  questionLine,
2746
2761
  RUN_TEXT_MAX,
2762
+ nextProgress,
2747
2763
  isYes,
2764
+ HARNESS_LIMIT,
2748
2765
  ENVIRONMENTS,
2749
2766
  environmentOf,
2750
2767
  runnerEnvironment,
@@ -2752,6 +2769,14 @@ export {
2752
2769
  runnerPath,
2753
2770
  cloopCommand,
2754
2771
  serviceIdentity,
2772
+ boxPath,
2773
+ isLocal,
2774
+ isHosted,
2775
+ isT3,
2776
+ showsOtherThreads,
2777
+ otherThreadsChoice,
2778
+ readRunnerConfig,
2779
+ writeBoxConfig,
2755
2780
  runLogDir,
2756
2781
  runLogPath,
2757
2782
  STOPPED_SUMMARY,
@@ -2781,16 +2806,12 @@ export {
2781
2806
  addTokens,
2782
2807
  sortedDays,
2783
2808
  sourceKey,
2809
+ orderThreads,
2784
2810
  T3Driver,
2785
2811
  takeoverSummary,
2786
2812
  runHarness,
2813
+ failedEnd,
2787
2814
  localRunsFilePath,
2788
2815
  LocalDriver,
2789
- readRunRecords,
2790
- boxPath,
2791
- isLocal,
2792
- showsOtherThreads,
2793
- otherThreadsChoice,
2794
- readRunnerConfig,
2795
- writeBoxConfig
2816
+ readRunRecords
2796
2817
  };
@@ -3,7 +3,7 @@ import {
3
3
  readRunnerState,
4
4
  runnerStatePath,
5
5
  threadsFilePath
6
- } from "./chunk-Z7WF67JW.js";
6
+ } from "./chunk-6F2ZM5H3.js";
7
7
  import {
8
8
  BoxToolError,
9
9
  CLOOP_THREAD_PREFIX,
@@ -19,6 +19,7 @@ import {
19
19
  defaultT3BinSources,
20
20
  environmentOf,
21
21
  exchangePairing,
22
+ isHosted,
22
23
  isLocal,
23
24
  isYes,
24
25
  localRunsFilePath,
@@ -37,7 +38,7 @@ import {
37
38
  windowsExecutable,
38
39
  windowsPowerShellEnv,
39
40
  writeBoxConfig
40
- } from "./chunk-TNNAPOD5.js";
41
+ } from "./chunk-NVESLEXA.js";
41
42
  import {
42
43
  getMachine,
43
44
  shortMachineName
@@ -55,17 +56,17 @@ import {
55
56
  } from "./chunk-R3CLO2FB.js";
56
57
  import {
57
58
  connectWebhook
58
- } from "./chunk-OZN4V4GC.js";
59
+ } from "./chunk-IXG4H623.js";
59
60
  import {
60
61
  ConnectFailure,
61
62
  connectReport,
62
63
  deviceLogin,
63
64
  newAttempt,
64
65
  sendConnectReport
65
- } from "./chunk-RKR55PPC.js";
66
+ } from "./chunk-UVB722OW.js";
66
67
  import {
67
68
  VERSION
68
- } from "./chunk-BKPSZTPK.js";
69
+ } from "./chunk-VH7XVQFJ.js";
69
70
  import {
70
71
  STAGING_ORIGIN,
71
72
  getOrigin,
@@ -325,7 +326,12 @@ var BOX_TOOLS = {
325
326
  if (parsed.resume) onResume?.(parsed.thread_id);
326
327
  return result;
327
328
  },
328
- "thread.interrupt": ({ driver }, args) => driver.interrupt(parseThreadId(args), parseCommandId(args))
329
+ "thread.interrupt": ({ driver }, args) => driver.interrupt(parseThreadId(args), parseCommandId(args)),
330
+ // Packs the skills before it answers, so an empty or oversized set is refused now; the upload runs on.
331
+ async "setup.share"({ setup }) {
332
+ if (!setup) throw new BoxToolError("cannot_share");
333
+ return setup.start();
334
+ }
329
335
  };
330
336
  function classifyError(err, driver = "t3") {
331
337
  if (err instanceof BoxToolError) return err.code;
@@ -2154,7 +2160,7 @@ function harnessesFound(found) {
2154
2160
  }
2155
2161
  var MODEL_LIST = /^[A-Za-z0-9][\w.:[\]-]*(,[A-Za-z0-9][\w.:[\]-]*)*$/;
2156
2162
  function rememberedDriver(previous) {
2157
- const chosen = previous?.chosenDriver;
2163
+ const chosen = previous && !isHosted(previous) ? previous.chosenDriver : void 0;
2158
2164
  return chosen && DRIVERS.includes(chosen) ? chosen : void 0;
2159
2165
  }
2160
2166
  var DRIVERS = ["t3", "claude-code", "codex"];
@@ -2435,6 +2441,7 @@ async function connectCommand(argv) {
2435
2441
 
2436
2442
  export {
2437
2443
  runBoxTool,
2444
+ SUBSCRIPTIONS,
2438
2445
  probeClaudePermissions,
2439
2446
  probeClaude,
2440
2447
  DEFAULT_FALLBACK_MODEL,
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-ES5BRAKJ.js";
6
6
  import {
7
7
  VERSION
8
- } from "./chunk-BKPSZTPK.js";
8
+ } from "./chunk-VH7XVQFJ.js";
9
9
  import {
10
10
  getOrigin,
11
11
  readCredentials,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/version.ts
4
- var VERSION = true ? "0.3.23" : "0.0.0-dev";
4
+ var VERSION = true ? "0.3.24" : "0.0.0-dev";
5
5
 
6
6
  export {
7
7
  VERSION
@@ -52,17 +52,17 @@ import {
52
52
  which,
53
53
  workFolder,
54
54
  workFolderLine
55
- } from "./chunk-IITOGOV7.js";
56
- import "./chunk-Z7WF67JW.js";
57
- import "./chunk-TNNAPOD5.js";
55
+ } from "./chunk-PQPWITU3.js";
56
+ import "./chunk-6F2ZM5H3.js";
57
+ import "./chunk-NVESLEXA.js";
58
58
  import "./chunk-NTXQLEMQ.js";
59
59
  import "./chunk-VK6GV757.js";
60
60
  import "./chunk-YEO27QQP.js";
61
61
  import "./chunk-R3CLO2FB.js";
62
- import "./chunk-OZN4V4GC.js";
63
- import "./chunk-RKR55PPC.js";
62
+ import "./chunk-IXG4H623.js";
63
+ import "./chunk-UVB722OW.js";
64
64
  import "./chunk-ES5BRAKJ.js";
65
- import "./chunk-BKPSZTPK.js";
65
+ import "./chunk-VH7XVQFJ.js";
66
66
  import "./chunk-D5UZW42X.js";
67
67
  export {
68
68
  DEFAULT_T3_URL,
@@ -7,17 +7,17 @@ import {
7
7
  runnerOrigin,
8
8
  stopService,
9
9
  unitOrigin
10
- } from "./chunk-IITOGOV7.js";
11
- import "./chunk-Z7WF67JW.js";
12
- import "./chunk-TNNAPOD5.js";
10
+ } from "./chunk-PQPWITU3.js";
11
+ import "./chunk-6F2ZM5H3.js";
12
+ import "./chunk-NVESLEXA.js";
13
13
  import "./chunk-NTXQLEMQ.js";
14
14
  import "./chunk-VK6GV757.js";
15
15
  import "./chunk-YEO27QQP.js";
16
16
  import "./chunk-R3CLO2FB.js";
17
- import "./chunk-OZN4V4GC.js";
18
- import "./chunk-RKR55PPC.js";
17
+ import "./chunk-IXG4H623.js";
18
+ import "./chunk-UVB722OW.js";
19
19
  import "./chunk-ES5BRAKJ.js";
20
- import "./chunk-BKPSZTPK.js";
20
+ import "./chunk-VH7XVQFJ.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-IITOGOV7.js";
6
- import "./chunk-Z7WF67JW.js";
7
- import "./chunk-TNNAPOD5.js";
5
+ } from "./chunk-PQPWITU3.js";
6
+ import "./chunk-6F2ZM5H3.js";
7
+ import "./chunk-NVESLEXA.js";
8
8
  import "./chunk-NTXQLEMQ.js";
9
9
  import "./chunk-VK6GV757.js";
10
10
  import "./chunk-YEO27QQP.js";
11
11
  import "./chunk-R3CLO2FB.js";
12
- import "./chunk-OZN4V4GC.js";
13
- import "./chunk-RKR55PPC.js";
12
+ import "./chunk-IXG4H623.js";
13
+ import "./chunk-UVB722OW.js";
14
14
  import "./chunk-ES5BRAKJ.js";
15
- import "./chunk-BKPSZTPK.js";
15
+ import "./chunk-VH7XVQFJ.js";
16
16
  import "./chunk-D5UZW42X.js";
17
17
  export {
18
18
  existingRunnerEnvironment,
@@ -68,7 +68,11 @@ function buildDigest(tasks, cloops, surface, now = /* @__PURE__ */ new Date()) {
68
68
  for (const c of cloops) if (c.id && c.label) labelById.set(c.id, c.label);
69
69
  const repo = repoCloop(cloops, surface);
70
70
  const repoLabel = repo?.label ? sanitizeLabel(repo.label, 40) : "";
71
- const header = `Cloop \u2014 ${tasks.length} open task${tasks.length === 1 ? "" : "s"}` + (cloops.length ? ` across ${cloops.length} cloops.` : ".") + (repoLabel ? ` This repo maps to cloop "${repoLabel}" (${repo?.open_loops ?? 0} open).` : "");
71
+ const header = [
72
+ `Cloop \u2014 ${tasks.length} open task${tasks.length === 1 ? "" : "s"}`,
73
+ cloops.length ? ` across ${cloops.length} cloops.` : ".",
74
+ repoLabel ? ` This repo maps to cloop "${repoLabel}" (${repo?.open_loops ?? 0} open).` : ""
75
+ ].join("");
72
76
  const ranked = tasks.map((task, i) => ({ task, i, s: score(task, repo?.id, now) })).sort((a, b) => b.s - a.s || a.i - b.i).slice(0, MAX_ITEMS).map(({ task }) => taskLine(task, labelById, now));
73
77
  const assemble = () => [header, TASKS_OPEN, ...ranked, TASKS_CLOSE, UNTRUSTED_NOTE, STANDING_INSTRUCTION].join("\n");
74
78
  while (ranked.length > 0 && assemble().length > CHAR_BUDGET) ranked.pop();
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-YEO27QQP.js";
5
5
  import {
6
6
  VERSION
7
- } from "./chunk-BKPSZTPK.js";
7
+ } from "./chunk-VH7XVQFJ.js";
8
8
  import {
9
9
  applyEnvironmentFlag
10
10
  } from "./chunk-D5UZW42X.js";
@@ -65,7 +65,7 @@ Add --staging to any command to use Cloop staging instead of production.
65
65
  A production runner and a staging runner can run side by side on one machine.
66
66
  `;
67
67
  async function pinExistingRunner() {
68
- const { pinExistingRunner: pin } = await import("./existing-runner-CO7FNUAW.js");
68
+ const { pinExistingRunner: pin } = await import("./existing-runner-4UYED6LY.js");
69
69
  const { note } = pin();
70
70
  if (note) console.error(note);
71
71
  }
@@ -73,7 +73,7 @@ async function main() {
73
73
  switch (command) {
74
74
  case "login":
75
75
  case "auth": {
76
- const { loginCommand } = await import("./login-ECXACUOZ.js");
76
+ const { loginCommand } = await import("./login-J3N7TYDI.js");
77
77
  await loginCommand(argv);
78
78
  break;
79
79
  }
@@ -83,61 +83,61 @@ async function main() {
83
83
  break;
84
84
  }
85
85
  case "serve": {
86
- const { startMcpServer } = await import("./mcp-server-FMYWDRGP.js");
86
+ const { startMcpServer } = await import("./mcp-server-HPMJRI6J.js");
87
87
  await startMcpServer();
88
88
  break;
89
89
  }
90
90
  case "statusline": {
91
- const { statuslineCommand } = await import("./statusline-TBZIUD3P.js");
91
+ const { statuslineCommand } = await import("./statusline-UIG25UUX.js");
92
92
  statuslineCommand();
93
93
  break;
94
94
  }
95
95
  case "connect": {
96
- const { connectCommand } = await import("./connect-5AYRHDDA.js");
96
+ const { connectCommand } = await import("./connect-7DUV7BMO.js");
97
97
  await connectCommand(argv.slice(1));
98
98
  break;
99
99
  }
100
100
  case "use": {
101
- const { useCommand } = await import("./use-W45QOQUI.js");
101
+ const { useCommand } = await import("./use-I2KUA64A.js");
102
102
  process.exitCode = await useCommand(argv.slice(1));
103
103
  break;
104
104
  }
105
105
  case "disconnect": {
106
- const { disconnectCommand } = await import("./disconnect-UEH44J7T.js");
106
+ const { disconnectCommand } = await import("./disconnect-IWGVQ2GZ.js");
107
107
  await disconnectCommand(argv.slice(1));
108
108
  break;
109
109
  }
110
110
  case "box": {
111
- const { boxCommand } = await import("./box-EUWQ7RT5.js");
111
+ const { boxCommand } = await import("./box-OGT2NRPJ.js");
112
112
  await boxCommand(argv.slice(1));
113
113
  break;
114
114
  }
115
115
  case "runs": {
116
116
  await pinExistingRunner();
117
- const { runsCommand } = await import("./runs-JCDJL7WU.js");
117
+ const { runsCommand } = await import("./runs-S3QKEWHY.js");
118
118
  process.exitCode = runsCommand();
119
119
  break;
120
120
  }
121
121
  case "watch": {
122
122
  await pinExistingRunner();
123
- const { watchCommand } = await import("./runs-JCDJL7WU.js");
123
+ const { watchCommand } = await import("./runs-S3QKEWHY.js");
124
124
  process.exitCode = await watchCommand(argv.slice(1));
125
125
  break;
126
126
  }
127
127
  case "takeover": {
128
128
  await pinExistingRunner();
129
- const { takeoverCommand } = await import("./takeover-2HUC4IOI.js");
129
+ const { takeoverCommand } = await import("./takeover-3U5V2KXY.js");
130
130
  process.exitCode = await takeoverCommand(argv.slice(1));
131
131
  break;
132
132
  }
133
133
  case "resume": {
134
134
  await pinExistingRunner();
135
- const { resumeCommand } = await import("./runs-JCDJL7WU.js");
135
+ const { resumeCommand } = await import("./runs-S3QKEWHY.js");
136
136
  process.exitCode = await resumeCommand(argv.slice(1));
137
137
  break;
138
138
  }
139
139
  case "runner": {
140
- const { runnerCommand } = await import("./runner-PV2WK3ZE.js");
140
+ const { runnerCommand } = await import("./runner-TMR3BBL5.js");
141
141
  await runnerCommand(argv.slice(1));
142
142
  break;
143
143
  }
@@ -146,7 +146,7 @@ async function main() {
146
146
  const { runnerPermissionHook } = await import("./read-permissions-SPOKGVLO.js");
147
147
  await runnerPermissionHook();
148
148
  } else if (argv[1] === "session-start") {
149
- const { hookSessionStart } = await import("./hook-session-start-DJ6W2NCO.js");
149
+ const { hookSessionStart } = await import("./hook-session-start-5JYNMGX4.js");
150
150
  await hookSessionStart();
151
151
  } else if (argv[1] === "activity") {
152
152
  const { hookActivity } = await import("./hook-activity-GAJ5NABA.js");
@@ -3,9 +3,9 @@ import {
3
3
  deviceLogin,
4
4
  loginCommand,
5
5
  refusalSentence
6
- } from "./chunk-RKR55PPC.js";
6
+ } from "./chunk-UVB722OW.js";
7
7
  import "./chunk-ES5BRAKJ.js";
8
- import "./chunk-BKPSZTPK.js";
8
+ import "./chunk-VH7XVQFJ.js";
9
9
  import "./chunk-D5UZW42X.js";
10
10
  export {
11
11
  deviceLogin,