@tablation/crew 0.132.1 → 0.132.2

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 +182 -133
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5463,6 +5463,7 @@ import {
5463
5463
  readdirSync as readdirSync4,
5464
5464
  rmSync as rmSync9
5465
5465
  } from "fs";
5466
+ import { tmpdir as tmpdir2 } from "os";
5466
5467
  import { dirname as dirname10, basename as basename5, join as join19 } from "path";
5467
5468
  var GitError = class extends Error {
5468
5469
  };
@@ -5646,6 +5647,16 @@ function fetchRemote(cwd, remote = "origin") {
5646
5647
  gitOk(cwd, ["fetch", "--quiet", remote, "refs/tags/*:refs/tags/*"]);
5647
5648
  return true;
5648
5649
  }
5650
+ function lsRemoteHeads(url) {
5651
+ const out = gitOk(tmpdir2(), ["ls-remote", "--heads", url]);
5652
+ if (out === null) return null;
5653
+ const heads = /* @__PURE__ */ new Map();
5654
+ for (const line of out.split("\n")) {
5655
+ const [sha, ref] = line.split(" ");
5656
+ if (sha && ref?.startsWith("refs/heads/")) heads.set(ref.slice("refs/heads/".length), sha);
5657
+ }
5658
+ return heads;
5659
+ }
5649
5660
  function remoteConfigured(cwd, remote = "origin") {
5650
5661
  return gitOk(cwd, ["remote", "get-url", remote]) !== null;
5651
5662
  }
@@ -6492,15 +6503,15 @@ import { promisify as promisify2 } from "util";
6492
6503
 
6493
6504
  // src/deprovision-host.ts
6494
6505
  import { spawnSync as spawnSync7 } from "child_process";
6495
- import { existsSync as existsSync29, readdirSync as readdirSync11 } from "fs";
6506
+ import { existsSync as existsSync30, readdirSync as readdirSync11 } from "fs";
6496
6507
 
6497
6508
  // src/interrupted.ts
6498
- import { existsSync as existsSync27, readdirSync as readdirSync9, readFileSync as readFileSync28 } from "fs";
6509
+ import { existsSync as existsSync28, readdirSync as readdirSync9, readFileSync as readFileSync28 } from "fs";
6499
6510
  import { join as join31 } from "path";
6500
6511
 
6501
6512
  // src/agent.ts
6502
6513
  import { spawnSync as spawnSync6 } from "child_process";
6503
- import { readFileSync as readFileSync27, existsSync as existsSync26, statSync as statSync8, mkdirSync as mkdirSync19, writeFileSync as writeFileSync20, createWriteStream, openSync as openSync4, closeSync as closeSync4, readSync } from "fs";
6514
+ import { readFileSync as readFileSync27, existsSync as existsSync27, statSync as statSync8, mkdirSync as mkdirSync19, writeFileSync as writeFileSync20, createWriteStream, openSync as openSync4, closeSync as closeSync4, readSync } from "fs";
6504
6515
  import { StringDecoder } from "string_decoder";
6505
6516
  import { finished } from "stream/promises";
6506
6517
  import { join as join30, dirname as dirname15, basename as basename9 } from "path";
@@ -8423,12 +8434,15 @@ var BeforeFirstEditTracker = class {
8423
8434
  };
8424
8435
 
8425
8436
  // src/agent-log.ts
8426
- import { existsSync as existsSync22, mkdirSync as mkdirSync16, readdirSync as readdirSync7, readFileSync as readFileSync23, rmSync as rmSync13, writeFileSync as writeFileSync17 } from "fs";
8437
+ import { existsSync as existsSync23, mkdirSync as mkdirSync16, readdirSync as readdirSync7, readFileSync as readFileSync23, rmSync as rmSync13, writeFileSync as writeFileSync17 } from "fs";
8427
8438
  import { join as join25 } from "path";
8428
8439
 
8429
8440
  // src/pending-backoff.ts
8430
8441
  var sleepBackoff = (attempts) => Math.min(6e4 * 2 ** Math.max(0, attempts - 1), 30 * 6e4);
8431
8442
 
8443
+ // src/handoff-guard.ts
8444
+ import { existsSync as existsSync22 } from "fs";
8445
+
8432
8446
  // src/ticket-branch.ts
8433
8447
  import { basename as basename7 } from "path";
8434
8448
 
@@ -9465,6 +9479,9 @@ function branchTemplates(cfg, t) {
9465
9479
  function pushedBranchForTicket(cfg, t, role) {
9466
9480
  return branchRenderer(t, role, cfg.branch.lowercase)(branchTemplates(cfg, t).push);
9467
9481
  }
9482
+ function branchCandidatesForTicket(cfg, t, role) {
9483
+ return branchCandidates(t.issue_id, branchTemplates(cfg, t), branchRenderer(t, role, cfg.branch.lowercase));
9484
+ }
9468
9485
  function existingBranchForTicket(dir, cfg, t, role) {
9469
9486
  return branchForIssue(dir, t.issue_id, branchTemplates(cfg, t), branchRenderer(t, role, cfg.branch.lowercase));
9470
9487
  }
@@ -9853,6 +9870,28 @@ function remoteTip(dir, remote, branch) {
9853
9870
  if (out === null) return null;
9854
9871
  return out.split("\n").find((l) => l.endsWith(` refs/heads/${branch}`))?.split(" ")[0] ?? "";
9855
9872
  }
9873
+ function inspectRemoteHandoff(origin, cfg, ticket, role) {
9874
+ const remote = cfg.branch.remote;
9875
+ const heads = lsRemoteHeads(origin);
9876
+ if (!heads) return { kind: "unverified", why: `could not reach \`${remote}\` (${origin}) to check the pushed branch` };
9877
+ for (const c of branchCandidatesForTicket(cfg, ticket, role)) {
9878
+ const hit = c.endsWith("*") ? [...heads.keys()].find((b) => b.startsWith(c.slice(0, -1))) : heads.has(c) ? c : void 0;
9879
+ if (hit) return { kind: "pushed", branch: hit, sha: heads.get(hit), remote };
9880
+ }
9881
+ return {
9882
+ kind: "bounce",
9883
+ branch: null,
9884
+ remote,
9885
+ local: null,
9886
+ origin: null,
9887
+ reason: `no branch for this ticket is on \`${remote}\`; the run's clone was deleted with its sandbox, so nothing it did not push can be recovered`
9888
+ };
9889
+ }
9890
+ function describeGuardError(e, dir) {
9891
+ const msg = e.message;
9892
+ if (!/ENOENT/.test(msg)) return msg;
9893
+ return dir && !existsSync22(dir) ? `the run's clone at ${dir} is gone` : "git is not installed on this machine";
9894
+ }
9856
9895
  function inspectHandoff(dir, cfg, ticket, role) {
9857
9896
  const remote = cfg.branch.remote;
9858
9897
  if (!remoteConfigured(dir, remote)) return { kind: "unverified", why: `no remote \`${remote}\` configured` };
@@ -9970,7 +10009,7 @@ async function enforceHandoff(i) {
9970
10009
  i.log.emit(`${t.issue_id} is at ${t.status}, not handed off \u2014 nothing to check`, log);
9971
10010
  return { kind: "not-handed-off" };
9972
10011
  }
9973
- const v = inspectHandoff(i.dir, i.cfg, t, i.role);
10012
+ const v = i.origin ? inspectRemoteHandoff(i.origin, i.cfg, t, i.role) : inspectHandoff(i.dir, i.cfg, t, i.role);
9974
10013
  if (v.kind === "unverified") {
9975
10014
  i.log.warn(`${t.issue_id} is at ${t.status} but the push was not checked: ${v.why}`, log);
9976
10015
  return { kind: "unverified", why: v.why };
@@ -10014,7 +10053,7 @@ async function enforceHandoff(i) {
10014
10053
  i.log.warn(`${t.issue_id} was taken over by another ship during this run \u2014 left alone`, log);
10015
10054
  return { kind: "unverified", why: "ticket was taken over during this run" };
10016
10055
  }
10017
- if (!v.local) {
10056
+ if (!v.local && !i.origin) {
10018
10057
  i.log.warn(`${t.issue_id} has no local branch on this ship, so it is not this ship's hand-off to bounce: ${v.reason}`, log);
10019
10058
  return { kind: "unverified", why: "no local branch on this ship" };
10020
10059
  }
@@ -10052,8 +10091,9 @@ async function enforceHandoff(i) {
10052
10091
  i.log.warn(`${t.issue_id} bounced back to ${i.contract.statuses.building}: ${v.reason}`, log);
10053
10092
  return { kind: "bounced" };
10054
10093
  } catch (e) {
10055
- i.log.warn(`could not check the hand-off: ${e.message}`, { step: "handoff" });
10056
- return { kind: "failed", why: e.message };
10094
+ const why = describeGuardError(e, i.dir);
10095
+ i.log.warn(`could not check the hand-off: ${why}`, { step: "handoff" });
10096
+ return { kind: "failed", why };
10057
10097
  }
10058
10098
  }
10059
10099
  async function guardRunHandoff(route2, ship, tracker, role, workingId, log, since2) {
@@ -10061,16 +10101,23 @@ async function guardRunHandoff(route2, ship, tracker, role, workingId, log, sinc
10061
10101
  if (!workingId || role !== "dev" && role !== "design" && role !== "qa") return null;
10062
10102
  const seatId = route2.resolved?.seats[role];
10063
10103
  if (!seatId) return null;
10104
+ let checkoutDir;
10064
10105
  try {
10065
10106
  const t = await tracker.ticket(workingId);
10066
10107
  const resolved = repoConfigFor(route2, t);
10067
10108
  if (!resolved) return null;
10068
10109
  const { target, cfg } = resolved;
10110
+ checkoutDir = target.dir;
10069
10111
  if (role === "qa") {
10070
10112
  await retireRunWorktree(tracker, target.dir, cfg, t, role, seatId, ship.name, log);
10071
10113
  return null;
10072
10114
  }
10073
10115
  const affinity = await tracker.claimAffinity();
10116
+ const origin = ship.runner === "sandbox" ? sandboxOriginFor(route2, target.name) : void 0;
10117
+ if (ship.runner === "sandbox" && !origin) {
10118
+ log.warn(`${t.issue_id}: the push was not checked: this ship cannot place the remote of ${target.name}`, { ticket: t.issue_id, step: "handoff" });
10119
+ return null;
10120
+ }
10074
10121
  const outcome = replayed.includes(workingId) ? { kind: "pushed", sha: "" } : await enforceHandoff({
10075
10122
  writer: tracker,
10076
10123
  contract: tracker.contract,
@@ -10082,19 +10129,21 @@ async function guardRunHandoff(route2, ship, tracker, role, workingId, log, sinc
10082
10129
  shipName: ship.name,
10083
10130
  hold: affinity ? { column: affinity.column, shipId: affinity.shipId } : void 0,
10084
10131
  since: since2,
10085
- log
10132
+ log,
10133
+ ...origin ? { origin } : {}
10086
10134
  });
10087
- if (outcome.kind === "pushed") await retireRunWorktree(tracker, target.dir, cfg, t, role, seatId, ship.name, log);
10135
+ if (origin) {
10136
+ } else if (outcome.kind === "pushed") await retireRunWorktree(tracker, target.dir, cfg, t, role, seatId, ship.name, log);
10088
10137
  else {
10089
10138
  const branch = existingBranchForTicket(target.dir, cfg, t, role);
10090
10139
  if (branch && dropEmptyRunBranch(target.dir, cfg, branch)) {
10091
10140
  log.emit(`${t.issue_id}: dropped ${branch} \u2014 the run made no commits beyond ${cfg.branch.base}`, { ticket: t.issue_id, step: "handoff" });
10092
10141
  }
10093
10142
  }
10094
- if (since2) await guardRunStrays(route2, ship, tracker, role, workingId, since2, log);
10143
+ if (since2 && !origin) await guardRunStrays(route2, ship, tracker, role, workingId, since2, log);
10095
10144
  return outcome;
10096
10145
  } catch (e) {
10097
- log.warn(`could not check the hand-off: ${e.message}`, { step: "handoff" });
10146
+ log.warn(`could not check the hand-off: ${describeGuardError(e, checkoutDir)}`, { step: "handoff" });
10098
10147
  return null;
10099
10148
  }
10100
10149
  }
@@ -10508,7 +10557,7 @@ function queueAgentRun(stateDir, name, q2) {
10508
10557
  }
10509
10558
  async function replayQueuedAgentRuns(stateDir, route2, keyFor, log, now = /* @__PURE__ */ new Date()) {
10510
10559
  const dir = queueDir(stateDir);
10511
- if (!existsSync22(dir)) return 0;
10560
+ if (!existsSync23(dir)) return 0;
10512
10561
  let sent = 0;
10513
10562
  for (const f of readdirSync7(dir).filter((n) => n.endsWith(".json")).sort()) {
10514
10563
  const path = join25(dir, f);
@@ -10561,7 +10610,7 @@ function queueTicketCounters(stateDir, name, q2) {
10561
10610
  }
10562
10611
  async function replayQueuedTicketCounters(stateDir, route2, keyFor, log, now = /* @__PURE__ */ new Date()) {
10563
10612
  const dir = countersDir(stateDir);
10564
- if (!existsSync22(dir)) return 0;
10613
+ if (!existsSync23(dir)) return 0;
10565
10614
  let sent = 0;
10566
10615
  for (const f of readdirSync7(dir).filter((n) => n.endsWith(".json")).sort()) {
10567
10616
  const path = join25(dir, f);
@@ -10829,10 +10878,10 @@ var HandoffTranscriptTracker = class {
10829
10878
  import { createHash as createHash4 } from "crypto";
10830
10879
  import { spawn as spawn3 } from "child_process";
10831
10880
  import { execFileSync as execFileSync7 } from "child_process";
10832
- import { existsSync as existsSync23, mkdirSync as mkdirSync17, readFileSync as readFileSync24, renameSync as renameSync3, writeFileSync as writeFileSync18, rmSync as rmSync14 } from "fs";
10881
+ import { existsSync as existsSync24, mkdirSync as mkdirSync17, readFileSync as readFileSync24, renameSync as renameSync3, writeFileSync as writeFileSync18, rmSync as rmSync14 } from "fs";
10833
10882
  import { dirname as dirname13, join as join26 } from "path";
10834
10883
  import { fileURLToPath } from "url";
10835
- import { tmpdir as tmpdir2 } from "os";
10884
+ import { tmpdir as tmpdir3 } from "os";
10836
10885
  var SANDBOX_BASE_IMAGE = "nvcr.io/nvidia/base/ubuntu:24.04";
10837
10886
  var SANDBOX_OPENSHELL_VERSION = "0.1.6";
10838
10887
  var SANDBOX_CLAUDE_VERSION = "2.1.309";
@@ -10847,7 +10896,7 @@ var SANDBOX_BRIDGE_PATH = `${CREW_PREFIX}/bin/intel-bridge`;
10847
10896
  function readBridgeBundle() {
10848
10897
  const here = dirname13(fileURLToPath(import.meta.url));
10849
10898
  for (const p of [join26(here, "sandbox-intel-bridge.cjs"), join26(here, "..", "dist", "sandbox-intel-bridge.cjs")]) {
10850
- if (existsSync23(p)) return readFileSync24(p, "utf8");
10899
+ if (existsSync24(p)) return readFileSync24(p, "utf8");
10851
10900
  }
10852
10901
  return void 0;
10853
10902
  }
@@ -11107,7 +11156,7 @@ async function buildSandboxImage(plan, deps) {
11107
11156
  const builtLayers = [];
11108
11157
  for (const layer of plan.layers) {
11109
11158
  if (deps.hasImage(layer.tag)) continue;
11110
- const ctx = join26(tmpdir2(), `crew-sandbox-${hash([layer.tag, process.pid, Date.now()])}`);
11159
+ const ctx = join26(tmpdir3(), `crew-sandbox-${hash([layer.tag, process.pid, Date.now()])}`);
11111
11160
  mkdirSync17(ctx, { recursive: true });
11112
11161
  try {
11113
11162
  writeFileSync18(join26(ctx, "Dockerfile"), layer.dockerfile);
@@ -11214,7 +11263,7 @@ function expandSkillMarkers(text2, lookup2, opts = {}) {
11214
11263
  }
11215
11264
 
11216
11265
  // src/skills.ts
11217
- import { readFileSync as readFileSync26, readdirSync as readdirSync8, existsSync as existsSync25 } from "fs";
11266
+ import { readFileSync as readFileSync26, readdirSync as readdirSync8, existsSync as existsSync26 } from "fs";
11218
11267
  import { join as join28 } from "path";
11219
11268
  import { parse as parseYaml } from "yaml";
11220
11269
  import { TablationClient as TablationClient3, StaleWriteError as StaleWriteError3, TablationApiError as TablationApiError2 } from "@tablation/client";
@@ -11231,7 +11280,7 @@ ${additions}`;
11231
11280
  }
11232
11281
 
11233
11282
  // src/agents.ts
11234
- import { readFileSync as readFileSync25, existsSync as existsSync24 } from "fs";
11283
+ import { readFileSync as readFileSync25, existsSync as existsSync25 } from "fs";
11235
11284
  import { join as join27 } from "path";
11236
11285
  import { TablationClient as TablationClient2, StaleWriteError as StaleWriteError2, TablationApiError } from "@tablation/client";
11237
11286
  var PERSONA_NAME = {
@@ -11247,10 +11296,10 @@ var AgentsSyncError = class extends Error {
11247
11296
  };
11248
11297
  function personaDefaultPrompt(promptsDir, role) {
11249
11298
  const briefPath = join27(promptsDir, "personas", `lane-${role}.md`);
11250
- if (!existsSync24(briefPath)) throw new AgentsSyncError(`no brief at ${briefPath}`);
11299
+ if (!existsSync25(briefPath)) throw new AgentsSyncError(`no brief at ${briefPath}`);
11251
11300
  if (SELF_CONTAINED_ROLES.has(role)) return readFileSync25(briefPath, "utf8");
11252
11301
  const commonPath = join27(promptsDir, "personas", "common.md");
11253
- if (!existsSync24(commonPath)) return readFileSync25(briefPath, "utf8");
11302
+ if (!existsSync25(commonPath)) return readFileSync25(briefPath, "utf8");
11254
11303
  return `${readFileSync25(commonPath, "utf8")}${readFileSync25(briefPath, "utf8")}`;
11255
11304
  }
11256
11305
  async function resolveAgentId(route2, role, opts) {
@@ -11712,7 +11761,7 @@ function parseSkillFile(path) {
11712
11761
  }
11713
11762
  function listLocalSkills(promptsDir) {
11714
11763
  const dir = join28(promptsDir, "skills");
11715
- if (!existsSync25(dir)) return [];
11764
+ if (!existsSync26(dir)) return [];
11716
11765
  return readdirSync8(dir).filter((f) => f.endsWith(".md")).map((f) => parseSkillFile(join28(dir, f)));
11717
11766
  }
11718
11767
  async function syncSkills(route2, opts) {
@@ -11900,7 +11949,7 @@ function skillMarkerWarnings(promptsDir, personaPrompts) {
11900
11949
  import { spawn as spawn4, execFile, execFileSync as execFileSync8 } from "child_process";
11901
11950
  import { mkdtempSync, mkdirSync as mkdirSync18, writeFileSync as writeFileSync19, rmSync as rmSync15 } from "fs";
11902
11951
  import { createHash as createHash5 } from "crypto";
11903
- import { tmpdir as tmpdir3 } from "os";
11952
+ import { tmpdir as tmpdir4 } from "os";
11904
11953
  import { basename as basename8, dirname as dirname14, join as join29 } from "path";
11905
11954
  import { promisify } from "util";
11906
11955
 
@@ -12085,7 +12134,7 @@ var SandboxRunner = class {
12085
12134
  const harness = cfg.agentBin ?? basename8(plan.bin);
12086
12135
  const viaUpload = Buffer.byteLength(plan.prompt) > SANDBOX_STDIN_LIMIT;
12087
12136
  if (viaUpload) {
12088
- const tmp = mkdtempSync(join29(tmpdir3(), "crew-prompt-"));
12137
+ const tmp = mkdtempSync(join29(tmpdir4(), "crew-prompt-"));
12089
12138
  try {
12090
12139
  const file = join29(tmp, "prompt.txt");
12091
12140
  writeFileSync19(file, plan.prompt, { mode: 384 });
@@ -12359,18 +12408,18 @@ function codeBridgeFor(o, harness) {
12359
12408
  }
12360
12409
  function planAgentRun(o) {
12361
12410
  const briefPath = join30(o.route.promptsDir, "personas", `lane-${o.role}.md`);
12362
- if (!existsSync26(briefPath)) {
12411
+ if (!existsSync27(briefPath)) {
12363
12412
  throw new AgentError(`no brief at ${briefPath} \u2014 refusing to run an unscoped session`);
12364
12413
  }
12365
12414
  const commonPath = join30(o.route.promptsDir, "personas", "common.md");
12366
- const usesCommon = !SELF_CONTAINED_ROLES.has(o.role) && existsSync26(commonPath);
12415
+ const usesCommon = !SELF_CONTAINED_ROLES.has(o.role) && existsSync27(commonPath);
12367
12416
  const now = o.now ?? (() => Date.now());
12368
12417
  const routeLabel = routeSlug(o.route.route);
12369
12418
  const ownDigest = o.runId ? digestPathFor(o.stateDir, routeLabel, o.role, o.runId) : void 0;
12370
- const digestPath2 = ownDigest && existsSync26(ownDigest) ? ownDigest : digestPathFor(o.stateDir, routeLabel, o.role);
12419
+ const digestPath2 = ownDigest && existsSync27(ownDigest) ? ownDigest : digestPathFor(o.stateDir, routeLabel, o.role);
12371
12420
  let digest;
12372
12421
  let ageSeconds;
12373
- if (existsSync26(digestPath2)) {
12422
+ if (existsSync27(digestPath2)) {
12374
12423
  ageSeconds = Math.floor((now() - statSync8(digestPath2).mtimeMs) / 1e3);
12375
12424
  if (ageSeconds <= DIGEST_MAX_AGE_SECONDS) digest = readFileSync27(digestPath2, "utf8");
12376
12425
  }
@@ -13134,7 +13183,7 @@ var pidAlive = (pid) => {
13134
13183
  };
13135
13184
  function runFinished(streamPath) {
13136
13185
  const path = `${streamPath}.meta.json`;
13137
- if (!existsSync27(path)) return false;
13186
+ if (!existsSync28(path)) return false;
13138
13187
  try {
13139
13188
  return JSON.parse(readFileSync28(path, "utf8")).running !== true;
13140
13189
  } catch {
@@ -13143,7 +13192,7 @@ function runFinished(streamPath) {
13143
13192
  }
13144
13193
  function orphanedStreams(o) {
13145
13194
  const dir = join31(o.stateDir, "streams");
13146
- if (!existsSync27(dir)) return [];
13195
+ if (!existsSync28(dir)) return [];
13147
13196
  const ownerAlive = o.isOwnerAlive ?? pidAlive;
13148
13197
  const out = [];
13149
13198
  for (const name of readdirSync9(dir)) {
@@ -13201,11 +13250,11 @@ async function reconcileRuns(o) {
13201
13250
  }
13202
13251
 
13203
13252
  // src/live-runs.ts
13204
- import { existsSync as existsSync28, readdirSync as readdirSync10, statSync as statSync9 } from "fs";
13253
+ import { existsSync as existsSync29, readdirSync as readdirSync10, statSync as statSync9 } from "fs";
13205
13254
  import { join as join32 } from "path";
13206
13255
  function liveRuns(stateDir, isAlive = runIsAlive) {
13207
13256
  const dir = join32(stateDir, "streams");
13208
- if (!existsSync28(dir)) return [];
13257
+ if (!existsSync29(dir)) return [];
13209
13258
  const out = [];
13210
13259
  for (const name of readdirSync10(dir)) {
13211
13260
  if (!name.endsWith(".jsonl") || name.endsWith(".events.jsonl")) continue;
@@ -13221,7 +13270,7 @@ function runActivity(stateDir, isAlive = runIsAlive) {
13221
13270
  const activeRuns = liveRuns(stateDir, isAlive).length;
13222
13271
  const dir = join32(stateDir, "streams");
13223
13272
  let newest = 0;
13224
- if (existsSync28(dir)) {
13273
+ if (existsSync29(dir)) {
13225
13274
  for (const name of readdirSync10(dir)) {
13226
13275
  if (!name.endsWith(".jsonl") || name.endsWith(".events.jsonl")) continue;
13227
13276
  const streamPath = join32(dir, name);
@@ -13319,7 +13368,7 @@ function realDeprovisionDeps(cfg, emit, crewHome, getStore) {
13319
13368
  if (host === "windows") return [];
13320
13369
  const ctx = installContext();
13321
13370
  const systemd = detectSystemd();
13322
- return ["run", "release", "passengers"].flatMap((job) => planInstall(cfg.ship, crewHome, host, systemd, job, ctx).unitPaths).filter((p) => existsSync29(p));
13371
+ return ["run", "release", "passengers"].flatMap((job) => planInstall(cfg.ship, crewHome, host, systemd, job, ctx).unitPaths).filter((p) => existsSync30(p));
13323
13372
  };
13324
13373
  return {
13325
13374
  liveRuns: () => liveRuns(stateDir).map((r) => ({ role: r.role, route: r.route, pid: r.pid, ticketRecordId: r.ticketRecordId ?? void 0, streamPath: r.streamPath })),
@@ -13380,7 +13429,7 @@ function realDeprovisionDeps(cfg, emit, crewHome, getStore) {
13380
13429
  },
13381
13430
  remaining() {
13382
13431
  const left = [];
13383
- if (existsSync29(cfg.configFile)) left.push(`config ${cfg.configFile}`);
13432
+ if (existsSync30(cfg.configFile)) left.push(`config ${cfg.configFile}`);
13384
13433
  for (const h of forgeHosts()) if (hasForgeToken(cfg.ship.forges, h, stateDir)) left.push(`forge token for ${h}`);
13385
13434
  try {
13386
13435
  for (const k of readdirSync11(keysDir(stateDir))) left.push(`seat key ${k}`);
@@ -14192,8 +14241,8 @@ function managedGitIdentityWarnings(kind, identity) {
14192
14241
 
14193
14242
  // src/selftest.ts
14194
14243
  import { spawn as spawn6 } from "child_process";
14195
- import { existsSync as existsSync30, mkdirSync as mkdirSync20, mkdtempSync as mkdtempSync2, readFileSync as readFileSync29, rmSync as rmSync16, writeFileSync as writeFileSync21 } from "fs";
14196
- import { tmpdir as tmpdir4 } from "os";
14244
+ import { existsSync as existsSync31, mkdirSync as mkdirSync20, mkdtempSync as mkdtempSync2, readFileSync as readFileSync29, rmSync as rmSync16, writeFileSync as writeFileSync21 } from "fs";
14245
+ import { tmpdir as tmpdir5 } from "os";
14197
14246
  import { join as join33 } from "path";
14198
14247
  var SELFTEST_TIMEOUT_MS = 12e4;
14199
14248
  var KEY_VAR = "CREW_API_KEY";
@@ -14360,7 +14409,7 @@ async function runSelftest(i, deps = realDeps) {
14360
14409
  ...adapter.runEnv(spec),
14361
14410
  [KEY_VAR]: i.apiKey
14362
14411
  };
14363
- const cwd = mkdtempSync2(join33(tmpdir4(), "crew-selftest-"));
14412
+ const cwd = mkdtempSync2(join33(tmpdir5(), "crew-selftest-"));
14364
14413
  try {
14365
14414
  const run3 = await deps.run({
14366
14415
  bin: invocation.bin,
@@ -14397,7 +14446,7 @@ var fileFor2 = (stateDir) => join33(stateDir, "selftest.json");
14397
14446
  function readSelftest(stateDir) {
14398
14447
  try {
14399
14448
  const p = fileFor2(stateDir);
14400
- return existsSync30(p) ? JSON.parse(readFileSync29(p, "utf8")) : {};
14449
+ return existsSync31(p) ? JSON.parse(readFileSync29(p, "utf8")) : {};
14401
14450
  } catch {
14402
14451
  return {};
14403
14452
  }
@@ -14724,7 +14773,7 @@ async function signOutSessions(o) {
14724
14773
  }
14725
14774
 
14726
14775
  // src/reset.ts
14727
- import { existsSync as existsSync31, mkdirSync as mkdirSync22, readFileSync as readFileSync31, readdirSync as readdirSync12, rmSync as rmSync18, statSync as statSync10, writeFileSync as writeFileSync23 } from "fs";
14776
+ import { existsSync as existsSync32, mkdirSync as mkdirSync22, readFileSync as readFileSync31, readdirSync as readdirSync12, rmSync as rmSync18, statSync as statSync10, writeFileSync as writeFileSync23 } from "fs";
14728
14777
  import { dirname as dirname17, join as join35 } from "path";
14729
14778
  import { hostFromUrl as hostFromUrl3 } from "@tablation/client";
14730
14779
  function clonedCheckoutsFile(stateDir) {
@@ -14797,7 +14846,7 @@ async function runReset(o, fx) {
14797
14846
  }
14798
14847
  if (o.beforeState) steps.push(...await o.beforeState());
14799
14848
  steps.push(...o.wipeState ? wipeStateDir(o.stateDir, o.dryRun) : removeState(o.stateDir, o.dryRun));
14800
- if (existsSync31(o.configFile)) {
14849
+ if (existsSync32(o.configFile)) {
14801
14850
  if (!o.dryRun) rmSync18(o.configFile, { force: true });
14802
14851
  steps.push({ step: "config", target: o.configFile, action: mark(o.dryRun) });
14803
14852
  } else {
@@ -14806,7 +14855,7 @@ async function runReset(o, fx) {
14806
14855
  return steps;
14807
14856
  }
14808
14857
  function removeCheckout(dir, dryRun, fx) {
14809
- if (!existsSync31(dir)) return { step: "checkout", target: dir, action: "absent", detail: "already gone" };
14858
+ if (!existsSync32(dir)) return { step: "checkout", target: dir, action: "absent", detail: "already gone" };
14810
14859
  const { dirty, linkedWorktrees } = fx.inspectCheckout(dir);
14811
14860
  if (dirty.length) {
14812
14861
  return { step: "checkout", target: dir, action: "kept", detail: `has uncommitted changes (${dirty.length} path${dirty.length === 1 ? "" : "s"}: ${dirty.slice(0, 5).join(", ")}${dirty.length > 5 ? ", \u2026" : ""})` };
@@ -14827,7 +14876,7 @@ function removeState(stateDir, dryRun) {
14827
14876
  } catch {
14828
14877
  }
14829
14878
  for (const t of targets) {
14830
- if (!existsSync31(t)) continue;
14879
+ if (!existsSync32(t)) continue;
14831
14880
  if (!dryRun) rmSync18(t, { recursive: true, force: true });
14832
14881
  out.push({ step: "state", target: t, action: mark(dryRun) });
14833
14882
  }
@@ -15223,13 +15272,13 @@ function hostArchitecture(arch = process.arch) {
15223
15272
 
15224
15273
  // src/pool-member-host.ts
15225
15274
  import "child_process";
15226
- import { existsSync as existsSync35 } from "fs";
15275
+ import { existsSync as existsSync36 } from "fs";
15227
15276
  import { hostname as hostname3 } from "os";
15228
15277
 
15229
15278
  // src/machine-id.ts
15230
15279
  import { execFileSync as execFileSync11 } from "child_process";
15231
15280
  import { createHash as createHash8 } from "crypto";
15232
- import { existsSync as existsSync32, mkdirSync as mkdirSync24, readFileSync as readFileSync33, writeFileSync as writeFileSync25 } from "fs";
15281
+ import { existsSync as existsSync33, mkdirSync as mkdirSync24, readFileSync as readFileSync33, writeFileSync as writeFileSync25 } from "fs";
15233
15282
  import { dirname as dirname19, join as join37 } from "path";
15234
15283
  function machineIdPathFor(stateDir) {
15235
15284
  return join37(stateDir, "machine-id");
@@ -15245,7 +15294,7 @@ function readRawMachineId(platform2 = process.platform) {
15245
15294
  return /"IOPlatformUUID"\s*=\s*"([^"]+)"/.exec(out)?.[1];
15246
15295
  }
15247
15296
  for (const p of ["/etc/machine-id", "/var/lib/dbus/machine-id"]) {
15248
- if (existsSync32(p)) {
15297
+ if (existsSync33(p)) {
15249
15298
  const id = readFileSync33(p, "utf8").trim();
15250
15299
  if (id) return id;
15251
15300
  }
@@ -15257,7 +15306,7 @@ function readRawMachineId(platform2 = process.platform) {
15257
15306
  function ensureMachineId(stateDir, opts = {}) {
15258
15307
  if (opts.override?.trim()) return sha256(opts.override.trim());
15259
15308
  const path = machineIdPathFor(stateDir);
15260
- if (existsSync32(path)) {
15309
+ if (existsSync33(path)) {
15261
15310
  const cached = readFileSync33(path, "utf8").trim();
15262
15311
  if (/^[0-9a-f]{64}$/.test(cached)) return cached;
15263
15312
  }
@@ -15278,7 +15327,7 @@ function matchShipRows(ships, shipName2, machineId) {
15278
15327
 
15279
15328
  // src/provision.ts
15280
15329
  import { spawnSync as spawnSync9 } from "child_process";
15281
- import { existsSync as existsSync33, readFileSync as readFileSync34, writeFileSync as writeFileSync26 } from "fs";
15330
+ import { existsSync as existsSync34, readFileSync as readFileSync34, writeFileSync as writeFileSync26 } from "fs";
15282
15331
  import { hostname as hostname2 } from "os";
15283
15332
  import { parseDocument as parseDocument3, isMap as isMap2, isScalar } from "yaml";
15284
15333
 
@@ -15896,7 +15945,7 @@ function realProvisionDeps(crewHome) {
15896
15945
  };
15897
15946
  const configFile = () => {
15898
15947
  const f = findConfigFile(crewHome);
15899
- return existsSync33(f) ? f : null;
15948
+ return existsSync34(f) ? f : null;
15900
15949
  };
15901
15950
  return {
15902
15951
  crew: spawnCrew,
@@ -15930,14 +15979,14 @@ function realProvisionDeps(crewHome) {
15930
15979
  continue;
15931
15980
  }
15932
15981
  for (const p of plan.unitPaths) {
15933
- if (!existsSync33(p) || readFileSync34(p, "utf8") !== plan.unitContent[p]) unitsStale = true;
15982
+ if (!existsSync34(p) || readFileSync34(p, "utf8") !== plan.unitContent[p]) unitsStale = true;
15934
15983
  }
15935
15984
  }
15936
15985
  const label = labelFor(crewHome, "run");
15937
15986
  let running = false;
15938
15987
  let lingering = true;
15939
15988
  if (mechanism === "systemd") {
15940
- const system = ctx.root || existsSync33(systemUnitPathFor(label));
15989
+ const system = ctx.root || existsSync34(systemUnitPathFor(label));
15941
15990
  const ctl = system ? ["systemctl"] : ["systemctl", "--user"];
15942
15991
  running = spawnSync9(ctl[0], [...ctl.slice(1), "is-active", "--quiet", `${label}.service`], { env: withUserBusEnv() }).status === 0;
15943
15992
  if (!system) {
@@ -15993,7 +16042,7 @@ host=${host}
15993
16042
 
15994
16043
  // src/tunnel.ts
15995
16044
  import { spawn as spawn7 } from "child_process";
15996
- import { existsSync as existsSync34, mkdirSync as mkdirSync25, readFileSync as readFileSync35, writeFileSync as writeFileSync27, unlinkSync as unlinkSync3, readdirSync as readdirSync13 } from "fs";
16045
+ import { existsSync as existsSync35, mkdirSync as mkdirSync25, readFileSync as readFileSync35, writeFileSync as writeFileSync27, unlinkSync as unlinkSync3, readdirSync as readdirSync13 } from "fs";
15997
16046
  import { randomInt } from "crypto";
15998
16047
  import { join as join39 } from "path";
15999
16048
  var DEFAULT_SPAWN_OPTIONS = { stdio: "ignore", detached: true };
@@ -16077,7 +16126,7 @@ function tunnelStatePath(stateDir, workspaceId) {
16077
16126
  }
16078
16127
  function readPersistedTunnel(stateDir, workspaceId) {
16079
16128
  const path = tunnelStatePath(stateDir, workspaceId);
16080
- if (!existsSync34(path)) return void 0;
16129
+ if (!existsSync35(path)) return void 0;
16081
16130
  try {
16082
16131
  return JSON.parse(readFileSync35(path, "utf8"));
16083
16132
  } catch {
@@ -16217,7 +16266,7 @@ function syncPassengerTunnels(plans, relayHost, relayPort, privateKeyPath, state
16217
16266
  }
16218
16267
  function readAllPersistedWorkspaceIds(stateDir) {
16219
16268
  const dir = join39(stateDir, "passengers");
16220
- if (!existsSync34(dir)) return [];
16269
+ if (!existsSync35(dir)) return [];
16221
16270
  return readdirSync13(dir).filter((f) => f.endsWith(".json") && !f.endsWith("-sync.json")).map((f) => f.slice(0, -".json".length));
16222
16271
  }
16223
16272
  var TUNNEL_REJECTED_KEY = "tunnel_rejected";
@@ -16257,7 +16306,7 @@ function realPoolMemberDeps(o) {
16257
16306
  crewVersion: crewVersion(o.crewHome),
16258
16307
  hostname: hostname3()
16259
16308
  },
16260
- hasShipConfig: () => existsSync35(findConfigFile(o.crewHome)),
16309
+ hasShipConfig: () => existsSync36(findConfigFile(o.crewHome)),
16261
16310
  async provision(lease, instanceClass, shipKind) {
16262
16311
  const hosts = lease.forges.map((f) => f.host.toLowerCase());
16263
16312
  const lines2 = [];
@@ -17634,7 +17683,7 @@ async function resolveOne(tracker, t, seat, approvedStatus, buildingStatus, affi
17634
17683
  }
17635
17684
 
17636
17685
  // src/repo-refresh.ts
17637
- import { existsSync as existsSync36, mkdirSync as mkdirSync26, readFileSync as readFileSync36, writeFileSync as writeFileSync29 } from "fs";
17686
+ import { existsSync as existsSync37, mkdirSync as mkdirSync26, readFileSync as readFileSync36, writeFileSync as writeFileSync29 } from "fs";
17638
17687
  import { dirname as dirname21 } from "path";
17639
17688
  var REFRESH_COOLDOWN_MS = 2 * 6e4;
17640
17689
  var UNSERVABLE_PASSES_BEFORE_ATTENTION = 3;
@@ -17664,7 +17713,7 @@ function applyRepoRows(resolved, rows) {
17664
17713
  }
17665
17714
  function persistRepoRows(stateDir, routeName, rows) {
17666
17715
  const path = resolvedPathFor(stateDir, routeName);
17667
- if (!existsSync36(path)) return;
17716
+ if (!existsSync37(path)) return;
17668
17717
  const raw = JSON.parse(readFileSync36(path, "utf8"));
17669
17718
  applyRepoRows(raw, rows);
17670
17719
  mkdirSync26(dirname21(path), { recursive: true });
@@ -18119,12 +18168,12 @@ var localRefSkipReported = (ticket, problem, events) => events.some((e) => e.rec
18119
18168
 
18120
18169
  // src/connect-wizard.ts
18121
18170
  import { delimiter, dirname as dirname22, join as join41 } from "path";
18122
- import { accessSync as accessSync3, constants as constants3, existsSync as existsSync37, mkdirSync as mkdirSync27, writeFileSync as writeFileSync30 } from "fs";
18171
+ import { accessSync as accessSync3, constants as constants3, existsSync as existsSync38, mkdirSync as mkdirSync27, writeFileSync as writeFileSync30 } from "fs";
18123
18172
  import { stringify as stringify3 } from "yaml";
18124
18173
  var HOST_PASSENGERS_DOCS_URL = "https://crew.tablation.dev/host-passengers";
18125
18174
  function shouldRunWizard(opts) {
18126
18175
  if (!opts.isTTY) return false;
18127
- const exists = opts.configExists ?? existsSync37;
18176
+ const exists = opts.configExists ?? existsSync38;
18128
18177
  return !configSearchPath(opts.crewHome).some((p) => exists(p));
18129
18178
  }
18130
18179
  function firstRunConfigPath() {
@@ -18403,9 +18452,9 @@ async function collectDiagnostics(d) {
18403
18452
  }
18404
18453
 
18405
18454
  // src/release-run.ts
18406
- import { readFileSync as readFileSync37, writeFileSync as writeFileSync31, existsSync as existsSync38, copyFileSync, mkdirSync as mkdirSync28, mkdtempSync as mkdtempSync3, rmSync as rmSync19 } from "fs";
18455
+ import { readFileSync as readFileSync37, writeFileSync as writeFileSync31, existsSync as existsSync39, copyFileSync, mkdirSync as mkdirSync28, mkdtempSync as mkdtempSync3, rmSync as rmSync19 } from "fs";
18407
18456
  import { dirname as dirname24, join as join43 } from "path";
18408
- import { tmpdir as tmpdir5, hostname as hostname4 } from "os";
18457
+ import { tmpdir as tmpdir6, hostname as hostname4 } from "os";
18409
18458
 
18410
18459
  // src/release.ts
18411
18460
  function describeUnplaceable(unplaceable, verifiedStatus) {
@@ -19188,7 +19237,7 @@ async function bump(o, size) {
19188
19237
  }
19189
19238
  const files = o.repo.release.versionFiles.map((f) => join43(o.cwd, f));
19190
19239
  const first = files[0];
19191
- if (!existsAt(first, existsSync38)) {
19240
+ if (!existsAt(first, existsSync39)) {
19192
19241
  o.emit.error(`no ${o.repo.release.versionFiles[0]} to read a version from`);
19193
19242
  return null;
19194
19243
  }
@@ -19230,7 +19279,7 @@ function writeChangelog(o, version, entries) {
19230
19279
  o.emit.emit(`would prepend ${entries.length} entr(ies) to ${file}`);
19231
19280
  return;
19232
19281
  }
19233
- const existing = existsAt(path, existsSync38) ? readTextAt(path, (p) => readFileSync37(p, "utf8")) : "# Changelog\n";
19282
+ const existing = existsAt(path, existsSync39) ? readTextAt(path, (p) => readFileSync37(p, "utf8")) : "# Changelog\n";
19234
19283
  writeTextAt(path, insertChangelogSection(existing, section), writeFileSync31);
19235
19284
  }
19236
19285
  async function confirm(o, expected) {
@@ -19324,7 +19373,7 @@ function closeReleaseCheckout(cwd, root, dir, branch, run3 = gitOk) {
19324
19373
  function openReleaseCheckout(o) {
19325
19374
  const { remote, base } = o.repo.branch;
19326
19375
  const branch = `crew/release-${Date.now()}`;
19327
- const root = mkdtempSync3(join43(tmpdir5(), "crew-release-"));
19376
+ const root = mkdtempSync3(join43(tmpdir6(), "crew-release-"));
19328
19377
  const dir = join43(root, "checkout");
19329
19378
  o.emit.emit(`release checkout: ${dir}`, { step: "release" });
19330
19379
  const close = () => closeReleaseCheckout(o.cwd, root, dir, branch);
@@ -19336,7 +19385,7 @@ function openReleaseCheckout(o) {
19336
19385
  }
19337
19386
  for (const f of o.repo.worktrees.copy) {
19338
19387
  const src = join43(o.cwd, f);
19339
- if (!existsSync38(src)) continue;
19388
+ if (!existsSync39(src)) continue;
19340
19389
  mkdirSync28(dirname24(join43(dir, f)), { recursive: true });
19341
19390
  copyFileSync(src, join43(dir, f));
19342
19391
  }
@@ -19489,7 +19538,7 @@ async function runReleaseCycle(o, movedPast2, localRefSkips) {
19489
19538
  let checkout;
19490
19539
  const stranded = recoverStrandedReleaseCheckouts(o.cwd);
19491
19540
  if (stranded.length > 0) o.emit.warn(scoped(`dropped release checkout(s) stranded by a crash: ${stranded.join(", ")}`));
19492
- const swept = sweepStaleReleaseRoots(tmpdir5());
19541
+ const swept = sweepStaleReleaseRoots(tmpdir6());
19493
19542
  if (swept.length > 0) o.emit.emit(scoped(`removed ${swept.length} stale crew-release-* temp dir(s)`), { step: "release" });
19494
19543
  try {
19495
19544
  checkout = openReleaseCheckout(o);
@@ -20173,7 +20222,7 @@ function runForge(a, io) {
20173
20222
  }
20174
20223
 
20175
20224
  // src/mirror-contract.ts
20176
- import { existsSync as existsSync39 } from "fs";
20225
+ import { existsSync as existsSync40 } from "fs";
20177
20226
 
20178
20227
  // src/passenger-mirror.ts
20179
20228
  import { mkdirSync as mkdirSync29 } from "fs";
@@ -20214,7 +20263,7 @@ function mirrorOutcome(m) {
20214
20263
 
20215
20264
  // src/mirror-contract.ts
20216
20265
  function lacksCheckout(ship, dir) {
20217
- return ship.runner === "sandbox" && !existsSync39(dir) && !remoteOf(dir);
20266
+ return ship.runner === "sandbox" && !existsSync40(dir) && !remoteOf(dir);
20218
20267
  }
20219
20268
  function skipsHostCheckout(ship) {
20220
20269
  return ship.runner === "sandbox";
@@ -20508,7 +20557,7 @@ function missingReleaserWarning(repo, release, ships, now = Date.now()) {
20508
20557
  }
20509
20558
 
20510
20559
  // src/watch.ts
20511
- import { watch as watchFile, existsSync as existsSync40, statSync as statSync11, openSync as openSync5, readSync as readSync2, closeSync as closeSync5 } from "fs";
20560
+ import { watch as watchFile, existsSync as existsSync41, statSync as statSync11, openSync as openSync5, readSync as readSync2, closeSync as closeSync5 } from "fs";
20512
20561
  var E = "\x1B[";
20513
20562
  var dim = (s) => `${E}2m${s}${E}0m`;
20514
20563
  var bold = (s) => `${E}1m${s}${E}0m`;
@@ -20609,7 +20658,7 @@ function renderHeaders(states, now = Date.now()) {
20609
20658
  return states.map((s) => renderHeader(s, now)).join("");
20610
20659
  }
20611
20660
  function readFrom(file, from) {
20612
- if (!existsSync40(file)) return { events: [], offset: from };
20661
+ if (!existsSync41(file)) return { events: [], offset: from };
20613
20662
  const size = statSync11(file).size;
20614
20663
  if (size < from) return readFrom(file, 0);
20615
20664
  if (size === from) return { events: [], offset: from };
@@ -20852,7 +20901,7 @@ function nextRoles(decision, ran) {
20852
20901
  }
20853
20902
 
20854
20903
  // src/ship-name.ts
20855
- import { existsSync as existsSync41, mkdirSync as mkdirSync31, readFileSync as readFileSync38, renameSync as renameSync5, writeFileSync as writeFileSync33 } from "fs";
20904
+ import { existsSync as existsSync42, mkdirSync as mkdirSync31, readFileSync as readFileSync38, renameSync as renameSync5, writeFileSync as writeFileSync33 } from "fs";
20856
20905
  import { dirname as dirname27 } from "path";
20857
20906
  import { parseDocument as parseDocument5 } from "yaml";
20858
20907
  var ShipNameError = class extends Error {
@@ -20914,7 +20963,7 @@ async function syncRouteName(i) {
20914
20963
  return { status: "ok", ...base, action, name: i.local };
20915
20964
  }
20916
20965
  function readSyncedName(resolvedFile) {
20917
- if (!existsSync41(resolvedFile)) return void 0;
20966
+ if (!existsSync42(resolvedFile)) return void 0;
20918
20967
  try {
20919
20968
  const v = JSON.parse(readFileSync38(resolvedFile, "utf8")).shipName;
20920
20969
  return typeof v === "string" ? v : void 0;
@@ -20923,7 +20972,7 @@ function readSyncedName(resolvedFile) {
20923
20972
  }
20924
20973
  }
20925
20974
  function writeSyncedName(resolvedFile, name) {
20926
- if (!existsSync41(resolvedFile)) return;
20975
+ if (!existsSync42(resolvedFile)) return;
20927
20976
  let raw;
20928
20977
  try {
20929
20978
  raw = JSON.parse(readFileSync38(resolvedFile, "utf8"));
@@ -21625,7 +21674,7 @@ function describeCapability(i) {
21625
21674
  }
21626
21675
 
21627
21676
  // src/agents-sync-run.ts
21628
- import { existsSync as existsSync42, mkdirSync as mkdirSync32, readFileSync as readFileSync39, writeFileSync as writeFileSync34 } from "fs";
21677
+ import { existsSync as existsSync43, mkdirSync as mkdirSync32, readFileSync as readFileSync39, writeFileSync as writeFileSync34 } from "fs";
21629
21678
  import { dirname as dirname28 } from "path";
21630
21679
  async function runAgentsSync(target, o) {
21631
21680
  const dryRun = o.dryRun ?? false;
@@ -21659,7 +21708,7 @@ async function runAgentsSync(target, o) {
21659
21708
  for (const s of skillResult?.outcomes ?? []) o.say(describeSkillSyncOutcome(s));
21660
21709
  if (!dryRun) {
21661
21710
  const resolvedPath = resolvedPathFor(o.stateDir, target.route);
21662
- const raw = existsSync42(resolvedPath) ? JSON.parse(readFileSync39(resolvedPath, "utf8")) : {};
21711
+ const raw = existsSync43(resolvedPath) ? JSON.parse(readFileSync39(resolvedPath, "utf8")) : {};
21663
21712
  raw.agentPersonas = personaResult.agentPersonas;
21664
21713
  if (skillResult) raw.agentSkills = skillResult.agentSkills;
21665
21714
  if (personaResult.releaseAgentId) raw.releaseAgentId = personaResult.releaseAgentId;
@@ -22374,7 +22423,7 @@ function planSampleTicket(i) {
22374
22423
  }
22375
22424
 
22376
22425
  // src/worktree-sweep.ts
22377
- import { existsSync as existsSync43, readFileSync as readFileSync41, readdirSync as readdirSync14 } from "fs";
22426
+ import { existsSync as existsSync44, readFileSync as readFileSync41, readdirSync as readdirSync14 } from "fs";
22378
22427
  import { basename as basename13, dirname as dirname30, join as join45, resolve as resolve5 } from "path";
22379
22428
  function planWorktreeSweep(target, tickets, contract) {
22380
22429
  const terminal = new Set(contract.statuses.resolved.filter((s) => s !== contract.statuses.verified));
@@ -22487,7 +22536,7 @@ async function applyWorktreeSweep(cwd, actions, dryRun, log, remote = "origin",
22487
22536
  let removed = 0;
22488
22537
  let keptBranches = 0;
22489
22538
  for (const a of actions) {
22490
- if (!dryRun && base && !a.keepBranch && existsSync43(a.path) && isHandBackMerge(a.path, base)) {
22539
+ if (!dryRun && base && !a.keepBranch && existsSync44(a.path) && isHandBackMerge(a.path, base)) {
22491
22540
  if (gitOk(a.path, ["merge", "--abort"]) !== null) {
22492
22541
  log.emit(
22493
22542
  `abandoned the hand-back merge of ${base} in ${a.path}: ${a.ticket.issue_id} deployed without it`,
@@ -22495,7 +22544,7 @@ async function applyWorktreeSweep(cwd, actions, dryRun, log, remote = "origin",
22495
22544
  );
22496
22545
  }
22497
22546
  }
22498
- if (!dryRun && existsSync43(a.path)) {
22547
+ if (!dryRun && existsSync44(a.path)) {
22499
22548
  let dirty = false;
22500
22549
  try {
22501
22550
  dirty = status(a.path).length > 0;
@@ -22506,7 +22555,7 @@ async function applyWorktreeSweep(cwd, actions, dryRun, log, remote = "origin",
22506
22555
  continue;
22507
22556
  }
22508
22557
  }
22509
- if (!dryRun && a.requirePushed && a.branch && existsSync43(a.path) && remoteConfigured(cwd, remote) && worktreeHoldsUnpushed(a.path, remote)) {
22558
+ if (!dryRun && a.requirePushed && a.branch && existsSync44(a.path) && remoteConfigured(cwd, remote) && worktreeHoldsUnpushed(a.path, remote)) {
22510
22559
  refuse2(a, "unpushed commits", `${a.branch} has commits that are not on ${remote}`);
22511
22560
  continue;
22512
22561
  }
@@ -22660,12 +22709,12 @@ function applyRemoteBranchCleanup(cwd, remote, branches2, dryRun, log) {
22660
22709
  }
22661
22710
 
22662
22711
  // src/stream-sweep.ts
22663
- import { existsSync as existsSync44, readdirSync as readdirSync15, rmSync as rmSync20, statSync as statSync12 } from "fs";
22712
+ import { existsSync as existsSync45, readdirSync as readdirSync15, rmSync as rmSync20, statSync as statSync12 } from "fs";
22664
22713
  import { join as join46 } from "path";
22665
22714
  var DAY_MS2 = 24 * 60 * 60 * 1e3;
22666
22715
  function planStreamSweep(stateDir, retentionDays, now = Date.now()) {
22667
22716
  const dir = join46(stateDir, "streams");
22668
- if (!existsSync44(dir)) return [];
22717
+ if (!existsSync45(dir)) return [];
22669
22718
  const cutoff = now - retentionDays * DAY_MS2;
22670
22719
  return readdirSync15(dir).map((name) => join46(dir, name)).filter((path) => {
22671
22720
  try {
@@ -22693,7 +22742,7 @@ function applyStreamSweep(paths, dryRun, log) {
22693
22742
  return removed;
22694
22743
  }
22695
22744
  function planEventsSweep(stateDir, retentionDays, now = Date.now()) {
22696
- if (!existsSync44(stateDir)) return [];
22745
+ if (!existsSync45(stateDir)) return [];
22697
22746
  const cutoff = now - retentionDays * DAY_MS2;
22698
22747
  return readdirSync15(stateDir).filter((name) => ROTATED_EVENTS_RE.test(name)).map((name) => join46(stateDir, name)).filter((path) => {
22699
22748
  try {
@@ -22705,11 +22754,11 @@ function planEventsSweep(stateDir, retentionDays, now = Date.now()) {
22705
22754
  }
22706
22755
 
22707
22756
  // src/cli.ts
22708
- import { realpathSync as realpathSync3, readFileSync as readFileSync48, existsSync as existsSync52, mkdirSync as mkdirSync40, writeFileSync as writeFileSync40, rmSync as rmSync25, unlinkSync as unlinkSync5, copyFileSync as copyFileSync2, renameSync as renameSync7, statSync as statSync16, readdirSync as readdirSync20 } from "fs";
22757
+ import { realpathSync as realpathSync3, readFileSync as readFileSync48, existsSync as existsSync53, mkdirSync as mkdirSync40, writeFileSync as writeFileSync40, rmSync as rmSync25, unlinkSync as unlinkSync5, copyFileSync as copyFileSync2, renameSync as renameSync7, statSync as statSync16, readdirSync as readdirSync20 } from "fs";
22709
22758
  import { createInterface } from "readline/promises";
22710
22759
 
22711
22760
  // src/periscope-cmd.ts
22712
- import { existsSync as existsSync45, mkdirSync as mkdirSync33, readFileSync as readFileSync42, rmSync as rmSync21, writeFileSync as writeFileSync35 } from "fs";
22761
+ import { existsSync as existsSync46, mkdirSync as mkdirSync33, readFileSync as readFileSync42, rmSync as rmSync21, writeFileSync as writeFileSync35 } from "fs";
22713
22762
  import { join as join47 } from "path";
22714
22763
  var PeriscopeError = class extends Error {
22715
22764
  };
@@ -22735,7 +22784,7 @@ function writePeriscopePrior(stateDir, ticketRecordId, prior) {
22735
22784
  function readPeriscopePrior(stateDir, ticketRecordId) {
22736
22785
  try {
22737
22786
  const p = priorPath(stateDir, ticketRecordId);
22738
- return existsSync45(p) ? JSON.parse(readFileSync42(p, "utf8")) : void 0;
22787
+ return existsSync46(p) ? JSON.parse(readFileSync42(p, "utf8")) : void 0;
22739
22788
  } catch {
22740
22789
  return void 0;
22741
22790
  }
@@ -23291,7 +23340,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
23291
23340
 
23292
23341
  // src/ssh-keys.ts
23293
23342
  import { execFileSync as execFileSync14 } from "child_process";
23294
- import { existsSync as existsSync46, mkdirSync as mkdirSync34, readFileSync as readFileSync43, chmodSync as chmodSync3 } from "fs";
23343
+ import { existsSync as existsSync47, mkdirSync as mkdirSync34, readFileSync as readFileSync43, chmodSync as chmodSync3 } from "fs";
23295
23344
  import { dirname as dirname31, join as join49 } from "path";
23296
23345
  var SshKeyError = class extends Error {
23297
23346
  };
@@ -23301,7 +23350,7 @@ function shipSshKeyPathFor(stateDir) {
23301
23350
  function ensureShipSshKeypair(stateDir) {
23302
23351
  const privateKeyPath = shipSshKeyPathFor(stateDir);
23303
23352
  const publicKeyPath = `${privateKeyPath}.pub`;
23304
- if (!existsSync46(privateKeyPath)) {
23353
+ if (!existsSync47(privateKeyPath)) {
23305
23354
  mkdirSync34(dirname31(privateKeyPath), { recursive: true });
23306
23355
  try {
23307
23356
  execFileSync14("ssh-keygen", [
@@ -23322,7 +23371,7 @@ function ensureShipSshKeypair(stateDir) {
23322
23371
  }
23323
23372
  chmodSync3(privateKeyPath, 384);
23324
23373
  }
23325
- if (!existsSync46(publicKeyPath)) {
23374
+ if (!existsSync47(publicKeyPath)) {
23326
23375
  throw new SshKeyError(`${privateKeyPath} exists but ${publicKeyPath} does not \u2014 regenerate or restore it`);
23327
23376
  }
23328
23377
  const publicKey = readFileSync43(publicKeyPath, "utf8").trim();
@@ -23489,7 +23538,7 @@ async function unregisterEndpoint(workspaceId, info, d) {
23489
23538
  import { createServer as createHttpServer } from "http";
23490
23539
  import { spawn as spawn9 } from "child_process";
23491
23540
  import { randomBytes } from "crypto";
23492
- import { existsSync as existsSync47, mkdirSync as mkdirSync35, readFileSync as readFileSync44, writeFileSync as writeFileSync36, unlinkSync as unlinkSync4, readdirSync as readdirSync16 } from "fs";
23541
+ import { existsSync as existsSync48, mkdirSync as mkdirSync35, readFileSync as readFileSync44, writeFileSync as writeFileSync36, unlinkSync as unlinkSync4, readdirSync as readdirSync16 } from "fs";
23493
23542
  import { join as join50 } from "path";
23494
23543
 
23495
23544
  // src/secret-compare.ts
@@ -23587,7 +23636,7 @@ function syncDaemonStatePath(stateDir, workspaceId) {
23587
23636
  }
23588
23637
  function readPersistedSyncDaemon(stateDir, workspaceId) {
23589
23638
  const path = syncDaemonStatePath(stateDir, workspaceId);
23590
- if (!existsSync47(path)) return void 0;
23639
+ if (!existsSync48(path)) return void 0;
23591
23640
  try {
23592
23641
  return JSON.parse(readFileSync44(path, "utf8"));
23593
23642
  } catch {
@@ -23618,7 +23667,7 @@ function waitForExit(pid, alive, timeoutMs = 5e3) {
23618
23667
  }
23619
23668
  function readAllPersistedSyncWorkspaceIds(stateDir) {
23620
23669
  const dir = join50(stateDir, "passengers");
23621
- if (!existsSync47(dir)) return [];
23670
+ if (!existsSync48(dir)) return [];
23622
23671
  const suffix = "-sync.json";
23623
23672
  return readdirSync16(dir).filter((f) => f.endsWith(suffix)).map((f) => f.slice(0, -suffix.length));
23624
23673
  }
@@ -24138,12 +24187,12 @@ function contractFixers(dir, baseRef, tickets, locate) {
24138
24187
  }
24139
24188
 
24140
24189
  // src/daemon.ts
24141
- import { existsSync as existsSync49, mkdirSync as mkdirSync38, readFileSync as readFileSync46, readdirSync as readdirSync17, rmSync as rmSync22, statSync as statSync14, writeFileSync as writeFileSync38 } from "fs";
24190
+ import { existsSync as existsSync50, mkdirSync as mkdirSync38, readFileSync as readFileSync46, readdirSync as readdirSync17, rmSync as rmSync22, statSync as statSync14, writeFileSync as writeFileSync38 } from "fs";
24142
24191
  import { join as join53 } from "path";
24143
24192
  import { randomBytes as randomBytes2 } from "crypto";
24144
24193
 
24145
24194
  // src/noop-runs.ts
24146
- import { existsSync as existsSync48, mkdirSync as mkdirSync37, readFileSync as readFileSync45, renameSync as renameSync6, writeFileSync as writeFileSync37 } from "fs";
24195
+ import { existsSync as existsSync49, mkdirSync as mkdirSync37, readFileSync as readFileSync45, renameSync as renameSync6, writeFileSync as writeFileSync37 } from "fs";
24147
24196
  import { join as join52 } from "path";
24148
24197
  var NOOP_DELAYS_MS = [5, 15, 60].map((m) => m * 6e4);
24149
24198
  var DEFAULT_NOOP_REPEATS = 3;
@@ -24178,7 +24227,7 @@ function recordNoopRun(stateDir, recordId, repeats, now = Date.now()) {
24178
24227
  return { count, nextAt, bounce: count >= repeats };
24179
24228
  }
24180
24229
  function clearNoopRuns(stateDir, recordId) {
24181
- if (!existsSync48(noopRunsPath(stateDir))) return;
24230
+ if (!existsSync49(noopRunsPath(stateDir))) return;
24182
24231
  const state = readNoopRuns(stateDir);
24183
24232
  if (!(recordId in state)) return;
24184
24233
  delete state[recordId];
@@ -24330,7 +24379,7 @@ function computeTreeSignature(paths) {
24330
24379
  }
24331
24380
  function makeStaleChecker(paths, opts = {}) {
24332
24381
  const initial = computeTreeSignature(paths);
24333
- return () => computeTreeSignature(paths) !== initial || opts.reloadSentinel !== void 0 && existsSync49(opts.reloadSentinel);
24382
+ return () => computeTreeSignature(paths) !== initial || opts.reloadSentinel !== void 0 && existsSync50(opts.reloadSentinel);
24334
24383
  }
24335
24384
  function reloadSentinelFor(stateDir) {
24336
24385
  return join53(stateDir, "reload-requested");
@@ -25057,7 +25106,7 @@ import { createHash as createHash11 } from "crypto";
25057
25106
  import {
25058
25107
  chmodSync as chmodSync4,
25059
25108
  closeSync as closeSync6,
25060
- existsSync as existsSync50,
25109
+ existsSync as existsSync51,
25061
25110
  fstatSync,
25062
25111
  openSync as openSync6,
25063
25112
  readSync as readSync3,
@@ -25428,7 +25477,7 @@ function lastLines2(path, n) {
25428
25477
  }
25429
25478
  function readTail(live, opts) {
25430
25479
  const max = opts.maxBytes ?? MAX_TAIL_BYTES;
25431
- if (!existsSync50(live)) {
25480
+ if (!existsSync51(live)) {
25432
25481
  return { lines: [], cursor: opts.after ?? encodeCursor({ dev: 0, ino: 0, off: 0 }), reset: false };
25433
25482
  }
25434
25483
  const cur = opts.after ? decodeCursor(opts.after) : null;
@@ -25585,7 +25634,7 @@ async function route(deps, method, url, req, abort) {
25585
25634
  const run3 = decodeURIComponent(p.slice("/streams/".length));
25586
25635
  if (!RUN_NAME_RE.test(run3) || run3.includes("..") || /\.(pid|meta\.json|events\.jsonl)$/.test(run3)) return err2(400, "not a run name");
25587
25636
  const file = join54(deps.stateDir, "streams", run3.endsWith(".jsonl") ? run3 : `${run3}.jsonl`);
25588
- if (!existsSync50(file)) return err2(404, "no such run");
25637
+ if (!existsSync51(file)) return err2(404, "no such run");
25589
25638
  return tailReply(file, url.searchParams, false, abort);
25590
25639
  }
25591
25640
  if ((p === "/pause" || p === "/resume") && post3) {
@@ -25630,7 +25679,7 @@ function send(res, r) {
25630
25679
  res.end(body);
25631
25680
  }
25632
25681
  async function socketIsStale(path) {
25633
- if (!existsSync50(path)) return false;
25682
+ if (!existsSync51(path)) return false;
25634
25683
  return new Promise((resolve8) => {
25635
25684
  const c = createConnection(path);
25636
25685
  c.once("connect", () => {
@@ -25649,7 +25698,7 @@ async function startControlServer(deps) {
25649
25698
  return null;
25650
25699
  }
25651
25700
  if (await socketIsStale(path)) rmSync23(path, { force: true });
25652
- else if (existsSync50(path)) {
25701
+ else if (existsSync51(path)) {
25653
25702
  log(`control API not started: ${path} is in use by another process`);
25654
25703
  return null;
25655
25704
  }
@@ -25742,7 +25791,7 @@ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/
25742
25791
 
25743
25792
  // src/periscope-endpoints.ts
25744
25793
  import { randomBytes as randomBytes3 } from "crypto";
25745
- import { chmodSync as chmodSync5, existsSync as existsSync51, mkdirSync as mkdirSync39, readdirSync as readdirSync19, readFileSync as readFileSync47, rmSync as rmSync24, writeFileSync as writeFileSync39 } from "fs";
25794
+ import { chmodSync as chmodSync5, existsSync as existsSync52, mkdirSync as mkdirSync39, readdirSync as readdirSync19, readFileSync as readFileSync47, rmSync as rmSync24, writeFileSync as writeFileSync39 } from "fs";
25746
25795
  import { join as join55 } from "path";
25747
25796
  var secretDir = (stateDir) => join55(stateDir, "periscope-mcp");
25748
25797
  var secretFile = (stateDir, id) => join55(secretDir(stateDir), `${id}.json`);
@@ -25785,7 +25834,7 @@ function removePeriscopeEndpointRecord(stateDir, ticketRecordId) {
25785
25834
  }
25786
25835
  function listPeriscopeEndpoints(stateDir) {
25787
25836
  const dir = endpointDir(stateDir);
25788
- if (!existsSync51(dir)) return [];
25837
+ if (!existsSync52(dir)) return [];
25789
25838
  const out = [];
25790
25839
  for (const name of readdirSync19(dir)) {
25791
25840
  if (!name.endsWith(".json")) continue;
@@ -26768,7 +26817,7 @@ if (command === "passenger-sync-daemon") {
26768
26817
  } else {
26769
26818
  const toleratesNoRoutes = command === "credential" || command === "forge" || command === "repos" || command === "ship" || command === "disconnect" && flag("reset") || command === "deprovision" || command === "connect" && flag("sign-out");
26770
26819
  const configless = command === "connect" && flag("sign-out") || command === "disconnect" && flag("reset") || command === "deprovision";
26771
- if (configless && !existsSync52(findConfigFile(CREW_HOME))) {
26820
+ if (configless && !existsSync53(findConfigFile(CREW_HOME))) {
26772
26821
  cfg = loadConfig(CREW_HOME, firstRunConfigPath(), { text: "ship: {}\n", allowNoRoutes: true });
26773
26822
  } else {
26774
26823
  cfg = loadConfig(CREW_HOME, void 0, toleratesNoRoutes ? { allowNoRoutes: true } : {});
@@ -27121,7 +27170,7 @@ if (command === "passenger-sync-daemon") {
27121
27170
  if (host === "linux" && hasSystemd) {
27122
27171
  const label = labelFor(CREW_HOME, "run");
27123
27172
  const staleTimer = join57(homedir11(), ".config", "systemd", "user", `${label}.timer`);
27124
- if (existsSync52(staleTimer)) {
27173
+ if (existsSync53(staleTimer)) {
27125
27174
  process.stdout.write(
27126
27175
  `removing stale run timer from before the persistent-service cutover: ${staleTimer}${dryRun ? " (dry run)" : ""}
27127
27176
  `
@@ -27150,7 +27199,7 @@ if (command === "passenger-sync-daemon") {
27150
27199
  const { settled: doctorRepos, errors: refusedRepos } = await settleRepos(reposOf(c), (t) => t.name, (t) => resolveOneRepo(c, t));
27151
27200
  for (const e of refusedRepos) problems.push(`repo ${e.repo}: ${e.detail}`);
27152
27201
  for (const r of doctorRepos) {
27153
- if (!existsSync52(r.dir)) problems.push(`repo ${r.name}: ${r.dir} is missing on disk`);
27202
+ if (!existsSync53(r.dir)) problems.push(`repo ${r.name}: ${r.dir} is missing on disk`);
27154
27203
  if (!satisfies(host, r.config.platform)) problems.push(`repo ${r.name}: requires ${r.config.platform}, this host is ${host}`);
27155
27204
  readiness.push(...validateEffective(r.config).map((p) => `repo ${r.name}: ${p}`));
27156
27205
  }
@@ -27177,7 +27226,7 @@ if (command === "passenger-sync-daemon") {
27177
27226
  }
27178
27227
  async function doctorFix(o) {
27179
27228
  const routes = await Promise.all(routesInScope(cfg.routes, named).map((c) => gatherHealth({ route: c.route, enabled: c.enabled, hasRepos: reposOf(c).length > 0 }, () => routeProblems(c))));
27180
- const unitExists = (p) => existsSync52(p);
27229
+ const unitExists = (p) => existsSync53(p);
27181
27230
  const crontab = o.host === "linux" ? spawnSync12("crontab", ["-l"], { encoding: "utf8" }).stdout ?? "" : "";
27182
27231
  const schedulerAbsent = o.host !== "windows" ? !schedulerInstalled(planInstall(cfg.ship, CREW_HOME, o.host, detectSystemd(), "run", installContext()), unitExists, crontab) : true;
27183
27232
  const plan = planFix({ routes, schedulerAbsent, host: o.host });
@@ -28835,7 +28884,7 @@ ${cu.tail.trimEnd()}
28835
28884
  `);
28836
28885
  if (!dryRun) {
28837
28886
  const resolvedPath = resolvedPathFor(cfg.ship.stateDir, target.route);
28838
- const raw = existsSync52(resolvedPath) ? JSON.parse(readFileSync48(resolvedPath, "utf8")) : {};
28887
+ const raw = existsSync53(resolvedPath) ? JSON.parse(readFileSync48(resolvedPath, "utf8")) : {};
28839
28888
  raw.agentSkills = result.agentSkills;
28840
28889
  mkdirSync40(dirOf2(resolvedPath), { recursive: true });
28841
28890
  writeFileSync40(resolvedPath, `${JSON.stringify(raw, null, 2)}
@@ -28940,8 +28989,8 @@ ${cu.tail.trimEnd()}
28940
28989
  try {
28941
28990
  const a = parseHooksArgs(positional.slice(2), routeNamesOf(configText));
28942
28991
  const dir = repoDirOf(configText, dirname35(cfg.configFile), a.route, a.name);
28943
- if (!existsSync52(dir)) throw new ReposError(`${dir} does not exist on disk`);
28944
- const files = { exists: (r) => existsSync52(resolvePath(dir, r)), list: (r) => {
28992
+ if (!existsSync53(dir)) throw new ReposError(`${dir} does not exist on disk`);
28993
+ const files = { exists: (r) => existsSync53(resolvePath(dir, r)), list: (r) => {
28945
28994
  try {
28946
28995
  return readdirSync20(resolvePath(dir, r));
28947
28996
  } catch {
@@ -29059,7 +29108,7 @@ ${cu.tail.trimEnd()}
29059
29108
  if (sub === "list" && !routeName) usage2();
29060
29109
  if (sub === "add") {
29061
29110
  try {
29062
- const a = parseAddArgs(positional.slice(2), routeNamesOf(configText), (p) => existsSync52(resolvePath(p.replace(/^~(?=\/|$)/, homedir11()))));
29111
+ const a = parseAddArgs(positional.slice(2), routeNamesOf(configText), (p) => existsSync53(resolvePath(p.replace(/^~(?=\/|$)/, homedir11()))));
29063
29112
  routeName = a.route;
29064
29113
  addPath = a.path;
29065
29114
  addName = a.name;
@@ -29089,7 +29138,7 @@ ${cu.tail.trimEnd()}
29089
29138
  const resolvedFile = resolvedPathFor(cfg.ship.stateDir, routeName);
29090
29139
  if (sub === "list" || sub === "add") {
29091
29140
  const liveRoute = cfg.routes.find((r) => r.route === routeName);
29092
- if (liveRoute?.resolved?.reposModelId && existsSync52(resolvedFile) && !dryRun) {
29141
+ if (liveRoute?.resolved?.reposModelId && existsSync53(resolvedFile) && !dryRun) {
29093
29142
  try {
29094
29143
  await hydrateApiKeys([liveRoute]);
29095
29144
  persistRepoRows(cfg.ship.stateDir, liveRoute.route, await new Tracker(liveRoute, cfg.ship).repoRowsForMap());
@@ -29098,7 +29147,7 @@ ${cu.tail.trimEnd()}
29098
29147
  }
29099
29148
  }
29100
29149
  let resolvedRemotes;
29101
- if (existsSync52(resolvedFile)) {
29150
+ if (existsSync53(resolvedFile)) {
29102
29151
  try {
29103
29152
  resolvedRemotes = JSON.parse(readFileSync48(resolvedFile, "utf8"));
29104
29153
  } catch {
@@ -29107,7 +29156,7 @@ ${cu.tail.trimEnd()}
29107
29156
  const originOf = (dir) => gitOk(dir, ["remote", "get-url", "origin"]) ?? void 0;
29108
29157
  const text2 = configText;
29109
29158
  const base = dirname35(cfg.configFile);
29110
- const isCheckout = (d) => existsSync52(`${d}/.git`);
29159
+ const isCheckout = (d) => existsSync53(`${d}/.git`);
29111
29160
  try {
29112
29161
  if (sub === "list") {
29113
29162
  if (flag("json")) {
@@ -29117,7 +29166,7 @@ ${cu.tail.trimEnd()}
29117
29166
  base,
29118
29167
  resolved: resolvedRemotes,
29119
29168
  originOf,
29120
- exists: (d) => existsSync52(d),
29169
+ exists: (d) => existsSync53(d),
29121
29170
  isCheckout,
29122
29171
  repoHasHooks: (d) => REPO_CONFIG_FILENAMES.some((f) => {
29123
29172
  try {
@@ -29139,7 +29188,7 @@ ${cu.tail.trimEnd()}
29139
29188
  for (const r of repos) {
29140
29189
  const origin2 = originOf(r.dir);
29141
29190
  const row = matchRepoName(origin2, resolvedRemotes);
29142
- const note = !existsSync52(r.dir) ? "missing on disk" : row ? `Repos row: ${row}` : `no Repos row matches ${normalizeRemote(origin2) ?? "this checkout (no origin remote)"}`;
29191
+ const note = !existsSync53(r.dir) ? "missing on disk" : row ? `Repos row: ${row}` : `no Repos row matches ${normalizeRemote(origin2) ?? "this checkout (no origin remote)"}`;
29143
29192
  process.stdout.write(`${r.name} ${r.dir} ${note}
29144
29193
  `);
29145
29194
  }
@@ -29151,9 +29200,9 @@ ${cu.tail.trimEnd()}
29151
29200
  ` : `${human}
29152
29201
  `);
29153
29202
  const plan2 = planRepoClone({ text: text2, base, route: routeName, name: addName, resolved: resolvedRemotes, dir: value("dir"), isCheckout });
29154
- if (existsSync52(plan2.target) && (existsSync52(`${plan2.target}/.git`) || readdirSync20(plan2.target).length > 0)) {
29203
+ if (existsSync53(plan2.target) && (existsSync53(`${plan2.target}/.git`) || readdirSync20(plan2.target).length > 0)) {
29155
29204
  throw new ReposError(
29156
- existsSync52(`${plan2.target}/.git`) ? `${plan2.target} is already a checkout \u2014 attach it with \`crew repos add ${routeName} ${plan2.name} ${plan2.target}\`` : `${plan2.target} exists and is not empty \u2014 pass --dir to clone somewhere else`
29205
+ existsSync53(`${plan2.target}/.git`) ? `${plan2.target} is already a checkout \u2014 attach it with \`crew repos add ${routeName} ${plan2.name} ${plan2.target}\`` : `${plan2.target} exists and is not empty \u2014 pass --dir to clone somewhere else`
29157
29206
  );
29158
29207
  }
29159
29208
  if (dryRun) {
@@ -29178,7 +29227,7 @@ ${cu.tail.trimEnd()}
29178
29227
  break;
29179
29228
  }
29180
29229
  const target = resolvePath(addPath.replace(/^~(?=\/|$)/, homedir11()));
29181
- const top = existsSync52(target) ? gitOk(target, ["rev-parse", "--show-toplevel"]) : null;
29230
+ const top = existsSync53(target) ? gitOk(target, ["rev-parse", "--show-toplevel"]) : null;
29182
29231
  if (!top) throw new ReposError(`${target} is not a git checkout`);
29183
29232
  const origin = originOf(top);
29184
29233
  const plan = planRepoAdd({
@@ -29230,7 +29279,7 @@ ${cu.tail.trimEnd()}
29230
29279
  const created = await rowTracker.createRepoRow(rowPayload);
29231
29280
  process.stdout.write(`created Repos row ${String(rowPayload.name)} (${String(rowPayload.remote)}) ${created.id}
29232
29281
  `);
29233
- if (existsSync52(resolvedFile)) {
29282
+ if (existsSync53(resolvedFile)) {
29234
29283
  const raw = JSON.parse(readFileSync48(resolvedFile, "utf8"));
29235
29284
  raw.repoNames = { ...raw.repoNames, [created.id]: String(rowPayload.name) };
29236
29285
  raw.repoRemotes = { ...raw.repoRemotes, [created.id]: String(rowPayload.remote) };
@@ -29656,7 +29705,7 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
29656
29705
  }
29657
29706
  }
29658
29707
  let previous;
29659
- const hadPreviousFile = existsSync52(resolvedPath);
29708
+ const hadPreviousFile = existsSync53(resolvedPath);
29660
29709
  if (hadPreviousFile) {
29661
29710
  try {
29662
29711
  previous = JSON.parse(readFileSync48(resolvedPath, "utf8"));
@@ -30555,7 +30604,7 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
30555
30604
  prepare: async (path) => {
30556
30605
  for (const f of repoWt.config.worktrees.copy) {
30557
30606
  const src = join57(repoWt.dir, f);
30558
- if (!existsSync52(src) || existsSync52(join57(path, f))) continue;
30607
+ if (!existsSync53(src) || existsSync53(join57(path, f))) continue;
30559
30608
  mkdirSync40(dirOf2(join57(path, f)), { recursive: true });
30560
30609
  copyFileSync2(src, join57(path, f));
30561
30610
  }
@@ -30778,7 +30827,7 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
30778
30827
  const shellR = hit && resolveShell(hit.repo.config.shell ?? cfg.ship.shell);
30779
30828
  const resumed = await runPeriscopeResume({
30780
30829
  find: async () => hit && { row: hit.row, tag: hit.tag },
30781
- worktreeExists: (p) => existsSync52(p),
30830
+ worktreeExists: (p) => existsSync53(p),
30782
30831
  prepareDropFile,
30783
30832
  startProxy: (wt, url, n) => launchProxy(crewInvocation(CREW_HOME), wt, url, Number(n), { host: hit.row.host || "localhost", inject: hit.repo.config.periscope?.inspector !== "repo" }),
30784
30833
  caps: periscopeCaps(cfg.ship),
@@ -30875,7 +30924,7 @@ ${where.join("\n")}`);
30875
30924
  prepare: async (path) => {
30876
30925
  for (const f of repoP.config.worktrees.copy) {
30877
30926
  const src = join57(repoP.dir, f);
30878
- if (!existsSync52(src)) continue;
30927
+ if (!existsSync53(src)) continue;
30879
30928
  mkdirSync40(dirOf2(join57(path, f)), { recursive: true });
30880
30929
  copyFileSync2(src, join57(path, f));
30881
30930
  }
@@ -31378,7 +31427,7 @@ ${where.join("\n")}`);
31378
31427
  }
31379
31428
  if (row) {
31380
31429
  await tracker.deleteRepoRow(row.id);
31381
- if (existsSync52(resolvedFile)) {
31430
+ if (existsSync53(resolvedFile)) {
31382
31431
  const raw = JSON.parse(readFileSync48(resolvedFile, "utf8"));
31383
31432
  if (raw.repoNames) delete raw.repoNames[row.id];
31384
31433
  if (raw.repoRemotes) delete raw.repoRemotes[row.id];
@@ -31386,13 +31435,13 @@ ${where.join("\n")}`);
31386
31435
  `);
31387
31436
  }
31388
31437
  }
31389
- if (existsSync52(join57(dir, ".git")) && basename16(dir) === SAMPLE_REPO) rmSync25(dir, { recursive: true, force: true });
31438
+ if (existsSync53(join57(dir, ".git")) && basename16(dir) === SAMPLE_REPO) rmSync25(dir, { recursive: true, force: true });
31390
31439
  say("removed", { dir, closed }, `removed the sample repo${closed.length ? `, closed ${closed.join(", ")}` : ""}`);
31391
31440
  break;
31392
31441
  }
31393
31442
  const projectId = route2.resolved.areaId ?? resolveRepoProject(await tracker.projectRows(), value("project"));
31394
- const fresh = !existsSync52(join57(dir, ".git"));
31395
- if (existsSync52(dir) && fresh && readdirSync20(dir).length > 0) fail2(`${dir} exists and is not a git checkout \u2014 move it aside`);
31443
+ const fresh = !existsSync53(join57(dir, ".git"));
31444
+ if (existsSync53(dir) && fresh && readdirSync20(dir).length > 0) fail2(`${dir} exists and is not a git checkout \u2014 move it aside`);
31396
31445
  if (dryRun) {
31397
31446
  say("dry-run", { dir, newCheckout: fresh, repoRow: row?.id ?? null }, `would ${fresh ? "create" : "reuse"} ${dir}${row ? "" : ", create the Repos row"}, and file one ${tracker.contract.statuses.approved} ticket`);
31398
31447
  break;
@@ -31418,7 +31467,7 @@ ${where.join("\n")}`);
31418
31467
  spec: { platform: "unix", releaseMode: "integrate", ciProvider: "none" }
31419
31468
  });
31420
31469
  repoId = (await tracker.createRepoRow(payload)).id;
31421
- if (existsSync52(resolvedFile)) {
31470
+ if (existsSync53(resolvedFile)) {
31422
31471
  const raw = JSON.parse(readFileSync48(resolvedFile, "utf8"));
31423
31472
  raw.repoNames = { ...raw.repoNames, [repoId]: SAMPLE_REPO };
31424
31473
  raw.repoRemotes = { ...raw.repoRemotes, [repoId]: SAMPLE_REMOTE };
@@ -31774,7 +31823,7 @@ watermark: ${state.watermark()}
31774
31823
  }
31775
31824
  for (const r of repos) {
31776
31825
  const remote = r.config.branch.remote;
31777
- if (existsSync52(r.dir)) {
31826
+ if (existsSync53(r.dir)) {
31778
31827
  pushAuth.push({
31779
31828
  route: c.route,
31780
31829
  repo: r.name,
@@ -31847,7 +31896,7 @@ watermark: ${state.watermark()}
31847
31896
  }
31848
31897
  }
31849
31898
  for (const message of roleCapWarnings(cfg.ship)) problems.push({ severity: "note", kind: "role_cap_above_ship_cap", message });
31850
- const runtimeDir = runtimeDirWarning(process.platform, process.getuid?.() ?? null, existsSync52, userInfo2().username);
31899
+ const runtimeDir = runtimeDirWarning(process.platform, process.getuid?.() ?? null, existsSync53, userInfo2().username);
31851
31900
  if (runtimeDir) problems.push({ severity: "attention", kind: "runtime_dir_missing", message: runtimeDir });
31852
31901
  if (!flag("offline")) {
31853
31902
  const shipKind = await doctorShipKind(route2, cfg.ship);
@@ -31912,7 +31961,7 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
31912
31961
  }
31913
31962
  try {
31914
31963
  const evFile = eventFileFor(cfg.ship.stateDir);
31915
- const evSize = existsSync52(evFile) ? statSync16(evFile).size : 0;
31964
+ const evSize = existsSync53(evFile) ? statSync16(evFile).size : 0;
31916
31965
  process.stdout.write(
31917
31966
  evSize > cfg.ship.eventsRotateBytes * 4 ? `events log: WARN ${evFile} is ${Math.round(evSize / 1048576)} MB (> 4x eventsRotateBytes); run \`crew reap\` to rotate it
31918
31967
  ` : "events log: ok\n"
@@ -31952,7 +32001,7 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
31952
32001
  if (host === "linux" && detectSystemd()) {
31953
32002
  const ctl = planDaemonControl(CREW_HOME, host, true);
31954
32003
  const unitPlan = planInstall(cfg.ship, CREW_HOME, host, true, "run", installContext());
31955
- if (ctl.statusCommand && unitPlan.unitPaths.some((p) => existsSync52(p))) {
32004
+ if (ctl.statusCommand && unitPlan.unitPaths.some((p) => existsSync53(p))) {
31956
32005
  const st = spawnSync12(ctl.statusCommand[0], ctl.statusCommand.slice(1), { cwd: CREW_HOME, encoding: "utf8" });
31957
32006
  if (!st.error && st.status !== 0) {
31958
32007
  process.stdout.write("daemon unit: WARN installed but not running \u2014 no work is picked up; run `crew reload` (or `crew daemon start`), and `crew install` if the unit still says Restart=on-failure\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.132.1",
3
+ "version": "0.132.2",
4
4
  "description": "A standing team of headless agents that picks work off a Tablation board, does it on a machine you control, and reports back.",
5
5
  "type": "module",
6
6
  "license": "MIT",