@tablation/crew 0.169.4 → 0.169.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +264 -176
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -136,13 +136,13 @@ function periscopeSummary(cfg) {
136
136
  if (routes.length === 0) return `off (no enabled route sets hostPeriscopes: true; ${limits})`;
137
137
  return `ON for ${routes.join(", ")} (${cfg.ship.relayPreviews ? "previews relayed" : `host ${cfg.ship.previewHost ?? "NOT SET (ship.previewHost)"}`}, ${limits})`;
138
138
  }
139
- async function previewHostProblem(cfg, resolve8 = (h) => lookup(h)) {
139
+ async function previewHostProblem(cfg, resolve9 = (h) => lookup(h)) {
140
140
  if (periscopeRoutes(cfg).length === 0) return void 0;
141
141
  if (cfg.ship.relayPreviews) return void 0;
142
142
  const host = cfg.ship.previewHost;
143
143
  if (!host) return "ship.previewHost is not set \u2014 a route hosts periscopes, so Passengers have no host to be sent to";
144
144
  try {
145
- await resolve8(host);
145
+ await resolve9(host);
146
146
  } catch {
147
147
  return `ship.previewHost "${host}" does not resolve from this machine`;
148
148
  }
@@ -791,11 +791,11 @@ function urlPort(url) {
791
791
  }
792
792
  }
793
793
  function hostListening(port, host, timeoutMs) {
794
- return new Promise((resolve8) => {
794
+ return new Promise((resolve9) => {
795
795
  const s = connect({ port, host });
796
796
  const done = (ok) => {
797
797
  s.destroy();
798
- resolve8(ok);
798
+ resolve9(ok);
799
799
  };
800
800
  s.setTimeout(timeoutMs, () => done(false));
801
801
  s.once("connect", () => done(true));
@@ -7477,12 +7477,12 @@ function envForRepository(entries, repo) {
7477
7477
  }
7478
7478
 
7479
7479
  // src/interrupted.ts
7480
- import { existsSync as existsSync30, readdirSync as readdirSync10, readFileSync as readFileSync32 } from "fs";
7480
+ import { existsSync as existsSync30, readdirSync as readdirSync10, readFileSync as readFileSync33 } from "fs";
7481
7481
  import { join as join36 } from "path";
7482
7482
 
7483
7483
  // src/agent.ts
7484
7484
  import { spawnSync as spawnSync7 } from "child_process";
7485
- import { readFileSync as readFileSync31, existsSync as existsSync29, statSync as statSync9, mkdirSync as mkdirSync23, writeFileSync as writeFileSync24, createWriteStream, openSync as openSync4, closeSync as closeSync4, readSync } from "fs";
7485
+ import { readFileSync as readFileSync32, existsSync as existsSync29, statSync as statSync9, mkdirSync as mkdirSync23, writeFileSync as writeFileSync24, createWriteStream, openSync as openSync4, closeSync as closeSync4, readSync } from "fs";
7486
7486
  import { StringDecoder } from "string_decoder";
7487
7487
  import { finished } from "stream/promises";
7488
7488
  import { join as join35, dirname as dirname17, basename as basename9 } from "path";
@@ -9192,9 +9192,9 @@ function createBridge(o) {
9192
9192
  }
9193
9193
  async function runBridge(stateDir, route2, ticket) {
9194
9194
  const bridge = createBridge({ attachFile: attachFilePath(stateDir, route2, ticket) });
9195
- const closed = new Promise((resolve8) => {
9196
- bridge.server.onclose = resolve8;
9197
- process.stdin.on("end", resolve8);
9195
+ const closed = new Promise((resolve9) => {
9196
+ bridge.server.onclose = resolve9;
9197
+ process.stdin.on("end", resolve9);
9198
9198
  });
9199
9199
  await bridge.start(new StdioServerTransport());
9200
9200
  await closed;
@@ -9634,7 +9634,7 @@ var unregisterRunInput = (run4) => {
9634
9634
  var runInputFor = (run4) => live.get(run4);
9635
9635
 
9636
9636
  // src/agent-log.ts
9637
- import { existsSync as existsSync25, mkdirSync as mkdirSync19, readdirSync as readdirSync8, readFileSync as readFileSync25, rmSync as rmSync14, writeFileSync as writeFileSync20 } from "fs";
9637
+ import { existsSync as existsSync25, mkdirSync as mkdirSync19, readdirSync as readdirSync8, readFileSync as readFileSync26, rmSync as rmSync14, writeFileSync as writeFileSync20 } from "fs";
9638
9638
  import { join as join29 } from "path";
9639
9639
 
9640
9640
  // src/pending-backoff.ts
@@ -11573,6 +11573,8 @@ import { join as join27 } from "path";
11573
11573
  import { StaleWriteError as StaleWriteError3 } from "@tablation/client";
11574
11574
 
11575
11575
  // src/conflict.ts
11576
+ import { readFileSync as readFileSync25 } from "fs";
11577
+ import { resolve as resolve4 } from "path";
11576
11578
  import { StaleWriteError as StaleWriteError2 } from "@tablation/client";
11577
11579
  var BOUNCE_MARKER = calloutHeader("WARNING", "Merge Conflict");
11578
11580
  function worktreeForBranch(cwd, branch) {
@@ -11615,9 +11617,45 @@ function planConflictBounce(cwd, ticket, branch, base, paths, events, merged = [
11615
11617
  siblings
11616
11618
  };
11617
11619
  }
11620
+ function isOwnUnresolvedMerge(worktree, base) {
11621
+ const mergeHead = gitOk(worktree, ["rev-parse", "-q", "--verify", "MERGE_HEAD"]);
11622
+ if (!mergeHead) return false;
11623
+ const baseTip = gitOk(worktree, ["rev-parse", "--verify", "-q", base]);
11624
+ if (!baseTip || !isAncestor(worktree, mergeHead, baseTip)) return false;
11625
+ const msgPath = gitOk(worktree, ["rev-parse", "--git-path", "MERGE_MSG"]);
11626
+ if (!msgPath) return false;
11627
+ try {
11628
+ const first = readFileSync25(resolve4(worktree, msgPath), "utf8").split("\n")[0] ?? "";
11629
+ if (!/^Merge (?:remote-tracking )?branch '/.test(first)) return false;
11630
+ } catch {
11631
+ return false;
11632
+ }
11633
+ const unmerged = new Set((gitOk(worktree, ["diff", "--name-only", "--diff-filter=U"]) ?? "").split("\n").filter(Boolean));
11634
+ for (const line of (gitOk(worktree, ["status", "--porcelain"]) ?? "").split("\n").filter(Boolean)) {
11635
+ const xy = line.slice(0, 2);
11636
+ const path = line.slice(3);
11637
+ if (unmerged.has(path)) continue;
11638
+ if (xy === "??" || xy[1] !== " ") return false;
11639
+ }
11640
+ for (const path of unmerged) {
11641
+ try {
11642
+ if (!/^<{7} /m.test(readFileSync25(resolve4(worktree, path), "utf8"))) return false;
11643
+ } catch {
11644
+ return false;
11645
+ }
11646
+ }
11647
+ return true;
11648
+ }
11618
11649
  function refreshBranch(worktree, base) {
11619
- const dirty = gitOk(worktree, ["status", "--porcelain"]);
11620
- if (dirty) return { clean: false, paths: [], why: "the worktree has uncommitted changes" };
11650
+ if (gitOk(worktree, ["status", "--porcelain"])) {
11651
+ if (!isOwnUnresolvedMerge(worktree, base)) {
11652
+ return { clean: false, paths: [], why: "the worktree has uncommitted changes" };
11653
+ }
11654
+ gitOk(worktree, ["merge", "--abort"]);
11655
+ if (gitOk(worktree, ["status", "--porcelain"])) {
11656
+ return { clean: false, paths: [], why: "the worktree has uncommitted changes" };
11657
+ }
11658
+ }
11621
11659
  const upstream = gitOk(worktree, ["rev-parse", "-q", "--verify", "@{upstream}"]);
11622
11660
  const head = gitOk(worktree, ["rev-parse", "HEAD"]);
11623
11661
  if (upstream && head && upstream !== head && isAncestor(worktree, head, upstream)) {
@@ -11661,6 +11699,34 @@ function escalateComment(b) {
11661
11699
  ${absorbed ? `Each earlier hand-back was answered by merging \`${b.base}\` in, and \`${b.base}\` moved underneath the branch every time. This file is changing faster than the lanes can absorb it, so it needs a person to sequence this ticket against the others touching it.` : `The branch ${b.priorBaseSha ? `does not contain \`${b.priorBaseSha}\`, the \`${b.base}\` tip it was last handed back for` : "was pushed"} \u2014 the hand-back was answered without merging \`${b.base}\` in, or this ticket overlaps work that has already shipped and needs rethinking rather than merging.`}
11662
11700
  That is a call for a person, not another lap through the lanes.`;
11663
11701
  }
11702
+ var STALE_RETRIES = 3;
11703
+ var cell = (t, column) => t[column] ?? null;
11704
+ function ticketMoves(read, now, contract, seat) {
11705
+ const moves = [];
11706
+ if (now.status !== read.status) moves.push(`status ${read.status} -> ${now.status}`);
11707
+ const assignee = cell(now, contract.columns.assignee);
11708
+ if (assignee !== cell(read, contract.columns.assignee) && assignee !== seat) moves.push(`assignee is now ${String(assignee)}`);
11709
+ const held = cell(now, contract.columns.heldBy);
11710
+ if (held !== cell(read, contract.columns.heldBy)) moves.push(`held by ${String(held)}`);
11711
+ return moves;
11712
+ }
11713
+ async function writeUnlessMoved(writer, ticket, patch2, contract, seat) {
11714
+ let stamp2 = ticket.updated_at;
11715
+ for (let i = 0; i <= STALE_RETRIES; i++) {
11716
+ try {
11717
+ await writer.updateTicket(ticket.id, patch2, stamp2);
11718
+ return { ok: true };
11719
+ } catch (e) {
11720
+ if (!(e instanceof StaleWriteError2)) throw e;
11721
+ if (!writer.ticket) return { ok: false, moved: "the row changed" };
11722
+ const now = await writer.ticket(ticket.id);
11723
+ const moves = ticketMoves(ticket, now, contract, seat);
11724
+ if (moves.length) return { ok: false, moved: moves.join(", ") };
11725
+ stamp2 = now.updated_at;
11726
+ }
11727
+ }
11728
+ return { ok: false, moved: "the row kept changing" };
11729
+ }
11664
11730
  async function applyConflictBounce(writer, b, contract, memberId, log, dryRun) {
11665
11731
  const t = { ticket: b.ticket.issue_id, step: "merge" };
11666
11732
  const absorbed = b.priorBounces > 0 && b.priorBounces < MAX_ABSORBED_HANDBACKS && !!b.priorBaseSha && isAncestor(b.worktree ?? b.cwd, b.priorBaseSha, b.branch);
@@ -11673,7 +11739,11 @@ async function applyConflictBounce(writer, b, contract, memberId, log, dryRun) {
11673
11739
  return { kind: "escalated" };
11674
11740
  }
11675
11741
  try {
11676
- await writer.updateTicket(b.ticket.id, { status: contract.statuses.needsHuman }, b.ticket.updated_at);
11742
+ const w = await writeUnlessMoved(writer, b.ticket, { status: contract.statuses.needsHuman }, contract, memberId);
11743
+ if (!w.ok) {
11744
+ log.emit(`${displayKey(b.ticket)} changed on the board since this run read it (${w.moved}) \u2014 not escalating over it`, t);
11745
+ return { kind: "stale" };
11746
+ }
11677
11747
  await writer.postEvent(b.ticket.id, escalateComment(b), memberId, "conflict_escalated").catch((e) => {
11678
11748
  log.warn(`escalated, but the note failed to post: ${e.message}`, t);
11679
11749
  });
@@ -11710,11 +11780,17 @@ async function applyConflictBounce(writer, b, contract, memberId, log, dryRun) {
11710
11780
  if (r.paths.length) b.paths = r.paths;
11711
11781
  }
11712
11782
  try {
11713
- await writer.updateTicket(
11714
- b.ticket.id,
11783
+ const w = await writeUnlessMoved(
11784
+ writer,
11785
+ b.ticket,
11715
11786
  { status: contract.statuses.building, assignee_id: null },
11716
- b.ticket.updated_at
11787
+ contract,
11788
+ memberId
11717
11789
  );
11790
+ if (!w.ok) {
11791
+ log.emit(`${displayKey(b.ticket)} changed on the board since this run read it (${w.moved}) \u2014 not handing it back over it`, t);
11792
+ return { kind: "stale" };
11793
+ }
11718
11794
  await writer.postEvent(
11719
11795
  b.ticket.id,
11720
11796
  handBackComment(b, merged),
@@ -11945,11 +12021,17 @@ async function applyBuildFailureBounce(writer, b, contract, memberId, log, dryRu
11945
12021
  return { kind: "escalated" };
11946
12022
  }
11947
12023
  try {
11948
- await writer.updateTicket(
11949
- b.ticket.id,
12024
+ const w = await writeUnlessMoved(
12025
+ writer,
12026
+ b.ticket,
11950
12027
  { status: contract.statuses.needsHuman, ...prior.operatorId ? { assignee_id: prior.operatorId } : {} },
11951
- b.ticket.updated_at
12028
+ contract,
12029
+ memberId
11952
12030
  );
12031
+ if (!w.ok) {
12032
+ log.emit(`${displayKey(b.ticket)} changed on the board since this run read it (${w.moved}) \u2014 not escalating over it`, t);
12033
+ return { kind: "stale" };
12034
+ }
11953
12035
  await writer.postEvent(b.ticket.id, buildFailureEscalation(b, prior.previousNote), memberId, "build_failed_escalated").catch(() => {
11954
12036
  log.warn("escalated, but the note failed to post", t);
11955
12037
  });
@@ -11965,11 +12047,17 @@ async function applyBuildFailureBounce(writer, b, contract, memberId, log, dryRu
11965
12047
  return { kind: "handed-back" };
11966
12048
  }
11967
12049
  try {
11968
- await writer.updateTicket(
11969
- b.ticket.id,
12050
+ const w = await writeUnlessMoved(
12051
+ writer,
12052
+ b.ticket,
11970
12053
  { status: contract.statuses.building, assignee_id: null },
11971
- b.ticket.updated_at
12054
+ contract,
12055
+ memberId
11972
12056
  );
12057
+ if (!w.ok) {
12058
+ log.emit(`${displayKey(b.ticket)} changed on the board since this run read it (${w.moved}) \u2014 not handing it back over it`, t);
12059
+ return { kind: "stale" };
12060
+ }
11973
12061
  await writer.postEvent(b.ticket.id, buildFailureComment(b, repeat), memberId, "build_failed").catch(() => {
11974
12062
  log.warn("handed back, but the note failed to post", t);
11975
12063
  });
@@ -13276,7 +13364,7 @@ async function replayQueuedAgentRuns(stateDir, route2, keyFor, log, now = /* @__
13276
13364
  const path = join29(dir, f2);
13277
13365
  let q2;
13278
13366
  try {
13279
- q2 = JSON.parse(readFileSync25(path, "utf8"));
13367
+ q2 = JSON.parse(readFileSync26(path, "utf8"));
13280
13368
  } catch {
13281
13369
  continue;
13282
13370
  }
@@ -13329,7 +13417,7 @@ async function replayQueuedTicketCounters(stateDir, route2, keyFor, log, now = /
13329
13417
  const path = join29(dir, f2);
13330
13418
  let q2;
13331
13419
  try {
13332
- q2 = JSON.parse(readFileSync25(path, "utf8"));
13420
+ q2 = JSON.parse(readFileSync26(path, "utf8"));
13333
13421
  } catch {
13334
13422
  continue;
13335
13423
  }
@@ -13588,7 +13676,7 @@ var HandoffTranscriptTracker = class {
13588
13676
  };
13589
13677
 
13590
13678
  // src/seat-notes.ts
13591
- import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync20, readFileSync as readFileSync26, renameSync as renameSync4, rmSync as rmSync15, writeFileSync as writeFileSync21 } from "fs";
13679
+ import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync20, readFileSync as readFileSync27, renameSync as renameSync4, rmSync as rmSync15, writeFileSync as writeFileSync21 } from "fs";
13592
13680
  import { randomUUID } from "crypto";
13593
13681
  import { join as join30 } from "path";
13594
13682
  var fileFor2 = (stateDir, role) => join30(stateDir, "seat-notes", `${role}.jsonl`);
@@ -13596,7 +13684,7 @@ var sameTicket = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
13596
13684
  function readAll(stateDir, role) {
13597
13685
  let raw;
13598
13686
  try {
13599
- raw = readFileSync26(fileFor2(stateDir, role), "utf8");
13687
+ raw = readFileSync27(fileFor2(stateDir, role), "utf8");
13600
13688
  } catch {
13601
13689
  return [];
13602
13690
  }
@@ -13650,7 +13738,7 @@ function seatNotesSection(notes) {
13650
13738
  import { createHash as createHash5 } from "crypto";
13651
13739
  import { spawn as spawn4 } from "child_process";
13652
13740
  import { execFileSync as execFileSync8 } from "child_process";
13653
- import { existsSync as existsSync26, mkdirSync as mkdirSync21, readFileSync as readFileSync27, renameSync as renameSync5, writeFileSync as writeFileSync22, rmSync as rmSync16, statSync as statSync8 } from "fs";
13741
+ import { existsSync as existsSync26, mkdirSync as mkdirSync21, readFileSync as readFileSync28, renameSync as renameSync5, writeFileSync as writeFileSync22, rmSync as rmSync16, statSync as statSync8 } from "fs";
13654
13742
  import { dirname as dirname15, join as join31 } from "path";
13655
13743
  import { fileURLToPath } from "url";
13656
13744
  import { tmpdir as tmpdir4 } from "os";
@@ -13668,7 +13756,7 @@ var SANDBOX_BRIDGE_PATH = `${CREW_PREFIX}/bin/intel-bridge`;
13668
13756
  function readBridgeBundle() {
13669
13757
  const here = dirname15(fileURLToPath(import.meta.url));
13670
13758
  for (const p of [join31(here, "sandbox-intel-bridge.cjs"), join31(here, "..", "dist", "sandbox-intel-bridge.cjs")]) {
13671
- if (existsSync26(p)) return readFileSync27(p, "utf8");
13759
+ if (existsSync26(p)) return readFileSync28(p, "utf8");
13672
13760
  }
13673
13761
  return void 0;
13674
13762
  }
@@ -13752,7 +13840,7 @@ var HOST_CA_BUNDLES = ["/etc/ssl/certs/ca-certificates.crt", "/etc/pki/tls/certs
13752
13840
  function readHostCaBundle(paths = HOST_CA_BUNDLES) {
13753
13841
  for (const path of paths) {
13754
13842
  try {
13755
- return readFileSync27(path, "utf8");
13843
+ return readFileSync28(path, "utf8");
13756
13844
  } catch {
13757
13845
  }
13758
13846
  }
@@ -13846,7 +13934,7 @@ var shipSandboxRef = () => ({ name: SHIP_SANDBOX_KEY, decl: { packages: [], setu
13846
13934
  var sandboxStatePath = (stateDir) => join31(stateDir, "sandbox-images.json");
13847
13935
  function readSandboxState(stateDir) {
13848
13936
  try {
13849
- const v = JSON.parse(readFileSync27(sandboxStatePath(stateDir), "utf8"));
13937
+ const v = JSON.parse(readFileSync28(sandboxStatePath(stateDir), "utf8"));
13850
13938
  return v && typeof v === "object" && !Array.isArray(v) ? v : {};
13851
13939
  } catch {
13852
13940
  return {};
@@ -13887,7 +13975,7 @@ function sandboxImageStatus(state, plan) {
13887
13975
  return { status: "ok", detail: `${current.tag} built ${current.builtAt}, claude ${current.claude ?? "unknown"}` };
13888
13976
  }
13889
13977
  var BUILD_INTERRUPTED = -1;
13890
- var spawnBuildRunner = (engine = "docker") => (args, logPath) => new Promise((resolve8) => {
13978
+ var spawnBuildRunner = (engine = "docker") => (args, logPath) => new Promise((resolve9) => {
13891
13979
  const child = spawn4(engine, args, { stdio: ["ignore", "pipe", "pipe"] });
13892
13980
  const chunks = [];
13893
13981
  child.stdout.on("data", (d) => chunks.push(d));
@@ -13895,7 +13983,7 @@ var spawnBuildRunner = (engine = "docker") => (args, logPath) => new Promise((re
13895
13983
  const done = (code, extra = "") => {
13896
13984
  writeFileSync22(logPath, `$ ${engine} ${args.join(" ")}
13897
13985
  ${Buffer.concat(chunks).toString("utf8")}${extra}`, { flag: "a" });
13898
- resolve8(code);
13986
+ resolve9(code);
13899
13987
  };
13900
13988
  child.on("error", (e) => done(127, `${e.message}
13901
13989
  `));
@@ -14056,7 +14144,7 @@ function expandSkillMarkers(text2, lookup2, opts = {}) {
14056
14144
  }
14057
14145
 
14058
14146
  // src/skills.ts
14059
- import { readFileSync as readFileSync30, readdirSync as readdirSync9, existsSync as existsSync28 } from "fs";
14147
+ import { readFileSync as readFileSync31, readdirSync as readdirSync9, existsSync as existsSync28 } from "fs";
14060
14148
  import { join as join33 } from "path";
14061
14149
  import { parse as parseYaml2 } from "yaml";
14062
14150
  import { TablationClient as TablationClient3, StaleWriteError as StaleWriteError5, TablationApiError as TablationApiError3 } from "@tablation/client";
@@ -14073,7 +14161,7 @@ ${additions}`;
14073
14161
  }
14074
14162
 
14075
14163
  // src/persona-file.ts
14076
- import { readFileSync as readFileSync28 } from "fs";
14164
+ import { readFileSync as readFileSync29 } from "fs";
14077
14165
  import { parse as parseYaml } from "yaml";
14078
14166
  function parsePersonaText(text2, path) {
14079
14167
  const match = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/.exec(text2);
@@ -14085,11 +14173,11 @@ function parsePersonaText(text2, path) {
14085
14173
  return { body: match[2], ...typeof meta.chat_enabled === "boolean" ? { chatEnabled: meta.chat_enabled } : {} };
14086
14174
  }
14087
14175
  function readPersonaFile(path) {
14088
- return parsePersonaText(readFileSync28(path, "utf8"), path);
14176
+ return parsePersonaText(readFileSync29(path, "utf8"), path);
14089
14177
  }
14090
14178
 
14091
14179
  // src/agents.ts
14092
- import { readFileSync as readFileSync29, existsSync as existsSync27 } from "fs";
14180
+ import { readFileSync as readFileSync30, existsSync as existsSync27 } from "fs";
14093
14181
  import { join as join32 } from "path";
14094
14182
  import { TablationClient as TablationClient2, StaleWriteError as StaleWriteError4, TablationApiError as TablationApiError2 } from "@tablation/client";
14095
14183
  var PERSONA_NAME = {
@@ -14110,7 +14198,7 @@ function personaDefaultPrompt(promptsDir, role) {
14110
14198
  if (SELF_CONTAINED_ROLES.has(role)) return brief;
14111
14199
  const commonPath = join32(promptsDir, "personas", "common.md");
14112
14200
  if (!existsSync27(commonPath)) return brief;
14113
- return `${readFileSync29(commonPath, "utf8")}${brief}`;
14201
+ return `${readFileSync30(commonPath, "utf8")}${brief}`;
14114
14202
  }
14115
14203
  function personaChatEnabled(promptsDir, role) {
14116
14204
  const briefPath = join32(promptsDir, "personas", `lane-${role}.md`);
@@ -14600,7 +14688,7 @@ function describeCrewLink(o) {
14600
14688
  var SkillSyncError = class extends Error {
14601
14689
  };
14602
14690
  function parseSkillFile(path) {
14603
- const text2 = readFileSync30(path, "utf8");
14691
+ const text2 = readFileSync31(path, "utf8");
14604
14692
  const match = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/.exec(text2);
14605
14693
  if (!match) throw new SkillSyncError(`${path}: missing YAML frontmatter (expected a leading --- block)`);
14606
14694
  const frontmatter = match[1];
@@ -15268,7 +15356,7 @@ var ALLOWANCE_REFUSAL_MARKER = "AI_ALLOWANCE_EXCEEDED";
15268
15356
  function streamShowsAllowanceRefusal(streamPath) {
15269
15357
  let raw;
15270
15358
  try {
15271
- raw = readFileSync31(streamPath, "utf8");
15359
+ raw = readFileSync32(streamPath, "utf8");
15272
15360
  } catch {
15273
15361
  return false;
15274
15362
  }
@@ -15355,9 +15443,9 @@ function planAgentRun(o) {
15355
15443
  let ageSeconds;
15356
15444
  if (existsSync29(digestPath2)) {
15357
15445
  ageSeconds = Math.floor((now() - statSync9(digestPath2).mtimeMs) / 1e3);
15358
- if (ageSeconds <= DIGEST_MAX_AGE_SECONDS) digest = readFileSync31(digestPath2, "utf8");
15446
+ if (ageSeconds <= DIGEST_MAX_AGE_SECONDS) digest = readFileSync32(digestPath2, "utf8");
15359
15447
  }
15360
- const common = usesCommon ? readFileSync31(commonPath, "utf8") : "";
15448
+ const common = usesCommon ? readFileSync32(commonPath, "utf8") : "";
15361
15449
  const brief = readPersonaFile(briefPath).body;
15362
15450
  const effectiveCommon = o.divergedPrompt ? "" : common;
15363
15451
  const effectiveBrief = appendAdditions(o.divergedPrompt ?? brief, o.personaAdditions);
@@ -15533,7 +15621,7 @@ function updateSidecar(streamPath, patch2) {
15533
15621
  var pidPathFor = (streamPath) => `${streamPath}.pid`;
15534
15622
  function readRunSidecar(streamPath) {
15535
15623
  try {
15536
- const sc = JSON.parse(readFileSync31(pidPathFor(streamPath), "utf8"));
15624
+ const sc = JSON.parse(readFileSync32(pidPathFor(streamPath), "utf8"));
15537
15625
  return typeof sc.pid === "number" && typeof sc.spawnedAt === "string" && typeof sc.role === "string" ? sc : null;
15538
15626
  } catch {
15539
15627
  return null;
@@ -16052,7 +16140,7 @@ function spawnPlanned(plan, emit, hintMoved) {
16052
16140
  closeSync4(streamFd);
16053
16141
  return supervise(begun);
16054
16142
  function supervise({ child, handle, promptDelivered }) {
16055
- return new Promise((resolve8, reject) => {
16143
+ return new Promise((resolve9, reject) => {
16056
16144
  const spawnedAt = (/* @__PURE__ */ new Date()).toISOString();
16057
16145
  const deadline = deadlineFor(spawnedAt, plan.maxRunMinutes);
16058
16146
  if (child.pid !== void 0) {
@@ -16194,7 +16282,7 @@ function spawnPlanned(plan, emit, hintMoved) {
16194
16282
  plan.agentLog?.apiKey,
16195
16283
  hintMoved
16196
16284
  );
16197
- resolve8({ code: code ?? 1, ms: ms3, ...handoffPending ? { handoffPending } : {}, ...killed ? { killed } : {} });
16285
+ resolve9({ code: code ?? 1, ms: ms3, ...handoffPending ? { handoffPending } : {}, ...killed ? { killed } : {} });
16198
16286
  });
16199
16287
  child.stdin?.on("error", (err3) => {
16200
16288
  emit.warn(`agent closed stdin before the prompt was delivered: ${err3.message}`, { step: "agent" });
@@ -16279,7 +16367,7 @@ function runFinished(streamPath) {
16279
16367
  const path = `${streamPath}.meta.json`;
16280
16368
  if (!existsSync30(path)) return false;
16281
16369
  try {
16282
- return JSON.parse(readFileSync32(path, "utf8")).running !== true;
16370
+ return JSON.parse(readFileSync33(path, "utf8")).running !== true;
16283
16371
  } catch {
16284
16372
  return true;
16285
16373
  }
@@ -16348,7 +16436,7 @@ import { existsSync as existsSync32, readdirSync as readdirSync12, statSync as s
16348
16436
  import { join as join38 } from "path";
16349
16437
 
16350
16438
  // src/run-snapshot.ts
16351
- import { closeSync as closeSync5, existsSync as existsSync31, fstatSync, openSync as openSync5, readSync as readSync2, readdirSync as readdirSync11, statSync as statSync10, readFileSync as readFileSync33, writeFileSync as writeFileSync25, renameSync as renameSync6 } from "fs";
16439
+ import { closeSync as closeSync5, existsSync as existsSync31, fstatSync, openSync as openSync5, readSync as readSync2, readdirSync as readdirSync11, statSync as statSync10, readFileSync as readFileSync34, writeFileSync as writeFileSync25, renameSync as renameSync6 } from "fs";
16352
16440
  import { join as join37 } from "path";
16353
16441
  var TAIL_BYTES = 256 * 1024;
16354
16442
  var EXCERPT_CHARS = 280;
@@ -16414,7 +16502,7 @@ function lastRunsBySeat(stateDir) {
16414
16502
  let meta;
16415
16503
  let mtimeMs;
16416
16504
  try {
16417
- meta = JSON.parse(readFileSync33(metaPath, "utf8"));
16505
+ meta = JSON.parse(readFileSync34(metaPath, "utf8"));
16418
16506
  mtimeMs = statSync10(metaPath).mtimeMs;
16419
16507
  } catch {
16420
16508
  continue;
@@ -16439,7 +16527,7 @@ function lastRunsBySeat(stateDir) {
16439
16527
  var notesPathFor = (streamPath) => `${streamPath}.notes.json`;
16440
16528
  function readRunNotes(streamPath) {
16441
16529
  try {
16442
- const parsed = JSON.parse(readFileSync33(notesPathFor(streamPath), "utf8"));
16530
+ const parsed = JSON.parse(readFileSync34(notesPathFor(streamPath), "utf8"));
16443
16531
  return Array.isArray(parsed) ? parsed : [];
16444
16532
  } catch {
16445
16533
  return [];
@@ -17436,10 +17524,10 @@ function formatPushAuth(repo, r) {
17436
17524
  return `${label}FAILED \u2014 ${r.detail}; ${r.hint}
17437
17525
  `;
17438
17526
  }
17439
- async function settleRepos(items, nameOf, resolve8) {
17527
+ async function settleRepos(items, nameOf, resolve9) {
17440
17528
  const out = await Promise.all(items.map(async (t) => {
17441
17529
  try {
17442
- return { ok: true, value: await resolve8(t) };
17530
+ return { ok: true, value: await resolve9(t) };
17443
17531
  } catch (e) {
17444
17532
  return { ok: false, repo: nameOf(t), detail: e.message };
17445
17533
  }
@@ -17509,14 +17597,14 @@ function managedGitIdentityWarnings(kind, identity) {
17509
17597
 
17510
17598
  // src/selftest.ts
17511
17599
  import { spawn as spawn7 } from "child_process";
17512
- import { existsSync as existsSync34, mkdirSync as mkdirSync24, mkdtempSync as mkdtempSync2, readFileSync as readFileSync34, rmSync as rmSync18, writeFileSync as writeFileSync26 } from "fs";
17600
+ import { existsSync as existsSync34, mkdirSync as mkdirSync24, mkdtempSync as mkdtempSync2, readFileSync as readFileSync35, rmSync as rmSync18, writeFileSync as writeFileSync26 } from "fs";
17513
17601
  import { tmpdir as tmpdir6 } from "os";
17514
17602
  import { join as join39 } from "path";
17515
17603
  var SELFTEST_TIMEOUT_MS = 12e4;
17516
17604
  var KEY_VAR = "CREW_API_KEY";
17517
17605
  var SELFTEST_PROMPT = "This is a read-only connectivity check. Use the tracker MCP tool to read this workspace (the workspaces find-one tool, using the workspace id below) and reply with the workspace's name alone, on one line. Do not write anything, do not create files, and do not use any other tool.\n\nWorkspace id: ";
17518
17606
  var realDeps = {
17519
- run: (o) => new Promise((resolve8) => {
17607
+ run: (o) => new Promise((resolve9) => {
17520
17608
  let stdout = "";
17521
17609
  let stderr = "";
17522
17610
  let timedOut = false;
@@ -17524,7 +17612,7 @@ var realDeps = {
17524
17612
  const done = (r) => {
17525
17613
  if (!settled) {
17526
17614
  settled = true;
17527
- resolve8(r);
17615
+ resolve9(r);
17528
17616
  }
17529
17617
  };
17530
17618
  const child = spawn7(o.bin, o.args, { cwd: o.cwd, env: o.env, stdio: ["pipe", "pipe", "pipe"], detached: true });
@@ -17714,7 +17802,7 @@ var fileFor3 = (stateDir) => join39(stateDir, "selftest.json");
17714
17802
  function readSelftest(stateDir) {
17715
17803
  try {
17716
17804
  const p = fileFor3(stateDir);
17717
- return existsSync34(p) ? JSON.parse(readFileSync34(p, "utf8")) : {};
17805
+ return existsSync34(p) ? JSON.parse(readFileSync35(p, "utf8")) : {};
17718
17806
  } catch {
17719
17807
  return {};
17720
17808
  }
@@ -17756,7 +17844,7 @@ ${printed}` : ""}` });
17756
17844
  if (obj.compiled !== own.compiled) return fail2(`the child reports compiled ${JSON.stringify(obj.compiled)}, this process is ${own.compiled}`);
17757
17845
  return { ok: true, message: `self-launch ok: ${own.version}${own.compiled ? " (compiled)" : ""}` };
17758
17846
  }
17759
- var spawnChild = (launch, args, timeoutMs) => new Promise((resolve8) => {
17847
+ var spawnChild = (launch, args, timeoutMs) => new Promise((resolve9) => {
17760
17848
  const child = spawn8(launch.command, [...launch.args, ...args], { stdio: ["ignore", "pipe", "pipe"] });
17761
17849
  let stdout = "";
17762
17850
  let stderr = "";
@@ -17773,11 +17861,11 @@ var spawnChild = (launch, args, timeoutMs) => new Promise((resolve8) => {
17773
17861
  });
17774
17862
  child.on("error", (e) => {
17775
17863
  clearTimeout(timer);
17776
- resolve8({ code: null, stdout, stderr: `${stderr}${e.message}`, timedOut });
17864
+ resolve9({ code: null, stdout, stderr: `${stderr}${e.message}`, timedOut });
17777
17865
  });
17778
17866
  child.on("close", (code) => {
17779
17867
  clearTimeout(timer);
17780
- resolve8({ code, stdout, stderr, timedOut });
17868
+ resolve9({ code, stdout, stderr, timedOut });
17781
17869
  });
17782
17870
  });
17783
17871
  async function runSelfLaunchCheck(own, spawnFn = spawnChild, launch = selfLaunch(), timeoutMs = SELF_LAUNCH_TIMEOUT_MS) {
@@ -17785,7 +17873,7 @@ async function runSelfLaunchCheck(own, spawnFn = spawnChild, launch = selfLaunch
17785
17873
  }
17786
17874
 
17787
17875
  // src/cli.ts
17788
- import { resolve as resolve7, dirname as dirname38, join as join67, basename as basename17 } from "path";
17876
+ import { resolve as resolve8, dirname as dirname38, join as join67, basename as basename17 } from "path";
17789
17877
  import { fileURLToPath as fileURLToPath2 } from "url";
17790
17878
  import { hostname as hostname5, homedir as homedir11, userInfo as userInfo2 } from "os";
17791
17879
  import { spawnSync as spawnSync15 } from "child_process";
@@ -18008,14 +18096,14 @@ function rosterMarkdown(roster, meId) {
18008
18096
  }
18009
18097
 
18010
18098
  // src/connect-resume.ts
18011
- import { mkdirSync as mkdirSync25, readFileSync as readFileSync35, rmSync as rmSync19, writeFileSync as writeFileSync27 } from "fs";
18099
+ import { mkdirSync as mkdirSync25, readFileSync as readFileSync36, rmSync as rmSync19, writeFileSync as writeFileSync27 } from "fs";
18012
18100
  import { dirname as dirname18, join as join40 } from "path";
18013
18101
  function lastSessionFile(stateDir) {
18014
18102
  return join40(stateDir, "connect-session.json");
18015
18103
  }
18016
18104
  function readPointers(stateDir) {
18017
18105
  try {
18018
- const parsed = JSON.parse(readFileSync35(lastSessionFile(stateDir), "utf8"));
18106
+ const parsed = JSON.parse(readFileSync36(lastSessionFile(stateDir), "utf8"));
18019
18107
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
18020
18108
  const out = {};
18021
18109
  for (const [host, v] of Object.entries(parsed)) {
@@ -18115,7 +18203,7 @@ async function signOutSessions(o) {
18115
18203
  }
18116
18204
 
18117
18205
  // src/reset.ts
18118
- import { existsSync as existsSync35, mkdirSync as mkdirSync26, readFileSync as readFileSync36, readdirSync as readdirSync14, rmSync as rmSync20, statSync as statSync12, writeFileSync as writeFileSync28 } from "fs";
18206
+ import { existsSync as existsSync35, mkdirSync as mkdirSync26, readFileSync as readFileSync37, readdirSync as readdirSync14, rmSync as rmSync20, statSync as statSync12, writeFileSync as writeFileSync28 } from "fs";
18119
18207
  import { dirname as dirname19, join as join41 } from "path";
18120
18208
  import { hostFromUrl as hostFromUrl3 } from "@tablation/client";
18121
18209
  function clonedCheckoutsFile(stateDir) {
@@ -18123,7 +18211,7 @@ function clonedCheckoutsFile(stateDir) {
18123
18211
  }
18124
18212
  function readClonedCheckouts(stateDir) {
18125
18213
  try {
18126
- const parsed = JSON.parse(readFileSync36(clonedCheckoutsFile(stateDir), "utf8"));
18214
+ const parsed = JSON.parse(readFileSync37(clonedCheckoutsFile(stateDir), "utf8"));
18127
18215
  return Array.isArray(parsed) ? parsed.filter((d) => typeof d === "string") : [];
18128
18216
  } catch {
18129
18217
  return [];
@@ -18315,7 +18403,7 @@ async function runDeprovision(o, fx, deps) {
18315
18403
  }
18316
18404
 
18317
18405
  // src/pool-member.ts
18318
- import { mkdirSync as mkdirSync27, readFileSync as readFileSync37, renameSync as renameSync7, writeFileSync as writeFileSync29 } from "fs";
18406
+ import { mkdirSync as mkdirSync27, readFileSync as readFileSync38, renameSync as renameSync7, writeFileSync as writeFileSync29 } from "fs";
18319
18407
  import { homedir as homedir8 } from "os";
18320
18408
  import { dirname as dirname20, join as join42 } from "path";
18321
18409
  var POOL_EXIT = { ok: 0, failed: 1, credential: 2 };
@@ -18566,7 +18654,7 @@ function fileMemberStore(dir) {
18566
18654
  return {
18567
18655
  read() {
18568
18656
  try {
18569
- return JSON.parse(readFileSync37(file, "utf8"));
18657
+ return JSON.parse(readFileSync38(file, "utf8"));
18570
18658
  } catch {
18571
18659
  return {};
18572
18660
  }
@@ -18632,7 +18720,7 @@ import { hostname as hostname3 } from "os";
18632
18720
  // src/machine-id.ts
18633
18721
  import { execFileSync as execFileSync12 } from "child_process";
18634
18722
  import { createHash as createHash9 } from "crypto";
18635
- import { existsSync as existsSync36, mkdirSync as mkdirSync28, readFileSync as readFileSync38, writeFileSync as writeFileSync30 } from "fs";
18723
+ import { existsSync as existsSync36, mkdirSync as mkdirSync28, readFileSync as readFileSync39, writeFileSync as writeFileSync30 } from "fs";
18636
18724
  import { dirname as dirname21, join as join43 } from "path";
18637
18725
  function machineIdPathFor(stateDir) {
18638
18726
  return join43(stateDir, "machine-id");
@@ -18649,7 +18737,7 @@ function readRawMachineId(platform2 = process.platform) {
18649
18737
  }
18650
18738
  for (const p of ["/etc/machine-id", "/var/lib/dbus/machine-id"]) {
18651
18739
  if (existsSync36(p)) {
18652
- const id = readFileSync38(p, "utf8").trim();
18740
+ const id = readFileSync39(p, "utf8").trim();
18653
18741
  if (id) return id;
18654
18742
  }
18655
18743
  }
@@ -18661,7 +18749,7 @@ function ensureMachineId(stateDir, opts = {}) {
18661
18749
  if (opts.override?.trim()) return sha256(opts.override.trim());
18662
18750
  const path = machineIdPathFor(stateDir);
18663
18751
  if (existsSync36(path)) {
18664
- const cached = readFileSync38(path, "utf8").trim();
18752
+ const cached = readFileSync39(path, "utf8").trim();
18665
18753
  if (/^[0-9a-f]{64}$/.test(cached)) return cached;
18666
18754
  }
18667
18755
  const raw = (opts.read ?? readRawMachineId)();
@@ -18681,7 +18769,7 @@ function matchShipRows(ships, shipName2, machineId) {
18681
18769
 
18682
18770
  // src/provision.ts
18683
18771
  import { spawnSync as spawnSync10 } from "child_process";
18684
- import { existsSync as existsSync37, readFileSync as readFileSync39, writeFileSync as writeFileSync31 } from "fs";
18772
+ import { existsSync as existsSync37, readFileSync as readFileSync40, writeFileSync as writeFileSync31 } from "fs";
18685
18773
  import { hostname as hostname2 } from "os";
18686
18774
  import { parseDocument as parseDocument3, isMap as isMap2, isScalar } from "yaml";
18687
18775
 
@@ -18690,7 +18778,7 @@ import { parseDocument as parseDocument2 } from "yaml";
18690
18778
 
18691
18779
  // src/repos-cmd.ts
18692
18780
  import { homedir as homedir9 } from "os";
18693
- import { basename as basename10, join as join44, resolve as resolve4 } from "path";
18781
+ import { basename as basename10, join as join44, resolve as resolve5 } from "path";
18694
18782
  import { isMap, isSeq, parseDocument, stringify as stringify2 } from "yaml";
18695
18783
  var ReposError = class extends Error {
18696
18784
  /** A stable reason for a `--json` reader, when the failure has one (CREW-3359). */
@@ -18750,7 +18838,7 @@ function parseAddArgs(args, routes, isDir) {
18750
18838
  }
18751
18839
  function expandDir(p, base) {
18752
18840
  const home = p === "~" ? homedir9() : p.startsWith("~/") ? `${homedir9()}/${p.slice(2)}` : p;
18753
- return resolve4(base, home);
18841
+ return resolve5(base, home);
18754
18842
  }
18755
18843
  function routeMapOf(doc, route2) {
18756
18844
  const routes = doc.get("routes", true);
@@ -19327,7 +19415,7 @@ function realProvisionDeps(crewHome) {
19327
19415
  enableRoute(route2) {
19328
19416
  const file = configFile();
19329
19417
  if (!file) return false;
19330
- const text2 = readFileSync39(file, "utf8");
19418
+ const text2 = readFileSync40(file, "utf8");
19331
19419
  const doc = parseDocument3(text2);
19332
19420
  const routes = doc.get("routes");
19333
19421
  const entry = routes?.items?.find((r) => r.get("route") === route2);
@@ -19353,7 +19441,7 @@ function realProvisionDeps(crewHome) {
19353
19441
  continue;
19354
19442
  }
19355
19443
  for (const p of plan.unitPaths) {
19356
- if (!existsSync37(p) || readFileSync39(p, "utf8") !== plan.unitContent[p]) unitsStale = true;
19444
+ if (!existsSync37(p) || readFileSync40(p, "utf8") !== plan.unitContent[p]) unitsStale = true;
19357
19445
  }
19358
19446
  }
19359
19447
  const label = labelFor(crewHome, "run");
@@ -19377,7 +19465,7 @@ function realProvisionDeps(crewHome) {
19377
19465
  setShipSetting(key, value2) {
19378
19466
  const file = configFile();
19379
19467
  if (!file) return false;
19380
- const doc = parseDocument3(readFileSync39(file, "utf8"));
19468
+ const doc = parseDocument3(readFileSync40(file, "utf8"));
19381
19469
  if (doc.getIn(["ship", key]) === value2) return false;
19382
19470
  doc.setIn(["ship", key], value2);
19383
19471
  writeFileSync31(file, doc.toString());
@@ -19386,7 +19474,7 @@ function realProvisionDeps(crewHome) {
19386
19474
  applyManagedDefaults() {
19387
19475
  const file = configFile();
19388
19476
  if (!file) return [];
19389
- const doc = parseDocument3(readFileSync39(file, "utf8"));
19477
+ const doc = parseDocument3(readFileSync40(file, "utf8"));
19390
19478
  const wrote = applyManagedDefaultsToDoc(doc);
19391
19479
  if (wrote.length) writeFileSync31(file, doc.toString());
19392
19480
  return wrote;
@@ -21294,7 +21382,7 @@ async function markCrewAssistedAtLaunch(tracker, route2, role, ticketId, ticket,
21294
21382
  }
21295
21383
 
21296
21384
  // src/repo-refresh.ts
21297
- import { existsSync as existsSync40, mkdirSync as mkdirSync29, readFileSync as readFileSync40, writeFileSync as writeFileSync33 } from "fs";
21385
+ import { existsSync as existsSync40, mkdirSync as mkdirSync29, readFileSync as readFileSync41, writeFileSync as writeFileSync33 } from "fs";
21298
21386
  import { dirname as dirname23 } from "path";
21299
21387
  var REFRESH_COOLDOWN_MS = 2 * 6e4;
21300
21388
  var UNSERVABLE_PASSES_BEFORE_ATTENTION = 3;
@@ -21325,7 +21413,7 @@ function applyRepoRows(resolved, rows) {
21325
21413
  function persistRepoRows(stateDir, routeName, rows) {
21326
21414
  const path = resolvedPathFor(stateDir, routeName);
21327
21415
  if (!existsSync40(path)) return;
21328
- const raw = JSON.parse(readFileSync40(path, "utf8"));
21416
+ const raw = JSON.parse(readFileSync41(path, "utf8"));
21329
21417
  applyRepoRows(raw, rows);
21330
21418
  mkdirSync29(dirname23(path), { recursive: true });
21331
21419
  writeFileSync33(path, `${JSON.stringify(raw, null, 2)}
@@ -21842,11 +21930,11 @@ function redactValue(v) {
21842
21930
  }
21843
21931
  return v;
21844
21932
  }
21845
- var defaultExec = (bin, args, timeoutMs) => new Promise((resolve8, reject) => {
21933
+ var defaultExec = (bin, args, timeoutMs) => new Promise((resolve9, reject) => {
21846
21934
  execFile4(bin, args, { timeout: timeoutMs, maxBuffer: 4 * 1024 * 1024 }, (e, stdout) => {
21847
21935
  if (e && e.code === "ENOENT") return reject(new Error(`${bin} is not installed`));
21848
21936
  if (e && e.killed) return reject(new Error(`${bin} timed out`));
21849
- resolve8({ stdout: String(stdout), code: typeof e?.code === "number" ? e.code : 0 });
21937
+ resolve9({ stdout: String(stdout), code: typeof e?.code === "number" ? e.code : 0 });
21850
21938
  });
21851
21939
  });
21852
21940
  var clip = (s) => s.length > MAX_SECTION_BYTES ? `${s.slice(0, MAX_SECTION_BYTES)}
@@ -21887,8 +21975,8 @@ async function collectDiagnostics(d) {
21887
21975
  return { runner: d.runner, list: clip(r.stdout).split("\n").filter((l) => l.length), exitCode: r.code };
21888
21976
  }
21889
21977
  };
21890
- const deadline = new Promise((resolve8) => {
21891
- setTimeout(() => resolve8("timeout"), budget).unref();
21978
+ const deadline = new Promise((resolve9) => {
21979
+ setTimeout(() => resolve9("timeout"), budget).unref();
21892
21980
  });
21893
21981
  const entries = await Promise.all(Object.entries(sections).map(async ([name, run4]) => {
21894
21982
  try {
@@ -21903,7 +21991,7 @@ async function collectDiagnostics(d) {
21903
21991
  }
21904
21992
 
21905
21993
  // src/release-run.ts
21906
- import { readFileSync as readFileSync41, writeFileSync as writeFileSync35, existsSync as existsSync42, copyFileSync, mkdirSync as mkdirSync31, mkdtempSync as mkdtempSync3, rmSync as rmSync21 } from "fs";
21994
+ import { readFileSync as readFileSync42, writeFileSync as writeFileSync35, existsSync as existsSync42, copyFileSync, mkdirSync as mkdirSync31, mkdtempSync as mkdtempSync3, rmSync as rmSync21 } from "fs";
21907
21995
  import { dirname as dirname26, join as join49 } from "path";
21908
21996
  import { tmpdir as tmpdir7, hostname as hostname4 } from "os";
21909
21997
 
@@ -22888,7 +22976,7 @@ async function bump(o, size) {
22888
22976
  o.emit.error(`no ${o.repo.release.versionFiles[0]} to read a version from`);
22889
22977
  return null;
22890
22978
  }
22891
- const firstText = readTextAt(first, (p) => readFileSync41(p, "utf8"));
22979
+ const firstText = readTextAt(first, (p) => readFileSync42(p, "utf8"));
22892
22980
  const problem = versionFileProblem(o.repo.release.versionFiles[0], firstText);
22893
22981
  if (problem) {
22894
22982
  o.emit.error(problem);
@@ -22907,7 +22995,7 @@ async function bump(o, size) {
22907
22995
  return version;
22908
22996
  }
22909
22997
  for (const f2 of files) {
22910
- const src = readTextAt(f2, (p) => readFileSync41(p, "utf8"));
22998
+ const src = readTextAt(f2, (p) => readFileSync42(p, "utf8"));
22911
22999
  const out = src.replace(/("version"\s*:\s*")[^"]*(")/, `$1${version}$2`);
22912
23000
  if (out === src) {
22913
23001
  o.emit.error(`no version field in ${f2}`);
@@ -22926,7 +23014,7 @@ function writeChangelog(o, version, entries) {
22926
23014
  o.emit.emit(`would prepend ${entries.length} entr(ies) to ${file}`);
22927
23015
  return;
22928
23016
  }
22929
- const existing = existsAt(path, existsSync42) ? readTextAt(path, (p) => readFileSync41(p, "utf8")) : "# Changelog\n";
23017
+ const existing = existsAt(path, existsSync42) ? readTextAt(path, (p) => readFileSync42(p, "utf8")) : "# Changelog\n";
22930
23018
  writeTextAt(path, insertChangelogSection(existing, section), writeFileSync35);
22931
23019
  }
22932
23020
  async function confirm(o, expected, ci) {
@@ -24153,14 +24241,14 @@ async function runCommentDeliveryPass(deps) {
24153
24241
  }
24154
24242
 
24155
24243
  // src/launchd-start.ts
24156
- import { readFileSync as readFileSync48 } from "fs";
24244
+ import { readFileSync as readFileSync49 } from "fs";
24157
24245
  import { spawnSync as spawnSync13 } from "child_process";
24158
24246
 
24159
24247
  // src/daemon-liveness.ts
24160
- import { existsSync as existsSync49, readFileSync as readFileSync47 } from "fs";
24248
+ import { existsSync as existsSync49, readFileSync as readFileSync48 } from "fs";
24161
24249
 
24162
24250
  // src/daemon.ts
24163
- import { existsSync as existsSync48, mkdirSync as mkdirSync37, readFileSync as readFileSync46, readdirSync as readdirSync15, rmSync as rmSync23, statSync as statSync14, writeFileSync as writeFileSync39 } from "fs";
24251
+ import { existsSync as existsSync48, mkdirSync as mkdirSync37, readFileSync as readFileSync47, readdirSync as readdirSync15, rmSync as rmSync23, statSync as statSync14, writeFileSync as writeFileSync39 } from "fs";
24164
24252
  import { join as join54 } from "path";
24165
24253
  import { randomBytes } from "crypto";
24166
24254
 
@@ -24447,7 +24535,7 @@ function nextRoles(decision, ran) {
24447
24535
  }
24448
24536
 
24449
24537
  // src/noop-runs.ts
24450
- import { existsSync as existsSync43, mkdirSync as mkdirSync32, readFileSync as readFileSync42, renameSync as renameSync8, writeFileSync as writeFileSync36 } from "fs";
24538
+ import { existsSync as existsSync43, mkdirSync as mkdirSync32, readFileSync as readFileSync43, renameSync as renameSync8, writeFileSync as writeFileSync36 } from "fs";
24451
24539
  import { join as join50 } from "path";
24452
24540
  var NOOP_DELAYS_MS = [5, 15, 60].map((m) => m * 6e4);
24453
24541
  var DEFAULT_NOOP_REPEATS = 3;
@@ -24456,7 +24544,7 @@ var noopRunsPath = (stateDir) => join50(stateDir, "noop-runs.json");
24456
24544
  var noopRunsKey = (issueId) => `noop_runs:${issueId}`;
24457
24545
  function readNoopRuns(stateDir) {
24458
24546
  try {
24459
- const v = JSON.parse(readFileSync42(noopRunsPath(stateDir), "utf8"));
24547
+ const v = JSON.parse(readFileSync43(noopRunsPath(stateDir), "utf8"));
24460
24548
  return v && typeof v === "object" && !Array.isArray(v) ? v : {};
24461
24549
  } catch {
24462
24550
  return {};
@@ -24547,7 +24635,7 @@ async function settleNoopRun(o) {
24547
24635
  }
24548
24636
 
24549
24637
  // src/ship-name.ts
24550
- import { existsSync as existsSync44, mkdirSync as mkdirSync33, readFileSync as readFileSync43, renameSync as renameSync9, writeFileSync as writeFileSync37 } from "fs";
24638
+ import { existsSync as existsSync44, mkdirSync as mkdirSync33, readFileSync as readFileSync44, renameSync as renameSync9, writeFileSync as writeFileSync37 } from "fs";
24551
24639
  import { dirname as dirname27 } from "path";
24552
24640
  import { parseDocument as parseDocument4 } from "yaml";
24553
24641
  var ShipNameError = class extends Error {
@@ -24611,7 +24699,7 @@ async function syncRouteName(i) {
24611
24699
  function readSyncedName(resolvedFile) {
24612
24700
  if (!existsSync44(resolvedFile)) return void 0;
24613
24701
  try {
24614
- const v = JSON.parse(readFileSync43(resolvedFile, "utf8")).shipName;
24702
+ const v = JSON.parse(readFileSync44(resolvedFile, "utf8")).shipName;
24615
24703
  return typeof v === "string" ? v : void 0;
24616
24704
  } catch {
24617
24705
  return void 0;
@@ -24621,7 +24709,7 @@ function writeSyncedName(resolvedFile, name) {
24621
24709
  if (!existsSync44(resolvedFile)) return;
24622
24710
  let raw;
24623
24711
  try {
24624
- raw = JSON.parse(readFileSync43(resolvedFile, "utf8"));
24712
+ raw = JSON.parse(readFileSync44(resolvedFile, "utf8"));
24625
24713
  } catch {
24626
24714
  return;
24627
24715
  }
@@ -24636,7 +24724,7 @@ function writeSyncedName(resolvedFile, name) {
24636
24724
  async function reconcileShipName(i) {
24637
24725
  let local = i.ship.name;
24638
24726
  try {
24639
- local = shipNameOfYaml(readFileSync43(i.configFile, "utf8")) ?? local;
24727
+ local = shipNameOfYaml(readFileSync44(i.configFile, "utf8")) ?? local;
24640
24728
  } catch {
24641
24729
  }
24642
24730
  const resolvedFile = resolvedPathFor(i.stateDir, i.route);
@@ -24660,7 +24748,7 @@ async function reconcileShipName(i) {
24660
24748
  }
24661
24749
  if (result.status !== "ok") return result;
24662
24750
  if (result.action === "adopt" || result.action === "row-wins") {
24663
- const text2 = readFileSync43(i.configFile, "utf8");
24751
+ const text2 = readFileSync44(i.configFile, "utf8");
24664
24752
  writeFileSync37(i.configFile, setShipNameInYaml(text2, result.name));
24665
24753
  i.ship.name = result.name;
24666
24754
  if (result.action === "row-wins") {
@@ -24882,7 +24970,7 @@ function seatMissingProblems(route2, probes) {
24882
24970
 
24883
24971
  // src/ssh-keys.ts
24884
24972
  import { execFileSync as execFileSync13 } from "child_process";
24885
- import { existsSync as existsSync46, mkdirSync as mkdirSync35, readFileSync as readFileSync44, chmodSync as chmodSync3 } from "fs";
24973
+ import { existsSync as existsSync46, mkdirSync as mkdirSync35, readFileSync as readFileSync45, chmodSync as chmodSync3 } from "fs";
24886
24974
  import { dirname as dirname29, join as join51 } from "path";
24887
24975
  var SshKeyError = class extends Error {
24888
24976
  };
@@ -24916,7 +25004,7 @@ function ensureShipSshKeypair(stateDir) {
24916
25004
  if (!existsSync46(publicKeyPath)) {
24917
25005
  throw new SshKeyError(`${privateKeyPath} exists but ${publicKeyPath} does not \u2014 regenerate or restore it`);
24918
25006
  }
24919
- const publicKey = readFileSync44(publicKeyPath, "utf8").trim();
25007
+ const publicKey = readFileSync45(publicKeyPath, "utf8").trim();
24920
25008
  return { privateKeyPath, publicKeyPath, publicKey };
24921
25009
  }
24922
25010
  function sshKeygenAvailable() {
@@ -25030,7 +25118,7 @@ async function runPeriscopeIdlePass(d) {
25030
25118
  }
25031
25119
 
25032
25120
  // src/periscope-cmd.ts
25033
- import { existsSync as existsSync47, mkdirSync as mkdirSync36, readFileSync as readFileSync45, rmSync as rmSync22, writeFileSync as writeFileSync38 } from "fs";
25121
+ import { existsSync as existsSync47, mkdirSync as mkdirSync36, readFileSync as readFileSync46, rmSync as rmSync22, writeFileSync as writeFileSync38 } from "fs";
25034
25122
  import { join as join53 } from "path";
25035
25123
  var PeriscopeError = class extends Error {
25036
25124
  };
@@ -25056,7 +25144,7 @@ function writePeriscopePrior(stateDir, ticketRecordId, prior) {
25056
25144
  function readPeriscopePrior(stateDir, ticketRecordId) {
25057
25145
  try {
25058
25146
  const p = priorPath(stateDir, ticketRecordId);
25059
- return existsSync47(p) ? JSON.parse(readFileSync45(p, "utf8")) : void 0;
25147
+ return existsSync47(p) ? JSON.parse(readFileSync46(p, "utf8")) : void 0;
25060
25148
  } catch {
25061
25149
  return void 0;
25062
25150
  }
@@ -25512,7 +25600,7 @@ var DEFAULT_FLOOR_MS = 5e3;
25512
25600
  var DEFAULT_CEILING_MS = INTERVAL_SECONDS * 1e3;
25513
25601
  var ALLOWANCE_PAUSE_MS = 5 * 60 * 1e3;
25514
25602
  var RELOAD_WARN_MS = 10 * 60 * 1e3;
25515
- var defaultSleep = (ms3) => new Promise((resolve8) => setTimeout(resolve8, ms3));
25603
+ var defaultSleep = (ms3) => new Promise((resolve9) => setTimeout(resolve9, ms3));
25516
25604
  async function runDaemonLoop(o) {
25517
25605
  const floor = o.floorMs ?? DEFAULT_FLOOR_MS;
25518
25606
  const ceiling = o.ceilingMs ?? DEFAULT_CEILING_MS;
@@ -25627,7 +25715,7 @@ function noteDaemonStarted(stateDir, now = Date.now()) {
25627
25715
  }
25628
25716
  function readDaemonStarted(stateDir) {
25629
25717
  try {
25630
- const v = JSON.parse(readFileSync46(daemonStampFor(stateDir), "utf8")).startedAt;
25718
+ const v = JSON.parse(readFileSync47(daemonStampFor(stateDir), "utf8")).startedAt;
25631
25719
  return typeof v === "number" ? v : null;
25632
25720
  } catch {
25633
25721
  return null;
@@ -25959,8 +26047,8 @@ async function fillSlots(o, routes, first) {
25959
26047
  }
25960
26048
  let settle = () => {
25961
26049
  };
25962
- const settled = new Promise((resolve8) => {
25963
- settle = resolve8;
26050
+ const settled = new Promise((resolve9) => {
26051
+ settle = resolve9;
25964
26052
  });
25965
26053
  const ready = (tookTicket2) => settle(tookTicket2);
25966
26054
  const run4 = spawn14(role, decision, ctx, { ready }).then(() => {
@@ -26516,7 +26604,7 @@ function parseSystemctlShow(text2) {
26516
26604
  }
26517
26605
  function lastLogLine(path, read = (p) => {
26518
26606
  try {
26519
- return readFileSync47(p, "utf8");
26607
+ return readFileSync48(p, "utf8");
26520
26608
  } catch {
26521
26609
  return null;
26522
26610
  }
@@ -26593,7 +26681,7 @@ function daemonProblem(d, route2) {
26593
26681
  }
26594
26682
  function readDaemonStamp(stateDir) {
26595
26683
  try {
26596
- const v = JSON.parse(readFileSync47(daemonStampFor(stateDir), "utf8"));
26684
+ const v = JSON.parse(readFileSync48(daemonStampFor(stateDir), "utf8"));
26597
26685
  if (typeof v.startedAt !== "number") return null;
26598
26686
  return typeof v.pid === "number" ? { pid: v.pid, startedAt: v.startedAt } : { startedAt: v.startedAt };
26599
26687
  } catch {
@@ -26619,7 +26707,7 @@ function defaultRun(cmd) {
26619
26707
  }
26620
26708
  function defaultReadLog(path) {
26621
26709
  try {
26622
- return readFileSync48(path, "utf8");
26710
+ return readFileSync49(path, "utf8");
26623
26711
  } catch {
26624
26712
  return null;
26625
26713
  }
@@ -26686,7 +26774,7 @@ function startLaunchdDaemon(o) {
26686
26774
  }
26687
26775
 
26688
26776
  // src/daemon-start-failure.ts
26689
- import { existsSync as existsSync50, mkdirSync as mkdirSync38, readFileSync as readFileSync49, unlinkSync as unlinkSync4, writeFileSync as writeFileSync40 } from "fs";
26777
+ import { existsSync as existsSync50, mkdirSync as mkdirSync38, readFileSync as readFileSync50, unlinkSync as unlinkSync4, writeFileSync as writeFileSync40 } from "fs";
26690
26778
  import { dirname as dirname30, join as join55 } from "path";
26691
26779
  var DAEMON_START_FAILED_KEY = "daemon_start_failed";
26692
26780
  var START_FAILURE_BACKOFF_MS = 6e4;
@@ -26694,7 +26782,7 @@ var BACKOFF_AFTER_FAILURES = 2;
26694
26782
  var fileFor4 = (stateDir) => join55(stateDir, ".daemon-start-failure.json");
26695
26783
  function readStartFailure(stateDir) {
26696
26784
  try {
26697
- const parsed = JSON.parse(readFileSync49(fileFor4(stateDir), "utf8"));
26785
+ const parsed = JSON.parse(readFileSync50(fileFor4(stateDir), "utf8"));
26698
26786
  return typeof parsed.reason === "string" && typeof parsed.count === "number" ? { reason: parsed.reason, count: parsed.count, firstAt: String(parsed.firstAt), lastAt: String(parsed.lastAt) } : null;
26699
26787
  } catch {
26700
26788
  return null;
@@ -28326,7 +28414,7 @@ function describeCapability(i) {
28326
28414
  }
28327
28415
 
28328
28416
  // src/persona-avatars.ts
28329
- import { existsSync as existsSync52, readFileSync as readFileSync50 } from "fs";
28417
+ import { existsSync as existsSync52, readFileSync as readFileSync51 } from "fs";
28330
28418
  import { join as join56 } from "path";
28331
28419
  var IMAGE_TYPES = { png: "image/png", svg: "image/svg+xml" };
28332
28420
  function personaAvatarFile(promptsDir, role) {
@@ -28351,7 +28439,7 @@ async function syncPersonaAvatars(route2, agentPersonas, opts) {
28351
28439
  if (!file || !agentId) continue;
28352
28440
  try {
28353
28441
  const form = new FormData();
28354
- form.append("file", new Blob([readFileSync50(file.path)], { type: file.mimeType }), file.name);
28442
+ form.append("file", new Blob([readFileSync51(file.path)], { type: file.mimeType }), file.name);
28355
28443
  const res = await fetch(`${base}/${agentId}/avatar`, {
28356
28444
  method: "PUT",
28357
28445
  headers: { Authorization: `Bearer ${resolveApiKey(route2)}`, "User-Agent": opts.userAgent ?? "Mozilla/5.0 TablationCrewAgent/1.0" },
@@ -28392,14 +28480,14 @@ function avatarFailures(raw) {
28392
28480
  }
28393
28481
  function routeAvatarFailures(stateDir, route2) {
28394
28482
  try {
28395
- return avatarFailures(JSON.parse(readFileSync50(resolvedPathFor(stateDir, route2), "utf8")));
28483
+ return avatarFailures(JSON.parse(readFileSync51(resolvedPathFor(stateDir, route2), "utf8")));
28396
28484
  } catch {
28397
28485
  return [];
28398
28486
  }
28399
28487
  }
28400
28488
 
28401
28489
  // src/agents-sync-run.ts
28402
- import { existsSync as existsSync53, mkdirSync as mkdirSync40, readFileSync as readFileSync51, writeFileSync as writeFileSync42 } from "fs";
28490
+ import { existsSync as existsSync53, mkdirSync as mkdirSync40, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
28403
28491
  import { dirname as dirname32 } from "path";
28404
28492
  async function runAgentsSync(target, o) {
28405
28493
  const dryRun = o.dryRun ?? false;
@@ -28445,7 +28533,7 @@ async function runAgentsSync(target, o) {
28445
28533
  }
28446
28534
  if (!dryRun) {
28447
28535
  const resolvedPath = resolvedPathFor(o.stateDir, target.route);
28448
- const raw = existsSync53(resolvedPath) ? JSON.parse(readFileSync51(resolvedPath, "utf8")) : {};
28536
+ const raw = existsSync53(resolvedPath) ? JSON.parse(readFileSync52(resolvedPath, "utf8")) : {};
28449
28537
  raw.agentPersonas = personaResult.agentPersonas;
28450
28538
  if (skillResult) raw.agentSkills = skillResult.agentSkills;
28451
28539
  if (!readOnly2) raw.avatarSyncFailures = avatarFailures2;
@@ -28587,16 +28675,16 @@ async function showLogEntry(route2, entryId, opts = {}) {
28587
28675
  }
28588
28676
 
28589
28677
  // src/repo-setup-prompt.ts
28590
- import { readFileSync as readFileSync52 } from "fs";
28678
+ import { readFileSync as readFileSync53 } from "fs";
28591
28679
  import { join as join57 } from "path";
28592
28680
  var REPO_SETUP_PROMPT_PATH = join57("docs", "repo-setup-prompt.md");
28593
28681
  function readRepoSetupPrompt(crewHome) {
28594
- return readFileSync52(join57(crewHome, REPO_SETUP_PROMPT_PATH), "utf8");
28682
+ return readFileSync53(join57(crewHome, REPO_SETUP_PROMPT_PATH), "utf8");
28595
28683
  }
28596
28684
 
28597
28685
  // src/repos-check.ts
28598
28686
  import { spawnSync as spawnSync14 } from "child_process";
28599
- import { readFileSync as readFileSync53 } from "fs";
28687
+ import { readFileSync as readFileSync54 } from "fs";
28600
28688
  import { basename as basename12 } from "path";
28601
28689
  var POSIX_SHELL = /^(?:ba|z|da|k|a|mk)?sh$|^fish$/;
28602
28690
  function checkHookSyntax(script, shell) {
@@ -28637,7 +28725,7 @@ function checkRepoSpec(dir, opts = {}) {
28637
28725
  }
28638
28726
  let parsed;
28639
28727
  try {
28640
- parsed = parseRepoConfig(readFileSync53(file, "utf8"), file);
28728
+ parsed = parseRepoConfig(readFileSync54(file, "utf8"), file);
28641
28729
  } catch (e) {
28642
28730
  if (!(e instanceof RepoConfigError)) throw e;
28643
28731
  return { ...empty, file, error: e.message, exitCode: 1 };
@@ -29048,7 +29136,7 @@ async function runAgentSuggest(o) {
29048
29136
  const before = porcelain(o.dir);
29049
29137
  const timeout = AbortSignal.timeout(o.timeoutMs ?? DEFAULT_TIMEOUT_MS);
29050
29138
  const signal = o.signal ? AbortSignal.any([o.signal, timeout]) : timeout;
29051
- const run4 = await new Promise((resolve8) => {
29139
+ const run4 = await new Promise((resolve9) => {
29052
29140
  let out = "";
29053
29141
  let err3 = "";
29054
29142
  const child = spawn9(bin, args, { cwd: o.dir, env, detached: true, stdio: ["pipe", "pipe", "pipe"] });
@@ -29057,7 +29145,7 @@ async function runAgentSuggest(o) {
29057
29145
  if (settled) return;
29058
29146
  settled = true;
29059
29147
  signal.removeEventListener("abort", onAbort);
29060
- resolve8(r);
29148
+ resolve9(r);
29061
29149
  };
29062
29150
  const onAbort = () => {
29063
29151
  try {
@@ -29394,8 +29482,8 @@ function fixPhaseNothingToOffer(o) {
29394
29482
  }
29395
29483
 
29396
29484
  // src/worktree-sweep.ts
29397
- import { existsSync as existsSync54, readFileSync as readFileSync54, readdirSync as readdirSync16 } from "fs";
29398
- import { basename as basename14, dirname as dirname34, join as join59, resolve as resolve5 } from "path";
29485
+ import { existsSync as existsSync54, readFileSync as readFileSync55, readdirSync as readdirSync16 } from "fs";
29486
+ import { basename as basename14, dirname as dirname34, join as join59, resolve as resolve6 } from "path";
29399
29487
  function planWorktreeSweep(target, tickets, contract) {
29400
29488
  const terminal = new Set(contract.statuses.resolved.filter((s) => s !== contract.statuses.verified));
29401
29489
  const verified = contract.statuses.verified;
@@ -29461,7 +29549,7 @@ function worktreeTicketNumbers(target) {
29461
29549
  function siblingWorktreeDirs(target) {
29462
29550
  const parent = dirname34(target.dir.replace(/[/\\]+$/, ""));
29463
29551
  const stem = `${basename14(target.dir.replace(/[/\\]+$/, ""))}-`;
29464
- const registered = new Set(worktrees(target.dir).map((w) => resolve5(w.path)));
29552
+ const registered = new Set(worktrees(target.dir).map((w) => resolve6(w.path)));
29465
29553
  let names;
29466
29554
  try {
29467
29555
  names = readdirSync16(parent);
@@ -29473,7 +29561,7 @@ function siblingWorktreeDirs(target) {
29473
29561
  if (!name.startsWith(stem)) continue;
29474
29562
  const m = DIR_NUMBER_SUFFIXED.exec(name);
29475
29563
  const path = join59(parent, name);
29476
- if (m && !registered.has(resolve5(path))) out.push({ path, number: m[1] });
29564
+ if (m && !registered.has(resolve6(path))) out.push({ path, number: m[1] });
29477
29565
  }
29478
29566
  return out;
29479
29567
  }
@@ -29599,7 +29687,7 @@ function isHandBackMerge(path, base) {
29599
29687
  if (!msgPath) return false;
29600
29688
  let first;
29601
29689
  try {
29602
- first = readFileSync54(resolve5(path, msgPath), "utf8").split("\n")[0] ?? "";
29690
+ first = readFileSync55(resolve6(path, msgPath), "utf8").split("\n")[0] ?? "";
29603
29691
  } catch {
29604
29692
  return false;
29605
29693
  }
@@ -29781,7 +29869,7 @@ function planStateSweep(stateDir, retentionDays, maxBytes, now = Date.now()) {
29781
29869
  }
29782
29870
 
29783
29871
  // src/cli.ts
29784
- import { realpathSync as realpathSync4, readFileSync as readFileSync57, existsSync as existsSync60, mkdirSync as mkdirSync44, writeFileSync as writeFileSync45, rmSync as rmSync27, unlinkSync as unlinkSync6, copyFileSync as copyFileSync2, renameSync as renameSync10, statSync as statSync19, readdirSync as readdirSync22 } from "fs";
29872
+ import { realpathSync as realpathSync4, readFileSync as readFileSync58, existsSync as existsSync60, mkdirSync as mkdirSync44, writeFileSync as writeFileSync45, rmSync as rmSync27, unlinkSync as unlinkSync6, copyFileSync as copyFileSync2, renameSync as renameSync10, statSync as statSync19, readdirSync as readdirSync22 } from "fs";
29785
29873
  import { createInterface } from "readline/promises";
29786
29874
 
29787
29875
  // src/periscope-resume.ts
@@ -29860,7 +29948,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
29860
29948
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
29861
29949
  import { join as join61 } from "path";
29862
29950
  function builtVersion() {
29863
- return true ? "0.169.4" : null;
29951
+ return true ? "0.169.5" : null;
29864
29952
  }
29865
29953
  var REBUILD_HINT = "rebuild with npm run build";
29866
29954
  function newestMtime(path) {
@@ -30101,7 +30189,7 @@ async function unregisterEndpoint(workspaceId, info, d) {
30101
30189
  import { createServer as createHttpServer } from "http";
30102
30190
  import { spawn as spawn10 } from "child_process";
30103
30191
  import { randomBytes as randomBytes2 } from "crypto";
30104
- import { existsSync as existsSync57, mkdirSync as mkdirSync41, readFileSync as readFileSync55, writeFileSync as writeFileSync43, unlinkSync as unlinkSync5, readdirSync as readdirSync19 } from "fs";
30192
+ import { existsSync as existsSync57, mkdirSync as mkdirSync41, readFileSync as readFileSync56, writeFileSync as writeFileSync43, unlinkSync as unlinkSync5, readdirSync as readdirSync19 } from "fs";
30105
30193
  import { join as join62 } from "path";
30106
30194
 
30107
30195
  // src/secret-compare.ts
@@ -30201,7 +30289,7 @@ function readPersistedSyncDaemon(stateDir, workspaceId) {
30201
30289
  const path = syncDaemonStatePath(stateDir, workspaceId);
30202
30290
  if (!existsSync57(path)) return void 0;
30203
30291
  try {
30204
- return JSON.parse(readFileSync55(path, "utf8"));
30292
+ return JSON.parse(readFileSync56(path, "utf8"));
30205
30293
  } catch {
30206
30294
  return void 0;
30207
30295
  }
@@ -30623,11 +30711,11 @@ function runProxyFromEnv(dropFile, env = process.env) {
30623
30711
  return server;
30624
30712
  }
30625
30713
  function accepts(host, port, timeoutMs = 500) {
30626
- return new Promise((resolve8) => {
30714
+ return new Promise((resolve9) => {
30627
30715
  const s = netConnect({ host, port });
30628
30716
  const done = (ok) => {
30629
30717
  s.destroy();
30630
- resolve8(ok);
30718
+ resolve9(ok);
30631
30719
  };
30632
30720
  s.setTimeout(timeoutMs, () => done(false));
30633
30721
  s.once("connect", () => done(true));
@@ -30934,7 +31022,7 @@ async function handlePeriscopes(h, q2) {
30934
31022
  ], q2.wantsStream, h.mcp ? async (done) => ({ ...done, ...await h.mcp.onUp(picked, done) }) : void 0);
30935
31023
  }
30936
31024
  function runCrew(args, onLine, timeoutMs = 20 * 6e4) {
30937
- return new Promise((resolve8) => {
31025
+ return new Promise((resolve9) => {
30938
31026
  const self = selfLaunch();
30939
31027
  const child = spawn12(self.command, [...self.args, ...args], { stdio: ["ignore", "pipe", "pipe"] });
30940
31028
  let stdout = "";
@@ -30957,12 +31045,12 @@ function runCrew(args, onLine, timeoutMs = 20 * 6e4) {
30957
31045
  const t = setTimeout(() => child.kill("SIGTERM"), timeoutMs);
30958
31046
  child.on("error", (e) => {
30959
31047
  clearTimeout(t);
30960
- resolve8({ code: 127, stdout, stderr: `${stderr}${e.message}
31048
+ resolve9({ code: 127, stdout, stderr: `${stderr}${e.message}
30961
31049
  ` });
30962
31050
  });
30963
31051
  child.on("close", (code) => {
30964
31052
  clearTimeout(t);
30965
- resolve8({ code: code ?? 1, stdout, stderr });
31053
+ resolve9({ code: code ?? 1, stdout, stderr });
30966
31054
  });
30967
31055
  });
30968
31056
  }
@@ -31146,7 +31234,7 @@ function readTail(live2, opts) {
31146
31234
  };
31147
31235
  }
31148
31236
  function waitForChange(dir, ms3, signal) {
31149
- return new Promise((resolve8) => {
31237
+ return new Promise((resolve9) => {
31150
31238
  let w;
31151
31239
  const done = () => {
31152
31240
  clearTimeout(t);
@@ -31156,7 +31244,7 @@ function waitForChange(dir, ms3, signal) {
31156
31244
  w?.close();
31157
31245
  } catch {
31158
31246
  }
31159
- resolve8();
31247
+ resolve9();
31160
31248
  };
31161
31249
  const t = setTimeout(done, ms3);
31162
31250
  const poll = setInterval(done, 500);
@@ -31367,13 +31455,13 @@ function send2(res, r) {
31367
31455
  }
31368
31456
  async function socketIsStale(path) {
31369
31457
  if (!existsSync58(path)) return false;
31370
- return new Promise((resolve8) => {
31458
+ return new Promise((resolve9) => {
31371
31459
  const c = createConnection(path);
31372
31460
  c.once("connect", () => {
31373
31461
  c.destroy();
31374
- resolve8(false);
31462
+ resolve9(false);
31375
31463
  });
31376
- c.once("error", () => resolve8(true));
31464
+ c.once("error", () => resolve9(true));
31377
31465
  });
31378
31466
  }
31379
31467
  async function startControlServer(deps) {
@@ -31415,10 +31503,10 @@ async function startControlServer(deps) {
31415
31503
  }
31416
31504
  })();
31417
31505
  });
31418
- return new Promise((resolve8) => {
31506
+ return new Promise((resolve9) => {
31419
31507
  server.once("error", (e) => {
31420
31508
  log(`control API not started: ${e.message}`);
31421
- resolve8(null);
31509
+ resolve9(null);
31422
31510
  });
31423
31511
  server.listen(path, () => {
31424
31512
  try {
@@ -31426,7 +31514,7 @@ async function startControlServer(deps) {
31426
31514
  } catch {
31427
31515
  }
31428
31516
  server.on("error", (e) => log(`control API error: ${e.message}`));
31429
- resolve8({
31517
+ resolve9({
31430
31518
  server,
31431
31519
  path,
31432
31520
  close: () => new Promise((done) => {
@@ -31462,36 +31550,36 @@ function stderrTail(stderr, lines2 = 5, maxChars = 600) {
31462
31550
  return tail3.length > maxChars ? `\u2026${tail3.slice(-maxChars)}` : tail3;
31463
31551
  }
31464
31552
  function crewJson(args, timeoutMs = CREW_JSON_TIMEOUT_MS) {
31465
- return new Promise((resolve8) => {
31553
+ return new Promise((resolve9) => {
31466
31554
  const self = selfLaunch();
31467
31555
  execFile6(self.command, [...self.args, ...args], { timeout: timeoutMs, maxBuffer: 16 * 1024 * 1024 }, (e, stdout, stderr) => {
31468
31556
  try {
31469
31557
  const v = JSON.parse(String(stdout));
31470
- if (v && typeof v === "object" && !Array.isArray(v)) return resolve8({ ok: true, doc: v });
31558
+ if (v && typeof v === "object" && !Array.isArray(v)) return resolve9({ ok: true, doc: v });
31471
31559
  } catch {
31472
31560
  }
31473
31561
  const ex = e;
31474
31562
  const tail3 = stderrTail(String(stderr ?? ""));
31475
- if (ex?.killed || ex?.code === "ETIMEDOUT") return resolve8({ ok: false, reason: "timed_out", detail: `no JSON within ${Math.round(timeoutMs / 1e3)}s${tail3 ? `; stderr: ${tail3}` : ""}` });
31563
+ if (ex?.killed || ex?.code === "ETIMEDOUT") return resolve9({ ok: false, reason: "timed_out", detail: `no JSON within ${Math.round(timeoutMs / 1e3)}s${tail3 ? `; stderr: ${tail3}` : ""}` });
31476
31564
  if (ex) {
31477
31565
  const how = typeof ex.code === "number" ? `exit code ${ex.code}` : ex.signal ? `signal ${ex.signal}` : `error ${String(ex.code ?? ex.message)}`;
31478
- return resolve8({ ok: false, reason: "exited", detail: `${how}${tail3 ? `; stderr: ${tail3}` : ""}` });
31566
+ return resolve9({ ok: false, reason: "exited", detail: `${how}${tail3 ? `; stderr: ${tail3}` : ""}` });
31479
31567
  }
31480
- resolve8({ ok: false, reason: "bad_output", detail: `exit 0 but stdout is not a JSON object (${String(stdout).length} bytes)${tail3 ? `; stderr: ${tail3}` : ""}` });
31568
+ resolve9({ ok: false, reason: "bad_output", detail: `exit 0 but stdout is not a JSON object (${String(stdout).length} bytes)${tail3 ? `; stderr: ${tail3}` : ""}` });
31481
31569
  });
31482
31570
  });
31483
31571
  }
31484
31572
 
31485
31573
  // src/periscope-mcp.ts
31486
31574
  import { lstat, mkdir, readdir, readFile, readlink, realpath, rm, stat, writeFile } from "fs/promises";
31487
- import { basename as basename16, dirname as dirname37, isAbsolute as isAbsolute5, join as join66, relative as relative2, resolve as resolve6, sep } from "path";
31575
+ import { basename as basename16, dirname as dirname37, isAbsolute as isAbsolute5, join as join66, relative as relative2, resolve as resolve7, sep } from "path";
31488
31576
  import { z } from "zod";
31489
31577
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
31490
31578
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
31491
31579
 
31492
31580
  // src/periscope-endpoints.ts
31493
31581
  import { randomBytes as randomBytes3 } from "crypto";
31494
- import { chmodSync as chmodSync5, existsSync as existsSync59, mkdirSync as mkdirSync43, readdirSync as readdirSync21, readFileSync as readFileSync56, rmSync as rmSync26, writeFileSync as writeFileSync44 } from "fs";
31582
+ import { chmodSync as chmodSync5, existsSync as existsSync59, mkdirSync as mkdirSync43, readdirSync as readdirSync21, readFileSync as readFileSync57, rmSync as rmSync26, writeFileSync as writeFileSync44 } from "fs";
31495
31583
  import { join as join65 } from "path";
31496
31584
  var secretDir = (stateDir) => join65(stateDir, "periscope-mcp");
31497
31585
  var secretFile = (stateDir, id) => join65(secretDir(stateDir), `${id}.json`);
@@ -31508,7 +31596,7 @@ function mintPeriscopeSecret(stateDir, ticketRecordId) {
31508
31596
  }
31509
31597
  function readPeriscopeSecret(stateDir, ticketRecordId) {
31510
31598
  try {
31511
- const v = JSON.parse(readFileSync56(secretFile(stateDir, ticketRecordId), "utf8"));
31599
+ const v = JSON.parse(readFileSync57(secretFile(stateDir, ticketRecordId), "utf8"));
31512
31600
  return typeof v.secret === "string" && v.secret ? v.secret : void 0;
31513
31601
  } catch {
31514
31602
  return void 0;
@@ -31519,7 +31607,7 @@ function removePeriscopeSecret(stateDir, ticketRecordId) {
31519
31607
  }
31520
31608
  function readPeriscopeEndpoint(stateDir, ticketRecordId) {
31521
31609
  try {
31522
- return JSON.parse(readFileSync56(endpointFile(stateDir, ticketRecordId), "utf8"));
31610
+ return JSON.parse(readFileSync57(endpointFile(stateDir, ticketRecordId), "utf8"));
31523
31611
  } catch {
31524
31612
  return void 0;
31525
31613
  }
@@ -31622,7 +31710,7 @@ async function realAncestor(p) {
31622
31710
  }
31623
31711
  if (isLink) {
31624
31712
  if (++hops > 40) throw new PathRefusal(`too many symbolic links resolving ${p}`);
31625
- cur = resolve6(dirname37(cur), await readlink(cur));
31713
+ cur = resolve7(dirname37(cur), await readlink(cur));
31626
31714
  continue;
31627
31715
  }
31628
31716
  const parent = dirname37(cur);
@@ -31636,10 +31724,10 @@ async function resolveInWorktree(root, requested) {
31636
31724
  const realRoot = await realpath(root);
31637
31725
  let abs;
31638
31726
  if (isAbsolute5(requested)) {
31639
- abs = resolve6(requested);
31727
+ abs = resolve7(requested);
31640
31728
  if (isInside(root, abs)) abs = join66(realRoot, relative2(root, abs));
31641
31729
  } else {
31642
- abs = resolve6(realRoot, requested);
31730
+ abs = resolve7(realRoot, requested);
31643
31731
  }
31644
31732
  if (!isInside(realRoot, abs)) throw new PathRefusal(`${requested} is outside this periscope's worktree`);
31645
31733
  const { real, rest } = await realAncestor(abs);
@@ -31898,7 +31986,7 @@ function findPeriscope(sidecars, segment) {
31898
31986
  }
31899
31987
 
31900
31988
  // src/cli.ts
31901
- var CREW_HOME = isCompiledBinary(import.meta.url) ? dirname38(process.execPath) : resolve7(dirname38(fileURLToPath2(import.meta.url)), "..");
31989
+ var CREW_HOME = isCompiledBinary(import.meta.url) ? dirname38(process.execPath) : resolve8(dirname38(fileURLToPath2(import.meta.url)), "..");
31902
31990
  {
31903
31991
  const v = crewVersion(CREW_HOME);
31904
31992
  if (v !== "0.0.0") setRunningCrewVersion(v);
@@ -32310,7 +32398,7 @@ if (command === "provision") {
32310
32398
  process.exit(outcome.code);
32311
32399
  }
32312
32400
  if (command === "pool-member") {
32313
- const pool = poolConfigFrom(argv, process.env, () => readFileSync57(0, "utf8"));
32401
+ const pool = poolConfigFrom(argv, process.env, () => readFileSync58(0, "utf8"));
32314
32402
  if (typeof pool === "string") {
32315
32403
  process.stderr.write(`crew pool-member: ${pool}
32316
32404
  `);
@@ -32678,7 +32766,7 @@ if (command === "passenger-sync-daemon") {
32678
32766
  throw e;
32679
32767
  }
32680
32768
  if (command === "credential") {
32681
- const r = runCredential(positional[1], readFileSync57(0, "utf8"), cfg.ship.forges, cfg.ship.stateDir, process.env, !flag("no-miss"));
32769
+ const r = runCredential(positional[1], readFileSync58(0, "utf8"), cfg.ship.forges, cfg.ship.stateDir, process.env, !flag("no-miss"));
32682
32770
  process.stdout.write(r.out);
32683
32771
  process.stderr.write(r.err);
32684
32772
  process.exit(r.code);
@@ -32690,9 +32778,9 @@ if (command === "passenger-sync-daemon") {
32690
32778
  forges: cfg.ship.forges,
32691
32779
  stateDir: cfg.ship.stateDir,
32692
32780
  configFile: cfg.configFile,
32693
- readFile: (p) => readFileSync57(p, "utf8"),
32781
+ readFile: (p) => readFileSync58(p, "utf8"),
32694
32782
  writeFile: (p, t) => writeFileSync45(p, t),
32695
- stdin: () => readFileSync57(0, "utf8"),
32783
+ stdin: () => readFileSync58(0, "utf8"),
32696
32784
  env: process.env
32697
32785
  }
32698
32786
  );
@@ -33172,7 +33260,7 @@ if (command === "passenger-sync-daemon") {
33172
33260
  changed2.push(`refreshed the connect snapshot for ${a.route} (\`crew connect\`)${rel.status === 0 ? " and reloaded the daemon" : "; `crew reload` failed \u2014 run it by hand"}`);
33173
33261
  } else if (a.kind === "enable") {
33174
33262
  if (prompter && !await prompter.confirm(`Route ${a.route} passes every check \u2014 set enabled: true in ${cfg.configFile}?`, false)) continue;
33175
- writeFileSync45(cfg.configFile, planEnable(readFileSync57(cfg.configFile, "utf8"), a.route));
33263
+ writeFileSync45(cfg.configFile, planEnable(readFileSync58(cfg.configFile, "utf8"), a.route));
33176
33264
  enabledSound.add(a.route);
33177
33265
  changed2.push(`enabled route ${a.route} in ${cfg.configFile}`);
33178
33266
  } else {
@@ -33742,11 +33830,11 @@ ${changed2.map((c) => ` - ${c}
33742
33830
  const prior = ticket.assignee_id ?? null;
33743
33831
  await tracker.postEvent(ticket.id, "release took the ticket while it merges and ships it", seat, RELEASE_CLAIMED_EVENT, { prior_assignee: prior });
33744
33832
  claimed.set(ticket.id, prior);
33745
- await tracker.updateTicket(ticket.id, { [tracker.contract.columns.assignee]: seat });
33833
+ ticket.updated_at = (await tracker.updateTicket(ticket.id, { [tracker.contract.columns.assignee]: seat })).updated_at;
33746
33834
  },
33747
33835
  onUnclaim: async (ticket) => {
33748
33836
  if (!claimed.has(ticket.id)) return;
33749
- await tracker.updateTicket(ticket.id, { [tracker.contract.columns.assignee]: claimed.get(ticket.id) ?? null });
33837
+ ticket.updated_at = (await tracker.updateTicket(ticket.id, { [tracker.contract.columns.assignee]: claimed.get(ticket.id) ?? null })).updated_at;
33750
33838
  claimed.delete(ticket.id);
33751
33839
  },
33752
33840
  onBasePushed: async (merged) => {
@@ -35157,7 +35245,7 @@ ${f2.tail.trimEnd()}
35157
35245
  for (const w of result.warnings) emit.warn(w);
35158
35246
  if (!dryRun) {
35159
35247
  const resolvedPath = resolvedPathFor(cfg.ship.stateDir, target.route);
35160
- const raw = existsSync60(resolvedPath) ? JSON.parse(readFileSync57(resolvedPath, "utf8")) : {};
35248
+ const raw = existsSync60(resolvedPath) ? JSON.parse(readFileSync58(resolvedPath, "utf8")) : {};
35161
35249
  raw.agentSkills = result.agentSkills;
35162
35250
  mkdirSync44(dirOf2(resolvedPath), { recursive: true });
35163
35251
  writeFileSync45(resolvedPath, `${JSON.stringify(raw, null, 2)}
@@ -35181,7 +35269,7 @@ ${f2.tail.trimEnd()}
35181
35269
  throw e;
35182
35270
  }
35183
35271
  const oldName = cfg.ship.name;
35184
- writeFileSync45(cfg.configFile, setShipNameInYaml(readFileSync57(cfg.configFile, "utf8"), newName));
35272
+ writeFileSync45(cfg.configFile, setShipNameInYaml(readFileSync58(cfg.configFile, "utf8"), newName));
35185
35273
  cfg.ship.name = newName;
35186
35274
  let renameMachineId;
35187
35275
  try {
@@ -35228,7 +35316,7 @@ ${f2.tail.trimEnd()}
35228
35316
  process.exit(2);
35229
35317
  };
35230
35318
  if (sub !== "add" && sub !== "list" && sub !== "clone" && sub !== "hooks" && sub !== "check") usage2();
35231
- const configText = readFileSync57(cfg.configFile, "utf8");
35319
+ const configText = readFileSync58(cfg.configFile, "utf8");
35232
35320
  if (sub === "check") {
35233
35321
  try {
35234
35322
  const routeArg = value("route") ?? positional[2];
@@ -35267,7 +35355,7 @@ ${f2.tail.trimEnd()}
35267
35355
  }
35268
35356
  }, read: (r) => {
35269
35357
  try {
35270
- return readFileSync57(resolvePath(dir, r), "utf8");
35358
+ return readFileSync58(resolvePath(dir, r), "utf8");
35271
35359
  } catch {
35272
35360
  return void 0;
35273
35361
  }
@@ -35411,7 +35499,7 @@ ${f2.tail.trimEnd()}
35411
35499
  let resolvedRemotes;
35412
35500
  if (existsSync60(resolvedFile)) {
35413
35501
  try {
35414
- resolvedRemotes = JSON.parse(readFileSync57(resolvedFile, "utf8"));
35502
+ resolvedRemotes = JSON.parse(readFileSync58(resolvedFile, "utf8"));
35415
35503
  } catch {
35416
35504
  }
35417
35505
  }
@@ -35433,7 +35521,7 @@ ${f2.tail.trimEnd()}
35433
35521
  repoHasHooks: (d) => REPO_CONFIG_FILENAMES.some((f2) => {
35434
35522
  try {
35435
35523
  const path = resolvePath(d, f2);
35436
- return Object.keys(parseRepoConfig(readFileSync57(path, "utf8"), path).hooks).length > 0;
35524
+ return Object.keys(parseRepoConfig(readFileSync58(path, "utf8"), path).hooks).length > 0;
35437
35525
  } catch {
35438
35526
  return false;
35439
35527
  }
@@ -35573,7 +35661,7 @@ would need a project first: the tracker has none (\`crew projects add NAME --pre
35573
35661
  process.stdout.write(`created Repos row ${String(rowPayload.name)} (${String(rowPayload.remote)}) ${created.id}
35574
35662
  `);
35575
35663
  if (existsSync60(resolvedFile)) {
35576
- const raw = JSON.parse(readFileSync57(resolvedFile, "utf8"));
35664
+ const raw = JSON.parse(readFileSync58(resolvedFile, "utf8"));
35577
35665
  raw.repoNames = { ...raw.repoNames, [created.id]: String(rowPayload.name) };
35578
35666
  raw.repoRemotes = { ...raw.repoRemotes, [created.id]: String(rowPayload.remote) };
35579
35667
  writeFileSync45(resolvedFile, `${JSON.stringify(raw, null, 2)}
@@ -35932,7 +36020,7 @@ Waiting for approval`
35932
36020
  ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, then run `crew connect` again");
35933
36021
  }
35934
36022
  if (found.shipNameAdopted && !dryRun) {
35935
- writeFileSync45(cfg.configFile, setShipNameInYaml(readFileSync57(cfg.configFile, "utf8"), found.shipNameAdopted));
36023
+ writeFileSync45(cfg.configFile, setShipNameInYaml(readFileSync58(cfg.configFile, "utf8"), found.shipNameAdopted));
35936
36024
  cfg.ship.name = found.shipNameAdopted;
35937
36025
  }
35938
36026
  if (found.shipRow) {
@@ -35976,7 +36064,7 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, t
35976
36064
  const hadPreviousFile = existsSync60(resolvedPath);
35977
36065
  if (hadPreviousFile) {
35978
36066
  try {
35979
- previous = JSON.parse(readFileSync57(resolvedPath, "utf8"));
36067
+ previous = JSON.parse(readFileSync58(resolvedPath, "utf8"));
35980
36068
  } catch {
35981
36069
  }
35982
36070
  }
@@ -37582,7 +37670,7 @@ ${where.join("\n")}`);
37582
37670
  };
37583
37671
  const droppedRoutes = [];
37584
37672
  try {
37585
- const rawCfg = parseYaml3(readFileSync57(cfg.configFile, "utf8"));
37673
+ const rawCfg = parseYaml3(readFileSync58(cfg.configFile, "utf8"));
37586
37674
  for (const r of rawCfg?.routes ?? []) {
37587
37675
  if (typeof r?.route !== "string" || cfg.routes.some((x) => x.route === r.route)) continue;
37588
37676
  try {
@@ -37708,7 +37796,7 @@ ${where.join("\n")}`);
37708
37796
  }
37709
37797
  case "log": {
37710
37798
  try {
37711
- const text2 = readFileSync57(cfg.ship.logFile, "utf8").split("\n");
37799
+ const text2 = readFileSync58(cfg.ship.logFile, "utf8").split("\n");
37712
37800
  process.stdout.write(`${text2.slice(-(Number(value("tail")) || 40)).join("\n")}
37713
37801
  `);
37714
37802
  } catch {
@@ -37732,7 +37820,7 @@ ${where.join("\n")}`);
37732
37820
  };
37733
37821
  if (!route2.resolved) fail2(`route ${route2.route} is not connected \u2014 run \`crew connect\` first`);
37734
37822
  const tracker = new Tracker(route2, cfg.ship);
37735
- const configText = readFileSync57(cfg.configFile, "utf8");
37823
+ const configText = readFileSync58(cfg.configFile, "utf8");
37736
37824
  const cfgBase = dirname38(cfg.configFile);
37737
37825
  const configured2 = configuredRepos(configText, route2.route, cfgBase);
37738
37826
  const dir = configured2.find((r) => r.name === SAMPLE_REPO)?.dir ?? sampleDir(configured2.map((r) => r.dir), route2.reposBasePath, route2.route.split("/")[0]);
@@ -37770,7 +37858,7 @@ ${where.join("\n")}`);
37770
37858
  if (row) {
37771
37859
  await tracker.deleteRepoRow(row.id);
37772
37860
  if (existsSync60(resolvedFile)) {
37773
- const raw = JSON.parse(readFileSync57(resolvedFile, "utf8"));
37861
+ const raw = JSON.parse(readFileSync58(resolvedFile, "utf8"));
37774
37862
  if (raw.repoNames) delete raw.repoNames[row.id];
37775
37863
  if (raw.repoRemotes) delete raw.repoRemotes[row.id];
37776
37864
  writeFileSync45(resolvedFile, `${JSON.stringify(raw, null, 2)}
@@ -37810,7 +37898,7 @@ ${where.join("\n")}`);
37810
37898
  });
37811
37899
  repoId = (await tracker.createRepoRow(payload)).id;
37812
37900
  if (existsSync60(resolvedFile)) {
37813
- const raw = JSON.parse(readFileSync57(resolvedFile, "utf8"));
37901
+ const raw = JSON.parse(readFileSync58(resolvedFile, "utf8"));
37814
37902
  raw.repoNames = { ...raw.repoNames, [repoId]: SAMPLE_REPO };
37815
37903
  raw.repoRemotes = { ...raw.repoRemotes, [repoId]: SAMPLE_REMOTE };
37816
37904
  writeFileSync45(resolvedFile, `${JSON.stringify(raw, null, 2)}
@@ -38452,7 +38540,7 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
38452
38540
  const unitPlan = planInstall(cfg.ship, CREW_HOME, host, detectSystemd(), "run", installContext());
38453
38541
  const abandons = unitAbandonsAgents(unitPlan, (p) => {
38454
38542
  try {
38455
- return readFileSync57(p, "utf8");
38543
+ return readFileSync58(p, "utf8");
38456
38544
  } catch {
38457
38545
  return null;
38458
38546
  }
@@ -38467,7 +38555,7 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
38467
38555
  const pPlan = planInstall(cfg.ship, CREW_HOME, host, true, "passengers", installContext());
38468
38556
  const keeps = unitAbandonsAgents(pPlan, (p) => {
38469
38557
  try {
38470
- return readFileSync57(p, "utf8");
38558
+ return readFileSync58(p, "utf8");
38471
38559
  } catch {
38472
38560
  return null;
38473
38561
  }