lobstah 0.7.10 → 0.8.0

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.
package/dist/runner.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // packages/runner/src/index.ts
2
- import * as fs29 from "node:fs";
3
- import * as path25 from "node:path";
2
+ import * as fs30 from "node:fs";
3
+ import * as path26 from "node:path";
4
4
 
5
5
  // packages/core/dist/types.js
6
6
  var VERBS = ["working", "needs-decision", "blocked", "paused", "done", "failed"];
@@ -9,8 +9,8 @@ var WAITING_ON = ["review", "pr", "deploy", "person", "external"];
9
9
  var WAITING_ON_VERBS = ["paused", "needs-decision", "blocked"];
10
10
 
11
11
  // packages/core/dist/queue.js
12
- import * as fs22 from "node:fs";
13
- import * as path18 from "node:path";
12
+ import * as fs23 from "node:fs";
13
+ import * as path19 from "node:path";
14
14
 
15
15
  // packages/core/dist/paths.js
16
16
  import * as os from "node:os";
@@ -36,8 +36,8 @@ function readDirIfPresent(dir) {
36
36
  try {
37
37
  return fs.readdirSync(dir);
38
38
  } catch (e) {
39
- const code = e.code;
40
- if (code === "ENOENT" || code === "ENOTDIR")
39
+ const code2 = e.code;
40
+ if (code2 === "ENOENT" || code2 === "ENOTDIR")
41
41
  return [];
42
42
  throw e;
43
43
  }
@@ -75,7 +75,7 @@ function evidencePath(id, lane) {
75
75
  }
76
76
 
77
77
  // packages/core/dist/status.js
78
- import * as fs21 from "node:fs";
78
+ import * as fs22 from "node:fs";
79
79
 
80
80
  // packages/core/dist/activity.js
81
81
  import * as fs2 from "node:fs";
@@ -285,8 +285,132 @@ var ActivityTracker = class {
285
285
  };
286
286
 
287
287
  // packages/core/dist/stats.js
288
- import * as fs20 from "node:fs";
289
- import * as path17 from "node:path";
288
+ import * as fs21 from "node:fs";
289
+ import * as path18 from "node:path";
290
+
291
+ // packages/core/dist/dir-lock.js
292
+ import fs3 from "node:fs";
293
+ import * as path3 from "node:path";
294
+ import { randomUUID as randomUUID2 } from "node:crypto";
295
+ var LOCK_CEILING_MS = 60 * 6e4;
296
+ var OWNER = "owner";
297
+ var TRANSIENT = ["EPERM", "EBUSY", "EACCES", "ENOTEMPTY"];
298
+ var pause = (ms) => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
299
+ var code = (err) => err.code ?? "";
300
+ function pidAlive(pid) {
301
+ try {
302
+ process.kill(pid, 0);
303
+ return true;
304
+ } catch (err) {
305
+ return code(err) === "EPERM";
306
+ }
307
+ }
308
+ function readOwner(lock) {
309
+ try {
310
+ const o = JSON.parse(fs3.readFileSync(path3.join(lock, OWNER), "utf8"));
311
+ return typeof o.pid === "number" && typeof o.token === "string" ? o : void 0;
312
+ } catch {
313
+ return void 0;
314
+ }
315
+ }
316
+ function removeLock(dir, deadline) {
317
+ for (; ; ) {
318
+ try {
319
+ fs3.rmSync(path3.join(dir, OWNER), { force: true });
320
+ fs3.rmdirSync(dir);
321
+ return;
322
+ } catch (err) {
323
+ if (code(err) === "ENOENT")
324
+ return;
325
+ if (!TRANSIENT.includes(code(err)) || Date.now() >= deadline)
326
+ throw err;
327
+ pause(10);
328
+ }
329
+ }
330
+ }
331
+ function takeOver(lock, staleMs, now2) {
332
+ let age;
333
+ try {
334
+ age = now2 - fs3.statSync(lock).mtimeMs;
335
+ } catch {
336
+ return;
337
+ }
338
+ if (age <= staleMs)
339
+ return;
340
+ const owner = readOwner(lock);
341
+ if (owner && age <= LOCK_CEILING_MS && pidAlive(owner.pid))
342
+ return;
343
+ const aside = `${lock}.stale-${process.pid}-${randomUUID2()}`;
344
+ try {
345
+ fs3.renameSync(lock, aside);
346
+ } catch {
347
+ return;
348
+ }
349
+ if (readOwner(aside)?.token !== owner?.token) {
350
+ try {
351
+ fs3.renameSync(aside, lock);
352
+ return;
353
+ } catch {
354
+ }
355
+ }
356
+ try {
357
+ removeLock(aside, Date.now() + 2e3);
358
+ } catch {
359
+ }
360
+ }
361
+ function attempt(lock, staleMs, now2) {
362
+ for (let n = 0; n < 2; n++) {
363
+ try {
364
+ fs3.mkdirSync(lock);
365
+ } catch (err) {
366
+ if (TRANSIENT.includes(code(err)))
367
+ return { busy: true, error: err };
368
+ if (code(err) !== "EEXIST")
369
+ throw err;
370
+ if (n === 0)
371
+ takeOver(lock, staleMs, now2);
372
+ continue;
373
+ }
374
+ const mine = { pid: process.pid, token: randomUUID2(), at: (/* @__PURE__ */ new Date()).toISOString() };
375
+ try {
376
+ fs3.writeFileSync(path3.join(lock, OWNER), JSON.stringify(mine));
377
+ } catch (err) {
378
+ try {
379
+ fs3.rmdirSync(lock);
380
+ } catch {
381
+ }
382
+ throw err;
383
+ }
384
+ let released = false;
385
+ return {
386
+ held: {
387
+ release(deadline = Date.now() + 2e3) {
388
+ if (released)
389
+ return;
390
+ released = true;
391
+ if (readOwner(lock)?.token !== mine.token)
392
+ return;
393
+ removeLock(lock, deadline);
394
+ }
395
+ }
396
+ };
397
+ }
398
+ return { busy: true };
399
+ }
400
+ function withDirLock(lock, action, opts) {
401
+ const deadline = Date.now() + opts.waitMs;
402
+ let a;
403
+ while (!("held" in (a = attempt(lock, opts.staleMs, Date.now())))) {
404
+ if (Date.now() >= deadline)
405
+ throw a.error ?? opts.busy();
406
+ pause(opts.pauseMs ?? 10);
407
+ }
408
+ try {
409
+ return action();
410
+ } finally {
411
+ a.held.release(deadline);
412
+ }
413
+ }
290
414
 
291
415
  // packages/core/dist/worker-metadata.js
292
416
  var WORKER_EFFORTS = ["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"];
@@ -379,14 +503,14 @@ function sanitizeWorker(value) {
379
503
  }
380
504
 
381
505
  // packages/core/dist/soak.js
382
- import * as fs18 from "node:fs";
383
- import * as path15 from "node:path";
506
+ import * as fs19 from "node:fs";
507
+ import * as path16 from "node:path";
384
508
 
385
509
  // packages/core/dist/evidence.js
386
- import * as fs3 from "node:fs";
510
+ import * as fs4 from "node:fs";
387
511
  function readEvidence(id, lane) {
388
512
  try {
389
- return JSON.parse(fs3.readFileSync(evidencePath(id, lane), "utf8"));
513
+ return JSON.parse(fs4.readFileSync(evidencePath(id, lane), "utf8"));
390
514
  } catch {
391
515
  return {};
392
516
  }
@@ -394,13 +518,13 @@ function readEvidence(id, lane) {
394
518
  function mergeEvidence(id, lane, patch) {
395
519
  const file2 = evidencePath(id, lane);
396
520
  const tmp = uniqueTempPath(file2);
397
- fs3.writeFileSync(tmp, JSON.stringify({ ...readEvidence(id, lane), ...patch }, null, 2));
521
+ fs4.writeFileSync(tmp, JSON.stringify({ ...readEvidence(id, lane), ...patch }, null, 2));
398
522
  atomicRenameSync(tmp, file2);
399
523
  }
400
524
 
401
525
  // packages/core/dist/pushes.js
402
- import * as fs4 from "node:fs";
403
- import * as path3 from "node:path";
526
+ import * as fs5 from "node:fs";
527
+ import * as path4 from "node:path";
404
528
  var MAX_PUSHES = 20;
405
529
  var PUSH_HEAD = "HEAD";
406
530
  var VALUE_OPTIONS = /* @__PURE__ */ new Set(["-o", "--push-option", "--repo", "--receive-pack", "--exec"]);
@@ -455,18 +579,18 @@ function gitPushTargets(command) {
455
579
  return found ? [...new Set(targets)] : void 0;
456
580
  }
457
581
  function gitDirAt(dir) {
458
- let at = path3.resolve(dir);
582
+ let at = path4.resolve(dir);
459
583
  for (; ; ) {
460
- const dotGit = path3.join(at, ".git");
584
+ const dotGit = path4.join(at, ".git");
461
585
  try {
462
- const stat = fs4.statSync(dotGit);
586
+ const stat = fs5.statSync(dotGit);
463
587
  if (stat.isDirectory())
464
588
  return dotGit;
465
- const m = /^gitdir:\s*(.+)$/m.exec(fs4.readFileSync(dotGit, "utf8"));
466
- return m ? path3.resolve(at, m[1].trim()) : void 0;
589
+ const m = /^gitdir:\s*(.+)$/m.exec(fs5.readFileSync(dotGit, "utf8"));
590
+ return m ? path4.resolve(at, m[1].trim()) : void 0;
467
591
  } catch {
468
592
  }
469
- const up = path3.dirname(at);
593
+ const up = path4.dirname(at);
470
594
  if (up === at)
471
595
  return void 0;
472
596
  at = up;
@@ -477,7 +601,7 @@ function currentBranchAt(dir) {
477
601
  if (!gitDir)
478
602
  return void 0;
479
603
  try {
480
- const m = /^ref:\s*refs\/heads\/(.+)$/m.exec(fs4.readFileSync(path3.join(gitDir, "HEAD"), "utf8"));
604
+ const m = /^ref:\s*refs\/heads\/(.+)$/m.exec(fs5.readFileSync(path4.join(gitDir, "HEAD"), "utf8"));
481
605
  return m ? m[1].trim() : void 0;
482
606
  } catch {
483
607
  return void 0;
@@ -496,13 +620,13 @@ function recordPush(id, lane, branches, at = (/* @__PURE__ */ new Date()).toISOS
496
620
  }
497
621
 
498
622
  // packages/core/dist/notices.js
499
- import fs16 from "node:fs";
500
- import * as path13 from "node:path";
623
+ import fs17 from "node:fs";
624
+ import * as path14 from "node:path";
501
625
 
502
626
  // packages/core/dist/config.js
503
- import * as fs5 from "node:fs";
627
+ import * as fs6 from "node:fs";
504
628
  import * as os2 from "node:os";
505
- import * as path4 from "node:path";
629
+ import * as path5 from "node:path";
506
630
 
507
631
  // node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/date.js
508
632
  var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
@@ -1176,10 +1300,13 @@ function validReviewTool(value) {
1176
1300
  // packages/core/dist/reviews.js
1177
1301
  var REVIEW_WORK = ["off", "trap", "headless"];
1178
1302
  var REVIEW_POST = ["draft", "auto"];
1303
+ var REVIEW_MODES = ["notify", "on-demand", "auto-draft", "auto-review"];
1179
1304
  var DEFAULT_REVIEWS = {
1180
1305
  enabled: false,
1306
+ mode: "notify",
1307
+ publish: false,
1181
1308
  repos: "configured",
1182
- work: "trap",
1309
+ work: "off",
1183
1310
  post: "draft",
1184
1311
  limits: { wallClockSecs: 900, maxTurns: 40 },
1185
1312
  trapWaitSecs: 600,
@@ -1205,6 +1332,19 @@ function strings(value, where) {
1205
1332
  }
1206
1333
  function parseSettings(raw, where) {
1207
1334
  const out = {};
1335
+ if (raw.mode !== void 0)
1336
+ out.mode = oneOf(raw.mode, REVIEW_MODES, `${where}.mode`);
1337
+ else if (raw.post === "auto")
1338
+ out.mode = "auto-review";
1339
+ else if (raw.work === "off")
1340
+ out.mode = "on-demand";
1341
+ else if (raw.work !== void 0 || raw.post !== void 0)
1342
+ out.mode = "auto-draft";
1343
+ if (raw.publish !== void 0) {
1344
+ if (typeof raw.publish !== "boolean")
1345
+ throw new Error(`${where}.publish must be a boolean`);
1346
+ out.publish = raw.publish;
1347
+ }
1208
1348
  if (raw.work !== void 0)
1209
1349
  out.work = oneOf(raw.work, REVIEW_WORK, `${where}.work`);
1210
1350
  if (raw.post !== void 0)
@@ -1231,6 +1371,9 @@ function parseReviews(raw, reposRaw = {}) {
1231
1371
  if (typeof r !== "object" || Array.isArray(r))
1232
1372
  throw new Error("[reviews] must be a table");
1233
1373
  const base = parseSettings(r, "[reviews]");
1374
+ const requestedMode = base.mode ?? "notify";
1375
+ const publish = base.publish ?? requestedMode === "auto-review";
1376
+ const mode = requestedMode.startsWith("auto-") ? publish ? "auto-review" : "auto-draft" : requestedMode;
1234
1377
  const perRepo = {};
1235
1378
  for (const [key, repo] of Object.entries(reposRaw)) {
1236
1379
  if (repo.reviews !== void 0)
@@ -1239,6 +1382,11 @@ function parseReviews(raw, reposRaw = {}) {
1239
1382
  return {
1240
1383
  ...DEFAULT_REVIEWS,
1241
1384
  ...base,
1385
+ mode,
1386
+ publish,
1387
+ work: mode.startsWith("auto-") ? base.work && base.work !== "off" ? base.work : "trap" : "off",
1388
+ post: publish ? "auto" : "draft",
1389
+ ...Object.fromEntries(["identity", "tokenCommand", "tokenEnv", "tokenFile"].filter((k) => r[k] !== void 0).map((k) => [k, String(r[k])])),
1242
1390
  limits: { ...DEFAULT_REVIEWS.limits, ...base.limits },
1243
1391
  enabled: r.enabled === void 0 ? false : Boolean(r.enabled),
1244
1392
  repos: r.repos === void 0 ? "configured" : oneOf(r.repos, ["configured", "any"], "[reviews].repos"),
@@ -1331,6 +1479,49 @@ function parseHooks(raw) {
1331
1479
  out.pickupNotify = { command: command(h.pickupNotify, "[hooks.pickupNotify]") };
1332
1480
  return out;
1333
1481
  }
1482
+ function parseCodexRules(raw) {
1483
+ const out = { forbidden: [], prompt: [], allow: [] };
1484
+ if (raw === void 0)
1485
+ return out;
1486
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw))
1487
+ throw new Error("[permissions.codex] must be a table");
1488
+ for (const [key, value] of Object.entries(raw)) {
1489
+ if (key !== "forbidden" && key !== "prompt" && key !== "allow")
1490
+ throw new Error(`[permissions.codex].${key} is not a key: use forbidden, prompt, or allow`);
1491
+ const prefix = (v) => Array.isArray(v) && v.length > 0 && v.every((w) => typeof w === "string" && w.trim() && !/\s/.test(w));
1492
+ if (!Array.isArray(value) || !value.every(prefix)) {
1493
+ throw new Error(`[permissions.codex].${key} must be a list of command prefixes, each a list of words, e.g. [["wrangler", "dev"]]`);
1494
+ }
1495
+ const seen = /* @__PURE__ */ new Set();
1496
+ out[key] = value.filter((p) => !seen.has(JSON.stringify(p)) && seen.add(JSON.stringify(p)));
1497
+ }
1498
+ return out;
1499
+ }
1500
+ var PERMISSION_RULE = /^[A-Za-z][\w-]*(\(.+\))?$/;
1501
+ function parsePermissions(raw) {
1502
+ const out = { environment: [], allow: [], deny: [], codex: parseCodexRules(void 0) };
1503
+ if (raw === void 0)
1504
+ return out;
1505
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw))
1506
+ throw new Error("[permissions] must be a table");
1507
+ for (const [key, value] of Object.entries(raw)) {
1508
+ if (key === "codex") {
1509
+ out.codex = parseCodexRules(value);
1510
+ continue;
1511
+ }
1512
+ if (key !== "environment" && key !== "allow" && key !== "deny")
1513
+ throw new Error(`[permissions].${key} is not a key: use environment, allow, deny, or [permissions.codex]`);
1514
+ if (!Array.isArray(value) || value.some((v) => typeof v !== "string" || !v.trim()))
1515
+ throw new Error(`[permissions].${key} must be a list of non-empty strings`);
1516
+ if (key !== "environment") {
1517
+ const bad = value.find((v) => !PERMISSION_RULE.test(v));
1518
+ if (bad !== void 0)
1519
+ throw new Error(`[permissions].${key}: "${bad}" is not a permission rule \u2014 write Tool or Tool(specifier), e.g. Bash(npm run test *)`);
1520
+ }
1521
+ out[key] = [...new Set(value)];
1522
+ }
1523
+ return out;
1524
+ }
1334
1525
  var ATTENTION_KINDS = ["question", "decision", "landed", "pr:draft", "pr:review", "pr:checks", "pr:conflict", "pr:ready", "report", "stack-ready", "review"];
1335
1526
  var DEFAULT_ATTENTION_KINDS = ["question", "decision", "pr:ready", "pr:review", "pr:conflict", "pr:checks"];
1336
1527
  function parseAttentionKinds(raw) {
@@ -1348,6 +1539,8 @@ function parseAttentionKinds(raw) {
1348
1539
  }
1349
1540
  function parseSoak(raw) {
1350
1541
  const soak = { ...DEFAULT_SOAK, ...raw ?? {} };
1542
+ if (!Number.isInteger(soak.codexStartSecs) || soak.codexStartSecs < 1)
1543
+ throw new Error("soak.codexStartSecs must be a positive whole number");
1351
1544
  if (typeof soak.acceptWharfStarts !== "boolean")
1352
1545
  throw new Error("soak.acceptWharfStarts must be true or false");
1353
1546
  if (soak.terminal !== void 0 && soak.terminal !== "terminal" && soak.terminal !== "iterm") {
@@ -1356,6 +1549,7 @@ function parseSoak(raw) {
1356
1549
  return soak;
1357
1550
  }
1358
1551
  var DEFAULT_SOAK = {
1552
+ codexStartSecs: 600,
1359
1553
  acceptWharfStarts: false,
1360
1554
  deferSecs: 90,
1361
1555
  claimIdleNoticeSecs: 180,
@@ -1365,6 +1559,7 @@ var DEFAULT_SOAK = {
1365
1559
  signOffGraceSecs: 600
1366
1560
  };
1367
1561
  var DEFAULT_HELM = {
1562
+ chat: "full",
1368
1563
  queuedNoticeSecs: 180,
1369
1564
  stalledNoticeSecs: 1200,
1370
1565
  idleWorkingNoticeSecs: 60,
@@ -1402,19 +1597,21 @@ function withConfigPath(parse2) {
1402
1597
  }
1403
1598
  }
1404
1599
  function configPath() {
1405
- return path4.join(lobstahHome(), "config.toml");
1600
+ return path5.join(lobstahHome(), "config.toml");
1406
1601
  }
1407
1602
  function expandHome(p) {
1408
- return p.startsWith("~/") ? path4.join(os2.homedir(), p.slice(2)) : p;
1603
+ return p.startsWith("~/") ? path5.join(os2.homedir(), p.slice(2)) : p;
1409
1604
  }
1410
1605
  function loadConfig() {
1411
1606
  const file2 = configPath();
1412
- const raw = fs5.existsSync(file2) ? parse(fs5.readFileSync(file2, "utf8")) : {};
1607
+ const raw = fs6.existsSync(file2) ? parse(fs6.readFileSync(file2, "utf8")) : {};
1413
1608
  const petOpen = raw.pet?.open ?? "tab";
1414
1609
  if (!["tab", "app", "helm"].includes(petOpen))
1415
1610
  throw new Error(`[pet].open must be "tab", "app", or "helm" in ${configPath()}`);
1416
1611
  const watch = { ...DEFAULT_WATCH, ...raw.watch ?? {} };
1417
1612
  const helm = { ...DEFAULT_HELM, ...raw.helm ?? {} };
1613
+ if (helm.chat !== "full" && helm.chat !== "brief")
1614
+ throw new Error('[helm].chat must be "full" or "brief"');
1418
1615
  const wait = { ...DEFAULT_WAIT, ...raw.wait ?? {} };
1419
1616
  for (const key of ["baseTimeoutSecs", "baseRepeats", "maxTimeoutSecs"]) {
1420
1617
  if (typeof wait[key] !== "number" || !Number.isSafeInteger(wait[key]) || wait[key] <= 0)
@@ -1500,8 +1697,9 @@ function loadConfig() {
1500
1697
  hooks: parseHooks(raw.hooks),
1501
1698
  remindSecs: raw.remindSecs !== void 0 ? Number(raw.remindSecs) : void 0,
1502
1699
  readySettleSecs,
1503
- attentionKinds: parseAttentionKinds(raw.attentionKinds),
1504
- reviews: withConfigPath(() => parseReviews(raw.reviews, reposRaw))
1700
+ attentionKinds: parseAttentionKinds(raw.attentionKinds ?? (raw.reviews?.enabled ? [...DEFAULT_ATTENTION_KINDS, "review"] : void 0)),
1701
+ reviews: withConfigPath(() => parseReviews(raw.reviews, reposRaw)),
1702
+ permissions: withConfigPath(() => parsePermissions(raw.permissions))
1505
1703
  };
1506
1704
  }
1507
1705
  function resolveDispatch(d, cfg) {
@@ -1545,25 +1743,25 @@ function firstMeaningfulLine(...outputs) {
1545
1743
  }
1546
1744
 
1547
1745
  // packages/core/dist/pr-poll.js
1548
- import * as fs9 from "node:fs";
1549
- import * as path8 from "node:path";
1746
+ import * as fs10 from "node:fs";
1747
+ import * as path9 from "node:path";
1550
1748
 
1551
1749
  // packages/core/dist/prs.js
1552
- import * as fs6 from "node:fs";
1553
- import * as path5 from "node:path";
1750
+ import * as fs7 from "node:fs";
1751
+ import * as path6 from "node:path";
1554
1752
  function prsDir() {
1555
- return path5.join(lobstahHome(), "prs");
1753
+ return path6.join(lobstahHome(), "prs");
1556
1754
  }
1557
1755
  function prRecordFile(key) {
1558
1756
  const ref = parsePrRef(key);
1559
1757
  if (!ref)
1560
1758
  throw new Error(`not a PR key: ${key}`);
1561
1759
  const safe = (s) => s.replace(/[^A-Za-z0-9._-]/g, "_");
1562
- return path5.join(prsDir(), `${safe(ref.owner)}__${safe(ref.repo)}__${ref.number}.json`);
1760
+ return path6.join(prsDir(), `${safe(ref.owner)}__${safe(ref.repo)}__${ref.number}.json`);
1563
1761
  }
1564
1762
  function readPr(key) {
1565
1763
  try {
1566
- return JSON.parse(fs6.readFileSync(prRecordFile(key), "utf8"));
1764
+ return JSON.parse(fs7.readFileSync(prRecordFile(key), "utf8"));
1567
1765
  } catch {
1568
1766
  return void 0;
1569
1767
  }
@@ -1571,13 +1769,13 @@ function readPr(key) {
1571
1769
  function readPrs() {
1572
1770
  let files;
1573
1771
  try {
1574
- files = fs6.readdirSync(prsDir()).filter((f) => f.endsWith(".json"));
1772
+ files = fs7.readdirSync(prsDir()).filter((f) => f.endsWith(".json"));
1575
1773
  } catch {
1576
1774
  return [];
1577
1775
  }
1578
1776
  return files.flatMap((f) => {
1579
1777
  try {
1580
- const r = JSON.parse(fs6.readFileSync(path5.join(prsDir(), f), "utf8"));
1778
+ const r = JSON.parse(fs7.readFileSync(path6.join(prsDir(), f), "utf8"));
1581
1779
  return typeof r.key === "string" && typeof r.url === "string" ? [r] : [];
1582
1780
  } catch {
1583
1781
  return [];
@@ -1586,16 +1784,16 @@ function readPrs() {
1586
1784
  }
1587
1785
 
1588
1786
  // packages/core/dist/watch.js
1589
- import fs8 from "node:fs";
1590
- import * as path7 from "node:path";
1787
+ import fs9 from "node:fs";
1788
+ import * as path8 from "node:path";
1591
1789
 
1592
1790
  // packages/core/dist/github-budget.js
1593
- import * as fs7 from "node:fs";
1594
- import * as path6 from "node:path";
1595
- var file = () => path6.join(lobstahHome(), "github-budget.json");
1791
+ import * as fs8 from "node:fs";
1792
+ import * as path7 from "node:path";
1793
+ var file = () => path7.join(lobstahHome(), "github-budget.json");
1596
1794
  function read() {
1597
1795
  try {
1598
- return JSON.parse(fs7.readFileSync(file(), "utf8"));
1796
+ return JSON.parse(fs8.readFileSync(file(), "utf8"));
1599
1797
  } catch {
1600
1798
  return { resources: {} };
1601
1799
  }
@@ -1609,27 +1807,27 @@ function githubBlockedUntil(now2 = Date.now()) {
1609
1807
 
1610
1808
  // packages/core/dist/watch.js
1611
1809
  function watchesDir() {
1612
- return path7.join(lobstahHome(), "watches");
1810
+ return path8.join(lobstahHome(), "watches");
1613
1811
  }
1614
1812
  function slug(key) {
1615
1813
  return key.replace(/[^A-Za-z0-9._-]+/g, "-");
1616
1814
  }
1617
1815
  function watchPath(key) {
1618
- return path7.join(watchesDir(), `${slug(key)}.json`);
1816
+ return path8.join(watchesDir(), `${slug(key)}.json`);
1619
1817
  }
1620
1818
  function readWatch(key) {
1621
1819
  try {
1622
- return JSON.parse(fs8.readFileSync(watchPath(key), "utf8"));
1820
+ return JSON.parse(fs9.readFileSync(watchPath(key), "utf8"));
1623
1821
  } catch {
1624
1822
  return void 0;
1625
1823
  }
1626
1824
  }
1627
1825
 
1628
1826
  // packages/core/dist/pr-poll.js
1629
- var cycleFile = (repo) => path8.join(lobstahHome(), "pr-polls", `${repo.replace(/[^\w.-]/g, "_")}.json`);
1827
+ var cycleFile = (repo) => path9.join(lobstahHome(), "pr-polls", `${repo.replace(/[^\w.-]/g, "_")}.json`);
1630
1828
  var readCycle = (repo) => {
1631
1829
  try {
1632
- return JSON.parse(fs9.readFileSync(cycleFile(repo), "utf8"));
1830
+ return JSON.parse(fs10.readFileSync(cycleFile(repo), "utf8"));
1633
1831
  } catch {
1634
1832
  return void 0;
1635
1833
  }
@@ -1722,23 +1920,23 @@ function parseUnresolvedThreads(stdout) {
1722
1920
  }
1723
1921
 
1724
1922
  // packages/core/dist/worktrees.js
1725
- import * as fs10 from "node:fs";
1726
- import * as path9 from "node:path";
1923
+ import * as fs11 from "node:fs";
1924
+ import * as path10 from "node:path";
1727
1925
  var LANES = ["work", "chore"];
1728
1926
  function worktreePath(id) {
1729
- return path9.join(lobstahHome(), "worktrees", id);
1927
+ return path10.join(lobstahHome(), "worktrees", id);
1730
1928
  }
1731
1929
  function readRecord(file2) {
1732
1930
  try {
1733
- const r = JSON.parse(fs10.readFileSync(file2, "utf8"));
1931
+ const r = JSON.parse(fs11.readFileSync(file2, "utf8"));
1734
1932
  return typeof r.path === "string" ? r : void 0;
1735
1933
  } catch {
1736
1934
  return void 0;
1737
1935
  }
1738
1936
  }
1739
1937
  function ownerOfPath(p) {
1740
- const rel = path9.relative(path9.join(lobstahHome(), "worktrees"), p);
1741
- if (!rel || rel.startsWith("..") || path9.isAbsolute(rel))
1938
+ const rel = path10.relative(path10.join(lobstahHome(), "worktrees"), p);
1939
+ if (!rel || rel.startsWith("..") || path10.isAbsolute(rel))
1742
1940
  return void 0;
1743
1941
  return rel.split(/[\\/]/)[0];
1744
1942
  }
@@ -1751,7 +1949,7 @@ function dispatchWorktree(id, lane) {
1751
1949
  }
1752
1950
  const dirs = laneDirs(l);
1753
1951
  for (const dir of [dirs.active, dirs.done]) {
1754
- const rec = readRecord(path9.join(dir, id, "worktree.json"));
1952
+ const rec = readRecord(path10.join(dir, id, "worktree.json"));
1755
1953
  if (rec) {
1756
1954
  const owner = rec.of ?? ownerOfPath(rec.path) ?? id;
1757
1955
  return { path: rec.path, owner, reused: owner !== id };
@@ -1763,7 +1961,7 @@ function dispatchWorktree(id, lane) {
1763
1961
  function laneOf(id) {
1764
1962
  for (const l of LANES) {
1765
1963
  const d = laneDirs(l);
1766
- if (fs10.existsSync(path9.join(d.queue, `${id}.json`)) || fs10.existsSync(path9.join(d.active, id)) || fs10.existsSync(path9.join(d.done, id))) {
1964
+ if (fs11.existsSync(path10.join(d.queue, `${id}.json`)) || fs11.existsSync(path10.join(d.active, id)) || fs11.existsSync(path10.join(d.done, id))) {
1767
1965
  return l;
1768
1966
  }
1769
1967
  }
@@ -1783,7 +1981,7 @@ function followUpAncestors(id, lane) {
1783
1981
  function chainWorktree(followUp) {
1784
1982
  for (const id of [followUp, ...followUpAncestors(followUp)]) {
1785
1983
  const wt = dispatchWorktree(id, laneOf(id));
1786
- if (fs10.existsSync(wt.path))
1984
+ if (fs11.existsSync(wt.path))
1787
1985
  return { ...wt, from: id };
1788
1986
  }
1789
1987
  return void 0;
@@ -1798,27 +1996,27 @@ function processAlive(pid) {
1798
1996
  }
1799
1997
  }
1800
1998
  function worktreeGitDir(wt) {
1801
- const dotGit = path9.join(wt, ".git");
1999
+ const dotGit = path10.join(wt, ".git");
1802
2000
  try {
1803
- const st = fs10.statSync(dotGit);
2001
+ const st = fs11.statSync(dotGit);
1804
2002
  if (st.isDirectory())
1805
2003
  return dotGit;
1806
- const m = /^gitdir:\s*(.+?)\s*$/m.exec(fs10.readFileSync(dotGit, "utf8"));
1807
- return m ? path9.resolve(wt, m[1]) : void 0;
2004
+ const m = /^gitdir:\s*(.+?)\s*$/m.exec(fs11.readFileSync(dotGit, "utf8"));
2005
+ return m ? path10.resolve(wt, m[1]) : void 0;
1808
2006
  } catch {
1809
2007
  return void 0;
1810
2008
  }
1811
2009
  }
1812
2010
  function worktreeLockFile(wt) {
1813
2011
  const gitDir = worktreeGitDir(wt);
1814
- return gitDir ? path9.join(gitDir, "lobstah.lock") : void 0;
2012
+ return gitDir ? path10.join(gitDir, "lobstah.lock") : void 0;
1815
2013
  }
1816
2014
  function readWorktreeLock(wt) {
1817
2015
  const file2 = worktreeLockFile(wt);
1818
2016
  if (!file2)
1819
2017
  return void 0;
1820
2018
  try {
1821
- return JSON.parse(fs10.readFileSync(file2, "utf8"));
2019
+ return JSON.parse(fs11.readFileSync(file2, "utf8"));
1822
2020
  } catch {
1823
2021
  return void 0;
1824
2022
  }
@@ -1826,7 +2024,7 @@ function readWorktreeLock(wt) {
1826
2024
  function lockIsLive(lock) {
1827
2025
  if (lock.kind === "warm")
1828
2026
  return processAlive(lock.pid) && Date.now() - (Date.parse(lock.at) || 0) < WARM_LOCK_MAX_MS;
1829
- return fs10.existsSync(path9.join(laneDirs(lock.lane).active, lock.id));
2027
+ return fs11.existsSync(path10.join(laneDirs(lock.lane).active, lock.id));
1830
2028
  }
1831
2029
  function worktreeHolder(wt) {
1832
2030
  const lock = readWorktreeLock(wt);
@@ -1837,9 +2035,9 @@ function acquireWorktreeLock(wt, id, lane, kind) {
1837
2035
  const mine = { id, lane, pid: process.pid, at: (/* @__PURE__ */ new Date()).toISOString(), ...kind ? { kind } : {} };
1838
2036
  if (!file2)
1839
2037
  return { id: "(no git dir)", lane, pid: 0, at: mine.at };
1840
- for (let attempt = 0; attempt < 3; attempt++) {
2038
+ for (let attempt2 = 0; attempt2 < 3; attempt2++) {
1841
2039
  try {
1842
- fs10.writeFileSync(file2, JSON.stringify(mine, null, 2), { flag: "wx" });
2040
+ fs11.writeFileSync(file2, JSON.stringify(mine, null, 2), { flag: "wx" });
1843
2041
  return void 0;
1844
2042
  } catch (err) {
1845
2043
  if (err.code !== "EEXIST")
@@ -1847,7 +2045,7 @@ function acquireWorktreeLock(wt, id, lane, kind) {
1847
2045
  }
1848
2046
  let raw;
1849
2047
  try {
1850
- raw = fs10.readFileSync(file2, "utf8");
2048
+ raw = fs11.readFileSync(file2, "utf8");
1851
2049
  } catch {
1852
2050
  continue;
1853
2051
  }
@@ -1858,14 +2056,14 @@ function acquireWorktreeLock(wt, id, lane, kind) {
1858
2056
  held2 = void 0;
1859
2057
  }
1860
2058
  if (held2?.id === id) {
1861
- fs10.writeFileSync(file2, JSON.stringify(mine, null, 2));
2059
+ fs11.writeFileSync(file2, JSON.stringify(mine, null, 2));
1862
2060
  return void 0;
1863
2061
  }
1864
2062
  if (held2 && lockIsLive(held2))
1865
2063
  return held2;
1866
2064
  try {
1867
- if (fs10.readFileSync(file2, "utf8") === raw)
1868
- fs10.rmSync(file2, { force: true });
2065
+ if (fs11.readFileSync(file2, "utf8") === raw)
2066
+ fs11.rmSync(file2, { force: true });
1869
2067
  } catch {
1870
2068
  }
1871
2069
  }
@@ -1877,22 +2075,22 @@ function releaseWorktreeLock(wt, id) {
1877
2075
  if (!file2)
1878
2076
  return;
1879
2077
  if (readWorktreeLock(wt)?.id === id)
1880
- fs10.rmSync(file2, { force: true });
2078
+ fs11.rmSync(file2, { force: true });
1881
2079
  }
1882
2080
 
1883
2081
  // packages/core/dist/events.js
1884
- import * as fs11 from "node:fs";
2082
+ import * as fs12 from "node:fs";
1885
2083
  function appendEvent(id, lane, ev) {
1886
- fs11.appendFileSync(eventsPath(id, lane), `${JSON.stringify(ev)}
2084
+ fs12.appendFileSync(eventsPath(id, lane), `${JSON.stringify(ev)}
1887
2085
  `);
1888
2086
  }
1889
2087
  function touchEvents(id, lane, at = /* @__PURE__ */ new Date()) {
1890
2088
  const file2 = eventsPath(id, lane);
1891
2089
  try {
1892
- fs11.utimesSync(file2, at, at);
2090
+ fs12.utimesSync(file2, at, at);
1893
2091
  } catch {
1894
- fs11.appendFileSync(file2, "");
1895
- fs11.utimesSync(file2, at, at);
2092
+ fs12.appendFileSync(file2, "");
2093
+ fs12.utimesSync(file2, at, at);
1896
2094
  }
1897
2095
  }
1898
2096
 
@@ -1906,31 +2104,31 @@ function isFinished(id, lane) {
1906
2104
  }
1907
2105
 
1908
2106
  // packages/core/dist/pools.js
1909
- import * as fs12 from "node:fs";
1910
- import * as path10 from "node:path";
2107
+ import * as fs13 from "node:fs";
2108
+ import * as path11 from "node:path";
1911
2109
  function poolsRoot() {
1912
- return path10.join(lobstahHome(), "pools");
2110
+ return path11.join(lobstahHome(), "pools");
1913
2111
  }
1914
2112
  function poolDir(pool) {
1915
- return path10.join(poolsRoot(), pool);
2113
+ return path11.join(poolsRoot(), pool);
1916
2114
  }
1917
2115
  function poolSlotPath(pool, slot) {
1918
- return path10.join(poolDir(pool), String(slot));
2116
+ return path11.join(poolDir(pool), String(slot));
1919
2117
  }
1920
2118
  function slotsDir(pool) {
1921
- return path10.join(poolDir(pool), ".slots");
2119
+ return path11.join(poolDir(pool), ".slots");
1922
2120
  }
1923
2121
  function poolSlotOf(p) {
1924
2122
  const real = (x) => {
1925
2123
  try {
1926
- return fs12.realpathSync.native(x);
2124
+ return fs13.realpathSync.native(x);
1927
2125
  } catch {
1928
- return path10.resolve(x);
2126
+ return path11.resolve(x);
1929
2127
  }
1930
2128
  };
1931
- for (const [rootDir, dir] of [[poolsRoot(), path10.resolve(p)], [real(poolsRoot()), real(p)]]) {
1932
- const rel = path10.relative(rootDir, dir);
1933
- if (!rel || rel.startsWith("..") || path10.isAbsolute(rel))
2129
+ for (const [rootDir, dir] of [[poolsRoot(), path11.resolve(p)], [real(poolsRoot()), real(p)]]) {
2130
+ const rel = path11.relative(rootDir, dir);
2131
+ if (!rel || rel.startsWith("..") || path11.isAbsolute(rel))
1934
2132
  continue;
1935
2133
  const parts = rel.split(/[\\/]/);
1936
2134
  if (parts.length !== 2 || !/^[1-9][0-9]*$/.test(parts[1]))
@@ -1944,20 +2142,20 @@ function poolSlotLabel(pool, slot) {
1944
2142
  }
1945
2143
  function readJson(file2) {
1946
2144
  try {
1947
- return JSON.parse(fs12.readFileSync(file2, "utf8"));
2145
+ return JSON.parse(fs13.readFileSync(file2, "utf8"));
1948
2146
  } catch {
1949
2147
  return void 0;
1950
2148
  }
1951
2149
  }
1952
2150
  function writeJson(file2, value) {
1953
- fs12.mkdirSync(path10.dirname(file2), { recursive: true });
2151
+ fs13.mkdirSync(path11.dirname(file2), { recursive: true });
1954
2152
  const tmp = uniqueTempPath(file2);
1955
- fs12.writeFileSync(tmp, JSON.stringify(value, null, 2));
2153
+ fs13.writeFileSync(tmp, JSON.stringify(value, null, 2));
1956
2154
  atomicRenameSync(tmp, file2);
1957
2155
  }
1958
- var metaFile = (pool, slot) => path10.join(slotsDir(pool), `${slot}.json`);
1959
- var claimFile = (pool, slot) => path10.join(slotsDir(pool), `${slot}.claim.json`);
1960
- var outFile = (pool, slot) => path10.join(slotsDir(pool), `${slot}.out.json`);
2156
+ var metaFile = (pool, slot) => path11.join(slotsDir(pool), `${slot}.json`);
2157
+ var claimFile = (pool, slot) => path11.join(slotsDir(pool), `${slot}.claim.json`);
2158
+ var outFile = (pool, slot) => path11.join(slotsDir(pool), `${slot}.out.json`);
1961
2159
  function readSlotMeta(pool, slot) {
1962
2160
  return readJson(metaFile(pool, slot)) ?? {};
1963
2161
  }
@@ -1977,7 +2175,7 @@ function writeSlotOut(pool, slot, out) {
1977
2175
  writeJson(outFile(pool, slot), out);
1978
2176
  }
1979
2177
  function clearSlotOut(pool, slot) {
1980
- fs12.rmSync(outFile(pool, slot), { force: true });
2178
+ fs13.rmSync(outFile(pool, slot), { force: true });
1981
2179
  }
1982
2180
  function dispatchHolder(dir) {
1983
2181
  const lock = readWorktreeLock(dir);
@@ -1987,7 +2185,7 @@ function poolSlotView(pool, slot) {
1987
2185
  const dir = poolSlotPath(pool, slot);
1988
2186
  const lastClaim = readSlotClaim(pool, slot)?.id;
1989
2187
  const base = { slot, path: dir, ...lastClaim ? { lastClaim } : {} };
1990
- if (!fs12.existsSync(dir)) {
2188
+ if (!fs13.existsSync(dir)) {
1991
2189
  const meta2 = readSlotMeta(pool, slot);
1992
2190
  return { ...base, state: "missing", ...meta2.error ? { reason: meta2.error } : {} };
1993
2191
  }
@@ -2002,8 +2200,8 @@ function poolSlotView(pool, slot) {
2002
2200
  return { ...base, state: "warming", ...meta.error ? { reason: meta.error } : {} };
2003
2201
  return { ...base, state: "free" };
2004
2202
  }
2005
- var warmStateFile = (pool) => path10.join(poolDir(pool), ".warm-state.json");
2006
- var warmLockFile = (pool) => path10.join(poolDir(pool), ".warm.lock");
2203
+ var warmStateFile = (pool) => path11.join(poolDir(pool), ".warm-state.json");
2204
+ var warmLockFile = (pool) => path11.join(poolDir(pool), ".warm.lock");
2007
2205
  var POOL_WARM_MAX_MS = 60 * 6e4;
2008
2206
  function readPoolWarmState(pool) {
2009
2207
  return readJson(warmStateFile(pool)) ?? {};
@@ -2011,7 +2209,7 @@ function readPoolWarmState(pool) {
2011
2209
  function writePoolWarmState(pool, state) {
2012
2210
  writeJson(warmStateFile(pool), state);
2013
2211
  }
2014
- function pidAlive(pid) {
2212
+ function pidAlive2(pid) {
2015
2213
  try {
2016
2214
  process.kill(pid, 0);
2017
2215
  return true;
@@ -2021,19 +2219,19 @@ function pidAlive(pid) {
2021
2219
  }
2022
2220
  function poolWarmRunning(pool, now2 = Date.now()) {
2023
2221
  const lock = readJson(warmLockFile(pool));
2024
- return !!lock && pidAlive(lock.pid) && now2 - (Date.parse(lock.at) || 0) < POOL_WARM_MAX_MS;
2222
+ return !!lock && pidAlive2(lock.pid) && now2 - (Date.parse(lock.at) || 0) < POOL_WARM_MAX_MS;
2025
2223
  }
2026
2224
  function takePoolWarmLock(pool) {
2027
2225
  const file2 = warmLockFile(pool);
2028
- fs12.mkdirSync(path10.dirname(file2), { recursive: true });
2226
+ fs13.mkdirSync(path11.dirname(file2), { recursive: true });
2029
2227
  const mine = JSON.stringify({ pid: process.pid, at: (/* @__PURE__ */ new Date()).toISOString() });
2030
- for (let attempt = 0; attempt < 2; attempt++) {
2228
+ for (let attempt2 = 0; attempt2 < 2; attempt2++) {
2031
2229
  try {
2032
- fs12.writeFileSync(file2, mine, { flag: "wx" });
2230
+ fs13.writeFileSync(file2, mine, { flag: "wx" });
2033
2231
  return () => {
2034
2232
  try {
2035
- if (fs12.readFileSync(file2, "utf8") === mine)
2036
- fs12.rmSync(file2, { force: true });
2233
+ if (fs13.readFileSync(file2, "utf8") === mine)
2234
+ fs13.rmSync(file2, { force: true });
2037
2235
  } catch {
2038
2236
  }
2039
2237
  };
@@ -2043,7 +2241,7 @@ function takePoolWarmLock(pool) {
2043
2241
  }
2044
2242
  if (poolWarmRunning(pool))
2045
2243
  return void 0;
2046
- fs12.rmSync(file2, { force: true });
2244
+ fs13.rmSync(file2, { force: true });
2047
2245
  }
2048
2246
  return void 0;
2049
2247
  }
@@ -2052,10 +2250,10 @@ var POOL_FETCH_MS = 10 * 6e4;
2052
2250
  var POOL_RECHECK_MS = 5 * 6e4;
2053
2251
 
2054
2252
  // packages/core/dist/disk.js
2055
- import * as fs13 from "node:fs";
2253
+ import * as fs14 from "node:fs";
2056
2254
  var GB = 1024 ** 3;
2057
2255
  var statfsFreeBytes = (dir) => {
2058
- const s = fs13.statfsSync(dir);
2256
+ const s = fs14.statfsSync(dir);
2059
2257
  return Number(s.bavail) * Number(s.bsize);
2060
2258
  };
2061
2259
  function formatGB(bytes) {
@@ -2063,30 +2261,30 @@ function formatGB(bytes) {
2063
2261
  }
2064
2262
 
2065
2263
  // packages/core/dist/inbox.js
2066
- import * as fs14 from "node:fs";
2067
- import * as path11 from "node:path";
2264
+ import * as fs15 from "node:fs";
2265
+ import * as path12 from "node:path";
2068
2266
  var metaName = (file2) => file2.replace(/\.msg$/, ".meta.json");
2069
2267
  function inboxDir(id, lane) {
2070
- return path11.join(laneDirs(lane).inbox, id);
2268
+ return path12.join(laneDirs(lane).inbox, id);
2071
2269
  }
2072
2270
  function unhandled(id, lane) {
2073
2271
  const dir = inboxDir(id, lane);
2074
- return readDirIfPresent(dir).filter((f) => f.endsWith(".msg")).sort().map((f) => ({ file: f, text: fs14.readFileSync(path11.join(dir, f), "utf8") }));
2272
+ return readDirIfPresent(dir).filter((f) => f.endsWith(".msg")).sort().map((f) => ({ file: f, text: fs15.readFileSync(path12.join(dir, f), "utf8") }));
2075
2273
  }
2076
2274
  function acknowledge(id, lane, file2) {
2077
2275
  const dir = inboxDir(id, lane);
2078
- fs14.mkdirSync(path11.join(dir, "handled"), { recursive: true });
2079
- fs14.renameSync(path11.join(dir, file2), path11.join(dir, "handled", file2));
2276
+ fs15.mkdirSync(path12.join(dir, "handled"), { recursive: true });
2277
+ fs15.renameSync(path12.join(dir, file2), path12.join(dir, "handled", file2));
2080
2278
  try {
2081
- fs14.renameSync(path11.join(dir, metaName(file2)), path11.join(dir, "handled", metaName(file2)));
2279
+ fs15.renameSync(path12.join(dir, metaName(file2)), path12.join(dir, "handled", metaName(file2)));
2082
2280
  } catch {
2083
2281
  }
2084
2282
  }
2085
2283
 
2086
2284
  // packages/core/dist/resume.js
2087
- import * as fs15 from "node:fs";
2285
+ import * as fs16 from "node:fs";
2088
2286
  import * as os3 from "node:os";
2089
- import * as path12 from "node:path";
2287
+ import * as path13 from "node:path";
2090
2288
  import { spawnSync as spawnSync2 } from "node:child_process";
2091
2289
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-([0-9a-f])[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
2092
2290
  function harnessFromSessionId(sessionId) {
@@ -2097,7 +2295,7 @@ function claimOf(id, lane) {
2097
2295
  const dirs = laneDirs(lane);
2098
2296
  for (const dir of [dirs.active, dirs.done]) {
2099
2297
  try {
2100
- return JSON.parse(fs15.readFileSync(path12.join(dir, id, "claim.json"), "utf8"));
2298
+ return JSON.parse(fs16.readFileSync(path13.join(dir, id, "claim.json"), "utf8"));
2101
2299
  } catch {
2102
2300
  }
2103
2301
  }
@@ -2147,7 +2345,7 @@ function isUnresumable(error) {
2147
2345
  return error !== void 0 && UNRESUMABLE.test(error);
2148
2346
  }
2149
2347
  function worktreeProgress(worktree, trunk) {
2150
- if (!worktree || !fs15.existsSync(worktree))
2348
+ if (!worktree || !fs16.existsSync(worktree))
2151
2349
  return "No worktree progress recorded.";
2152
2350
  const git2 = (...a) => spawnSync2("git", a, { cwd: worktree, encoding: "utf8" }).stdout?.trim() ?? "";
2153
2351
  const commits = trunk ? git2("log", "--oneline", `origin/${trunk}..HEAD`) : git2("log", "--oneline", "-15");
@@ -2180,31 +2378,31 @@ function handoffNote(fromHarness, progress, why) {
2180
2378
  ${progress}`;
2181
2379
  }
2182
2380
  function codexHome(env = process.env) {
2183
- return env.CODEX_HOME ?? path12.join(os3.homedir(), ".codex");
2381
+ return env.CODEX_HOME ?? path13.join(os3.homedir(), ".codex");
2184
2382
  }
2185
2383
  function codexRolloutFile(threadId, home = codexHome()) {
2186
2384
  const suffix = `-${threadId}.jsonl`;
2187
2385
  const walk = (dir, depth) => {
2188
2386
  let entries;
2189
2387
  try {
2190
- entries = fs15.readdirSync(dir, { withFileTypes: true });
2388
+ entries = fs16.readdirSync(dir, { withFileTypes: true });
2191
2389
  } catch {
2192
2390
  return void 0;
2193
2391
  }
2194
2392
  for (const e of entries) {
2195
2393
  if (e.isFile() && e.name.startsWith("rollout-") && e.name.endsWith(suffix))
2196
- return path12.join(dir, e.name);
2394
+ return path13.join(dir, e.name);
2197
2395
  }
2198
2396
  if (depth === 0)
2199
2397
  return void 0;
2200
2398
  for (const e of entries.filter((x) => x.isDirectory()).sort((a, b) => b.name.localeCompare(a.name))) {
2201
- const hit = walk(path12.join(dir, e.name), depth - 1);
2399
+ const hit = walk(path13.join(dir, e.name), depth - 1);
2202
2400
  if (hit)
2203
2401
  return hit;
2204
2402
  }
2205
2403
  return void 0;
2206
2404
  };
2207
- return walk(path12.join(home, "sessions"), 3) ?? walk(path12.join(home, "archived_sessions"), 0);
2405
+ return walk(path13.join(home, "sessions"), 3) ?? walk(path13.join(home, "archived_sessions"), 0);
2208
2406
  }
2209
2407
  function codexDesktopThread(threadId, home = codexHome()) {
2210
2408
  const file2 = codexRolloutFile(threadId, home);
@@ -2212,16 +2410,18 @@ function codexDesktopThread(threadId, home = codexHome()) {
2212
2410
  return void 0;
2213
2411
  let head = "";
2214
2412
  try {
2215
- const fd = fs15.openSync(file2, "r");
2413
+ const fd = fs16.openSync(file2, "r");
2216
2414
  try {
2217
2415
  const buf = Buffer.alloc(4096);
2218
- head = buf.subarray(0, fs15.readSync(fd, buf, 0, buf.length, 0)).toString("utf8");
2416
+ head = buf.subarray(0, fs16.readSync(fd, buf, 0, buf.length, 0)).toString("utf8");
2219
2417
  } finally {
2220
- fs15.closeSync(fd);
2418
+ fs16.closeSync(fd);
2221
2419
  }
2222
2420
  } catch {
2223
2421
  return void 0;
2224
2422
  }
2423
+ if (/"source"\s*:\s*"vscode"/.test(head))
2424
+ return "VS Code extension";
2225
2425
  const originator = /"originator"\s*:\s*"([^"]*)"/.exec(head)?.[1];
2226
2426
  return originator && /desktop/i.test(originator) ? originator : void 0;
2227
2427
  }
@@ -2229,16 +2429,16 @@ var CODEX_DESKTOP_THREAD = "Codex desktop thread; not resumable from the CLI";
2229
2429
 
2230
2430
  // packages/core/dist/notices.js
2231
2431
  function noticesDir() {
2232
- return path13.join(lobstahHome(), "notices");
2432
+ return path14.join(lobstahHome(), "notices");
2233
2433
  }
2234
2434
  var counter = 0;
2235
2435
  function postNotice(n) {
2236
2436
  const dir = noticesDir();
2237
- fs16.mkdirSync(dir, { recursive: true });
2437
+ fs17.mkdirSync(dir, { recursive: true });
2238
2438
  if (n.dedupeKey) {
2239
- const marker = path13.join(dir, `.dedupe-${n.dedupeKey.replace(/[^A-Za-z0-9_-]/g, "_")}`);
2439
+ const marker = path14.join(dir, `.dedupe-${n.dedupeKey.replace(/[^A-Za-z0-9_-]/g, "_")}`);
2240
2440
  try {
2241
- fs16.writeFileSync(marker, "", { flag: "wx" });
2441
+ fs17.writeFileSync(marker, "", { flag: "wx" });
2242
2442
  } catch {
2243
2443
  return void 0;
2244
2444
  }
@@ -2256,9 +2456,9 @@ function postNotice(n) {
2256
2456
  ...n.quiet ? { quiet: true } : {},
2257
2457
  ...n.stateHash ? { stateHash: n.stateHash } : {}
2258
2458
  };
2259
- const file2 = path13.join(dir, `${seq}.json`);
2459
+ const file2 = path14.join(dir, `${seq}.json`);
2260
2460
  const tmp = uniqueTempPath(file2);
2261
- fs16.writeFileSync(tmp, JSON.stringify(notice, null, 2));
2461
+ fs17.writeFileSync(tmp, JSON.stringify(notice, null, 2));
2262
2462
  atomicRenameSync(tmp, file2);
2263
2463
  return notice;
2264
2464
  }
@@ -2275,14 +2475,14 @@ function attachmentBlock(attachments) {
2275
2475
  }
2276
2476
 
2277
2477
  // packages/core/dist/helm.js
2278
- import * as fs17 from "node:fs";
2279
- import * as path14 from "node:path";
2478
+ import * as fs18 from "node:fs";
2479
+ import * as path15 from "node:path";
2280
2480
  function helmDir() {
2281
- return path14.join(lobstahHome(), "helm");
2481
+ return path15.join(lobstahHome(), "helm");
2282
2482
  }
2283
2483
  function listHelms() {
2284
2484
  try {
2285
- return fs17.readdirSync(helmDir()).filter((f) => f.endsWith(".json")).map((f) => JSON.parse(fs17.readFileSync(path14.join(helmDir(), f), "utf8")));
2485
+ return fs18.readdirSync(helmDir()).filter((f) => f.endsWith(".json")).map((f) => JSON.parse(fs18.readFileSync(path15.join(helmDir(), f), "utf8")));
2286
2486
  } catch {
2287
2487
  return [];
2288
2488
  }
@@ -2293,39 +2493,39 @@ function liveHelms(ttlMs, now2 = Date.now()) {
2293
2493
 
2294
2494
  // packages/core/dist/soak.js
2295
2495
  function regPath(trapId) {
2296
- return path15.join(soakingDir(), `${trapId}.json`);
2496
+ return path16.join(soakingDir(), `${trapId}.json`);
2297
2497
  }
2298
2498
  function readTrap(trapId) {
2299
2499
  try {
2300
- return JSON.parse(fs18.readFileSync(regPath(trapId), "utf8"));
2500
+ return JSON.parse(fs19.readFileSync(regPath(trapId), "utf8"));
2301
2501
  } catch {
2302
2502
  return void 0;
2303
2503
  }
2304
2504
  }
2305
2505
  function listTraps() {
2306
2506
  try {
2307
- return fs18.readdirSync(soakingDir()).filter((f) => f.endsWith(".json")).map((f) => JSON.parse(fs18.readFileSync(path15.join(soakingDir(), f), "utf8"))).filter((r) => typeof r.trapId === "string");
2507
+ return fs19.readdirSync(soakingDir()).filter((f) => f.endsWith(".json")).map((f) => JSON.parse(fs19.readFileSync(path16.join(soakingDir(), f), "utf8"))).filter((r) => typeof r.trapId === "string");
2308
2508
  } catch {
2309
2509
  return [];
2310
2510
  }
2311
2511
  }
2312
2512
  function claimPath(id, lane) {
2313
- return path15.join(laneDirs(lane).active, id, "claim.json");
2513
+ return path16.join(laneDirs(lane).active, id, "claim.json");
2314
2514
  }
2315
2515
  function readSessionClaim(id, lane) {
2316
2516
  try {
2317
- return JSON.parse(fs18.readFileSync(claimPath(id, lane), "utf8"));
2517
+ return JSON.parse(fs19.readFileSync(claimPath(id, lane), "utf8"));
2318
2518
  } catch {
2319
2519
  return void 0;
2320
2520
  }
2321
2521
  }
2322
2522
 
2323
2523
  // packages/core/dist/catch-context.js
2324
- import * as fs19 from "node:fs";
2325
- import * as path16 from "node:path";
2524
+ import * as fs20 from "node:fs";
2525
+ import * as path17 from "node:path";
2326
2526
  function readCatchContext(dir, id) {
2327
2527
  try {
2328
- return JSON.parse(fs19.readFileSync(path16.join(dir, `${id}.catch-context`), "utf8"));
2528
+ return JSON.parse(fs20.readFileSync(path17.join(dir, `${id}.catch-context`), "utf8"));
2329
2529
  } catch {
2330
2530
  return {};
2331
2531
  }
@@ -2338,19 +2538,19 @@ function observeLocalCatch(id, lane, phase, now2 = Date.now()) {
2338
2538
  const helms = liveHelms(cfg.helm.ttlSecs * 1e3, now2);
2339
2539
  const present = repo ? helms.some((h) => h.repos.includes(repo)) : null;
2340
2540
  const next = phase === "claim" ? { claimHelm: present, location: "local" } : { ...old, location: "local", helm: old.claimHelm === true || present === true ? true : old.claimHelm === false && present === false ? false : null };
2341
- const file2 = path16.join(dir, `${id}.catch-context`), tmp = uniqueTempPath(file2);
2541
+ const file2 = path17.join(dir, `${id}.catch-context`), tmp = uniqueTempPath(file2);
2342
2542
  try {
2343
- fs19.writeFileSync(tmp, JSON.stringify(next));
2344
- fs19.renameSync(tmp, file2);
2543
+ fs20.writeFileSync(tmp, JSON.stringify(next));
2544
+ fs20.renameSync(tmp, file2);
2345
2545
  } finally {
2346
- fs19.rmSync(tmp, { force: true });
2546
+ fs20.rmSync(tmp, { force: true });
2347
2547
  }
2348
2548
  }
2349
2549
 
2350
2550
  // packages/core/dist/stats.js
2351
2551
  var DAILY_RETENTION_DAYS = 400;
2352
2552
  function statsPath() {
2353
- return path17.join(lobstahHome(), "stats.json");
2553
+ return path18.join(lobstahHome(), "stats.json");
2354
2554
  }
2355
2555
  function shiftDay(day, days) {
2356
2556
  const [y, m, d] = day.split("-").map(Number);
@@ -2363,7 +2563,7 @@ function localDay(at = Date.now()) {
2363
2563
  function readCatchFacts(stateDir, id) {
2364
2564
  let last;
2365
2565
  try {
2366
- for (const line of fs20.readFileSync(path17.join(stateDir, `${id}.status`), "utf8").split("\n")) {
2566
+ for (const line of fs21.readFileSync(path18.join(stateDir, `${id}.status`), "utf8").split("\n")) {
2367
2567
  if (!line.trim())
2368
2568
  continue;
2369
2569
  try {
@@ -2379,7 +2579,7 @@ function readCatchFacts(stateDir, id) {
2379
2579
  let trap;
2380
2580
  let worker = workerProfile();
2381
2581
  try {
2382
- const evidence = JSON.parse(fs20.readFileSync(path17.join(stateDir, `${id}.evidence`), "utf8"));
2582
+ const evidence = JSON.parse(fs21.readFileSync(path18.join(stateDir, `${id}.evidence`), "utf8"));
2383
2583
  const to = evidence.deliveredTo;
2384
2584
  if (typeof to === "string" && to.startsWith("wt:"))
2385
2585
  trap = to;
@@ -2462,7 +2662,7 @@ function add(store, facts, now2) {
2462
2662
  }
2463
2663
  function backfillSources() {
2464
2664
  const live = ["work", "chore"].map((lane) => ({ dir: laneDirs(lane).state, live: true }));
2465
- const backups = readDirIfPresent(lobstahHome()).filter((name) => name.startsWith("state-backup-")).sort().map((name) => ({ dir: path17.join(lobstahHome(), name), live: false })).filter((s) => fs20.statSync(s.dir).isDirectory());
2665
+ const backups = readDirIfPresent(lobstahHome()).filter((name) => name.startsWith("state-backup-")).sort().map((name) => ({ dir: path18.join(lobstahHome(), name), live: false })).filter((s) => fs21.statSync(s.dir).isDirectory());
2466
2666
  return [...live, ...backups];
2467
2667
  }
2468
2668
  function backfillStats(now2 = Date.now(), alreadyCounted) {
@@ -2534,42 +2734,23 @@ function parseStore(text) {
2534
2734
  var complete2 = (s) => !!s && s.daily !== void 0;
2535
2735
  function writeStore(store) {
2536
2736
  const file2 = statsPath();
2537
- fs20.mkdirSync(path17.dirname(file2), { recursive: true });
2737
+ fs21.mkdirSync(path18.dirname(file2), { recursive: true });
2538
2738
  const tmp = uniqueTempPath(file2);
2539
- fs20.writeFileSync(tmp, JSON.stringify(store));
2739
+ fs21.writeFileSync(tmp, JSON.stringify(store));
2540
2740
  atomicRenameSync(tmp, file2);
2541
2741
  }
2542
2742
  function withStatsLock(action) {
2543
- fs20.mkdirSync(lobstahHome(), { recursive: true });
2544
- const lock = `${statsPath()}.lock`;
2545
- const deadline = Date.now() + 1e4;
2546
- for (; ; ) {
2547
- try {
2548
- fs20.mkdirSync(lock);
2549
- break;
2550
- } catch (err) {
2551
- if (err.code !== "EEXIST")
2552
- throw err;
2553
- try {
2554
- if (Date.now() - fs20.statSync(lock).mtimeMs > 12e4)
2555
- fs20.rmdirSync(lock);
2556
- } catch {
2557
- }
2558
- if (Date.now() >= deadline)
2559
- throw new Error("stats store locked");
2560
- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10);
2561
- }
2562
- }
2563
- try {
2564
- return action();
2565
- } finally {
2566
- fs20.rmdirSync(lock);
2567
- }
2743
+ fs21.mkdirSync(lobstahHome(), { recursive: true });
2744
+ return withDirLock(`${statsPath()}.lock`, action, {
2745
+ staleMs: 12e4,
2746
+ waitMs: 1e4,
2747
+ busy: () => new Error("stats store locked")
2748
+ });
2568
2749
  }
2569
2750
  function loadOrBackfill(now2) {
2570
2751
  let text;
2571
2752
  try {
2572
- text = fs20.readFileSync(statsPath(), "utf8");
2753
+ text = fs21.readFileSync(statsPath(), "utf8");
2573
2754
  } catch (err) {
2574
2755
  if (err.code !== "ENOENT")
2575
2756
  throw err;
@@ -2596,7 +2777,7 @@ function loadOrBackfill(now2) {
2596
2777
  return store2;
2597
2778
  }
2598
2779
  if (text !== void 0)
2599
- fs20.renameSync(statsPath(), `${statsPath()}.unreadable-${now2}`);
2780
+ fs21.renameSync(statsPath(), `${statsPath()}.unreadable-${now2}`);
2600
2781
  const store = backfillStats(now2);
2601
2782
  writeStore(store);
2602
2783
  return store;
@@ -2683,7 +2864,7 @@ function appendStatus(id, lane, verb, note, at, waiting, reported = false) {
2683
2864
  } catch {
2684
2865
  }
2685
2866
  }
2686
- fs21.appendFileSync(statusPath(id, lane), `${JSON.stringify(entry)}
2867
+ fs22.appendFileSync(statusPath(id, lane), `${JSON.stringify(entry)}
2687
2868
  `);
2688
2869
  if (verb === "done") {
2689
2870
  try {
@@ -2695,9 +2876,9 @@ function appendStatus(id, lane, verb, note, at, waiting, reported = false) {
2695
2876
  }
2696
2877
  function readStatusLog(id, lane) {
2697
2878
  const file2 = statusPath(id, lane);
2698
- if (!fs21.existsSync(file2))
2879
+ if (!fs22.existsSync(file2))
2699
2880
  return [];
2700
- return fs21.readFileSync(file2, "utf8").split("\n").filter(Boolean).flatMap((line) => {
2881
+ return fs22.readFileSync(file2, "utf8").split("\n").filter(Boolean).flatMap((line) => {
2701
2882
  try {
2702
2883
  const parsed = JSON.parse(line);
2703
2884
  return isVerb(parsed.verb) ? [parsed] : [];
@@ -2713,28 +2894,28 @@ function pausedWaiting(entry) {
2713
2894
  // packages/core/dist/queue.js
2714
2895
  function requeue(id, lane) {
2715
2896
  const dirs = laneDirs(lane);
2716
- const activeDir = path18.join(dirs.active, id);
2717
- const file2 = path18.join(activeDir, "descriptor.json");
2897
+ const activeDir = path19.join(dirs.active, id);
2898
+ const file2 = path19.join(activeDir, "descriptor.json");
2718
2899
  const d = { ...readDescriptor(id, lane), queuedAt: (/* @__PURE__ */ new Date()).toISOString() };
2719
2900
  const tmp = uniqueTempPath(file2);
2720
- fs22.writeFileSync(tmp, JSON.stringify(d, null, 2));
2901
+ fs23.writeFileSync(tmp, JSON.stringify(d, null, 2));
2721
2902
  atomicRenameSync(tmp, file2);
2722
- fs22.renameSync(file2, path18.join(dirs.queue, `${id}.json`));
2723
- fs22.rmSync(activeDir, { recursive: true, force: true });
2903
+ fs23.renameSync(file2, path19.join(dirs.queue, `${id}.json`));
2904
+ fs23.rmSync(activeDir, { recursive: true, force: true });
2724
2905
  }
2725
2906
  function readDescriptor(id, lane) {
2726
- const file2 = path18.join(laneDirs(lane).active, id, "descriptor.json");
2727
- return JSON.parse(fs22.readFileSync(file2, "utf8"));
2907
+ const file2 = path19.join(laneDirs(lane).active, id, "descriptor.json");
2908
+ return JSON.parse(fs23.readFileSync(file2, "utf8"));
2728
2909
  }
2729
2910
  function storedDescriptor(id, lane) {
2730
2911
  const dirs = laneDirs(lane);
2731
2912
  for (const file2 of [
2732
- path18.join(dirs.queue, `${id}.json`),
2733
- path18.join(dirs.active, id, "descriptor.json"),
2734
- path18.join(dirs.done, id, "descriptor.json")
2913
+ path19.join(dirs.queue, `${id}.json`),
2914
+ path19.join(dirs.active, id, "descriptor.json"),
2915
+ path19.join(dirs.done, id, "descriptor.json")
2735
2916
  ]) {
2736
2917
  try {
2737
- return JSON.parse(fs22.readFileSync(file2, "utf8"));
2918
+ return JSON.parse(fs23.readFileSync(file2, "utf8"));
2738
2919
  } catch {
2739
2920
  }
2740
2921
  }
@@ -2745,10 +2926,10 @@ function activeIds(lane) {
2745
2926
  }
2746
2927
  function complete(id, lane) {
2747
2928
  const dirs = laneDirs(lane);
2748
- fs22.renameSync(path18.join(dirs.active, id), path18.join(dirs.done, id));
2929
+ fs23.renameSync(path19.join(dirs.active, id), path19.join(dirs.done, id));
2749
2930
  }
2750
2931
  function cancelRequested(id, lane) {
2751
- return fs22.existsSync(path18.join(laneDirs(lane).active, id, "cancel"));
2932
+ return fs23.existsSync(path19.join(laneDirs(lane).active, id, "cancel"));
2752
2933
  }
2753
2934
 
2754
2935
  // packages/core/dist/backend.js
@@ -2797,21 +2978,21 @@ var ANSWER_EXTENSIONS = Object.keys(ANSWER_TYPES);
2797
2978
  var ONCE_TTL_MS = 60 * 60 * 1e3;
2798
2979
 
2799
2980
  // packages/core/dist/harness.js
2800
- import * as fs23 from "node:fs";
2801
- import * as path19 from "node:path";
2981
+ import * as fs24 from "node:fs";
2982
+ import * as path20 from "node:path";
2802
2983
  import { createRequire } from "node:module";
2803
2984
  function resolveOnPath(bin, pathVar = process.env.PATH) {
2804
2985
  if (!pathVar)
2805
2986
  return void 0;
2806
2987
  const names = process.platform === "win32" ? [bin, `${bin}.exe`, `${bin}.cmd`, `${bin}.bat`] : [bin];
2807
- for (const dir of pathVar.split(path19.delimiter)) {
2988
+ for (const dir of pathVar.split(path20.delimiter)) {
2808
2989
  if (!dir)
2809
2990
  continue;
2810
2991
  for (const name of names) {
2811
- const candidate = path19.join(dir, name);
2992
+ const candidate = path20.join(dir, name);
2812
2993
  try {
2813
- fs23.accessSync(candidate, fs23.constants.X_OK);
2814
- if (fs23.statSync(candidate).isFile())
2994
+ fs24.accessSync(candidate, fs24.constants.X_OK);
2995
+ if (fs24.statSync(candidate).isFile())
2815
2996
  return candidate;
2816
2997
  } catch {
2817
2998
  }
@@ -2832,8 +3013,8 @@ function codexInvocation(argv) {
2832
3013
  } catch {
2833
3014
  }
2834
3015
  for (const dir of require_.resolve.paths("@openai/codex") ?? []) {
2835
- const cli = path19.join(dir, "@openai", "codex", "bin", "codex.js");
2836
- if (fs23.existsSync(cli))
3016
+ const cli = path20.join(dir, "@openai", "codex", "bin", "codex.js");
3017
+ if (fs24.existsSync(cli))
2837
3018
  return { file: process.execPath, argv: [cli, ...argv] };
2838
3019
  }
2839
3020
  return void 0;
@@ -2906,8 +3087,8 @@ function droppedModelNote(harness, dropped) {
2906
3087
  }
2907
3088
 
2908
3089
  // packages/runner/src/run.ts
2909
- import * as fs28 from "node:fs";
2910
- import * as path24 from "node:path";
3090
+ import * as fs29 from "node:fs";
3091
+ import * as path25 from "node:path";
2911
3092
  import { execFileSync as execFileSync2 } from "node:child_process";
2912
3093
  import { fileURLToPath as fileURLToPath2 } from "node:url";
2913
3094
 
@@ -3117,13 +3298,13 @@ function startClaudeCli(invocation, opts) {
3117
3298
  events.close();
3118
3299
  resolve9({ sessionId, error: err.message });
3119
3300
  });
3120
- child.on("exit", (code) => {
3301
+ child.on("exit", (code2) => {
3121
3302
  events.close();
3122
- if (code === 0)
3303
+ if (code2 === 0)
3123
3304
  resolve9({ sessionId });
3124
3305
  else {
3125
3306
  const detail = stderrTail.trim().split("\n").at(-1);
3126
- const error = `claude exited ${code}${detail ? ` \u2014 ${detail}` : ""}`;
3307
+ const error = `claude exited ${code2}${detail ? ` \u2014 ${detail}` : ""}`;
3127
3308
  resolve9({ sessionId, error });
3128
3309
  }
3129
3310
  });
@@ -3203,25 +3384,25 @@ function createClaudeAdapter() {
3203
3384
  }
3204
3385
 
3205
3386
  // packages/adapters/dist/codex.js
3206
- import * as fs24 from "node:fs";
3387
+ import * as fs25 from "node:fs";
3207
3388
  import * as os4 from "node:os";
3208
- import * as path20 from "node:path";
3389
+ import * as path21 from "node:path";
3209
3390
  import { spawn as spawn2 } from "node:child_process";
3210
3391
  function isolatedCodexHome() {
3211
- const dir = path20.join(lobstahHome(), "codex-home");
3212
- fs24.mkdirSync(dir, { recursive: true });
3213
- const auth = path20.join(dir, "auth.json");
3214
- const realAuth = path20.join(os4.homedir(), ".codex", "auth.json");
3215
- if (!fs24.existsSync(auth) && fs24.existsSync(realAuth)) {
3392
+ const dir = path21.join(lobstahHome(), "codex-home");
3393
+ fs25.mkdirSync(dir, { recursive: true });
3394
+ const auth = path21.join(dir, "auth.json");
3395
+ const realAuth = path21.join(os4.homedir(), ".codex", "auth.json");
3396
+ if (!fs25.existsSync(auth) && fs25.existsSync(realAuth)) {
3216
3397
  try {
3217
- fs24.symlinkSync(realAuth, auth);
3398
+ fs25.symlinkSync(realAuth, auth);
3218
3399
  } catch {
3219
- fs24.copyFileSync(realAuth, auth);
3400
+ fs25.copyFileSync(realAuth, auth);
3220
3401
  }
3221
3402
  }
3222
- const cfg = path20.join(dir, "config.toml");
3223
- if (!fs24.existsSync(cfg)) {
3224
- fs24.writeFileSync(cfg, "# lobstah-managed: auth inherited from ~/.codex, interactive config not\n");
3403
+ const cfg = path21.join(dir, "config.toml");
3404
+ if (!fs25.existsSync(cfg)) {
3405
+ fs25.writeFileSync(cfg, "# lobstah-managed: auth inherited from ~/.codex, interactive config not\n");
3225
3406
  }
3226
3407
  return dir;
3227
3408
  }
@@ -3305,13 +3486,13 @@ function startCodexCli(invoke, opts) {
3305
3486
  }
3306
3487
  });
3307
3488
  child.on("error", (err) => resolve9(err.message));
3308
- child.on("exit", (code) => {
3489
+ child.on("exit", (code2) => {
3309
3490
  if (turnError)
3310
3491
  return resolve9(turnError);
3311
- if (code === 0 || killed)
3492
+ if (code2 === 0 || killed)
3312
3493
  return resolve9(void 0);
3313
3494
  const detail = stderrTail.trim().split("\n").at(-1);
3314
- resolve9(`codex exited ${code}${detail ? ` \u2014 ${detail}` : ""}`);
3495
+ resolve9(`codex exited ${code2}${detail ? ` \u2014 ${detail}` : ""}`);
3315
3496
  });
3316
3497
  });
3317
3498
  }
@@ -3424,15 +3605,15 @@ function loadAdapter(name) {
3424
3605
  }
3425
3606
 
3426
3607
  // packages/worktree/dist/index.js
3427
- import * as fs26 from "node:fs";
3428
- import * as path22 from "node:path";
3608
+ import * as fs27 from "node:fs";
3609
+ import * as path23 from "node:path";
3429
3610
  import { createHash } from "node:crypto";
3430
3611
  import { exec, execFile as execFile2, execFileSync } from "node:child_process";
3431
3612
  import { promisify as promisify2 } from "node:util";
3432
3613
 
3433
3614
  // packages/worktree/dist/pool.js
3434
- import * as fs25 from "node:fs";
3435
- import * as path21 from "node:path";
3615
+ import * as fs26 from "node:fs";
3616
+ import * as path22 from "node:path";
3436
3617
  import { execFile } from "node:child_process";
3437
3618
  import { promisify } from "node:util";
3438
3619
  var run = promisify(execFile);
@@ -3494,17 +3675,17 @@ function takeOut(name, pool, slot, reason, dispatch, notice = true) {
3494
3675
  function trapIn(dir) {
3495
3676
  const real = (p) => {
3496
3677
  try {
3497
- return fs25.realpathSync.native(p);
3678
+ return fs26.realpathSync.native(p);
3498
3679
  } catch {
3499
- return path21.resolve(p);
3680
+ return path22.resolve(p);
3500
3681
  }
3501
3682
  };
3502
3683
  const here = real(dir);
3503
3684
  return listTraps().some((t) => {
3504
3685
  if (typeof t.worktree !== "string")
3505
3686
  return false;
3506
- const rel = path21.relative(here, real(t.worktree));
3507
- return rel === "" || !rel.startsWith("..") && !path21.isAbsolute(rel);
3687
+ const rel = path22.relative(here, real(t.worktree));
3688
+ return rel === "" || !rel.startsWith("..") && !path22.isAbsolute(rel);
3508
3689
  });
3509
3690
  }
3510
3691
  async function claimPoolSlot(input) {
@@ -3512,7 +3693,7 @@ async function claimPoolSlot(input) {
3512
3693
  const refused = [];
3513
3694
  for (let slot = 1; slot <= pool.size; slot++) {
3514
3695
  const dir = poolSlotPath(name, slot);
3515
- if (fs25.existsSync(dir) && readWorktreeLock(dir)?.id === id && readWorktreeLock(dir)?.kind !== "warm") {
3696
+ if (fs26.existsSync(dir) && readWorktreeLock(dir)?.id === id && readWorktreeLock(dir)?.kind !== "warm") {
3516
3697
  writeSlotClaim(name, slot, { id, lane, at: (/* @__PURE__ */ new Date()).toISOString() });
3517
3698
  return { claimed: true, dir, slot, label: poolSlotLabel(name, slot) };
3518
3699
  }
@@ -3560,7 +3741,7 @@ async function resetPoolWorktree(repo, dir, id, fromRemoteBranch = repo.trunk) {
3560
3741
  }
3561
3742
  var WARM_ID = "pool-warm";
3562
3743
  async function createSlot(repo, dir) {
3563
- fs25.mkdirSync(path21.dirname(dir), { recursive: true });
3744
+ fs26.mkdirSync(path22.dirname(dir), { recursive: true });
3564
3745
  await oneAtATime(repo.path, async () => {
3565
3746
  await tryGit(repo.path, "worktree", "prune");
3566
3747
  await gitShared(repo.path, "worktree", "add", "--detach", dir, `origin/${repo.trunk}`);
@@ -3582,7 +3763,7 @@ async function warmPool(name, opts = {}) {
3582
3763
  if (!release)
3583
3764
  return false;
3584
3765
  try {
3585
- if (!fs25.existsSync(repo.path)) {
3766
+ if (!fs26.existsSync(repo.path)) {
3586
3767
  if (!repo.origin)
3587
3768
  throw new Error(`repo path ${repo.path} missing and no origin configured`);
3588
3769
  await run("git", ["clone", repo.origin, repo.path], { env: process.env });
@@ -3595,8 +3776,8 @@ async function warmPool(name, opts = {}) {
3595
3776
  const dir = poolSlotPath(name, slot);
3596
3777
  const label = poolSlotLabel(name, slot);
3597
3778
  const meta = readSlotMeta(name, slot);
3598
- if (!fs25.existsSync(dir)) {
3599
- fs25.mkdirSync(poolsRoot(), { recursive: true });
3779
+ if (!fs26.existsSync(dir)) {
3780
+ fs26.mkdirSync(poolsRoot(), { recursive: true });
3600
3781
  let free = Infinity;
3601
3782
  try {
3602
3783
  free = need > 0 ? read2(poolsRoot()) : Infinity;
@@ -3712,23 +3893,23 @@ ${err instanceof Error ? err.message : ""}`;
3712
3893
  }
3713
3894
  var ATTEMPTS = 6;
3714
3895
  async function gitShared(cwd, ...args) {
3715
- for (let attempt = 1; ; attempt++) {
3896
+ for (let attempt2 = 1; ; attempt2++) {
3716
3897
  try {
3717
3898
  return await git(cwd, ...args);
3718
3899
  } catch (err) {
3719
3900
  if (!isLockContention(err))
3720
3901
  throw err;
3721
- if (attempt >= ATTEMPTS) {
3722
- throw new Error(`git ${args.join(" ")}: lock contention, ${attempt} attempts
3902
+ if (attempt2 >= ATTEMPTS) {
3903
+ throw new Error(`git ${args.join(" ")}: lock contention, ${attempt2} attempts
3723
3904
  ${gitStderr(err)}`, { cause: err });
3724
3905
  }
3725
- await new Promise((r) => setTimeout(r, 100 * 2 ** (attempt - 1) * (0.5 + Math.random())));
3906
+ await new Promise((r) => setTimeout(r, 100 * 2 ** (attempt2 - 1) * (0.5 + Math.random())));
3726
3907
  }
3727
3908
  }
3728
3909
  }
3729
3910
  var REPO_LOCK_WAIT_MS = 5 * 6e4;
3730
3911
  var repoQueues = /* @__PURE__ */ new Map();
3731
- function pidAlive2(pid) {
3912
+ function pidAlive3(pid) {
3732
3913
  try {
3733
3914
  process.kill(pid, 0);
3734
3915
  return true;
@@ -3739,18 +3920,18 @@ function pidAlive2(pid) {
3739
3920
  var BUSY = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY"]);
3740
3921
  function takeRepoLock(file2, mine) {
3741
3922
  try {
3742
- fs26.writeFileSync(file2, mine, { flag: "wx" });
3923
+ fs27.writeFileSync(file2, mine, { flag: "wx" });
3743
3924
  return { state: "held" };
3744
3925
  } catch (err) {
3745
- const code = err.code ?? "";
3746
- if (code !== "EEXIST" && !BUSY.has(code))
3926
+ const code2 = err.code ?? "";
3927
+ if (code2 !== "EEXIST" && !BUSY.has(code2))
3747
3928
  throw err;
3748
3929
  }
3749
3930
  let raw = "";
3750
3931
  let age = 0;
3751
3932
  try {
3752
- raw = fs26.readFileSync(file2, "utf8");
3753
- age = Date.now() - fs26.statSync(file2).mtimeMs;
3933
+ raw = fs27.readFileSync(file2, "utf8");
3934
+ age = Date.now() - fs27.statSync(file2).mtimeMs;
3754
3935
  } catch {
3755
3936
  return { state: "retry" };
3756
3937
  }
@@ -3760,11 +3941,11 @@ function takeRepoLock(file2, mine) {
3760
3941
  } catch {
3761
3942
  holder = void 0;
3762
3943
  }
3763
- const stale = age > REPO_LOCK_WAIT_MS || (holder ? !pidAlive2(holder.pid) : age > 5e3);
3944
+ const stale = age > REPO_LOCK_WAIT_MS || (holder ? !pidAlive3(holder.pid) : age > 5e3);
3764
3945
  if (stale) {
3765
3946
  try {
3766
- if (fs26.readFileSync(file2, "utf8") === raw)
3767
- fs26.rmSync(file2, { force: true });
3947
+ if (fs27.readFileSync(file2, "utf8") === raw)
3948
+ fs27.rmSync(file2, { force: true });
3768
3949
  } catch {
3769
3950
  }
3770
3951
  return { state: "retry" };
@@ -3773,13 +3954,13 @@ function takeRepoLock(file2, mine) {
3773
3954
  }
3774
3955
  function releaseRepoLock(file2, mine) {
3775
3956
  try {
3776
- if (fs26.readFileSync(file2, "utf8") === mine)
3777
- fs26.rmSync(file2, { force: true, recursive: true, maxRetries: 5 });
3957
+ if (fs27.readFileSync(file2, "utf8") === mine)
3958
+ fs27.rmSync(file2, { force: true, recursive: true, maxRetries: 5 });
3778
3959
  } catch {
3779
3960
  }
3780
3961
  }
3781
3962
  async function withRepoLock(common, fn) {
3782
- const file2 = path22.join(common, "lobstah-git.lock");
3963
+ const file2 = path23.join(common, "lobstah-git.lock");
3783
3964
  const mine = JSON.stringify({ pid: process.pid, at: (/* @__PURE__ */ new Date()).toISOString() });
3784
3965
  const deadline = Date.now() + REPO_LOCK_WAIT_MS;
3785
3966
  let held = false;
@@ -3815,7 +3996,7 @@ async function oneAtATime(cwd, fn) {
3815
3996
  }
3816
3997
  function fetchStamps(common) {
3817
3998
  try {
3818
- return JSON.parse(fs26.readFileSync(path22.join(common, "lobstah-fetch.json"), "utf8"));
3999
+ return JSON.parse(fs27.readFileSync(path23.join(common, "lobstah-fetch.json"), "utf8"));
3819
4000
  } catch {
3820
4001
  return {};
3821
4002
  }
@@ -3829,15 +4010,15 @@ async function fetchShared(cwd, remote, ref) {
3829
4010
  const started = Date.now();
3830
4011
  await gitShared(cwd, "fetch", remote, ref);
3831
4012
  const stamps = { ...fetchStamps(common), [key]: started };
3832
- fs26.writeFileSync(path22.join(common, "lobstah-fetch.json"), JSON.stringify(stamps, null, 2));
4013
+ fs27.writeFileSync(path23.join(common, "lobstah-fetch.json"), JSON.stringify(stamps, null, 2));
3833
4014
  });
3834
4015
  }
3835
4016
  async function allocate(repo, id, fromRemoteBranch = repo.trunk) {
3836
4017
  const dir = worktreePath(id);
3837
- if (fs26.existsSync(dir)) {
4018
+ if (fs27.existsSync(dir)) {
3838
4019
  throw new Error(`worktree for ${id} already exists at ${dir} \u2014 never allocate a second`);
3839
4020
  }
3840
- if (!fs26.existsSync(repo.path)) {
4021
+ if (!fs27.existsSync(repo.path)) {
3841
4022
  if (!repo.origin)
3842
4023
  throw new Error(`repo path ${repo.path} missing and no origin configured`);
3843
4024
  await run2("git", ["clone", repo.origin, repo.path], { env: process.env });
@@ -3852,7 +4033,7 @@ async function allocate(repo, id, fromRemoteBranch = repo.trunk) {
3852
4033
  async function recoverWorktree(repo, id) {
3853
4034
  const dir = worktreePath(id);
3854
4035
  try {
3855
- if (fs26.statSync(path22.join(dir, ".git")).isFile()) {
4036
+ if (fs27.statSync(path23.join(dir, ".git")).isFile()) {
3856
4037
  const branch = await git(dir, "symbolic-ref", "--quiet", "HEAD");
3857
4038
  const root = await git(dir, "rev-parse", "--show-toplevel");
3858
4039
  const common = await git(dir, "rev-parse", "--path-format=absolute", "--git-common-dir");
@@ -3890,27 +4071,27 @@ function setupHash(repo, dir) {
3890
4071
  const h = createHash("sha256");
3891
4072
  h.update(JSON.stringify(repo.setup ?? []));
3892
4073
  for (const name of LOCKFILES) {
3893
- const file2 = path22.join(dir, name);
3894
- if (!fs26.existsSync(file2))
4074
+ const file2 = path23.join(dir, name);
4075
+ if (!fs27.existsSync(file2))
3895
4076
  continue;
3896
4077
  h.update(`\0${name}\0`);
3897
- h.update(fs26.readFileSync(file2));
4078
+ h.update(fs27.readFileSync(file2));
3898
4079
  }
3899
4080
  return h.digest("hex");
3900
4081
  }
3901
4082
  function setupRecordFile(dir) {
3902
4083
  const gitDir = worktreeGitDir(dir);
3903
- return gitDir ? path22.join(gitDir, "lobstah-setup.json") : void 0;
4084
+ return gitDir ? path23.join(gitDir, "lobstah-setup.json") : void 0;
3904
4085
  }
3905
4086
  function recordSetup(repo, dir) {
3906
4087
  const file2 = setupRecordFile(dir);
3907
4088
  if (file2)
3908
- fs26.writeFileSync(file2, JSON.stringify({ hash: setupHash(repo, dir), at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
4089
+ fs27.writeFileSync(file2, JSON.stringify({ hash: setupHash(repo, dir), at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
3909
4090
  }
3910
4091
  function recordedSetupHash(dir) {
3911
4092
  const file2 = setupRecordFile(dir);
3912
4093
  try {
3913
- return file2 ? JSON.parse(fs26.readFileSync(file2, "utf8")).hash : void 0;
4094
+ return file2 ? JSON.parse(fs27.readFileSync(file2, "utf8")).hash : void 0;
3914
4095
  } catch {
3915
4096
  return void 0;
3916
4097
  }
@@ -3923,9 +4104,9 @@ function poolReused(slot, by) {
3923
4104
  function realpath(p) {
3924
4105
  let r;
3925
4106
  try {
3926
- r = fs26.realpathSync.native(p);
4107
+ r = fs27.realpathSync.native(p);
3927
4108
  } catch {
3928
- r = path22.resolve(p);
4109
+ r = path23.resolve(p);
3929
4110
  }
3930
4111
  return process.platform === "win32" ? r.toLowerCase() : r;
3931
4112
  }
@@ -3973,8 +4154,8 @@ async function chooseWorktree(input) {
3973
4154
  for (const t of listTraps()) {
3974
4155
  if (typeof t.worktree !== "string")
3975
4156
  continue;
3976
- const rel = path22.relative(here, realpath(t.worktree));
3977
- if (!rel.startsWith("..") && !path22.isAbsolute(rel))
4157
+ const rel = path23.relative(here, realpath(t.worktree));
4158
+ if (!rel.startsWith("..") && !path23.isAbsolute(rel))
3978
4159
  return { reuse: false, reason: "origin worktree is a trap\u2019s" };
3979
4160
  }
3980
4161
  for (const l of ["work", "chore"]) {
@@ -4402,8 +4583,8 @@ function startWallClock(opts) {
4402
4583
  import { execFile as execFile3 } from "node:child_process";
4403
4584
  import { promisify as promisify3 } from "node:util";
4404
4585
  import { fileURLToPath } from "node:url";
4405
- import * as fs27 from "node:fs";
4406
- import * as path23 from "node:path";
4586
+ import * as fs28 from "node:fs";
4587
+ import * as path24 from "node:path";
4407
4588
  var exec2 = promisify3(execFile3);
4408
4589
  function firstLine(err) {
4409
4590
  const stderr = err && typeof err === "object" && "stderr" in err ? String(err.stderr).trim() : "";
@@ -4433,10 +4614,10 @@ function keepRemote(opts) {
4433
4614
  const note = (message) => mergeEvidence(id, lane, { note: message.slice(0, 300) });
4434
4615
  if (existingPrUrl) mergeEvidence(id, lane, { prUrl: existingPrUrl });
4435
4616
  const registerWatch = async (url) => {
4436
- const root = path23.resolve(path23.dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
4437
- const localCli = path23.join(root, "apps", "cli", "dist", "main.js");
4617
+ const root = path24.resolve(path24.dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
4618
+ const localCli = path24.join(root, "apps", "cli", "dist", "main.js");
4438
4619
  const args = ["watch", "add", url, "--for", id];
4439
- if (fs27.existsSync(localCli)) await command(process.execPath, [localCli, ...args], 15e3);
4620
+ if (fs28.existsSync(localCli)) await command(process.execPath, [localCli, ...args], 15e3);
4440
4621
  else await command("lobstah", args, 15e3);
4441
4622
  };
4442
4623
  let lastSeenHead;
@@ -4628,16 +4809,16 @@ function coldNote(cold, cwd, trunk) {
4628
4809
  }
4629
4810
  async function main(activeDir, lane, seams = {}) {
4630
4811
  const deps = { ...defaultDeps, ...seams };
4631
- const id = path24.basename(activeDir);
4812
+ const id = path25.basename(activeDir);
4632
4813
  if (isTrapCatch(id, lane)) throw new Error(`refusing headless runner for trap catch ${id}`);
4633
4814
  const status = (verb, note) => appendStatus(id, lane, verb, note);
4634
4815
  const cfg = loadConfig();
4635
- const descriptor = JSON.parse(fs28.readFileSync(path24.join(activeDir, "descriptor.json"), "utf8"));
4816
+ const descriptor = JSON.parse(fs29.readFileSync(path25.join(activeDir, "descriptor.json"), "utf8"));
4636
4817
  const resolved = resolveDispatch(descriptor, cfg);
4637
4818
  const repo = cfg.repos[descriptor.repo];
4638
- const briefFile = path24.join(activeDir, "brief.md");
4639
- if (!fs28.existsSync(briefFile)) fs28.writeFileSync(briefFile, descriptor.brief);
4640
- const brief = fs28.readFileSync(briefFile, "utf8");
4819
+ const briefFile = path25.join(activeDir, "brief.md");
4820
+ if (!fs29.existsSync(briefFile)) fs29.writeFileSync(briefFile, descriptor.brief);
4821
+ const brief = fs29.readFileSync(briefFile, "utf8");
4641
4822
  const attempts = Number(process.env.LOBSTAH_ATTEMPTS ?? "1");
4642
4823
  const wake = process.env.LOBSTAH_WAKE;
4643
4824
  const runnerInfo = {
@@ -4645,7 +4826,7 @@ async function main(activeDir, lane, seams = {}) {
4645
4826
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
4646
4827
  attempts
4647
4828
  };
4648
- fs28.writeFileSync(path24.join(activeDir, "runner.json"), JSON.stringify(runnerInfo, null, 2));
4829
+ fs29.writeFileSync(path25.join(activeDir, "runner.json"), JSON.stringify(runnerInfo, null, 2));
4649
4830
  if (descriptor.systemRepair && descriptor.pr?.url) {
4650
4831
  const state = deps.prState(descriptor.pr.url) ?? readPr(parsePrRef(descriptor.pr.url)?.key ?? "")?.state;
4651
4832
  if (state === "MERGED" || state === "CLOSED") {
@@ -4662,14 +4843,14 @@ async function main(activeDir, lane, seams = {}) {
4662
4843
  resolvedHarness: resolved.harness,
4663
4844
  envResume: process.env.LOBSTAH_RESUME
4664
4845
  });
4665
- const wtFile = path24.join(activeDir, "worktree.json");
4846
+ const wtFile = path25.join(activeDir, "worktree.json");
4666
4847
  let recorded;
4667
4848
  let recovered = false;
4668
4849
  let choice3;
4669
- if (fs28.existsSync(wtFile)) {
4670
- recorded = JSON.parse(fs28.readFileSync(wtFile, "utf8")).path;
4671
- if (!fs28.existsSync(recorded)) throw new Error(`recorded worktree ${recorded} is gone`);
4672
- } else if (fs28.existsSync(worktreePath(id))) {
4850
+ if (fs29.existsSync(wtFile)) {
4851
+ recorded = JSON.parse(fs29.readFileSync(wtFile, "utf8")).path;
4852
+ if (!fs29.existsSync(recorded)) throw new Error(`recorded worktree ${recorded} is gone`);
4853
+ } else if (fs29.existsSync(worktreePath(id))) {
4673
4854
  recorded = await recoverWorktree(repo, id);
4674
4855
  recovered = true;
4675
4856
  } else if (descriptor.followUp && cfg.limits.reuseWorktree !== false) {
@@ -4724,7 +4905,7 @@ async function main(activeDir, lane, seams = {}) {
4724
4905
  if (held) throw new Error(`worktree at ${cwd} is in use by ${held.id} \u2014 wait for that dispatch to release it before retrying`);
4725
4906
  if (recovered) {
4726
4907
  await deps.prepareReuse(repo, cwd);
4727
- fs28.writeFileSync(wtFile, JSON.stringify({ path: cwd }, null, 2));
4908
+ fs29.writeFileSync(wtFile, JSON.stringify({ path: cwd }, null, 2));
4728
4909
  }
4729
4910
  } else if (choice3?.reuse) {
4730
4911
  cwd = choice3.path;
@@ -4735,17 +4916,17 @@ async function main(activeDir, lane, seams = {}) {
4735
4916
  type: "runner",
4736
4917
  data: { worktree: cwd, worktreeOf: choice3.owner, setupRan }
4737
4918
  });
4738
- fs28.writeFileSync(wtFile, JSON.stringify({ path: cwd, of: choice3.owner }, null, 2));
4919
+ fs29.writeFileSync(wtFile, JSON.stringify({ path: cwd, of: choice3.owner }, null, 2));
4739
4920
  } else if (poolClaim) {
4740
4921
  cwd = poolClaim.dir;
4741
4922
  await deps.resetPool(repo, cwd, id, descriptor.systemRepair ? descriptor.pr?.headRefName : void 0);
4742
- fs28.writeFileSync(wtFile, JSON.stringify({ path: cwd, pool: poolClaim.label }, null, 2));
4923
+ fs29.writeFileSync(wtFile, JSON.stringify({ path: cwd, pool: poolClaim.label }, null, 2));
4743
4924
  } else {
4744
4925
  cwd = await deps.allocate(repo, id, descriptor.systemRepair ? descriptor.pr?.headRefName : void 0);
4745
4926
  acquireWorktreeLock(cwd, id, lane);
4746
- fs28.writeFileSync(wtFile, JSON.stringify({ path: cwd }, null, 2));
4927
+ fs29.writeFileSync(wtFile, JSON.stringify({ path: cwd }, null, 2));
4747
4928
  }
4748
- const worktreeOf = JSON.parse(fs28.readFileSync(wtFile, "utf8")).of;
4929
+ const worktreeOf = JSON.parse(fs29.readFileSync(wtFile, "utf8")).of;
4749
4930
  const inPool = poolSlotOf(cwd);
4750
4931
  mergeEvidence(id, lane, { worktree: cwd, worktreeOf, ...inPool ? { pool: poolSlotLabel(inPool.pool, inPool.slot) } : {} });
4751
4932
  const existingPr = boundPr(descriptor, lane);
@@ -4773,14 +4954,14 @@ async function main(activeDir, lane, seams = {}) {
4773
4954
  const envNudge = [process.env.LOBSTAH_NUDGE, wakeNote()].filter(Boolean).join("\n\n") || void 0;
4774
4955
  const planNudge = plan.cold && !envNudge ? coldNote(plan.cold, cwd, repo.trunk) : void 0;
4775
4956
  const promptWith = (nudge) => buildPrompt(brief, { id, nudge, attachments: descriptor.attachments, existingPr });
4776
- const binDir = path24.resolve(path24.dirname(fileURLToPath2(import.meta.url)), "..", "..", "..", "bin");
4777
- const workerPath = fs28.existsSync(path24.join(binDir, "lobstah")) ? `${binDir}${path24.delimiter}${process.env.PATH ?? ""}` : void 0;
4957
+ const binDir = path25.resolve(path25.dirname(fileURLToPath2(import.meta.url)), "..", "..", "..", "bin");
4958
+ const workerPath = fs29.existsSync(path25.join(binDir, "lobstah")) ? `${binDir}${path25.delimiter}${process.env.PATH ?? ""}` : void 0;
4778
4959
  let wallClockHit = false;
4779
4960
  let current;
4780
- const wallFile = path24.join(activeDir, "wallclock.json");
4961
+ const wallFile = path25.join(activeDir, "wallclock.json");
4781
4962
  const wallState = (() => {
4782
4963
  try {
4783
- return JSON.parse(fs28.readFileSync(wallFile, "utf8"));
4964
+ return JSON.parse(fs29.readFileSync(wallFile, "utf8"));
4784
4965
  } catch {
4785
4966
  return { elapsedMs: 0, windowMs: resolved.limits.wallClockSecs * 1e3 };
4786
4967
  }
@@ -4799,8 +4980,8 @@ async function main(activeDir, lane, seams = {}) {
4799
4980
  ) * 1e3;
4800
4981
  const persistWall = (elapsedMs, windowMs) => {
4801
4982
  const tmp = uniqueTempPath(wallFile);
4802
- fs28.writeFileSync(tmp, JSON.stringify({ ...wallState, elapsedMs, windowMs }));
4803
- fs28.renameSync(tmp, wallFile);
4983
+ fs29.writeFileSync(tmp, JSON.stringify({ ...wallState, elapsedMs, windowMs }));
4984
+ fs29.renameSync(tmp, wallFile);
4804
4985
  };
4805
4986
  const madeProgress = () => {
4806
4987
  const activity = readActivity(id, lane);
@@ -5104,13 +5285,13 @@ async function reapStarted(root = process.pid, graceMs) {
5104
5285
  var EXIT_LINGER_MS = 5e3;
5105
5286
  function runRunner(activeDirArg2, laneArg2) {
5106
5287
  const lane = laneArg2 === "chore" ? "chore" : "work";
5107
- const id = path25.basename(activeDirArg2);
5288
+ const id = path26.basename(activeDirArg2);
5108
5289
  main(activeDirArg2, lane, { reap: () => reapStarted(process.pid) }).catch((err) => {
5109
5290
  try {
5110
5291
  if (!isFinished(id, lane)) {
5111
5292
  appendStatus(id, lane, "failed", String(err instanceof Error ? err.message : err).slice(0, 500));
5112
5293
  }
5113
- fs29.renameSync(activeDirArg2, path25.join(laneDirs(lane).done, id));
5294
+ fs30.renameSync(activeDirArg2, path26.join(laneDirs(lane).done, id));
5114
5295
  } catch {
5115
5296
  }
5116
5297
  process.exitCode = 1;