@cloop/runner 0.3.18 → 0.3.22

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.
@@ -5,11 +5,10 @@ import {
5
5
  } from "./chunk-IJH4O27H.js";
6
6
  import {
7
7
  serveTakeovers
8
- } from "./chunk-7OBTF35R.js";
9
- import "./chunk-NNPOMXCM.js";
8
+ } from "./chunk-H4WR3GSK.js";
9
+ import "./chunk-A5SHBJHU.js";
10
10
  import {
11
11
  DEFAULT_FALLBACK_MODEL,
12
- T3Client,
13
12
  awaitDaemon,
14
13
  claudeDialect,
15
14
  cmdWord,
@@ -34,7 +33,7 @@ import {
34
33
  systemServices,
35
34
  unitFor,
36
35
  which
37
- } from "./chunk-HVXCQQWG.js";
36
+ } from "./chunk-P7LFM7AI.js";
38
37
  import {
39
38
  BoxWatch,
40
39
  lockThreadsFile,
@@ -42,19 +41,32 @@ import {
42
41
  runnerStatePath,
43
42
  threadsFilePath,
44
43
  writeRunnerState
45
- } from "./chunk-QINWGIXU.js";
44
+ } from "./chunk-Z7WF67JW.js";
46
45
  import {
46
+ BackgroundReading,
47
+ HARNESS_STALE_MS,
47
48
  LocalDriver,
49
+ T3Client,
48
50
  T3Driver,
51
+ TOKEN_DAYS,
52
+ TOKEN_SCOPE,
53
+ TOKEN_TTL_MS,
54
+ addTokens,
55
+ commandFor,
49
56
  isLocal,
57
+ quotaFromClaude,
58
+ quotaFromCodex,
50
59
  readRunnerConfig,
51
60
  runnerDir,
52
61
  runnerEnvironment,
53
62
  runnerPath,
54
63
  showsOtherThreads,
64
+ sortedDays,
65
+ sourceKey,
66
+ utcWindow,
55
67
  windowsPowerShellEnv,
56
68
  writeBoxConfig
57
- } from "./chunk-R22774MI.js";
69
+ } from "./chunk-TNNAPOD5.js";
58
70
  import {
59
71
  getMachine
60
72
  } from "./chunk-NTXQLEMQ.js";
@@ -63,38 +75,394 @@ import {
63
75
  olderThan
64
76
  } from "./chunk-YEO27QQP.js";
65
77
  import "./chunk-R3CLO2FB.js";
66
- import "./chunk-LORK2EOG.js";
67
- import "./chunk-EIBHDWUG.js";
78
+ import "./chunk-VKINCK5H.js";
79
+ import "./chunk-OF3PX5L2.js";
68
80
  import "./chunk-ES5BRAKJ.js";
69
81
  import {
70
82
  VERSION
71
- } from "./chunk-OBFJRACJ.js";
83
+ } from "./chunk-AJAVT5YZ.js";
72
84
  import {
73
85
  getMeshUrl,
74
86
  getToken,
75
87
  readCredentials
76
88
  } from "./chunk-D5UZW42X.js";
77
89
 
78
- // src/outside-sessions.ts
90
+ // src/drivers/local-usage.ts
91
+ import { spawn } from "child_process";
79
92
  import { createReadStream } from "fs";
80
- import { readdir, stat } from "fs/promises";
81
- import { homedir } from "os";
93
+ import { readdir, realpath, stat } from "fs/promises";
94
+ import { homedir, hostname, tmpdir } from "os";
82
95
  import { join } from "path";
83
96
  import { createInterface } from "readline";
97
+ var PROBE_TIMEOUT_MS = 1e4;
98
+ var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
99
+ var count = (v) => typeof v === "number" && Number.isFinite(v) && v > 0 ? v : 0;
100
+ var parse = (line) => {
101
+ try {
102
+ return JSON.parse(line);
103
+ } catch {
104
+ return void 0;
105
+ }
106
+ };
107
+ function askHarness(bin, args, requests, answer, timeoutMs = PROBE_TIMEOUT_MS) {
108
+ const command = commandFor(bin, args);
109
+ return new Promise((resolve, reject) => {
110
+ const child = spawn(command.file, command.args, {
111
+ cwd: tmpdir(),
112
+ stdio: ["pipe", "pipe", "ignore"],
113
+ env: process.env,
114
+ windowsHide: true,
115
+ ...command.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
116
+ });
117
+ let settled = false;
118
+ const finish = (err, value) => {
119
+ if (settled) return;
120
+ settled = true;
121
+ clearTimeout(timer);
122
+ child.stdin?.end();
123
+ child.kill();
124
+ setTimeout(() => {
125
+ if (child.exitCode === null && child.signalCode === null) child.kill("SIGKILL");
126
+ }, 2e3).unref();
127
+ if (err) reject(err);
128
+ else resolve(value);
129
+ };
130
+ const timer = setTimeout(
131
+ () => finish(new Error(`no answer in ${timeoutMs / 1e3} s`)),
132
+ timeoutMs
133
+ );
134
+ child.on("error", (err) => finish(err));
135
+ child.on("close", () => finish(new Error("it exited before it answered")));
136
+ child.stdin?.on("error", () => {
137
+ });
138
+ createInterface({ input: child.stdout }).on("line", (line) => {
139
+ const msg = parse(line);
140
+ const value = isObject(msg) ? answer(msg) : void 0;
141
+ if (value !== void 0) finish(null, value);
142
+ });
143
+ child.stdin?.write(requests.map((r) => `${JSON.stringify(r)}
144
+ `).join(""));
145
+ });
146
+ }
147
+ var reason = (err) => err?.message ?? "the probe failed";
148
+ async function probeClaudeQuota(bin = "claude", timeoutMs = PROBE_TIMEOUT_MS) {
149
+ const args = [
150
+ "--print",
151
+ "--verbose",
152
+ "--output-format",
153
+ "stream-json",
154
+ "--input-format",
155
+ "stream-json",
156
+ "--settings",
157
+ JSON.stringify({ disableAllHooks: true }),
158
+ "--strict-mcp-config",
159
+ "--no-session-persistence",
160
+ "--disable-slash-commands"
161
+ ];
162
+ const request = (id, request2) => ({
163
+ type: "control_request",
164
+ request_id: id,
165
+ request: request2
166
+ });
167
+ try {
168
+ const response = await askHarness(
169
+ bin,
170
+ args,
171
+ [
172
+ request("cloop-init", { subtype: "initialize" }),
173
+ request("cloop-usage", { subtype: "get_usage", skip_behaviors: true })
174
+ ],
175
+ (msg) => {
176
+ const r = msg.type === "control_response" ? msg.response : void 0;
177
+ return isObject(r) && r.request_id === "cloop-usage" ? r : void 0;
178
+ },
179
+ timeoutMs
180
+ );
181
+ return quotaFromClaude(response, (/* @__PURE__ */ new Date()).toISOString());
182
+ } catch (err) {
183
+ return quotaFromClaude({ subtype: "error", error: reason(err) }, (/* @__PURE__ */ new Date()).toISOString());
184
+ }
185
+ }
186
+ async function probeCodexQuota(bin = "codex", timeoutMs = PROBE_TIMEOUT_MS) {
187
+ try {
188
+ const answer = await askHarness(
189
+ bin,
190
+ ["app-server"],
191
+ [
192
+ {
193
+ id: 1,
194
+ method: "initialize",
195
+ params: { clientInfo: { name: "cloop-runner", version: VERSION } }
196
+ },
197
+ { method: "initialized" },
198
+ { id: 2, method: "account/rateLimits/read" }
199
+ ],
200
+ (msg) => msg.id === 2 ? msg : void 0,
201
+ timeoutMs
202
+ );
203
+ return quotaFromCodex(answer, (/* @__PURE__ */ new Date()).toISOString());
204
+ } catch (err) {
205
+ return quotaFromCodex({ error: { message: reason(err) } }, (/* @__PURE__ */ new Date()).toISOString());
206
+ }
207
+ }
208
+ async function listLogs(dir, depth, match, found) {
209
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
210
+ const path = join(dir, entry.name);
211
+ if (entry.isFile() && match(entry.name)) found.files.push(path);
212
+ else if (entry.isDirectory() && depth > 1)
213
+ await listLogs(path, depth - 1, match, found).catch(() => {
214
+ found.skipped++;
215
+ });
216
+ }
217
+ }
218
+ async function readLines(file, read) {
219
+ let malformed = 0;
220
+ let lastBad = false;
221
+ const lines = createInterface({
222
+ input: createReadStream(file, "utf-8"),
223
+ crlfDelay: Number.POSITIVE_INFINITY
224
+ });
225
+ for await (const line of lines) {
226
+ lastBad = !read(line);
227
+ if (lastBad) malformed++;
228
+ }
229
+ return lastBad ? malformed - 1 : malformed;
230
+ }
231
+ function dayOf(v) {
232
+ const ms = typeof v === "string" ? Date.parse(v) : Number.NaN;
233
+ return Number.isFinite(ms) ? new Date(ms).toISOString().slice(0, 10) : null;
234
+ }
235
+ var inWindow = (day, w) => day >= w.sinceDay && day <= w.untilDay;
236
+ function claudeReader(window, days) {
237
+ const calls = /* @__PURE__ */ new Map();
238
+ return {
239
+ read: (line) => {
240
+ if (!line.includes('"assistant"')) return true;
241
+ const d = parse(line);
242
+ if (d === void 0) return false;
243
+ if (!isObject(d) || d.type !== "assistant") return true;
244
+ const m = d.message;
245
+ const u = isObject(m) ? m.usage : void 0;
246
+ if (!isObject(m) || !isObject(u) || m.model === "<synthetic>") return true;
247
+ const day = dayOf(d.timestamp);
248
+ if (!day) return false;
249
+ if (!inWindow(day, window)) return true;
250
+ const details = isObject(u.output_tokens_details) ? u.output_tokens_details : {};
251
+ const call = {
252
+ day,
253
+ uncached: count(u.input_tokens),
254
+ cached: count(u.cache_read_input_tokens),
255
+ creation: count(u.cache_creation_input_tokens),
256
+ output: count(u.output_tokens),
257
+ reasoning: count(details.thinking_tokens),
258
+ records: 1
259
+ };
260
+ if (typeof m.id !== "string") addTokens(days, day, "claude", call);
261
+ else {
262
+ const key = `${m.id} ${String(d.requestId ?? "")}`;
263
+ const seen2 = calls.get(key);
264
+ if (!seen2 || call.output >= seen2.output) calls.set(key, call);
265
+ }
266
+ return true;
267
+ },
268
+ finish: () => {
269
+ for (const call of calls.values()) addTokens(days, call.day, "claude", call);
270
+ }
271
+ };
272
+ }
273
+ function codexReader(window, days) {
274
+ return () => {
275
+ let prev = { input: 0, cached: 0, write: 0, output: 0, reasoning: 0 };
276
+ return (line) => {
277
+ if (!line.includes('"token_count"')) return true;
278
+ const d = parse(line);
279
+ if (d === void 0) return false;
280
+ const p = isObject(d) ? d.payload : void 0;
281
+ if (!isObject(p) || p.type !== "token_count") return true;
282
+ if (p.info === null || p.info === void 0) return true;
283
+ const t = isObject(p.info) ? p.info.total_token_usage : void 0;
284
+ const day = isObject(d) ? dayOf(d.timestamp) : null;
285
+ if (!isObject(t) || !day) return false;
286
+ const cur = {
287
+ input: count(t.input_tokens),
288
+ cached: count(t.cached_input_tokens),
289
+ write: count(t.cache_write_input_tokens),
290
+ output: count(t.output_tokens),
291
+ reasoning: count(t.reasoning_output_tokens)
292
+ };
293
+ if (cur.input + cur.output <= prev.input + prev.output) return true;
294
+ const rise = (k) => Math.max(0, cur[k] - prev[k]);
295
+ if (inWindow(day, window))
296
+ addTokens(days, day, "codex", {
297
+ uncached: Math.max(0, rise("input") - rise("cached") - rise("write")),
298
+ cached: rise("cached"),
299
+ creation: rise("write"),
300
+ output: rise("output"),
301
+ reasoning: rise("reasoning"),
302
+ records: 1
303
+ });
304
+ prev = cur;
305
+ return true;
306
+ };
307
+ };
308
+ }
309
+ async function scanSource(source, sinceMs) {
310
+ const key = sourceKey([
311
+ hostname(),
312
+ source.provider,
313
+ await realpath(source.home).catch(() => source.home)
314
+ ]);
315
+ const base = { source_key: key, provider: source.provider };
316
+ const found = { files: [], skipped: 0 };
317
+ for (const [i, root] of source.roots.entries()) {
318
+ try {
319
+ await listLogs(root.dir, root.depth, source.match, found);
320
+ } catch (err) {
321
+ const code = err.code;
322
+ if (i > 0 && code === "ENOENT") continue;
323
+ const empty = { scanned_files: 0, skipped_files: 0, malformed_records: 0 };
324
+ return code === "ENOENT" ? { ...base, status: "missing", ...empty } : {
325
+ ...base,
326
+ status: "failed",
327
+ ...empty,
328
+ message: `The log folder could not be read (${code ?? "error"}).`
329
+ };
330
+ }
331
+ }
332
+ let scanned = 0;
333
+ let skipped = found.skipped;
334
+ let malformed = 0;
335
+ for (const file of found.files) {
336
+ try {
337
+ if ((await stat(file)).mtimeMs < sinceMs) continue;
338
+ malformed += await readLines(file, source.reader());
339
+ scanned++;
340
+ } catch {
341
+ skipped++;
342
+ }
343
+ }
344
+ return {
345
+ ...base,
346
+ status: skipped || malformed ? "partial" : "ok",
347
+ scanned_files: scanned,
348
+ skipped_files: skipped,
349
+ malformed_records: malformed
350
+ };
351
+ }
352
+ async function scanTokenUsage(opts = {}) {
353
+ const window = utcWindow(opts.now ?? Date.now(), TOKEN_DAYS);
354
+ const sinceMs = Date.parse(`${window.sinceDay}T00:00:00Z`);
355
+ const days = /* @__PURE__ */ new Map();
356
+ const claudeHome = opts.claudeHome ?? (process.env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude"));
357
+ const codexHome = opts.codexHome ?? (process.env.CODEX_HOME || join(homedir(), ".codex"));
358
+ const claude = claudeReader(window, days);
359
+ const sources = [
360
+ await scanSource(
361
+ {
362
+ provider: "claude",
363
+ home: claudeHome,
364
+ // projects/<project>/<session>.jsonl and projects/<project>/<session>/subagents/agent-*.jsonl
365
+ roots: [{ dir: join(claudeHome, "projects"), depth: 4 }],
366
+ match: (name) => name.endsWith(".jsonl"),
367
+ reader: () => claude.read
368
+ },
369
+ sinceMs
370
+ ),
371
+ await scanSource(
372
+ {
373
+ provider: "codex",
374
+ home: codexHome,
375
+ roots: [
376
+ { dir: join(codexHome, "sessions"), depth: 4 },
377
+ { dir: join(codexHome, "archived_sessions"), depth: 1 }
378
+ ],
379
+ match: (name) => name.startsWith("rollout-") && name.endsWith(".jsonl"),
380
+ reader: codexReader(window, days)
381
+ },
382
+ sinceMs
383
+ )
384
+ ];
385
+ claude.finish();
386
+ const partial = sources.some((s) => s.status === "partial" || s.status === "failed");
387
+ return {
388
+ status: partial ? "partial" : "ok",
389
+ scope: TOKEN_SCOPE,
390
+ window: { since_day: window.sinceDay, until_day: window.untilDay, time_zone: "UTC" },
391
+ read_at: (/* @__PURE__ */ new Date()).toISOString(),
392
+ by_day: sortedDays(days),
393
+ sources
394
+ };
395
+ }
396
+ var LocalUsage = class {
397
+ constructor(deps) {
398
+ this.deps = deps;
399
+ this.tokens = new BackgroundReading({
400
+ ttlMs: TOKEN_TTL_MS,
401
+ read: () => this.scan(),
402
+ now: deps.now
403
+ });
404
+ }
405
+ deps;
406
+ quotas = /* @__PURE__ */ new Map();
407
+ tokens;
408
+ /** The quota of a signed-in harness, probed at most once per harness check period. */
409
+ quota(harness) {
410
+ const probe = this.deps.probes[harness];
411
+ if (!probe) return { status: "not_reported" };
412
+ let reading = this.quotas.get(harness);
413
+ if (!reading) {
414
+ reading = new BackgroundReading({
415
+ ttlMs: HARNESS_STALE_MS,
416
+ read: async () => {
417
+ const q = await probe();
418
+ if (q.status === "probe_failed")
419
+ this.deps.log?.(`quota probe failed harness=${harness}: ${q.message ?? ""}`);
420
+ return q;
421
+ },
422
+ now: this.deps.now
423
+ });
424
+ this.quotas.set(harness, reading);
425
+ }
426
+ return reading.get();
427
+ }
428
+ /** Token counts from the last log scan, rescanned at most every TOKEN_TTL_MS. */
429
+ tokenUsage() {
430
+ return this.tokens.get();
431
+ }
432
+ async scan() {
433
+ const now = this.deps.now ?? Date.now;
434
+ const started = now();
435
+ try {
436
+ const usage = await (this.deps.scan ?? scanTokenUsage)();
437
+ this.deps.log?.(`token scan took ${now() - started} ms status=${usage.status}`);
438
+ return usage;
439
+ } catch (err) {
440
+ this.deps.log?.(`token scan failed: ${err?.message}`);
441
+ return { status: "unavailable", reason: "The agent logs could not be read" };
442
+ }
443
+ }
444
+ };
445
+
446
+ // src/outside-sessions.ts
447
+ import { createReadStream as createReadStream2 } from "fs";
448
+ import { readdir as readdir2, stat as stat2 } from "fs/promises";
449
+ import { homedir as homedir2 } from "os";
450
+ import { join as join2 } from "path";
451
+ import { createInterface as createInterface2 } from "readline";
84
452
  var seen = /* @__PURE__ */ new Map();
85
453
  var UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;
86
- async function listOutsideSessions(root = join(homedir(), ".claude", "projects"), own = /* @__PURE__ */ new Set(), now = Date.now()) {
454
+ async function listOutsideSessions(root = join2(homedir2(), ".claude", "projects"), own = /* @__PURE__ */ new Set(), now = Date.now()) {
87
455
  const files = [];
88
- for (const project of await readdir(root, { withFileTypes: true }).catch(() => [])) {
456
+ for (const project of await readdir2(root, { withFileTypes: true }).catch(() => [])) {
89
457
  if (!project.isDirectory()) continue;
90
- for (const entry of await readdir(join(root, project.name), { withFileTypes: true }).catch(
458
+ for (const entry of await readdir2(join2(root, project.name), { withFileTypes: true }).catch(
91
459
  () => []
92
460
  )) {
93
461
  if (!entry.isFile() || !entry.name.endsWith(".jsonl")) continue;
94
462
  const id = entry.name.slice(0, -6);
95
463
  if (!UUID.test(id) || own.has(id)) continue;
96
- const path = join(root, project.name, entry.name);
97
- const info = await stat(path).catch(() => null);
464
+ const path = join2(root, project.name, entry.name);
465
+ const info = await stat2(path).catch(() => null);
98
466
  if (info && info.mtimeMs >= now - 7 * 864e5)
99
467
  files.push({ id, project: project.name.slice(0, 200), file: path, mtime: info.mtimeMs });
100
468
  }
@@ -107,8 +475,8 @@ async function listOutsideSessions(root = join(homedir(), ".claude", "projects")
107
475
  let title = known?.mtime === file.mtime ? known.title : void 0;
108
476
  let cwd = known?.mtime === file.mtime ? known.cwd : void 0;
109
477
  if (known?.mtime !== file.mtime) {
110
- const stream = createReadStream(file.file, { encoding: "utf8" });
111
- const lines = createInterface({ input: stream, crlfDelay: Number.POSITIVE_INFINITY });
478
+ const stream = createReadStream2(file.file, { encoding: "utf8" });
479
+ const lines = createInterface2({ input: stream, crlfDelay: Number.POSITIVE_INFINITY });
112
480
  try {
113
481
  for await (const line of lines) {
114
482
  if (!cwd && line.includes('"cwd"')) {
@@ -150,7 +518,7 @@ async function listOutsideSessions(root = join(homedir(), ".claude", "projects")
150
518
  }
151
519
 
152
520
  // src/update.ts
153
- import { execFile, spawn } from "child_process";
521
+ import { execFile, spawn as spawn2 } from "child_process";
154
522
  import {
155
523
  closeSync,
156
524
  mkdirSync,
@@ -160,8 +528,8 @@ import {
160
528
  rmSync,
161
529
  writeFileSync
162
530
  } from "fs";
163
- import { homedir as homedir2 } from "os";
164
- import { dirname, join as join2 } from "path";
531
+ import { homedir as homedir3 } from "os";
532
+ import { dirname, join as join3 } from "path";
165
533
  var REGISTRY_LATEST = "https://registry.npmjs.org/@cloop/runner/latest";
166
534
  var FIRST_CHECK_MS = 10 * 6e4;
167
535
  var CHECK_EVERY_MS = 6 * 36e5;
@@ -201,10 +569,10 @@ function updateDir(env) {
201
569
  return runnerPath(env, process.env.CLOOP_UPDATE_DIR, (dir) => dir);
202
570
  }
203
571
  function updateLogPath() {
204
- return join2(updateDir(), "update.log");
572
+ return join3(updateDir(), "update.log");
205
573
  }
206
574
  function statePath(env) {
207
- return join2(updateDir(env), "update.json");
575
+ return join3(updateDir(env), "update.json");
208
576
  }
209
577
  function readFailed() {
210
578
  try {
@@ -252,7 +620,7 @@ var adoptWords = (npx, to, kind) => [
252
620
  kind
253
621
  ];
254
622
  function adoptScriptPath() {
255
- return join2(updateDir(), "adopt.cmd");
623
+ return join3(updateDir(), "adopt.cmd");
256
624
  }
257
625
  function adoptScript(npx, to, kind, log3) {
258
626
  return [
@@ -266,7 +634,7 @@ function servicePath(kind, platform) {
266
634
  platform,
267
635
  kind,
268
636
  environment: runnerEnvironment(),
269
- home: homedir2(),
637
+ home: homedir3(),
270
638
  uid: process.getuid?.() ?? 0,
271
639
  ...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {}
272
640
  }).path;
@@ -326,7 +694,7 @@ function selfUpdate(kind, platform = process.platform) {
326
694
  }
327
695
  handing = true;
328
696
  log(`handing over ${VERSION} -> ${to}; its log is ${updateLogPath()}`);
329
- const child = spawn(
697
+ const child = spawn2(
330
698
  command,
331
699
  args,
332
700
  platform === "win32" ? { stdio: "ignore", windowsHide: true, env: windowsPowerShellEnv() } : { detached: true, stdio: ["ignore", fd, fd] }
@@ -388,7 +756,7 @@ async function adopt(from, kind, { services: given, script = process.argv[1] ??
388
756
  const where = {
389
757
  platform: services.platform,
390
758
  kind,
391
- home: homedir2(),
759
+ home: homedir3(),
392
760
  uid: process.getuid?.() ?? 0,
393
761
  ...process.env.CLOOP_UNIT_DIR ? { dir: process.env.CLOOP_UNIT_DIR } : {}
394
762
  };
@@ -498,6 +866,13 @@ async function localDriver(cfg, name) {
498
866
  repos: cfg.repos,
499
867
  label: cfg.label,
500
868
  harnesses: () => machineHarnesses(cfg),
869
+ usage: new LocalUsage({
870
+ probes: {
871
+ "claude-code": () => probeClaudeQuota(cfg.driver === "claude-code" ? cfg.bin : void 0),
872
+ codex: () => probeCodexQuota(cfg.driver === "codex" ? cfg.bin : void 0)
873
+ },
874
+ log: log2
875
+ }),
501
876
  log: log2
502
877
  });
503
878
  driver.warmHarnesses();
@@ -9,7 +9,7 @@ import {
9
9
  runHarness,
10
10
  runLogDir,
11
11
  runLogPath
12
- } from "./chunk-R22774MI.js";
12
+ } from "./chunk-TNNAPOD5.js";
13
13
  import {
14
14
  sanitizeLabel,
15
15
  stripControl
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/version.ts
4
- var VERSION = true ? "0.3.18" : "0.0.0-dev";
4
+ var VERSION = true ? "0.3.22" : "0.0.0-dev";
5
5
 
6
6
  export {
7
7
  VERSION
@@ -2,17 +2,17 @@
2
2
  import {
3
3
  findRun,
4
4
  ownHarness
5
- } from "./chunk-NNPOMXCM.js";
5
+ } from "./chunk-A5SHBJHU.js";
6
6
  import {
7
7
  lockThreadsFile,
8
8
  threadsFilePath
9
- } from "./chunk-QINWGIXU.js";
9
+ } from "./chunk-Z7WF67JW.js";
10
10
  import {
11
11
  localRunsFilePath,
12
12
  readRunRecords,
13
13
  runHarness,
14
14
  takeoverSummary
15
- } from "./chunk-R22774MI.js";
15
+ } from "./chunk-TNNAPOD5.js";
16
16
  import {
17
17
  shortMachineName
18
18
  } from "./chunk-NTXQLEMQ.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-ES5BRAKJ.js";
6
6
  import {
7
7
  VERSION
8
- } from "./chunk-OBFJRACJ.js";
8
+ } from "./chunk-AJAVT5YZ.js";
9
9
  import {
10
10
  getOrigin,
11
11
  readCredentials,
@@ -38,6 +38,7 @@ function newAttempt(now = Date.now()) {
38
38
  fellBack: false,
39
39
  workFolder: false,
40
40
  codexInstall: null,
41
+ codexInstallReason: null,
41
42
  claudeInstall: null,
42
43
  mcpRegistered: [],
43
44
  mcpSignedIn: [],
@@ -60,6 +61,7 @@ function connectReport(attempt, error, machine, now = Date.now()) {
60
61
  fell_back: attempt.fellBack,
61
62
  work_folder: attempt.workFolder,
62
63
  codex_install: attempt.codexInstall,
64
+ codex_install_reason: attempt.codexInstallReason,
63
65
  claude_install: attempt.claudeInstall,
64
66
  mcp_registered: attempt.mcpRegistered,
65
67
  mcp_signed_in: attempt.mcpSignedIn,