@tablation/crew 0.159.3 → 0.160.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +691 -398
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -115,9 +115,9 @@ function describeHttp(res, q2) {
115
115
  if (res.status === 404) return `${q2.remote}'s runs are not visible to the forge credential (HTTP 404)`;
116
116
  return `${q2.host} answered HTTP ${res.status}`;
117
117
  }
118
- function describeCiFailure(f) {
119
- const where = f.job ? ` \u2014 job "${f.job}"${f.step ? `, step "${f.step}"` : ""}` : "";
120
- return `${f.run.name}${where}${f.run.url ? ` (${f.run.url})` : ""}`;
118
+ function describeCiFailure(f2) {
119
+ const where = f2.job ? ` \u2014 job "${f2.job}"${f2.step ? `, step "${f2.step}"` : ""}` : "";
120
+ return `${f2.run.name}${where}${f2.run.url ? ` (${f2.run.url})` : ""}`;
121
121
  }
122
122
  function ciRemoteOf(url) {
123
123
  if (!url) return null;
@@ -315,8 +315,8 @@ var LSP_SERVERS = {
315
315
  }
316
316
  };
317
317
  function lspFlavor(script) {
318
- const f = intelFlavor(script);
319
- return f && Object.prototype.hasOwnProperty.call(LSP_SERVERS, f) ? f : void 0;
318
+ const f2 = intelFlavor(script);
319
+ return f2 && Object.prototype.hasOwnProperty.call(LSP_SERVERS, f2) ? f2 : void 0;
320
320
  }
321
321
  var lspLocalBin = (mainCheckout, flavor) => join2(mainCheckout, "node_modules", ".bin", LSP_SERVERS[flavor].bin);
322
322
  function lspBinaryFound(flavor, mainCheckout, onPath2) {
@@ -385,9 +385,9 @@ async function rpcResult(res) {
385
385
  if (msg.error) throw new Error(msg.error.message ?? "MCP error");
386
386
  return msg.result;
387
387
  }
388
- async function initializeAndList(url, f, signal) {
388
+ async function initializeAndList(url, f2, signal) {
389
389
  const headers = { "content-type": "application/json", accept: "application/json, text/event-stream" };
390
- const init = await f(url, {
390
+ const init = await f2(url, {
391
391
  method: "POST",
392
392
  headers,
393
393
  signal,
@@ -402,9 +402,9 @@ async function initializeAndList(url, f, signal) {
402
402
  await rpcResult(init);
403
403
  const session = init.headers.get("mcp-session-id");
404
404
  const sessionHeaders = session ? { ...headers, "mcp-session-id": session } : headers;
405
- await f(url, { method: "POST", headers: sessionHeaders, signal, body: JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }) }).then((r) => r.body?.cancel()).catch(() => {
405
+ await f2(url, { method: "POST", headers: sessionHeaders, signal, body: JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }) }).then((r) => r.body?.cancel()).catch(() => {
406
406
  });
407
- const list = await f(url, { method: "POST", headers: sessionHeaders, signal, body: JSON.stringify({ jsonrpc: "2.0", id: 2, method: "tools/list" }) });
407
+ const list = await f2(url, { method: "POST", headers: sessionHeaders, signal, body: JSON.stringify({ jsonrpc: "2.0", id: 2, method: "tools/list" }) });
408
408
  if (!list.ok) throw new Error(`tools/list answered ${list.status}`);
409
409
  const result = await rpcResult(list);
410
410
  return (result?.tools ?? []).map((t) => String(t.name)).filter(Boolean);
@@ -420,14 +420,14 @@ async function probeIntel(deps, env, startupSeconds) {
420
420
  if (ran.code !== 0) return { state: "failed", reason: `the intel hook exited ${ran.code}${ran.output.trim() ? `: ${oneLine(ran.output.trim().split("\n").pop() ?? "")}` : ""}` };
421
421
  const url = lastUrl(ran.output);
422
422
  if (!url) return { state: "failed", reason: "the intel hook printed no URL as its last line" };
423
- const f = deps.fetch ?? fetch;
423
+ const f2 = deps.fetch ?? fetch;
424
424
  const sleep = deps.sleep ?? ((ms3) => new Promise((r) => setTimeout(r, ms3)));
425
425
  const now = deps.now ?? Date.now;
426
426
  const deadline = now() + startupSeconds * 1e3;
427
427
  let last = "no answer";
428
428
  for (; ; ) {
429
429
  try {
430
- const tools = await initializeAndList(url, f, AbortSignal.timeout(Math.max(1, deadline - now())));
430
+ const tools = await initializeAndList(url, f2, AbortSignal.timeout(Math.max(1, deadline - now())));
431
431
  return { state: "ready", url, tools };
432
432
  } catch (e) {
433
433
  last = oneLine(e.message);
@@ -1061,7 +1061,7 @@ function syncPassengerTunnels(plans, relayHost, relayPort, privateKeyPath, state
1061
1061
  function readAllPersistedWorkspaceIds(stateDir) {
1062
1062
  const dir = join7(stateDir, "passengers");
1063
1063
  if (!existsSync8(dir)) return [];
1064
- return readdirSync2(dir).filter((f) => f.endsWith(".json") && !f.endsWith("-sync.json")).map((f) => f.slice(0, -".json".length));
1064
+ return readdirSync2(dir).filter((f2) => f2.endsWith(".json") && !f2.endsWith("-sync.json")).map((f2) => f2.slice(0, -".json".length));
1065
1065
  }
1066
1066
  var TUNNEL_REJECTED_KEY = "tunnel_rejected";
1067
1067
  function tunnelRejectedMessage(workspaceId, quickExits) {
@@ -1335,10 +1335,10 @@ var Emitter = class _Emitter {
1335
1335
  this.opts = opts;
1336
1336
  this.now = opts.now ?? (() => /* @__PURE__ */ new Date());
1337
1337
  this.cycle = opts.cycleId ?? this.now().toISOString().replace(/[-:.TZ]/g, "").slice(0, 14);
1338
- for (const f of [opts.eventFile, opts.logFile]) {
1339
- if (!f) continue;
1338
+ for (const f2 of [opts.eventFile, opts.logFile]) {
1339
+ if (!f2) continue;
1340
1340
  try {
1341
- mkdirSync7(dirname4(f), { recursive: true });
1341
+ mkdirSync7(dirname4(f2), { recursive: true });
1342
1342
  } catch {
1343
1343
  }
1344
1344
  }
@@ -2391,7 +2391,7 @@ function vscodeUserDirs(o) {
2391
2391
  const home = o.home ?? homedir5();
2392
2392
  const platform2 = o.platform ?? process.platform;
2393
2393
  const root = platform2 === "darwin" ? join14(home, "Library", "Application Support") : platform2 === "win32" ? process.env.APPDATA ?? join14(home, "AppData", "Roaming") : join14(home, ".config");
2394
- const all = VSCODE_FLAVOURS.map((f) => join14(root, f, "User"));
2394
+ const all = VSCODE_FLAVOURS.map((f2) => join14(root, f2, "User"));
2395
2395
  const present = all.filter((d) => existsSync12(d));
2396
2396
  return present.length > 0 ? present : [all[0]];
2397
2397
  }
@@ -2900,13 +2900,13 @@ function forgeFor(forges, host) {
2900
2900
  return void 0;
2901
2901
  }
2902
2902
  function readForgeToken(forges, host, stateDir, env = process.env) {
2903
- const f = forgeFor(forges, host);
2904
- if (!f) return null;
2905
- return impl(f.entry.token).read(f.entry.token, { host: f.host, stateDir, env });
2903
+ const f2 = forgeFor(forges, host);
2904
+ if (!f2) return null;
2905
+ return impl(f2.entry.token).read(f2.entry.token, { host: f2.host, stateDir, env });
2906
2906
  }
2907
2907
  function describeForgeSource(forges, host, stateDir) {
2908
- const f = forgeFor(forges, host);
2909
- return f ? impl(f.entry.token).describe(f.entry.token, { host: f.host, stateDir, env: process.env }) : null;
2908
+ const f2 = forgeFor(forges, host);
2909
+ return f2 ? impl(f2.entry.token).describe(f2.entry.token, { host: f2.host, stateDir, env: process.env }) : null;
2910
2910
  }
2911
2911
  function hasForgeToken(forges, host, stateDir, env = process.env) {
2912
2912
  try {
@@ -2916,20 +2916,20 @@ function hasForgeToken(forges, host, stateDir, env = process.env) {
2916
2916
  }
2917
2917
  }
2918
2918
  function storeForgeToken(forges, host, token, stateDir, env = process.env) {
2919
- const f = forgeFor(forges, host);
2920
- if (!f) throw new ForgeError(`no forges.${host} entry in crew.yaml`);
2921
- const i = impl(f.entry.token);
2922
- if (!i.write) throw new ForgeError(`forges.${host} reads its token from ${i.describe(f.entry.token, { host: f.host, stateDir, env })}, which crew cannot write`);
2919
+ const f2 = forgeFor(forges, host);
2920
+ if (!f2) throw new ForgeError(`no forges.${host} entry in crew.yaml`);
2921
+ const i = impl(f2.entry.token);
2922
+ if (!i.write) throw new ForgeError(`forges.${host} reads its token from ${i.describe(f2.entry.token, { host: f2.host, stateDir, env })}, which crew cannot write`);
2923
2923
  if (!token.trim()) throw new ForgeError("empty token");
2924
- i.write(f.entry.token, token.trim(), { host: f.host, stateDir, env });
2925
- noteForgeMiss(stateDir, f.host, null);
2924
+ i.write(f2.entry.token, token.trim(), { host: f2.host, stateDir, env });
2925
+ noteForgeMiss(stateDir, f2.host, null);
2926
2926
  }
2927
2927
  function eraseForgeToken(forges, host, stateDir, env = process.env) {
2928
- const f = forgeFor(forges, host);
2929
- if (!f) return "absent";
2930
- const i = impl(f.entry.token);
2928
+ const f2 = forgeFor(forges, host);
2929
+ if (!f2) return "absent";
2930
+ const i = impl(f2.entry.token);
2931
2931
  if (!i.erase) return "env";
2932
- i.erase(f.entry.token, { host: f.host, stateDir, env });
2932
+ i.erase(f2.entry.token, { host: f2.host, stateDir, env });
2933
2933
  return "erased";
2934
2934
  }
2935
2935
  function parseCredentialInput(text2) {
@@ -2945,11 +2945,11 @@ function answerCredential(action, input, forges, stateDir, env = process.env) {
2945
2945
  if (action !== "get") return "";
2946
2946
  if (input.protocol && input.protocol !== "https") return "";
2947
2947
  if (!input.host) return "";
2948
- const f = forgeFor(forges, input.host);
2949
- if (!f) return "";
2950
- const token = impl(f.entry.token).read(f.entry.token, { host: f.host, stateDir, env });
2948
+ const f2 = forgeFor(forges, input.host);
2949
+ if (!f2) return "";
2950
+ const token = impl(f2.entry.token).read(f2.entry.token, { host: f2.host, stateDir, env });
2951
2951
  if (!token) return "";
2952
- return `username=${f.entry.username}
2952
+ return `username=${f2.entry.username}
2953
2953
  password=${token}
2954
2954
  `;
2955
2955
  }
@@ -3071,8 +3071,8 @@ function hostOfRemote(url) {
3071
3071
  }
3072
3072
  function forgeOfRemote(forges, remoteUrl, hasToken) {
3073
3073
  const host = hostOfRemote(remoteUrl);
3074
- const f = host ? forgeFor(forges, host) : void 0;
3075
- return f ? { host: f.host, hasToken: hasToken(f.host) } : void 0;
3074
+ const f2 = host ? forgeFor(forges, host) : void 0;
3075
+ return f2 ? { host: f2.host, hasToken: hasToken(f2.host) } : void 0;
3076
3076
  }
3077
3077
 
3078
3078
  // src/config.ts
@@ -4604,6 +4604,7 @@ function parseResolved(raw, m, where) {
4604
4604
  operator: m.req(raw.operator, `${where}.resolved.operator`),
4605
4605
  holds: holds2,
4606
4606
  contract: raw.contract ?? void 0,
4607
+ ...raw.trackerInterface?.declared === true && typeof raw.trackerInterface.mappingKey === "string" ? { trackerInterface: { declared: true, version: String(raw.trackerInterface.version ?? ""), mappingKey: raw.trackerInterface.mappingKey } } : {},
4607
4608
  ...typeof raw.releaseSeat === "string" && raw.releaseSeat ? { releaseSeat: raw.releaseSeat } : {},
4608
4609
  ...typeof raw.connectedAt === "string" && raw.connectedAt ? { connectedAt: raw.connectedAt } : {},
4609
4610
  ...typeof raw.releaseAgentId === "string" && raw.releaseAgentId ? { releaseAgentId: raw.releaseAgentId } : {},
@@ -5010,7 +5011,9 @@ function parseOneRoute(c, where, file, base, stateDir, raw, missing, crewHome, t
5010
5011
  };
5011
5012
  const resolvedFile = routeWellFormed ? readResolvedFile(stateDir, route2) : void 0;
5012
5013
  result.resolved = parseResolved(resolvedFile ?? c?.resolved, missing, where);
5013
- result.contract = resolvedFile?.contract ?? c?.contract ?? null;
5014
+ const declaredApp = resolvedFile?.trackerInterface?.declared === true;
5015
+ result.contract = declaredApp ? resolvedFile?.contract ?? null : resolvedFile?.contract ?? c?.contract ?? null;
5016
+ result.contractAuthored = !!c?.contract;
5014
5017
  missing.throwIfAny(file);
5015
5018
  return result;
5016
5019
  }
@@ -5206,10 +5209,10 @@ function ticketsByRepo(r, tickets) {
5206
5209
  const targets = reposOf(r);
5207
5210
  const byRepo = new Map(targets.map((t) => [t.name, []]));
5208
5211
  const unplaceable = [];
5209
- const single = Object.keys(r.repos).length === 0 && targets.length === 1;
5212
+ const single2 = Object.keys(r.repos).length === 0 && targets.length === 1;
5210
5213
  const names = r.resolved?.repoNames ?? {};
5211
5214
  for (const t of tickets) {
5212
- if (single) {
5215
+ if (single2) {
5213
5216
  byRepo.get(targets[0].name).push(t);
5214
5217
  continue;
5215
5218
  }
@@ -5377,14 +5380,14 @@ async function notify(route2, ship, n, emit, dryRun = false) {
5377
5380
  return false;
5378
5381
  }
5379
5382
  }
5380
- function withHookTail(detail, f) {
5381
- if (!f || !f.tail) return detail;
5383
+ function withHookTail(detail, f2) {
5384
+ if (!f2 || !f2.tail) return detail;
5382
5385
  return `${detail}
5383
5386
 
5384
- The \`${f.hook}\` hook (\`${f.label}\`) printed, last lines:
5387
+ The \`${f2.hook}\` hook (\`${f2.label}\`) printed, last lines:
5385
5388
 
5386
5389
  \`\`\`
5387
- ${f.tail}
5390
+ ${f2.tail}
5388
5391
  \`\`\``;
5389
5392
  }
5390
5393
  function describeRelease(o, route2, where) {
@@ -5991,15 +5994,15 @@ function loadedCrewLabels() {
5991
5994
  }
5992
5995
  function listLaunchdUnits(dir = launchAgentsDir(), loaded = []) {
5993
5996
  const files = existsSync16(dir) ? readdirSync4(dir) : [];
5994
- const units = files.filter((f) => f.startsWith(CREW_LAUNCHD_PREFIX) && f.endsWith(".plist")).sort().map((f) => {
5995
- const plistPath = join19(dir, f);
5997
+ const units = files.filter((f2) => f2.startsWith(CREW_LAUNCHD_PREFIX) && f2.endsWith(".plist")).sort().map((f2) => {
5998
+ const plistPath = join19(dir, f2);
5996
5999
  let program = null;
5997
6000
  try {
5998
6001
  program = programFromPlist(readFileSync17(plistPath, "utf8"));
5999
6002
  } catch {
6000
6003
  }
6001
6004
  return {
6002
- label: f.slice(0, -".plist".length),
6005
+ label: f2.slice(0, -".plist".length),
6003
6006
  plistPath,
6004
6007
  program,
6005
6008
  programExists: program !== null && existsSync16(program)
@@ -6974,9 +6977,9 @@ function recheckEnvironmentStops(state, route2, ship, deps = {}) {
6974
6977
  return cleared;
6975
6978
  }
6976
6979
  function recheckBaseStops(state, route2) {
6977
- const open = state.shipAttention().previous().filter((i) => i.kind === "base_unsafe");
6980
+ const open2 = state.shipAttention().previous().filter((i) => i.kind === "base_unsafe");
6978
6981
  const cleared = [];
6979
- for (const item of open) {
6982
+ for (const item of open2) {
6980
6983
  const target = reposOf(route2).find((t) => baseUnsafeKey(t.name) === item.key);
6981
6984
  if (!target) continue;
6982
6985
  const cfg = resolveRepoConfig(loadRepoConfigTolerant(target.dir), void 0, target.dir);
@@ -7620,9 +7623,9 @@ var State = class _State {
7620
7623
  const gateFailed = `.test-gate-failed-${suffix}`;
7621
7624
  const gateReported = `.test-gate-reported-${suffix}`;
7622
7625
  const heldReported = `.release-held-${suffix}`;
7623
- const read = (f) => {
7626
+ const read = (f2) => {
7624
7627
  try {
7625
- return readFileSync21(this.path(f), "utf8").trim() || null;
7628
+ return readFileSync21(this.path(f2), "utf8").trim() || null;
7626
7629
  } catch {
7627
7630
  return null;
7628
7631
  }
@@ -7707,15 +7710,15 @@ var State = class _State {
7707
7710
  const ticketFile = `.fairness-ticket-${suffix}`;
7708
7711
  const sinceFile = `.fairness-since-${suffix}`;
7709
7712
  const ticketStreakFile = `.fairness-ticket-streak-${suffix}`;
7710
- const read = (f) => {
7713
+ const read = (f2) => {
7711
7714
  try {
7712
- return readFileSync21(this.path(f), "utf8").trim() || null;
7715
+ return readFileSync21(this.path(f2), "utf8").trim() || null;
7713
7716
  } catch {
7714
7717
  return null;
7715
7718
  }
7716
7719
  };
7717
7720
  const clear2 = () => {
7718
- for (const f of [streakFile, ticketFile, sinceFile, ticketStreakFile]) rmSync11(this.path(f), { force: true });
7721
+ for (const f2 of [streakFile, ticketFile, sinceFile, ticketStreakFile]) rmSync11(this.path(f2), { force: true });
7719
7722
  };
7720
7723
  return {
7721
7724
  /** Consecutive cycles this route had actionable work and did not win. */
@@ -8517,9 +8520,9 @@ exit 125
8517
8520
  ].join(" && ");
8518
8521
  }
8519
8522
  function writeFilesScript(files) {
8520
- return files.map((f) => {
8521
- const dir = f.path.slice(0, f.path.lastIndexOf("/")) || "/";
8522
- return `mkdir -p ${shSingle(dir)} && printf %s ${shSingle(Buffer.from(f.content, "utf8").toString("base64"))} | base64 -d > ${shSingle(f.path)}`;
8523
+ return files.map((f2) => {
8524
+ const dir = f2.path.slice(0, f2.path.lastIndexOf("/")) || "/";
8525
+ return `mkdir -p ${shSingle(dir)} && printf %s ${shSingle(Buffer.from(f2.content, "utf8").toString("base64"))} | base64 -d > ${shSingle(f2.path)}`;
8523
8526
  }).join(" && ");
8524
8527
  }
8525
8528
  function shSingle(s) {
@@ -9067,89 +9070,188 @@ async function runBridge(stateDir, route2, ticket) {
9067
9070
  await bridge.stop();
9068
9071
  }
9069
9072
 
9073
+ // src/tracker-interface.ts
9074
+ var TRACKER_INTERFACE_NAME = "work-tracker";
9075
+ var ACCEPTED_INTERFACE_VERSIONS = { major: 1, minMinor: 0 };
9076
+ var ALLOW_UNDECLARED_TRACKER_APPS = true;
9077
+ var TABLE_ENTRIES = [
9078
+ { role: "issues", defaultName: "Issues", label: "Tickets table", whatBreaks: "Without it crew has no tickets to work." },
9079
+ { role: "comments", defaultName: "Comments", label: "Comments table", whatBreaks: "Without it crew cannot read answers or post progress." },
9080
+ { role: "crew", defaultName: "Crew", label: "Crew table", whatBreaks: "Without it crew has no seats to act as and no people to hand work to." },
9081
+ { role: "projects", defaultName: "Projects", label: "Projects table", optional: true, whatBreaks: "Without it tickets cannot be routed by project or work mode." },
9082
+ { role: "repos", defaultName: "Repos", label: "Repos table", optional: true, whatBreaks: "Without it a ticket cannot name the repository it belongs to." },
9083
+ { role: "ships", defaultName: "Ships", label: "Ships table", optional: true, whatBreaks: "Without it several machines cannot share one board." },
9084
+ { role: "epics", defaultName: "Epics", label: "Epics table", optional: true, whatBreaks: "Without it tickets cannot belong to an epic." },
9085
+ { role: "maps", defaultName: "Maps", label: "Maps table", optional: true, whatBreaks: "Without it a ticket cannot cite its epic\u2019s planning document." },
9086
+ { role: "periscopes", defaultName: "Periscopes", label: "Periscopes table", optional: true, whatBreaks: "Without it crew cannot host live previews." },
9087
+ { role: "locks", defaultName: "Locks", label: "Locks table", optional: true, whatBreaks: "Without it ships cannot take the release lock through the board." }
9088
+ ];
9089
+ function f(table2, name, contractPath, defaultColumn, kind, label, whatBreaks, extra = {}) {
9090
+ return { role: `${table2}.${name}`, table: table2, contractPath, defaultColumn, kind, label, whatBreaks, ...extra };
9091
+ }
9092
+ var opt = { optional: true };
9093
+ var FIELD_ENTRIES = [
9094
+ f("issues", "key", "columns.key", "issue_id", "any", "Ticket key", "Without it tickets cannot be named in branches, comments or logs."),
9095
+ f("issues", "tag", "columns.tag", "issue_tag", "any", "Per-project ticket tag", "Without it branches fall back to plain `issue-<number>` names.", opt),
9096
+ f("issues", "title", "columns.title", "title", "text", "Title", "Without it crew cannot show or file a ticket."),
9097
+ f("issues", "status", "columns.status", "status", "choice", "Status", "Without it crew cannot tell which tickets to work."),
9098
+ f("issues", "assignee", "columns.assignee", "assignee_id", "link", "Assignee", "Without it crew cannot claim a ticket or see who holds one."),
9099
+ f("issues", "priority", "columns.priority", "priority", "choice", "Priority", "Without it tickets cannot be ordered by urgency."),
9100
+ f("issues", "severity", "columns.severity", "severity", "choice", "Severity", "Without it tickets cannot be ordered by severity."),
9101
+ f("issues", "slice", "columns.slice", "project_id", "link", "Project", "Without it tickets cannot be partitioned by project."),
9102
+ f("issues", "repo", "columns.repo", "repo_id", "link", "Repository", "Without it crew cannot tell which checkout a ticket belongs to."),
9103
+ f("issues", "parent", "columns.parent", "parent_id", "link", "Parent ticket", "Without it coordinating tickets cannot roll up their children.", opt),
9104
+ f("issues", "blockedBy", "columns.blockedBy", "blocked_by", "link", "Blocked by", "Without it crew cannot park a ticket behind its dependencies.", { multiple: "either" }),
9105
+ f("issues", "updatedAt", "columns.updatedAt", "updated_at", "any", "Updated at", "Without it crew cannot tell what changed since the last poll.", { builtin: ["updated_at"] }),
9106
+ f("issues", "needsDesign", "columns.needsDesign", "needs_design", "boolean", "Needs design", "Without it tickets cannot be split between the dev and design lanes.", opt),
9107
+ f("issues", "attachments", "columns.attachments", "attachments", "link", "Attachments", "Without it a seat cannot open a ticket\u2019s screenshots.", { ...opt, multiple: "either" }),
9108
+ f("issues", "reportType", "columns.reportType", "report_type", "choice", "Report type", "Without it questions, investigations and coordinating tickets are treated as builds.", opt),
9109
+ f("issues", "epic", "columns.epic", "epic_id", "link", "Epic", "Without it tickets cannot belong to an epic.", opt),
9110
+ f("issues", "author", "columns.author", "filed_by_id", "link", "Filed by", "Without it a filed ticket does not name its filer.", opt),
9111
+ f("issues", "ship", "columns.ship", "ship_id", "link", "Filed from ship", "Without it a ticket does not name the machine it was filed from.", opt),
9112
+ f("issues", "heldBy", "columns.heldBy", "held_by_ship_id", "link", "Held by ship", "Without it two machines can claim the same ticket.", opt),
9113
+ f("issues", "resolutionNote", "columns.resolutionNote", "resolution_note", "text", "Resolution note", "Without it a close that needs a reason cannot give one.", opt),
9114
+ f("issues", "verifiedSha", "columns.verifiedSha", "verified_sha", "text", "Verified commit", "Without it review cannot tell whether the verified branch changed.", opt),
9115
+ f("issues", "prRef", "columns.prRef", "pr_ref", "text", "Pull request reference", "Without it the merged hook cannot be told which pull request it ends.", opt),
9116
+ f("issues", "branchUrl", "columns.branchUrl", "branch_url", "text", "Branch URL", "Without it the ticket does not link to its pushed branch.", opt),
9117
+ f("issues", "prUrl", "columns.prUrl", "pr_url", "text", "Pull request URL", "Without it the ticket does not link to its pull request.", opt),
9118
+ f("issues", "externalId", "columns.externalId", "external_id", "text", "External id", "Without it imported tickets cannot be told from hand-filed ones.", opt),
9119
+ f("issues", "position", "columns.position", "position", "number", "Manual position", "Without it the board\u2019s manual order is ignored.", opt),
9120
+ f("issues", "agentRuns", "columns.agentRuns", "agent_runs", "number", "Agent runs", "Without it per-ticket run counts are not kept.", opt),
9121
+ f("issues", "tokensIn", "columns.tokensIn", "tokens_in", "number", "Input tokens", "Without it per-ticket token spend is not kept.", opt),
9122
+ f("issues", "tokensOut", "columns.tokensOut", "tokens_out", "number", "Output tokens", "Without it per-ticket token spend is not kept.", opt),
9123
+ f("issues", "cacheReadTokens", "columns.cacheReadTokens", "cache_read_tokens", "number", "Cache read tokens", "Without it per-ticket token spend is not kept.", opt),
9124
+ f("issues", "cacheWriteTokens", "columns.cacheWriteTokens", "cache_write_tokens", "number", "Cache write tokens", "Without it per-ticket token spend is not kept.", opt),
9125
+ f("issues", "costUsd", "columns.costUsd", "cost_usd", "number", "Cost (USD)", "Without it per-ticket spend is not kept.", opt),
9126
+ f("issues", "crewAssisted", "columns.crewAssisted", "crew_assisted", "boolean", "Crew assisted", "Without it tickets the crew worked are not marked.", opt),
9127
+ f("projects", "workMode", "columns.workMode", "work_mode", "choice", "Work mode", "Without it every project is worked automatically.", opt),
9128
+ f("comments", "parent", "comments.parent", "ticket_id", "link", "Comment ticket", "Without it a comment cannot be tied to its ticket."),
9129
+ f("comments", "body", "comments.body", "body", "text", "Comment body", "Without it a comment has no text."),
9130
+ f("comments", "author", "comments.author", "team_member_id", "link", "Comment author", "Without it crew cannot tell its own comments from a person\u2019s."),
9131
+ f("comments", "createdAt", "comments.createdAt", "created_at", "any", "Comment time", "Without it comments cannot be ordered.", { builtin: ["created_at"] }),
9132
+ f("comments", "ship", "comments.ship", "ship_id", "link", "Posted from ship", "Without it a comment does not name the machine that posted it.", opt),
9133
+ f("comments", "publicReply", "comments.publicReply", "is_public_reply", "boolean", "Public reply", "Without it replies from a public form are read as the team\u2019s.", opt),
9134
+ f("comments", "authorName", "comments.authorName", "author_name", "text", "Public author name", "Without it a public reporter\u2019s name is lost.", opt),
9135
+ f("epics", "status", "epics.statusColumn", "status", "choice", "Epic status", "Without it crew cannot keep an epic\u2019s status from its tickets.", opt),
9136
+ f("epics", "key", "epics.keyColumn", "epic_id", "any", "Epic key", "Without it an epic has no name in the log.", opt),
9137
+ f("maps", "epic", "maps.epicColumn", "epic_id", "link", "Map epic", "Without it a Map cannot be matched to its epic.", opt),
9138
+ f("maps", "title", "maps.titleColumn", "title", "text", "Map title", "Without it a Map has no name in a brief.", opt),
9139
+ f("maps", "content", "maps.contentColumn", "content", "text", "Map content", "Without it a brief cannot carry the Map.", opt),
9140
+ f("maps", "conversation", "maps.conversationColumn", "conversation", "text", "Map conversation", "Without it the interview record cannot be pointed at.", opt),
9141
+ f("maps", "status", "maps.statusColumn", "status", "choice", "Map status", "Without it the active Map cannot be told from a draft.", opt),
9142
+ f("maps", "version", "maps.versionColumn", "version", "any", "Map version", "Without it a brief cannot name the Map\u2019s version.", opt)
9143
+ ];
9144
+ var STATUS_MEANINGS = [
9145
+ { id: "new", label: "New", defaultValue: "new", open: true, resolved: false, meaning: "Filed, not yet approved by a person." },
9146
+ { id: "approved", label: "Approved", defaultValue: "accepted", contractKey: "approved", open: true, resolved: false, meaning: "A person authorized the work. Only a person sets it." },
9147
+ { id: "parked", label: "Parked", defaultValue: "blocked", contractKey: "parked", open: true, resolved: false, meaning: "Approved but waiting on an unresolved dependency; crew parks and restores it." },
9148
+ { id: "building", label: "Building", defaultValue: "in_progress", contractKey: "building", open: true, resolved: false, meaning: "A seat is working it." },
9149
+ { id: "needsHuman", label: "Needs a person", defaultValue: "needs_info", contractKey: "needsHuman", open: true, resolved: false, meaning: "A person owes an answer." },
9150
+ { id: "handoff", label: "Handed off", defaultValue: "fixed", contractKey: "handoff", open: true, resolved: false, meaning: "Built, not yet checked. Open and not resolved." },
9151
+ { id: "verifying", label: "Verifying", defaultValue: "qa", contractKey: "verifying", open: true, resolved: false, meaning: "Being checked." },
9152
+ { id: "verified", label: "Verified", defaultValue: "verified", contractKey: "verified", open: true, resolved: true, meaning: "Checked and awaiting release. Resolves a blocker but is not closed." },
9153
+ { id: "reviewing", label: "Under review", defaultValue: "", contractKey: "reviewing", open: true, resolved: false, optional: true, meaning: "A pull request is open for human review. Only an app with a review step has it." },
9154
+ { id: "deployed", label: "Deployed", defaultValue: "closed_deployed", contractKey: "deployed", open: false, resolved: true, meaning: "Released; set by the release phase alone." },
9155
+ { id: "wontFix", label: "Won\u2019t fix", defaultValue: "closed_wont_fix", contractKey: "wontFix", open: false, resolved: true, meaning: "Called off without merging." },
9156
+ { id: "duplicate", label: "Duplicate", defaultValue: "closed_duplicate", open: false, resolved: true, meaning: "Closed in favor of another ticket." },
9157
+ { id: "completed", label: "Completed", defaultValue: "closed_completed", open: false, resolved: true, meaning: "Done with nothing to deploy." },
9158
+ { id: "cantReproduce", label: "Can\u2019t reproduce", defaultValue: "closed_cant_reproduce", open: false, resolved: true, meaning: "Closed as written, unreproducible." },
9159
+ { id: "draft", label: "Draft", defaultValue: "draft", contractKey: "draft", open: false, resolved: false, optional: true, meaning: "Held back; never polled." }
9160
+ ];
9161
+ function defaultGroup(group) {
9162
+ const out = {};
9163
+ for (const e of FIELD_ENTRIES) {
9164
+ const [g, key] = e.contractPath.split(".");
9165
+ if (g === group) out[key] = e.defaultColumn;
9166
+ }
9167
+ return out;
9168
+ }
9169
+ function defaultStatusValues() {
9170
+ const open2 = STATUS_MEANINGS.filter((s) => s.open && s.defaultValue).map((s) => s.defaultValue);
9171
+ const resolved = STATUS_MEANINGS.filter((s) => s.resolved && s.defaultValue).map((s) => s.defaultValue);
9172
+ const single2 = {};
9173
+ for (const s of STATUS_MEANINGS) if (s.contractKey) single2[s.contractKey] = s.defaultValue || null;
9174
+ return { open: open2, resolved, single: single2 };
9175
+ }
9176
+ function versionLabel(v) {
9177
+ return `${v.major}.${v.minor}`;
9178
+ }
9179
+ function acceptedLabel() {
9180
+ return `${ACCEPTED_INTERFACE_VERSIONS.major}.${ACCEPTED_INTERFACE_VERSIONS.minMinor} or a later ${ACCEPTED_INTERFACE_VERSIONS.major}.x`;
9181
+ }
9182
+ function versionAccepted(v) {
9183
+ return v.major === ACCEPTED_INTERFACE_VERSIONS.major && v.minor >= ACCEPTED_INTERFACE_VERSIONS.minMinor;
9184
+ }
9185
+ function sideToUpdate(v) {
9186
+ return v.major > ACCEPTED_INTERFACE_VERSIONS.major ? "crew" : "app";
9187
+ }
9188
+ function contractFromMapping(base, mapping) {
9189
+ const next = structuredClone(base);
9190
+ const groups = { columns: next.columns, comments: next.comments, epics: next.epics, maps: next.maps };
9191
+ for (const e of FIELD_ENTRIES) {
9192
+ const col = mapping.fields[e.role];
9193
+ if (!col) continue;
9194
+ const [group, key] = e.contractPath.split(".");
9195
+ Object.assign(groups[group], { [key]: col });
9196
+ }
9197
+ const mapped = mapping.values?.["status"] ?? {};
9198
+ const open2 = [];
9199
+ const resolved = [];
9200
+ for (const s of STATUS_MEANINGS) {
9201
+ const v = mapped[s.id] ?? (s.defaultValue || null);
9202
+ if (s.contractKey) Object.assign(next.statuses, { [s.contractKey]: v });
9203
+ if (!v) continue;
9204
+ if (s.open && !open2.includes(v)) open2.push(v);
9205
+ if (s.resolved && !resolved.includes(v)) resolved.push(v);
9206
+ }
9207
+ next.statuses.open = open2;
9208
+ next.statuses.resolved = resolved;
9209
+ return next;
9210
+ }
9211
+ function mappedTableName(mapping, role) {
9212
+ return mapping.tables?.[role];
9213
+ }
9214
+ function describeShape(roleId) {
9215
+ const t = TABLE_ENTRIES.find((x) => x.role === roleId);
9216
+ if (t) return "a table";
9217
+ const e = FIELD_ENTRIES.find((x) => x.role === roleId);
9218
+ if (!e) return "unknown role";
9219
+ const kind = e.kind === "any" ? "any column" : e.kind === "link" ? `a ${e.multiple === "either" ? "link (one or several)" : "link"} field` : `a ${e.kind} field`;
9220
+ return `${kind} on the ${e.table} table${e.optional ? " (optional)" : ""}`;
9221
+ }
9222
+ function describeDifferences(unmet) {
9223
+ return unmet.map((u) => `role ${u.roleId} \u2014 expected ${describeShape(u.roleId)}; found: ${u.message}`);
9224
+ }
9225
+
9070
9226
  // src/contract.ts
9227
+ var STATUS_DEFAULTS = defaultStatusValues();
9228
+ var EPIC_DEFAULTS = defaultGroup("epics");
9229
+ var MAP_DEFAULTS = defaultGroup("maps");
9230
+ var single = (k) => STATUS_DEFAULTS.single[k];
9071
9231
  var DEFAULT_CONTRACT = {
9072
- columns: {
9073
- key: "issue_id",
9074
- tag: "issue_tag",
9075
- title: "title",
9076
- status: "status",
9077
- assignee: "assignee_id",
9078
- priority: "priority",
9079
- severity: "severity",
9080
- slice: "project_id",
9081
- repo: "repo_id",
9082
- parent: "parent_id",
9083
- blockedBy: "blocked_by",
9084
- updatedAt: "updated_at",
9085
- needsDesign: "needs_design",
9086
- attachments: "attachments",
9087
- workMode: "work_mode",
9088
- reportType: "report_type",
9089
- epic: "epic_id",
9090
- author: "filed_by_id",
9091
- ship: "ship_id",
9092
- heldBy: "held_by_ship_id",
9093
- resolutionNote: "resolution_note",
9094
- verifiedSha: "verified_sha",
9095
- prRef: "pr_ref",
9096
- branchUrl: "branch_url",
9097
- prUrl: "pr_url",
9098
- externalId: "external_id",
9099
- position: "position",
9100
- agentRuns: "agent_runs",
9101
- tokensIn: "tokens_in",
9102
- tokensOut: "tokens_out",
9103
- cacheReadTokens: "cache_read_tokens",
9104
- cacheWriteTokens: "cache_write_tokens",
9105
- costUsd: "cost_usd",
9106
- crewAssisted: "crew_assisted"
9107
- },
9108
- comments: {
9109
- parent: "ticket_id",
9110
- body: "body",
9111
- author: "team_member_id",
9112
- createdAt: "created_at",
9113
- ship: "ship_id",
9114
- publicReply: "is_public_reply",
9115
- authorName: "author_name"
9116
- },
9232
+ columns: defaultGroup("columns"),
9233
+ comments: defaultGroup("comments"),
9117
9234
  statuses: {
9118
- open: ["new", "accepted", "blocked", "in_progress", "needs_info", "fixed", "qa", "verified"],
9119
- resolved: [
9120
- "verified",
9121
- "closed_deployed",
9122
- "closed_wont_fix",
9123
- "closed_duplicate",
9124
- "closed_completed",
9125
- "closed_cant_reproduce"
9126
- ],
9127
- approved: "accepted",
9128
- parked: "blocked",
9129
- building: "in_progress",
9130
- handoff: "fixed",
9131
- verifying: "qa",
9132
- verified: "verified",
9133
- deployed: "closed_deployed",
9134
- needsHuman: "needs_info",
9135
- reviewing: null,
9136
- wontFix: "closed_wont_fix",
9137
- draft: "draft"
9235
+ open: STATUS_DEFAULTS.open,
9236
+ resolved: STATUS_DEFAULTS.resolved,
9237
+ approved: single("approved"),
9238
+ parked: single("parked"),
9239
+ building: single("building"),
9240
+ handoff: single("handoff"),
9241
+ verifying: single("verifying"),
9242
+ verified: single("verified"),
9243
+ deployed: single("deployed"),
9244
+ needsHuman: single("needsHuman"),
9245
+ reviewing: STATUS_DEFAULTS.single.reviewing ?? null,
9246
+ wontFix: single("wontFix"),
9247
+ draft: single("draft")
9138
9248
  },
9139
9249
  epics: {
9140
- statusColumn: "status",
9141
- keyColumn: "epic_id",
9250
+ statusColumn: EPIC_DEFAULTS.statusColumn,
9251
+ keyColumn: EPIC_DEFAULTS.keyColumn,
9142
9252
  statuses: { planned: "planned", building: "in_progress", done: "done", cancelled: "cancelled" }
9143
9253
  },
9144
- maps: {
9145
- epicColumn: "epic_id",
9146
- titleColumn: "title",
9147
- contentColumn: "content",
9148
- conversationColumn: "conversation",
9149
- statusColumn: "status",
9150
- versionColumn: "version",
9151
- activeStatus: "active"
9152
- },
9254
+ maps: { ...MAP_DEFAULTS, activeStatus: "active" },
9153
9255
  priorityOrder: ["p0", "p1", "p2", "p3"],
9154
9256
  severityOrder: ["s1", "s2", "s3", "s4"],
9155
9257
  unknownPriorityRank: 2,
@@ -9188,13 +9290,13 @@ function resolveContract(override) {
9188
9290
  }
9189
9291
  function validateContract(c) {
9190
9292
  const problems = [];
9191
- const open = new Set(c.statuses.open);
9293
+ const open2 = new Set(c.statuses.open);
9192
9294
  const resolved = new Set(c.statuses.resolved);
9193
9295
  for (const role of ["approved", "parked", "building", "handoff", "verifying", "needsHuman"]) {
9194
9296
  const v = c.statuses[role];
9195
- if (!open.has(v)) problems.push(`statuses.${role} ("${v}") is not listed in statuses.open`);
9297
+ if (!open2.has(v)) problems.push(`statuses.${role} ("${v}") is not listed in statuses.open`);
9196
9298
  }
9197
- if (c.statuses.reviewing && !open.has(c.statuses.reviewing)) {
9299
+ if (c.statuses.reviewing && !open2.has(c.statuses.reviewing)) {
9198
9300
  problems.push(`statuses.reviewing ("${c.statuses.reviewing}") is not listed in statuses.open`);
9199
9301
  }
9200
9302
  if (!resolved.has(c.statuses.deployed)) {
@@ -9482,7 +9584,7 @@ function referenceKeys(t) {
9482
9584
  return t.issue_tag && t.issue_tag !== t.issue_id ? [t.issue_id, t.issue_tag] : [t.issue_id];
9483
9585
  }
9484
9586
  var RESOLVED_STATUSES = new Set(DEFAULT_CONTRACT.statuses.resolved);
9485
- var encodeFilters = (f) => JSON.stringify(f);
9587
+ var encodeFilters = (f2) => JSON.stringify(f2);
9486
9588
  var encodeSort = (s) => JSON.stringify(s);
9487
9589
  var LIST_PAGE_SIZE = 500;
9488
9590
  var LIST_MAX_PAGES = 200;
@@ -10324,7 +10426,7 @@ var Tracker = class _Tracker {
10324
10426
  }
10325
10427
  /** Whether Issues carries the optional `crew_assisted` column (CREW-3258). */
10326
10428
  async hasCrewAssistedColumn() {
10327
- this.crewAssistedColumn ??= this.columnNames(this.models.issues).then((f) => f.has(this.contract.columns.crewAssisted));
10429
+ this.crewAssistedColumn ??= this.columnNames(this.models.issues).then((f2) => f2.has(this.contract.columns.crewAssisted));
10328
10430
  return this.crewAssistedColumn;
10329
10431
  }
10330
10432
  /**
@@ -10394,7 +10496,7 @@ var Tracker = class _Tracker {
10394
10496
  async probeAttachments() {
10395
10497
  try {
10396
10498
  const model = await this.client.dataModels.get(this.models.issues);
10397
- const field = model.fields.find((f) => f.columnName === this.contract.columns.attachments);
10499
+ const field = model.fields.find((f2) => f2.columnName === this.contract.columns.attachments);
10398
10500
  const fieldType = field?.fieldType;
10399
10501
  const target = fieldType?.targetModelId;
10400
10502
  return { mediaLibraryModelId: typeof target === "string" && target ? target : null };
@@ -10405,7 +10507,7 @@ var Tracker = class _Tracker {
10405
10507
  async columnNames(modelId) {
10406
10508
  try {
10407
10509
  const model = await this.client.dataModels.get(modelId);
10408
- return new Set(model.fields.map((f) => f.columnName));
10510
+ return new Set(model.fields.map((f2) => f2.columnName));
10409
10511
  } catch {
10410
10512
  return /* @__PURE__ */ new Set();
10411
10513
  }
@@ -10750,7 +10852,7 @@ function planFootprints(input) {
10750
10852
  const candidates2 = tickets.filter((t) => isWaiting(t) && !input.dependencyBlocked?.has(t.id)).sort(byAge);
10751
10853
  for (const t of candidates2) {
10752
10854
  const mine = footprintOf(t, input.declared, input.pushed, extra);
10753
- const hits = held.filter((h) => h.ticket.id !== t.id && mine.some((f) => h.files.has(f)));
10855
+ const hits = held.filter((h) => h.ticket.id !== t.id && mine.some((f2) => h.files.has(f2)));
10754
10856
  if (mine.length === 0 || hits.length === 0) {
10755
10857
  if (mine.length) held.push({ ticket: t, files: new Set(mine) });
10756
10858
  continue;
@@ -10758,7 +10860,7 @@ function planFootprints(input) {
10758
10860
  waits.set(t.id, {
10759
10861
  ticket: t,
10760
10862
  waitingFor: hits.map((h) => displayKey(h.ticket)),
10761
- files: [...new Set(hits.flatMap((h) => mine.filter((f) => h.files.has(f))))].sort()
10863
+ files: [...new Set(hits.flatMap((h) => mine.filter((f2) => h.files.has(f2))))].sort()
10762
10864
  });
10763
10865
  }
10764
10866
  }
@@ -10774,12 +10876,12 @@ function mustYieldTo(self, input) {
10774
10876
  const x = input.declared.get(a.id).at, y = input.declared.get(b.id).at;
10775
10877
  return x !== y ? x < y : number(a) < number(b);
10776
10878
  };
10777
- const hits = input.tickets.filter((o) => o.id !== self.id && repoOf(o) === repoOf(self) && isActive(o)).filter((o) => !(newly(self) && newly(o) && earlier(self, o))).map((o) => ({ o, shared: footprintOf(o, input.declared, input.pushed, extra).filter((f) => mine.includes(f)) })).filter((h) => h.shared.length > 0);
10879
+ const hits = input.tickets.filter((o) => o.id !== self.id && repoOf(o) === repoOf(self) && isActive(o)).filter((o) => !(newly(self) && newly(o) && earlier(self, o))).map((o) => ({ o, shared: footprintOf(o, input.declared, input.pushed, extra).filter((f2) => mine.includes(f2)) })).filter((h) => h.shared.length > 0);
10778
10880
  if (hits.length === 0) return null;
10779
10881
  return { waitingFor: hits.map((h) => displayKey(h.o)), files: [...new Set(hits.flatMap((h) => h.shared))].sort() };
10780
10882
  }
10781
10883
  function describeFiles(files, shown = 3) {
10782
- const head = files.slice(0, shown).map((f) => `\`${f}\``).join(", ");
10884
+ const head = files.slice(0, shown).map((f2) => `\`${f2}\``).join(", ");
10783
10885
  return files.length > shown ? `${head} and ${files.length - shown} more` : head;
10784
10886
  }
10785
10887
  function footprintWaitNote(w) {
@@ -10854,9 +10956,9 @@ function listPendingHandoffs(stateDir, route2) {
10854
10956
  const dir = pendingDirFor(stateDir);
10855
10957
  if (!existsSync22(dir)) return [];
10856
10958
  const out = [];
10857
- for (const f of readdirSync7(dir).filter((n) => n.endsWith(".json")).sort()) {
10959
+ for (const f2 of readdirSync7(dir).filter((n) => n.endsWith(".json")).sort()) {
10858
10960
  try {
10859
- const rec = JSON.parse(readFileSync24(join25(dir, f), "utf8"));
10961
+ const rec = JSON.parse(readFileSync24(join25(dir, f2), "utf8"));
10860
10962
  if (rec.version === 1 && rec.ticketRecordId && (!route2 || rec.route === route2)) out.push(rec);
10861
10963
  } catch {
10862
10964
  }
@@ -11857,7 +11959,7 @@ function columnsOf(target, modelId) {
11857
11959
  const key = `${target.baseUrl}|${target.workspaceId}|${modelId}`;
11858
11960
  let p = issueColumns.get(key);
11859
11961
  if (!p) {
11860
- p = request(target, "GET", `/data-models/${modelId}`).then((m) => new Set((m.fields ?? []).map((f) => f.columnName)));
11962
+ p = request(target, "GET", `/data-models/${modelId}`).then((m) => new Set((m.fields ?? []).map((f2) => f2.columnName)));
11861
11963
  p.catch(() => issueColumns.delete(key));
11862
11964
  issueColumns.set(key, p);
11863
11965
  }
@@ -12300,8 +12402,8 @@ async function replayQueuedAgentRuns(stateDir, route2, keyFor, log, now = /* @__
12300
12402
  const dir = queueDir(stateDir);
12301
12403
  if (!existsSync25(dir)) return 0;
12302
12404
  let sent = 0;
12303
- for (const f of readdirSync8(dir).filter((n) => n.endsWith(".json")).sort()) {
12304
- const path = join28(dir, f);
12405
+ for (const f2 of readdirSync8(dir).filter((n) => n.endsWith(".json")).sort()) {
12406
+ const path = join28(dir, f2);
12305
12407
  let q2;
12306
12408
  try {
12307
12409
  q2 = JSON.parse(readFileSync25(path, "utf8"));
@@ -12314,7 +12416,7 @@ async function replayQueuedAgentRuns(stateDir, route2, keyFor, log, now = /* @__
12314
12416
  if (!apiKey) continue;
12315
12417
  const sentRun = await reportAgentRun({ ...q2.target, apiKey }, q2.report);
12316
12418
  if (sentRun.counterWarning) log.warn(sentRun.counterWarning);
12317
- if (sentRun.counterRetry) queueTicketCounters(stateDir, f.replace(/\.json$/, ""), {
12419
+ if (sentRun.counterRetry) queueTicketCounters(stateDir, f2.replace(/\.json$/, ""), {
12318
12420
  version: 1,
12319
12421
  route: q2.route,
12320
12422
  role: q2.role,
@@ -12325,11 +12427,11 @@ async function replayQueuedAgentRuns(stateDir, route2, keyFor, log, now = /* @__
12325
12427
  });
12326
12428
  rmSync14(path, { force: true });
12327
12429
  sent += 1;
12328
- log.emit(`sent a queued Agent Log report (${f})`);
12430
+ log.emit(`sent a queued Agent Log report (${f2})`);
12329
12431
  } catch (e) {
12330
12432
  if (!(e instanceof AgentLogUnreachableError)) {
12331
12433
  rmSync14(path, { force: true });
12332
- log.warn(`dropped a queued Agent Log report (${f}): ${e.message}`);
12434
+ log.warn(`dropped a queued Agent Log report (${f2}): ${e.message}`);
12333
12435
  continue;
12334
12436
  }
12335
12437
  const attempts = q2.attempts + 1;
@@ -12353,8 +12455,8 @@ async function replayQueuedTicketCounters(stateDir, route2, keyFor, log, now = /
12353
12455
  const dir = countersDir(stateDir);
12354
12456
  if (!existsSync25(dir)) return 0;
12355
12457
  let sent = 0;
12356
- for (const f of readdirSync8(dir).filter((n) => n.endsWith(".json")).sort()) {
12357
- const path = join28(dir, f);
12458
+ for (const f2 of readdirSync8(dir).filter((n) => n.endsWith(".json")).sort()) {
12459
+ const path = join28(dir, f2);
12358
12460
  let q2;
12359
12461
  try {
12360
12462
  q2 = JSON.parse(readFileSync25(path, "utf8"));
@@ -12368,11 +12470,11 @@ async function replayQueuedTicketCounters(stateDir, route2, keyFor, log, now = /
12368
12470
  await writeCounters({ ...q2.target, apiKey }, q2.write);
12369
12471
  rmSync14(path, { force: true });
12370
12472
  sent += 1;
12371
- log.emit(`added a queued run's spend to ${q2.write.ticketReference ?? q2.write.recordId} (${f})`);
12473
+ log.emit(`added a queued run's spend to ${q2.write.ticketReference ?? q2.write.recordId} (${f2})`);
12372
12474
  } catch (e) {
12373
12475
  if (!isRetryable(e)) {
12374
12476
  rmSync14(path, { force: true });
12375
- log.warn(`dropped a queued ticket counter update (${f}): ${e.message}`);
12477
+ log.warn(`dropped a queued ticket counter update (${f2}): ${e.message}`);
12376
12478
  continue;
12377
12479
  }
12378
12480
  const attempts = q2.attempts + 1;
@@ -12819,7 +12921,7 @@ function readWarmFiles(dir, ref, patterns) {
12819
12921
  const res = patterns.map(globToRegExp);
12820
12922
  const out = {};
12821
12923
  let total = 0;
12822
- for (const path of all.filter((f) => res.some((re) => re.test(f))).sort()) {
12924
+ for (const path of all.filter((f2) => res.some((re) => re.test(f2))).sort()) {
12823
12925
  const content = git2(["show", `${ref}:${path}`]);
12824
12926
  total += content.length;
12825
12927
  if (total > WARM_MAX_BYTES) throw new Error(`sandbox.warm files exceed ${WARM_MAX_BYTES} bytes`);
@@ -13274,10 +13376,10 @@ function isForbidden(e) {
13274
13376
  return e instanceof TablationApiError2 && e.status === 403;
13275
13377
  }
13276
13378
  function promptSourceFields(model, prompt) {
13277
- return model.fields?.some((f) => f.columnName === "prompt_baseline") ? { prompt_source: "crew", prompt_baseline: prompt } : {};
13379
+ return model.fields?.some((f2) => f2.columnName === "prompt_baseline") ? { prompt_source: "crew", prompt_baseline: prompt } : {};
13278
13380
  }
13279
13381
  function hasPromptBaselineColumn(model) {
13280
- return model.fields?.some((f) => f.columnName === "prompt_baseline") === true;
13382
+ return model.fields?.some((f2) => f2.columnName === "prompt_baseline") === true;
13281
13383
  }
13282
13384
  function needsBaselineBackfill(model, row) {
13283
13385
  return hasPromptBaselineColumn(model) && row.prompt_customized !== true && (typeof row.prompt_baseline !== "string" || !row.prompt_source);
@@ -13312,7 +13414,7 @@ async function syncPersonas(route2, opts) {
13312
13414
  const cache = route2.resolved.agentPersonas ?? {};
13313
13415
  const outcomes = [];
13314
13416
  const agentPersonas = { ...cache };
13315
- const hasChatColumn = agentsModel.fields?.some((f) => f.columnName === "chat_enabled") === true;
13417
+ const hasChatColumn = agentsModel.fields?.some((f2) => f2.columnName === "chat_enabled") === true;
13316
13418
  const chatDeclared = {};
13317
13419
  for (const role of ROLE_NAMES) {
13318
13420
  const v = personaChatEnabled(route2.promptsDir, role);
@@ -13552,7 +13654,7 @@ async function linkCrewSeats(route2, client2, agentsModelId, agentPersonas, user
13552
13654
  }
13553
13655
  async function ensureCrewAgentField(route2, client2, crewModel, agentsModelId, userAgent) {
13554
13656
  const existing = crewModel.fields.find(
13555
- (f) => f.fieldType?.kind === "REFERENCE" && f.fieldType.targetModelId === agentsModelId && f.fieldType.isMultiple === false
13657
+ (f2) => f2.fieldType?.kind === "REFERENCE" && f2.fieldType.targetModelId === agentsModelId && f2.fieldType.isMultiple === false
13556
13658
  );
13557
13659
  if (existing) return existing.columnName;
13558
13660
  const workspaceId = route2.resolved.workspaceId;
@@ -13657,10 +13759,10 @@ function parseSkillFile(path) {
13657
13759
  function listLocalSkills(promptsDir) {
13658
13760
  const dir = join32(promptsDir, "skills");
13659
13761
  if (!existsSync28(dir)) return [];
13660
- return readdirSync9(dir).filter((f) => f.endsWith(".md")).map((f) => parseSkillFile(join32(dir, f)));
13762
+ return readdirSync9(dir).filter((f2) => f2.endsWith(".md")).map((f2) => parseSkillFile(join32(dir, f2)));
13661
13763
  }
13662
13764
  function personaColumn(model) {
13663
- for (const c of ["persona_id", "persona"]) if (model.fields?.some((f) => f.columnName === c)) return c;
13765
+ for (const c of ["persona_id", "persona"]) if (model.fields?.some((f2) => f2.columnName === c)) return c;
13664
13766
  return void 0;
13665
13767
  }
13666
13768
  var refId2 = (v) => typeof v === "string" ? v : v && typeof v === "object" && typeof v.id === "string" ? v.id : "";
@@ -13691,7 +13793,7 @@ async function syncSkills(route2, opts) {
13691
13793
  const outcomes = [];
13692
13794
  const agentSkills = { ...cache };
13693
13795
  const warnings = [];
13694
- const hasTrigger = skillsModel.fields?.some((f) => f.columnName === "trigger") === true;
13796
+ const hasTrigger = skillsModel.fields?.some((f2) => f2.columnName === "trigger") === true;
13695
13797
  const personaCol = personaColumn(skillsModel);
13696
13798
  let agentRows;
13697
13799
  const classified = /* @__PURE__ */ new Set();
@@ -16372,27 +16474,27 @@ function probePushAuth(o, run4 = realGit, baseEnv = process.env) {
16372
16474
  const err3 = e;
16373
16475
  const raw = (err3.stderr ? String(err3.stderr) : err3.message).trim().split("\n").filter(Boolean).slice(-2).join(" / ");
16374
16476
  const detail = raw || "push dry-run failed";
16375
- const f = o.forge;
16376
- if (!f) return { state: "failed", detail: hostOfRemote(o.remoteUrl) ? `${hostOfRemote(o.remoteUrl)}: ${detail}` : detail, hint: pushAuthHint(o.remoteUrl) };
16377
- if (!f.hasToken) {
16477
+ const f2 = o.forge;
16478
+ if (!f2) return { state: "failed", detail: hostOfRemote(o.remoteUrl) ? `${hostOfRemote(o.remoteUrl)}: ${detail}` : detail, hint: pushAuthHint(o.remoteUrl) };
16479
+ if (!f2.hasToken) {
16378
16480
  return {
16379
16481
  state: "failed",
16380
- detail: `no token for forge ${f.host}: ${detail}`,
16381
- hint: `set one with \`crew forge set ${f.host}\` (forges.${f.host} in crew.yaml)`
16482
+ detail: `no token for forge ${f2.host}: ${detail}`,
16483
+ hint: `set one with \`crew forge set ${f2.host}\` (forges.${f2.host} in crew.yaml)`
16382
16484
  };
16383
16485
  }
16384
16486
  try {
16385
16487
  run4(o.dir, ["ls-remote", "--exit-code", o.remote, "HEAD"], env);
16386
16488
  return {
16387
16489
  state: "failed",
16388
- detail: `the token for forge ${f.host} is read-only (fetch works, push refused): ${detail}`,
16389
- hint: `replace it with one that can write contents: \`crew forge rotate ${f.host}\``
16490
+ detail: `the token for forge ${f2.host} is read-only (fetch works, push refused): ${detail}`,
16491
+ hint: `replace it with one that can write contents: \`crew forge rotate ${f2.host}\``
16390
16492
  };
16391
16493
  } catch {
16392
16494
  return {
16393
16495
  state: "failed",
16394
- detail: `the token for forge ${f.host} was refused: ${detail}`,
16395
- hint: `check that it is current and has access to this repository: \`crew forge rotate ${f.host}\``
16496
+ detail: `the token for forge ${f2.host} was refused: ${detail}`,
16497
+ hint: `check that it is current and has access to this repository: \`crew forge rotate ${f2.host}\``
16396
16498
  };
16397
16499
  }
16398
16500
  }
@@ -17575,10 +17677,10 @@ function fileMemberStore(dir) {
17575
17677
  return {};
17576
17678
  }
17577
17679
  },
17578
- write(f) {
17680
+ write(f2) {
17579
17681
  mkdirSync26(dirname20(file), { recursive: true, mode: 448 });
17580
17682
  const tmp = `${file}.tmp`;
17581
- writeFileSync28(tmp, `${JSON.stringify(f)}
17683
+ writeFileSync28(tmp, `${JSON.stringify(f2)}
17582
17684
  `, { mode: 384 });
17583
17685
  renameSync7(tmp, file);
17584
17686
  }
@@ -17938,11 +18040,11 @@ function planRepoRow(i) {
17938
18040
  project_id: i.projectId
17939
18041
  };
17940
18042
  }
17941
- function resolveRepoProject(projects, opt, routeAreaId) {
17942
- if (opt) {
17943
- const want = opt.toLowerCase();
17944
- const hit = projects.find((p) => p.id === opt || p.name?.toLowerCase() === want);
17945
- if (!hit) throw new ReposError(`no Projects row "${opt}" (have: ${projects.map((p) => p.name ?? p.id).join(", ") || "none"})`);
18043
+ function resolveRepoProject(projects, opt2, routeAreaId) {
18044
+ if (opt2) {
18045
+ const want = opt2.toLowerCase();
18046
+ const hit = projects.find((p) => p.id === opt2 || p.name?.toLowerCase() === want);
18047
+ if (!hit) throw new ReposError(`no Projects row "${opt2}" (have: ${projects.map((p) => p.name ?? p.id).join(", ") || "none"})`);
17946
18048
  return hit.id;
17947
18049
  }
17948
18050
  if (routeAreaId) return routeAreaId;
@@ -17993,13 +18095,13 @@ function planRepoClone(i) {
17993
18095
 
17994
18096
  // src/doctor-fix.ts
17995
18097
  var sound = (r) => r.hasRepos && r.problems.length === 0;
17996
- function planFix(f) {
18098
+ function planFix(f2) {
17997
18099
  const actions = [];
17998
18100
  const notes = [];
17999
- for (const r of f.routes) {
18101
+ for (const r of f2.routes) {
18000
18102
  if (r.snapshotStale) actions.push({ kind: "refresh-snapshot", route: r.route });
18001
18103
  }
18002
- for (const r of f.routes) {
18104
+ for (const r of f2.routes) {
18003
18105
  if (!r.enabled && sound(r)) {
18004
18106
  actions.push({ kind: "enable", route: r.route });
18005
18107
  const gaps = r.readiness ?? [];
@@ -18010,8 +18112,8 @@ function planFix(f) {
18010
18112
  notes.push(`${r.route}: not enabled \u2014 ${r.hasRepos ? r.problems[0] : "no checkout is configured"}`);
18011
18113
  }
18012
18114
  }
18013
- if (f.schedulerAbsent && f.routes.some(sound)) {
18014
- if (f.host === "windows") notes.push("scheduler support is not built for Windows yet \u2014 nothing to install; run `crew run` by hand");
18115
+ if (f2.schedulerAbsent && f2.routes.some(sound)) {
18116
+ if (f2.host === "windows") notes.push("scheduler support is not built for Windows yet \u2014 nothing to install; run `crew run` by hand");
18015
18117
  else actions.push({ kind: "install" });
18016
18118
  }
18017
18119
  return { actions, notes };
@@ -18322,8 +18424,8 @@ function realProvisionDeps(crewHome) {
18322
18424
  return { status: res.status ?? 1, stdout: res.stdout ?? "", stderr: `${res.stderr ?? ""}${res.error ? String(res.error) : ""}` };
18323
18425
  };
18324
18426
  const configFile = () => {
18325
- const f = findConfigFile(crewHome);
18326
- return existsSync37(f) ? f : null;
18427
+ const f2 = findConfigFile(crewHome);
18428
+ return existsSync37(f2) ? f2 : null;
18327
18429
  };
18328
18430
  return {
18329
18431
  crew: spawnCrew,
@@ -18444,7 +18546,7 @@ function realPoolMemberDeps(o) {
18444
18546
  },
18445
18547
  hasShipConfig: () => existsSync38(findConfigFile(o.crewHome)),
18446
18548
  async provision(lease, instanceClass, shipKind) {
18447
- const hosts = lease.forges.map((f) => f.host.toLowerCase());
18549
+ const hosts = lease.forges.map((f2) => f2.host.toLowerCase());
18448
18550
  const lines2 = [];
18449
18551
  const outcome = await runProvision({
18450
18552
  key: lease.connectKey,
@@ -18458,7 +18560,7 @@ function realPoolMemberDeps(o) {
18458
18560
  maxConcurrentAgents: lease.maxConcurrentAgents,
18459
18561
  baseUrl: platformBaseUrl(o.platformUrl),
18460
18562
  forgeHosts: hosts,
18461
- tokens: Object.fromEntries(lease.forges.map((f) => [f.host.toLowerCase(), f.token])),
18563
+ tokens: Object.fromEntries(lease.forges.map((f2) => [f2.host.toLowerCase(), f2.token])),
18462
18564
  json: false,
18463
18565
  dryRun: false,
18464
18566
  choices: []
@@ -18471,7 +18573,7 @@ function realPoolMemberDeps(o) {
18471
18573
  return { ok: false, reason: `crew provision exited ${outcome.code}: ${lines2.at(-1) ?? "no detail"}` };
18472
18574
  },
18473
18575
  async applyTokens(forges) {
18474
- const want = new Map(forges.map((f) => [f.host.toLowerCase(), f.token]));
18576
+ const want = new Map(forges.map((f2) => [f2.host.toLowerCase(), f2.token]));
18475
18577
  for (const [host, token] of want) {
18476
18578
  const stored = provisionDeps.storedToken(host);
18477
18579
  if (stored === token) continue;
@@ -19032,9 +19134,9 @@ function planEpicSync(epics, outstanding, closed, c) {
19032
19134
  const steps = [];
19033
19135
  for (const epic of trackedEpics(epics, c)) {
19034
19136
  const from = statusOf(epic, c);
19035
- const open = openByEpic.get(epic.id) ?? [];
19137
+ const open2 = openByEpic.get(epic.id) ?? [];
19036
19138
  const label = epicLabel(epic, c);
19037
- if (open.length === 0) {
19139
+ if (open2.length === 0) {
19038
19140
  const n = closedCount.get(epic.id) ?? 0;
19039
19141
  if (from !== s.done && n > 0) {
19040
19142
  steps.push({
@@ -19048,7 +19150,7 @@ function planEpicSync(epics, outstanding, closed, c) {
19048
19150
  }
19049
19151
  continue;
19050
19152
  }
19051
- const active = open.filter((t) => worked.has(t.status));
19153
+ const active = open2.filter((t) => worked.has(t.status));
19052
19154
  if (active.length && from !== s.building) {
19053
19155
  steps.push({
19054
19156
  action: from === s.done ? "reopen" : "start",
@@ -19377,6 +19479,141 @@ ${waiting.map((t) => `| ${displayKey2(t)} | ${t.status} | ${blockers(t, i)} |`).
19377
19479
  ]);
19378
19480
  }
19379
19481
 
19482
+ // src/tracker-interface-read.ts
19483
+ var INTERFACE_MISMATCH_KEY = "tracker_interface";
19484
+ var INTERFACE_UNDECLARED_KEY = "tracker_interface_undeclared";
19485
+ function statusOf2(e) {
19486
+ return typeof e?.status === "number" ? e.status : void 0;
19487
+ }
19488
+ async function findImplementers(get2, workspaceId) {
19489
+ try {
19490
+ return await get2(
19491
+ `/app-interfaces/implementers?workspaceId=${encodeURIComponent(workspaceId)}&name=${encodeURIComponent(TRACKER_INTERFACE_NAME)}`
19492
+ );
19493
+ } catch (e) {
19494
+ if (statusOf2(e) === 404) return [];
19495
+ return "unreadable";
19496
+ }
19497
+ }
19498
+ async function readInterfaceState(get2, workspaceId, projectId) {
19499
+ const found = await findImplementers(get2, workspaceId);
19500
+ if (found === "unreadable") return { kind: "unreadable" };
19501
+ const mine = found.find((i) => i.project.id === projectId && i.interfaceName === TRACKER_INTERFACE_NAME);
19502
+ if (!mine) return { kind: "undeclared" };
19503
+ const mapping = {
19504
+ tables: { ...mine.mapping.tables },
19505
+ fields: { ...mine.mapping.fields },
19506
+ values: { ...mine.mapping.values }
19507
+ };
19508
+ const accepted = versionAccepted(mine.version);
19509
+ let conforms = null;
19510
+ let unmet = [];
19511
+ try {
19512
+ const rows = await get2(`/projects/${encodeURIComponent(projectId)}/interfaces`);
19513
+ const row = rows.find((r) => r.name === TRACKER_INTERFACE_NAME);
19514
+ if (row) {
19515
+ conforms = row.conforms;
19516
+ unmet = row.unmet ?? [];
19517
+ }
19518
+ } catch {
19519
+ }
19520
+ return { kind: "declared", version: mine.version, accepted, mapping, conforms, unmet };
19521
+ }
19522
+ function mappingKey(m) {
19523
+ return JSON.stringify([m.tables, m.fields, m.values], (_k, v) => v && typeof v === "object" && !Array.isArray(v) ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a.localeCompare(b))) : v);
19524
+ }
19525
+ function versionMismatchMessage(v) {
19526
+ const side = sideToUpdate(v);
19527
+ return `the app declares work-tracker interface ${versionLabel(v)} but this crew reads ${acceptedLabel()} \u2014 no ticket will be picked. ` + (side === "crew" ? "Update crew (`npm install -g @tablation/crew`, or the Crew app)." : "Update the app: apply the newest Issues template to the project.") + " Resumes automatically once the versions agree";
19528
+ }
19529
+ function nonConformingMessage(unmet) {
19530
+ return `the app declares the work-tracker interface but does not conform \u2014 no ticket will be picked. ${describeDifferences(unmet).join("; ")}. Fix the app\u2019s tables or its mapping (Settings \u2192 Interfaces). Resumes automatically once it conforms`;
19531
+ }
19532
+ var MAPPING_CHANGED_MESSAGE = "the app\u2019s work-tracker mapping changed since `crew connect` \u2014 no ticket will be picked until you rerun `crew connect`. Resumes automatically once the stored mapping matches";
19533
+ var UNDECLARED_MESSAGE = "the app declares no work-tracker interface, so crew reads it from its built-in defaults by table name. Ask the operator to update the app\u2019s Issues template so it declares one; nothing is blocked meanwhile. Clears itself once the app declares it";
19534
+ var OVERRIDE_IGNORED_MESSAGE = "crew.yaml carries a `contract:` override for this route, but the app declares the work-tracker interface and its declaration wins \u2014 the override is ignored";
19535
+ function blockingMessage(state, storedMappingKey) {
19536
+ if (state.kind !== "declared") return null;
19537
+ if (!state.accepted) return versionMismatchMessage(state.version);
19538
+ if (state.conforms === false) return nonConformingMessage(state.unmet);
19539
+ if (storedMappingKey !== void 0 && storedMappingKey !== mappingKey(state.mapping)) return MAPPING_CHANGED_MESSAGE;
19540
+ return null;
19541
+ }
19542
+ function mismatchItem(message, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19543
+ return { kind: "tracker_interface", key: INTERFACE_MISMATCH_KEY, since: nowIso, message };
19544
+ }
19545
+ function undeclaredItem(nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19546
+ return { kind: "tracker_interface", key: INTERFACE_UNDECLARED_KEY, since: nowIso, message: UNDECLARED_MESSAGE };
19547
+ }
19548
+ function overrideItem(nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19549
+ return { kind: "tracker_interface", key: `${INTERFACE_MISMATCH_KEY}_override`, since: nowIso, message: OVERRIDE_IGNORED_MESSAGE };
19550
+ }
19551
+ function open(state, key) {
19552
+ return state.shipAttention().previous().find((i) => i.key === key)?.message ?? null;
19553
+ }
19554
+ async function checkTrackerInterface(o, deps = {}) {
19555
+ const r = o.route.resolved;
19556
+ if (!r?.projectId) return null;
19557
+ const state = await (deps.read ?? readForRoute)(o.route, o.ship);
19558
+ if (state.kind === "unreadable") return open(o.state, INTERFACE_MISMATCH_KEY);
19559
+ if (state.kind === "undeclared") {
19560
+ clearShipAttention(o.state, INTERFACE_MISMATCH_KEY);
19561
+ clearShipAttention(o.state, `${INTERFACE_MISMATCH_KEY}_override`);
19562
+ if (ALLOW_UNDECLARED_TRACKER_APPS) {
19563
+ await raiseShipAttention(o, undeclaredItem());
19564
+ return null;
19565
+ }
19566
+ const message2 = "the app declares no work-tracker interface and this crew requires one \u2014 no ticket will be picked. Update the app\u2019s Issues template. Resumes automatically once it declares one";
19567
+ await raiseShipAttention(o, mismatchItem(message2));
19568
+ return message2;
19569
+ }
19570
+ clearShipAttention(o.state, INTERFACE_UNDECLARED_KEY);
19571
+ if (o.route.contractAuthored) await raiseShipAttention(o, overrideItem());
19572
+ else clearShipAttention(o.state, `${INTERFACE_MISMATCH_KEY}_override`);
19573
+ const message = blockingMessage(state, r.trackerInterface?.mappingKey);
19574
+ if (message) {
19575
+ await raiseShipAttention(o, mismatchItem(message));
19576
+ return message;
19577
+ }
19578
+ clearShipAttention(o.state, INTERFACE_MISMATCH_KEY);
19579
+ return null;
19580
+ }
19581
+ async function readForRoute(route2, ship) {
19582
+ const r = route2.resolved;
19583
+ if (!r?.projectId) return { kind: "unreadable" };
19584
+ const get2 = async (path) => {
19585
+ const res = await fetch(`${route2.baseUrl.replace(/\/+$/, "")}/api${path}`, {
19586
+ headers: { Authorization: `Bearer ${resolveApiKey(route2)}`, "User-Agent": ship.userAgent }
19587
+ });
19588
+ if (!res.ok) throw Object.assign(new Error(`HTTP ${res.status}`), { status: res.status });
19589
+ return await res.json();
19590
+ };
19591
+ try {
19592
+ return await readInterfaceState(get2, r.workspaceId, r.projectId);
19593
+ } catch {
19594
+ return { kind: "unreadable" };
19595
+ }
19596
+ }
19597
+ function interfaceReport(state, o) {
19598
+ if (state.kind === "unreadable") return [{ line: "work tracker interface: could not be read from the platform", problem: false }];
19599
+ if (state.kind === "undeclared") {
19600
+ return [{
19601
+ line: ALLOW_UNDECLARED_TRACKER_APPS ? `work tracker interface: not declared \u2014 read from built-in defaults by table name (non-blocking). ${UNDECLARED_MESSAGE}` : "work tracker interface: not declared, and this crew requires one",
19602
+ problem: !ALLOW_UNDECLARED_TRACKER_APPS
19603
+ }];
19604
+ }
19605
+ const lines2 = [];
19606
+ const blocking = blockingMessage(state, o.storedMappingKey);
19607
+ if (!state.accepted) lines2.push({ line: `work tracker interface: ${versionMismatchMessage(state.version)}`, problem: true });
19608
+ else if (state.conforms === false) {
19609
+ lines2.push({ line: `work tracker interface ${versionLabel(state.version)}: does not conform`, problem: true });
19610
+ for (const d of describeDifferences(state.unmet)) lines2.push({ line: ` - ${d}`, problem: true });
19611
+ } else if (blocking) lines2.push({ line: `work tracker interface: ${blocking}`, problem: true });
19612
+ else lines2.push({ line: `work tracker interface ${versionLabel(state.version)}: ${state.conforms ? "conforms" : "declared (conformance not visible to this key)"}`, problem: false });
19613
+ if (o.contractAuthored) lines2.push({ line: `work tracker interface: ${OVERRIDE_IGNORED_MESSAGE}`, problem: false });
19614
+ return lines2;
19615
+ }
19616
+
19380
19617
  // src/sandbox-hygiene.ts
19381
19618
  import { execFile as execFile3 } from "child_process";
19382
19619
  import { existsSync as existsSync39, statfsSync as statfsSync2 } from "fs";
@@ -19659,10 +19896,10 @@ async function runStalledSweep(o, stalled) {
19659
19896
  const scoped = r.attention.map((i) => scope ? { ...i, key: stalledKey(i.key.slice("stalled:".length), scope) } : i);
19660
19897
  const keep = new Set(scoped.map((i) => i.key));
19661
19898
  for (const item of scoped) await raiseShipAttention({ state: o.state, emit: o.emit, route: o.route, ship: o.ship }, item);
19662
- for (const open of o.state.shipAttention().previous()) {
19663
- if (open.kind !== "stalled" || keep.has(open.key)) continue;
19664
- const unscoped = !/^stalled:[^:]+:/.test(open.key);
19665
- if (unscoped || open.key.startsWith(prefix)) clearShipAttention(o.state, open.key);
19899
+ for (const open2 of o.state.shipAttention().previous()) {
19900
+ if (open2.kind !== "stalled" || keep.has(open2.key)) continue;
19901
+ const unscoped = !/^stalled:[^:]+:/.test(open2.key);
19902
+ if (unscoped || open2.key.startsWith(prefix)) clearShipAttention(o.state, open2.key);
19666
19903
  }
19667
19904
  return r;
19668
19905
  }
@@ -19835,7 +20072,7 @@ async function decideCycle(o) {
19835
20072
  emit.emit(`${what}: no longer missing from the scheduler PATH \u2014 stop cleared`, { step: "select" });
19836
20073
  }
19837
20074
  await checkRepoDisks({ state, emit, route: route2, ship });
19838
- const floorStop = await checkCrewFloor({ state, emit, route: route2, ship });
20075
+ const floorStop = await checkCrewFloor({ state, emit, route: route2, ship }) ?? await checkTrackerInterface({ state, emit, route: route2, ship });
19839
20076
  const itemStop = repoStopFor(openShipAttention(state), route2);
19840
20077
  const diskStop = diskFullStop(state);
19841
20078
  const selectionInput = {
@@ -20470,7 +20707,7 @@ function planBuildFailureBounce(cwd, c, base, remote) {
20470
20707
  }
20471
20708
  function outsideNote(b) {
20472
20709
  if (b.inBranch !== false || !b.failingFiles?.length) return "";
20473
- const shown = b.failingFiles.slice(0, 5).map((f) => `\`${f}\``).join(", ");
20710
+ const shown = b.failingFiles.slice(0, 5).map((f2) => `\`${f2}\``).join(", ");
20474
20711
  return `**None of the files the failure names (${shown}) are among this branch's changes**, so this may be a flake or a failure that already lives on \`${b.base ?? "the base"}\` rather than something the branch broke; check that before changing code.
20475
20712
 
20476
20713
  `;
@@ -20508,8 +20745,8 @@ function failureComparison(b, previousNote) {
20508
20745
  if (!before.length || !now.length) {
20509
20746
  lines2.push("- Same failure both times? Unknown: the output of at least one run names no file.");
20510
20747
  } else {
20511
- const same2 = now.filter((f) => before.includes(f));
20512
- lines2.push(same2.length ? `- Same failure both times: yes, ${same2.map((f) => `\`${f}\``).join(", ")} fails in both.` : `- Same failure both times: **no**. First ${before.slice(0, 3).map((f) => `\`${f}\``).join(", ")}, now ${now.slice(0, 3).map((f) => `\`${f}\``).join(", ")}. Two different failures look like a flake, not a branch that keeps breaking.`);
20748
+ const same2 = now.filter((f2) => before.includes(f2));
20749
+ lines2.push(same2.length ? `- Same failure both times: yes, ${same2.map((f2) => `\`${f2}\``).join(", ")} fails in both.` : `- Same failure both times: **no**. First ${before.slice(0, 3).map((f2) => `\`${f2}\``).join(", ")}, now ${now.slice(0, 3).map((f2) => `\`${f2}\``).join(", ")}. Two different failures look like a flake, not a branch that keeps breaking.`);
20513
20750
  }
20514
20751
  lines2.push(b.inBranch == null ? "- Failing files among the branch's changes? Unknown: the failure names no file." : b.inBranch ? "- Failing files among the branch's changes: yes." : "- Failing files among the branch's changes: **no**, none of them. Not proof, but the branch probably did not break it.");
20515
20752
  return lines2.join("\n");
@@ -20719,12 +20956,12 @@ var overlap = (a, b) => {
20719
20956
  return a.filter((p) => set.has(p));
20720
20957
  };
20721
20958
  function planRightOfWay(candidates2, tickets, events, contract, now, ttlMinutes) {
20722
- const { open, lapsed } = handBacks(tickets, events, contract, now, ttlMinutes);
20723
- const own = new Map(open.map((h) => [h.ticket.id, h]));
20959
+ const { open: open2, lapsed } = handBacks(tickets, events, contract, now, ttlMinutes);
20960
+ const own = new Map(open2.map((h) => [h.ticket.id, h]));
20724
20961
  const deferrals = [];
20725
20962
  for (const c of candidates2) {
20726
20963
  const mine = own.get(c.ticket.id);
20727
- const first = open.find((h) => h.ticket.id !== c.ticket.id && (!mine || mine.at > h.at || mine.at === h.at && mine.ticket.issue_id > h.ticket.issue_id) && overlap(c.paths, h.paths).length > 0);
20964
+ const first = open2.find((h) => h.ticket.id !== c.ticket.id && (!mine || mine.at > h.at || mine.at === h.at && mine.ticket.issue_id > h.ticket.issue_id) && overlap(c.paths, h.paths).length > 0);
20728
20965
  if (first) deferrals.push({ ticket: c.ticket, waitingFor: first.ticket, paths: overlap(c.paths, first.paths), since: first.at });
20729
20966
  }
20730
20967
  const lapsedUsed = lapsed.filter((h) => candidates2.some((c) => c.ticket.id !== h.ticket.id && overlap(c.paths, h.paths).length > 0));
@@ -20743,12 +20980,12 @@ function deferralComment(d, base, ttlMinutes) {
20743
20980
  ${displayKey(d.waitingFor)} was handed back for a merge conflict in ${list}, which this branch also changes. Releasing this branch first would move \`${base}\` under it again, so the release leaves this ticket at \`verified\` and retries it each cycle until ${displayKey(d.waitingFor)} is verified and released, or until its right of way lapses (${ttlMinutes} minutes after the hand-back). Nothing is needed from anyone.`;
20744
20981
  }
20745
20982
  function deferredFromLog(tickets, events, contract, now, ttlMinutes) {
20746
- const { open } = handBacks(tickets, events, contract, now, ttlMinutes);
20983
+ const { open: open2 } = handBacks(tickets, events, contract, now, ttlMinutes);
20747
20984
  const out = [];
20748
20985
  for (const t of tickets) {
20749
20986
  if (t.status !== contract.statuses.verified) continue;
20750
20987
  const last = events.filter((e) => e.record_id === t.id && e.event_type === DEFERRED_EVENT).sort((a, b) => stampMs(b) - stampMs(a))[0];
20751
- const hb = last && open.find((h) => h.ticket.id === last.metadata?.waiting_for && h.at <= stampMs(last));
20988
+ const hb = last && open2.find((h) => h.ticket.id === last.metadata?.waiting_for && h.at <= stampMs(last));
20752
20989
  if (hb) out.push({ ticket: t, waitingFor: hb.ticket });
20753
20990
  }
20754
20991
  return out;
@@ -20775,7 +21012,7 @@ function platformAdmitters(dir, baseRef, ship, tickets, locate) {
20775
21012
  const branch = locate(t);
20776
21013
  if (!branch) continue;
20777
21014
  const changed2 = gitOk(dir, ["diff", "--name-only", `${baseRef}...${branch}`, "--", ...REPO_CONFIG_FILENAMES]);
20778
- const file = changed2?.split("\n").find((f) => f.trim() !== "");
21015
+ const file = changed2?.split("\n").find((f2) => f2.trim() !== "");
20779
21016
  if (!file) continue;
20780
21017
  const text2 = gitOk(dir, ["show", `${branch}:${file}`]);
20781
21018
  if (text2 === null) continue;
@@ -20946,10 +21183,10 @@ function parseChoices(argv2) {
20946
21183
  function choiceData(key, options) {
20947
21184
  return { key, options, answer: `--choose ${key}=<value>` };
20948
21185
  }
20949
- function usesFlagAnswers(f, isTTY) {
20950
- if (f.noWizard) return true;
21186
+ function usesFlagAnswers(f2, isTTY) {
21187
+ if (f2.noWizard) return true;
20951
21188
  if (isTTY) return false;
20952
- return !!(f.shipName || f.agentBin || f.extraPath || f.hostPassengers);
21189
+ return !!(f2.shipName || f2.agentBin || f2.extraPath || f2.hostPassengers);
20953
21190
  }
20954
21191
  function agentBinSearchDirs(home, pathEnv, extraPath) {
20955
21192
  const dirs = [
@@ -20968,7 +21205,7 @@ function findAgentBin(name, env, extraPath, isExec) {
20968
21205
  const searched = agentBinSearchDirs(env.home ?? homedir10(), env.pathEnv, extraPath);
20969
21206
  return { bin: findOnPath2(name, searched.join(delimiter2), isExec), searched };
20970
21207
  }
20971
- function flagWizardAnswers(f, env) {
21208
+ function flagWizardAnswers(f2, env) {
20972
21209
  const isExec = env.isExecutable ?? ((p) => {
20973
21210
  try {
20974
21211
  accessSync4(p, constants4.X_OK);
@@ -20977,19 +21214,19 @@ function flagWizardAnswers(f, env) {
20977
21214
  return false;
20978
21215
  }
20979
21216
  });
20980
- if (f.agentBin && !isExec(f.agentBin)) return { error: `--agent-bin ${f.agentBin} is not an executable file` };
20981
- const found = f.agentBin ? void 0 : findAgentBin("claude", env, f.extraPath, isExec);
20982
- const agentBin = f.agentBin ?? found?.bin;
21217
+ if (f2.agentBin && !isExec(f2.agentBin)) return { error: `--agent-bin ${f2.agentBin} is not an executable file` };
21218
+ const found = f2.agentBin ? void 0 : findAgentBin("claude", env, f2.extraPath, isExec);
21219
+ const agentBin = f2.agentBin ?? found?.bin;
20983
21220
  const pnpmPath = findOnPath2("pnpm", env.pathEnv, isExec);
20984
- const dockerPath = f.hostPassengers ? findOnPath2("docker", env.pathEnv, isExec) : void 0;
20985
- const extraPath = f.extraPath ?? deriveExtraPath([dirname25(env.nodePath), pnpmPath ? dirname25(pnpmPath) : void 0, dockerPath ? dirname25(dockerPath) : void 0]);
21221
+ const dockerPath = f2.hostPassengers ? findOnPath2("docker", env.pathEnv, isExec) : void 0;
21222
+ const extraPath = f2.extraPath ?? deriveExtraPath([dirname25(env.nodePath), pnpmPath ? dirname25(pnpmPath) : void 0, dockerPath ? dirname25(dockerPath) : void 0]);
20986
21223
  return {
20987
21224
  answers: {
20988
- name: f.shipName?.trim() || env.hostname,
21225
+ name: f2.shipName?.trim() || env.hostname,
20989
21226
  platform: env.platform,
20990
21227
  agentBin: agentBin ?? "claude",
20991
21228
  extraPath,
20992
- hostPassengers: f.hostPassengers
21229
+ hostPassengers: f2.hostPassengers
20993
21230
  },
20994
21231
  ...agentBin ? {} : { agentBinSearched: found?.searched ?? [] }
20995
21232
  };
@@ -21453,8 +21690,8 @@ async function applyExternalClosures(tracker, closures, contract, emit, dryRun,
21453
21690
  // src/pr-links.ts
21454
21691
  function selectPull(pulls, firstPushedAt) {
21455
21692
  const byNewest = [...pulls].sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt));
21456
- const open = byNewest.find((p) => p.open);
21457
- if (open) return open;
21693
+ const open2 = byNewest.find((p) => p.open);
21694
+ if (open2) return open2;
21458
21695
  const cutoff = firstPushedAt ? Date.parse(firstPushedAt) : NaN;
21459
21696
  if (Number.isNaN(cutoff)) return null;
21460
21697
  return byNewest.find((p) => Date.parse(p.createdAt) > cutoff) ?? null;
@@ -21905,8 +22142,8 @@ async function reviewHandoff(o, closures, verifiedCandidates, reviewing) {
21905
22142
  for (const p of problems) o.emit.error(`${o.scope ?? "release"}: ${p}`);
21906
22143
  return void 0;
21907
22144
  }
21908
- const open = new Set(closures.filter((c) => c.closure.state !== "merged").map((c) => c.ticket.id));
21909
- const verified = verifiedCandidates.filter((c) => !!c.branch && open.has(c.ticket.id)).map((c) => ({ ticket: c.ticket, branch: c.branch }));
22145
+ const open2 = new Set(closures.filter((c) => c.closure.state !== "merged").map((c) => c.ticket.id));
22146
+ const verified = verifiedCandidates.filter((c) => !!c.branch && open2.has(c.ticket.id)).map((c) => ({ ticket: c.ticket, branch: c.branch }));
21910
22147
  const outcome = await runReview({
21911
22148
  cwd: o.cwd,
21912
22149
  repo: o.repo,
@@ -21919,7 +22156,7 @@ async function reviewHandoff(o, closures, verifiedCandidates, reviewing) {
21919
22156
  const r = await hook(o, "pr", env);
21920
22157
  return r ? { code: r.code, output: r.output } : null;
21921
22158
  }
21922
- }, verified, reviewing.filter((r) => open.has(r.ticket.id)));
22159
+ }, verified, reviewing.filter((r) => open2.has(r.ticket.id)));
21923
22160
  return outcome.handoffs.length || outcome.requeues.length ? outcome : void 0;
21924
22161
  }
21925
22162
  async function confirmExternalReleased(o, closures) {
@@ -22057,7 +22294,7 @@ async function bump(o, size) {
22057
22294
  }
22058
22295
  return printed;
22059
22296
  }
22060
- const files = o.repo.release.versionFiles.map((f) => join48(o.cwd, f));
22297
+ const files = o.repo.release.versionFiles.map((f2) => join48(o.cwd, f2));
22061
22298
  const first = files[0];
22062
22299
  if (!existsAt(first, existsSync42)) {
22063
22300
  o.emit.error(`no ${o.repo.release.versionFiles[0]} to read a version from`);
@@ -22081,14 +22318,14 @@ async function bump(o, size) {
22081
22318
  o.emit.emit(`would bump ${current} -> ${version} in ${files.length} file(s)`);
22082
22319
  return version;
22083
22320
  }
22084
- for (const f of files) {
22085
- const src = readTextAt(f, (p) => readFileSync41(p, "utf8"));
22321
+ for (const f2 of files) {
22322
+ const src = readTextAt(f2, (p) => readFileSync41(p, "utf8"));
22086
22323
  const out = src.replace(/("version"\s*:\s*")[^"]*(")/, `$1${version}$2`);
22087
22324
  if (out === src) {
22088
- o.emit.error(`no version field in ${f}`);
22325
+ o.emit.error(`no version field in ${f2}`);
22089
22326
  return null;
22090
22327
  }
22091
- writeTextAt(f, out, writeFileSync34);
22328
+ writeTextAt(f2, out, writeFileSync34);
22092
22329
  }
22093
22330
  return version;
22094
22331
  }
@@ -22121,7 +22358,7 @@ async function confirm(o, expected, ci) {
22121
22358
  o.emit.emit(`confirmed live: ${live2.slice(0, 12)}`);
22122
22359
  return true;
22123
22360
  }
22124
- if (ci?.failures.some((f) => f.run.ref === "tag")) {
22361
+ if (ci?.failures.some((f2) => f2.run.ref === "tag")) {
22125
22362
  o.emit.warn(`the CI run for ${ci.q.tag ?? "the release tag"} failed \u2014 not waiting out the remaining ${Math.max(0, Math.round((deadline - Date.now()) / 1e3))}s`);
22126
22363
  return false;
22127
22364
  }
@@ -22161,14 +22398,14 @@ async function sweepCi(o, w, live2) {
22161
22398
  return;
22162
22399
  }
22163
22400
  for (const run4 of failed) {
22164
- if (w.failures.some((f2) => f2.run.id === run4.id)) continue;
22165
- const f = await w.provider.failure(w.q, run4);
22166
- w.failures.push(f);
22167
- o.emit.error(`CI run failed for ${w.version}: ${describeCiFailure(f)}`, { data: { run: run4.id, ref: run4.ref } });
22401
+ if (w.failures.some((f3) => f3.run.id === run4.id)) continue;
22402
+ const f2 = await w.provider.failure(w.q, run4);
22403
+ w.failures.push(f2);
22404
+ o.emit.error(`CI run failed for ${w.version}: ${describeCiFailure(f2)}`, { data: { run: run4.id, ref: run4.ref } });
22168
22405
  }
22169
- w.failures = w.failures.filter((f) => failed.some((r) => r.id === f.run.id));
22406
+ w.failures = w.failures.filter((f2) => failed.some((r) => r.id === f2.run.id));
22170
22407
  if (o.attention) {
22171
- const url = w.failures.find((f) => f.run.url)?.run.url;
22408
+ const url = w.failures.find((f2) => f2.run.url)?.run.url;
22172
22409
  await o.attention.raise({
22173
22410
  kind: "ci_run_failed",
22174
22411
  key: ciKey(o, w.version),
@@ -22265,11 +22502,11 @@ function openReleaseCheckout(o) {
22265
22502
  close();
22266
22503
  throw e;
22267
22504
  }
22268
- for (const f of o.repo.worktrees.copy) {
22269
- const src = join48(o.cwd, f);
22505
+ for (const f2 of o.repo.worktrees.copy) {
22506
+ const src = join48(o.cwd, f2);
22270
22507
  if (!existsSync42(src)) continue;
22271
- mkdirSync30(dirname26(join48(dir, f)), { recursive: true });
22272
- copyFileSync(src, join48(dir, f));
22508
+ mkdirSync30(dirname26(join48(dir, f2)), { recursive: true });
22509
+ copyFileSync(src, join48(dir, f2));
22273
22510
  }
22274
22511
  return { dir, branch, close };
22275
22512
  }
@@ -23393,12 +23630,12 @@ function since(iso, now = Date.now()) {
23393
23630
  if (hours < 48) return `${hours}h`;
23394
23631
  return `${Math.round(hours / 24)}d`;
23395
23632
  }
23396
- function renderFleet(f, state) {
23397
- const rows = f.entries.map((e) => {
23633
+ function renderFleet(f2, state) {
23634
+ const rows = f2.entries.map((e) => {
23398
23635
  if (e.error) return ` ${e.route.route.padEnd(16)} unreachable \u2014 ${e.error}`;
23399
23636
  if (!e.role) return ` ${e.route.route.padEnd(16)} nothing pending`;
23400
23637
  const pending = e.decision?.selection.pending.join(" ") ?? "";
23401
- const win = f.winner?.route.route === e.route.route ? " <- runs this cycle" : "";
23638
+ const win = f2.winner?.route.route === e.route.route ? " <- runs this cycle" : "";
23402
23639
  const streak = state?.fairness(e.route.route).streak() ?? 0;
23403
23640
  const passedOver = !win && streak >= LOUD_STREAK ? ` ! passed over ${streak} cycles running` : "";
23404
23641
  return ` ${e.route.route.padEnd(16)} ${e.role.padEnd(7)} rank ${String(e.rank).padStart(12)} pending: ${pending}${win}${passedOver}`;
@@ -23759,7 +23996,7 @@ async function readMirrorWarmFiles(cache, repo, base, patterns) {
23759
23996
  const res = patterns.map(globToRegExp);
23760
23997
  const out = {};
23761
23998
  let total = 0;
23762
- for (const path of (await cache.listFiles(repo, base)).filter((f) => res.some((re) => re.test(f))).sort()) {
23999
+ for (const path of (await cache.listFiles(repo, base)).filter((f2) => res.some((re) => re.test(f2))).sort()) {
23763
24000
  const content = await cache.showFile(repo, base, path);
23764
24001
  if (content === null) continue;
23765
24002
  total += content.length;
@@ -23832,10 +24069,10 @@ async function reconcileSeatAttention(route2, probes, io) {
23832
24069
  }
23833
24070
  }
23834
24071
  var missingRoles = (probes) => probes.filter((p) => p.state === "missing").map((p) => p.role);
23835
- function mergeSeatAttention(open, route2, probes, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
24072
+ function mergeSeatAttention(open2, route2, probes, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
23836
24073
  const slug2 = routeSlug(route2.route);
23837
24074
  const settled = new Map(probes.filter((p) => p.state !== "unknown").map((p) => [seatMissingKey(slug2, p.role), p.state]));
23838
- const kept = open.filter((i) => i.kind !== "seat_missing" || !settled.has(i.key) || settled.get(i.key) === "missing");
24075
+ const kept = open2.filter((i) => i.kind !== "seat_missing" || !settled.has(i.key) || settled.get(i.key) === "missing");
23839
24076
  const have = new Set(kept.map((i) => i.key));
23840
24077
  const added = probes.filter((p) => p.state === "missing" && !have.has(seatMissingKey(slug2, p.role))).map((p) => seatMissingItem(slug2, p.role, nowIso));
23841
24078
  return [...kept, ...added];
@@ -24113,9 +24350,9 @@ ${res.url}
24113
24350
  ${res.codeTools}
24114
24351
  `;
24115
24352
  }
24116
- function shouldOpen(f) {
24117
- if (f.noOpen || f.json) return false;
24118
- return f.open || f.terminal;
24353
+ function shouldOpen(f2) {
24354
+ if (f2.noOpen || f2.json) return false;
24355
+ return f2.open || f2.terminal;
24119
24356
  }
24120
24357
  function progressComment(url, handoff) {
24121
24358
  return [
@@ -24342,14 +24579,14 @@ function rowForCwd(rows, cwd) {
24342
24579
  }
24343
24580
  var PROTOTYPE_HEADING = "## Prototype";
24344
24581
  function prototypeSection(files) {
24345
- const added = files.reduce((n, f) => n + f.added, 0);
24346
- const removed = files.reduce((n, f) => n + f.removed, 0);
24582
+ const added = files.reduce((n, f2) => n + f2.added, 0);
24583
+ const removed = files.reduce((n, f2) => n + f2.removed, 0);
24347
24584
  return [
24348
24585
  PROTOTYPE_HEADING,
24349
24586
  "",
24350
24587
  "This branch began as a Periscope prototype and may be rewritten rather than treated as reviewed work.",
24351
24588
  "",
24352
- ...files.length === 0 ? ["No files differ from the base."] : files.map((f) => `- \`${f.path}\` (+${f.added} \u2212${f.removed})`),
24589
+ ...files.length === 0 ? ["No files differ from the base."] : files.map((f2) => `- \`${f2.path}\` (+${f2.added} \u2212${f2.removed})`),
24353
24590
  "",
24354
24591
  `${files.length} file${files.length === 1 ? "" : "s"} changed, ${added} insertion${added === 1 ? "" : "s"}(+), ${removed} deletion${removed === 1 ? "" : "s"}(\u2212)`
24355
24592
  ].join("\n");
@@ -24604,9 +24841,9 @@ function readDaemonStarted(stateDir) {
24604
24841
  }
24605
24842
  }
24606
24843
  function configChangedAfter(files, startedAt) {
24607
- for (const f of files) {
24844
+ for (const f2 of files) {
24608
24845
  try {
24609
- if (statSync14(f).mtimeMs > startedAt) return f;
24846
+ if (statSync14(f2).mtimeMs > startedAt) return f2;
24610
24847
  } catch {
24611
24848
  }
24612
24849
  }
@@ -25721,11 +25958,11 @@ function fallbackStateDir(configFile) {
25721
25958
  }
25722
25959
 
25723
25960
  // src/projects-cmd.ts
25724
- async function buildProjectsReport(routes, open) {
25961
+ async function buildProjectsReport(routes, open2) {
25725
25962
  return Promise.all(routes.map(async (r) => {
25726
25963
  const areaId = r.areaId ?? null;
25727
25964
  try {
25728
- const rows = await open(r.route).projectRowsWithModes();
25965
+ const rows = await open2(r.route).projectRowsWithModes();
25729
25966
  return {
25730
25967
  route: r.route,
25731
25968
  areaId,
@@ -26138,12 +26375,12 @@ var WORKING_STEPS = /* @__PURE__ */ new Set(["worktree", "agent", "reconcile", "
26138
26375
  function byRoute(events, route2) {
26139
26376
  return route2 ? events.filter((e) => e.route === route2) : events;
26140
26377
  }
26141
- function matches(e, f) {
26142
- if (f.role && e.role !== f.role) return false;
26143
- if (f.ticket && e.ticket !== f.ticket) return false;
26144
- if (f.route && e.route !== f.route) return false;
26145
- if (f.level === "warn" && e.level === "info") return false;
26146
- if (f.level === "error" && e.level !== "error") return false;
26378
+ function matches(e, f2) {
26379
+ if (f2.role && e.role !== f2.role) return false;
26380
+ if (f2.ticket && e.ticket !== f2.ticket) return false;
26381
+ if (f2.route && e.route !== f2.route) return false;
26382
+ if (f2.level === "warn" && e.level === "info") return false;
26383
+ if (f2.level === "error" && e.level !== "error") return false;
26147
26384
  return true;
26148
26385
  }
26149
26386
  function localTime(iso) {
@@ -26660,9 +26897,12 @@ async function discover(o) {
26660
26897
  }
26661
26898
  } else {
26662
26899
  const projects = await get(o, `/projects?workspaceId=${ws.id}`);
26900
+ const implementers = await findImplementers((path) => get(o, path), ws.id);
26901
+ const declaredHere = implementers === "unreadable" ? [] : implementers.filter((i) => projects.some((p) => p.id === i.project.id));
26663
26902
  const issuesKeys = await resolveIssuesTemplateKeys(o);
26664
- const defaultCandidate = projects.find((p) => !!p.sourceTemplateId && issuesKeys.has(p.sourceTemplateId)) ?? projects.find((p) => eq(p.slug ?? "", "issues"));
26665
- if (defaultCandidate && (await missingTables(o, defaultCandidate.id)).length === 0) {
26903
+ const declaredCandidate = declaredHere.length === 1 ? projects.find((p) => p.id === declaredHere[0].project.id) : void 0;
26904
+ const defaultCandidate = declaredCandidate ?? projects.find((p) => !!p.sourceTemplateId && issuesKeys.has(p.sourceTemplateId)) ?? projects.find((p) => eq(p.slug ?? "", "issues"));
26905
+ if (defaultCandidate && (declaredCandidate || (await missingTables(o, defaultCandidate.id)).length === 0)) {
26666
26906
  out.projectId = defaultCandidate.id;
26667
26907
  out.projectSlug = defaultCandidate.slug;
26668
26908
  out.projectName = defaultCandidate.name;
@@ -26691,22 +26931,53 @@ async function discover(o) {
26691
26931
  }
26692
26932
  if (!out.projectId) return out;
26693
26933
  const models = await get(o, `/data-models?projectId=${out.projectId}`);
26694
- const find = (name) => models.find((m) => eq(m.name, name))?.id;
26695
- for (const [key, name] of [["issues", "Issues"], ["comments", "Comments"], ["crew", "Crew"]]) {
26696
- const id = find(name);
26697
- if (id) out.models[key] = id;
26698
- else problems.push(`no "${name}" table \u2014 have: ${models.map((m) => m.name).join(", ")}`);
26934
+ const iface = await readInterfaceState((path) => get(o, path), ws.id, out.projectId);
26935
+ out.interface = iface;
26936
+ const usesMapping = iface.kind === "declared" && iface.accepted;
26937
+ const mapping = iface.kind === "declared" ? iface.mapping : void 0;
26938
+ let contractNow = DEFAULT_CONTRACT;
26939
+ if (iface.kind === "declared" && mapping) {
26940
+ if (!iface.accepted) problems.push(versionMismatchMessage(iface.version));
26941
+ else {
26942
+ out.declaredContract = contractFromMapping(DEFAULT_CONTRACT, mapping);
26943
+ out.declaredMappingKey = mappingKey(mapping);
26944
+ contractNow = out.declaredContract;
26945
+ if (iface.conforms === false) {
26946
+ problems.push(
26947
+ `the app declares work-tracker interface ${versionLabel(iface.version)} but does not conform:
26948
+ ` + describeDifferences(iface.unmet).join("\n ")
26949
+ );
26950
+ }
26951
+ }
26952
+ }
26953
+ const tableByRole = (role) => {
26954
+ if (usesMapping) {
26955
+ const name = mappedTableName(mapping, role);
26956
+ return name ? models.find((m) => eq(m.name, name))?.id : void 0;
26957
+ }
26958
+ const entry = TABLE_ENTRIES.find((t) => t.role === role);
26959
+ return entry ? models.find((m) => eq(m.name, entry.defaultName))?.id : void 0;
26960
+ };
26961
+ const find = (role) => tableByRole(role);
26962
+ const have = () => models.map((m) => m.name).join(", ");
26963
+ for (const role of ["issues", "comments", "crew"]) {
26964
+ const id = find(role);
26965
+ if (id) out.models[role] = id;
26966
+ else {
26967
+ const wanted = usesMapping ? mappedTableName(mapping, role) ?? `(no table mapped for ${role})` : TABLE_ENTRIES.find((t) => t.role === role).defaultName;
26968
+ problems.push(`no "${wanted}" table \u2014 have: ${have()}`);
26969
+ }
26699
26970
  }
26700
26971
  if (out.models.issues) {
26701
26972
  try {
26702
26973
  const issuesModel = await get(o, `/data-models/${out.models.issues}`);
26703
- const statusField = issuesModel.fields.find((f) => f.columnName === DEFAULT_CONTRACT.columns.status);
26974
+ const statusField = issuesModel.fields.find((f2) => f2.columnName === contractNow.columns.status);
26704
26975
  const known = /* @__PURE__ */ new Set([
26705
- ...DEFAULT_CONTRACT.statuses.open,
26706
- ...DEFAULT_CONTRACT.statuses.resolved,
26707
- DEFAULT_CONTRACT.statuses.draft
26976
+ ...contractNow.statuses.open,
26977
+ ...contractNow.statuses.resolved,
26978
+ contractNow.statuses.draft
26708
26979
  ]);
26709
- out.unrecognizedStatuses = (statusField?.fieldType?.choiceOptions ?? []).filter((opt) => !known.has(opt.value)).sort((a, b) => (a.position ?? 0) - (b.position ?? 0)).map((opt) => ({ value: opt.value, label: opt.label ?? void 0, position: opt.position ?? void 0 }));
26980
+ out.unrecognizedStatuses = (statusField?.fieldType?.choiceOptions ?? []).filter((opt2) => !known.has(opt2.value)).sort((a, b) => (a.position ?? 0) - (b.position ?? 0)).map((opt2) => ({ value: opt2.value, label: opt2.label ?? void 0, position: opt2.position ?? void 0 }));
26710
26981
  } catch {
26711
26982
  }
26712
26983
  }
@@ -26716,8 +26987,8 @@ async function discover(o) {
26716
26987
  try {
26717
26988
  const model = await get(o, `/data-models/${out.models.issues}`);
26718
26989
  const tracked2 = model.eventLogConfig?.trackedFields;
26719
- if (Array.isArray(tracked2) && !tracked2.includes(DEFAULT_CONTRACT.columns.status)) {
26720
- problems.push(EVENT_LOG_STATUS_UNTRACKED(DEFAULT_CONTRACT.columns.status));
26990
+ if (Array.isArray(tracked2) && !tracked2.includes(contractNow.columns.status)) {
26991
+ problems.push(EVENT_LOG_STATUS_UNTRACKED(contractNow.columns.status));
26721
26992
  }
26722
26993
  } catch {
26723
26994
  }
@@ -26725,13 +26996,13 @@ async function discover(o) {
26725
26996
  if (e instanceof ConnectHttpError && e.status === 404) problems.push(EVENT_LOG_MISSING);
26726
26997
  }
26727
26998
  }
26728
- out.areaModelId = find("Projects");
26729
- out.reposModelId = find("Repos");
26730
- out.shipsModelId = find("Ships");
26731
- out.epicsModelId = find("Epics");
26732
- out.mapsModelId = find("Maps");
26733
- out.periscopesModelId = find("Periscopes");
26734
- out.locksModelId = find("Locks");
26999
+ out.areaModelId = find("projects");
27000
+ out.reposModelId = find("repos");
27001
+ out.shipsModelId = find("ships");
27002
+ out.epicsModelId = find("epics");
27003
+ out.mapsModelId = find("maps");
27004
+ out.periscopesModelId = find("periscopes");
27005
+ out.locksModelId = find("locks");
26735
27006
  try {
26736
27007
  const views = await get(o, `/views?workspaceId=${ws.id}`);
26737
27008
  const candidates2 = views.filter((v) => v.recordLinkOnly === true && v.published === true && !!v.publicSlug && (v.pages ?? []).some((p) => (p.components ?? []).some((c) => c.dataModelId === out.models.issues)));
@@ -26784,10 +27055,10 @@ async function discover(o) {
26784
27055
  const shipOptions = /* @__PURE__ */ new Map();
26785
27056
  try {
26786
27057
  const shipsModel = await get(o, `/data-models/${out.shipsModelId}`);
26787
- shipColumns = new Set((shipsModel.fields ?? []).map((f) => f.columnName));
26788
- for (const f of shipsModel.fields ?? []) {
26789
- const opts = f.fieldType?.choiceOptions;
26790
- if (Array.isArray(opts)) shipOptions.set(f.columnName, new Set(opts.map((x) => x.value)));
27058
+ shipColumns = new Set((shipsModel.fields ?? []).map((f2) => f2.columnName));
27059
+ for (const f2 of shipsModel.fields ?? []) {
27060
+ const opts = f2.fieldType?.choiceOptions;
27061
+ if (Array.isArray(opts)) shipOptions.set(f2.columnName, new Set(opts.map((x) => x.value)));
26791
27062
  }
26792
27063
  } catch {
26793
27064
  }
@@ -27575,14 +27846,14 @@ function renderRepoCheck(r) {
27575
27846
 
27576
27847
  // src/repos-hooks.ts
27577
27848
  import { isMap as isMap3, parseDocument as parseDocument6, YAMLMap } from "yaml";
27578
- function packageManager(f) {
27579
- if (f.exists("pnpm-lock.yaml")) return "pnpm";
27580
- if (f.exists("yarn.lock")) return "yarn";
27581
- if (f.exists("bun.lock") || f.exists("bun.lockb")) return "bun";
27849
+ function packageManager(f2) {
27850
+ if (f2.exists("pnpm-lock.yaml")) return "pnpm";
27851
+ if (f2.exists("yarn.lock")) return "yarn";
27852
+ if (f2.exists("bun.lock") || f2.exists("bun.lockb")) return "bun";
27582
27853
  return "npm";
27583
27854
  }
27584
- function fromPackageJson(f) {
27585
- const text2 = f.read("package.json");
27855
+ function fromPackageJson(f2) {
27856
+ const text2 = f2.read("package.json");
27586
27857
  if (text2 === void 0) return void 0;
27587
27858
  let pkg;
27588
27859
  try {
@@ -27591,7 +27862,7 @@ function fromPackageJson(f) {
27591
27862
  return void 0;
27592
27863
  }
27593
27864
  if (!pkg || typeof pkg !== "object") return void 0;
27594
- const pm = packageManager(f);
27865
+ const pm = packageManager(f2);
27595
27866
  const scripts = pkg.scripts && typeof pkg.scripts === "object" ? pkg.scripts : {};
27596
27867
  const out = {};
27597
27868
  if (typeof scripts.test === "string") out.test = `${pm} test`;
@@ -27602,14 +27873,14 @@ function fromPackageJson(f) {
27602
27873
  }
27603
27874
  return out;
27604
27875
  }
27605
- function fromPackageSwift(f) {
27606
- return f.exists("Package.swift") ? { test: "swift test", build: "swift build" } : void 0;
27876
+ function fromPackageSwift(f2) {
27877
+ return f2.exists("Package.swift") ? { test: "swift test", build: "swift build" } : void 0;
27607
27878
  }
27608
- function fromPyproject(f) {
27609
- return f.exists("pyproject.toml") ? { test: "pytest" } : void 0;
27879
+ function fromPyproject(f2) {
27880
+ return f2.exists("pyproject.toml") ? { test: "pytest" } : void 0;
27610
27881
  }
27611
- function fromMakefile(f) {
27612
- const text2 = f.read("Makefile") ?? f.read("makefile") ?? f.read("GNUmakefile");
27882
+ function fromMakefile(f2) {
27883
+ const text2 = f2.read("Makefile") ?? f2.read("makefile") ?? f2.read("GNUmakefile");
27613
27884
  if (text2 === void 0) return void 0;
27614
27885
  const out = {};
27615
27886
  for (const target of ["test", "build"]) {
@@ -27624,8 +27895,8 @@ var DETECTORS = [
27624
27895
  { source: "Makefile", detect: fromMakefile }
27625
27896
  ];
27626
27897
  var WORKFLOW_RE = /\.ya?ml$/;
27627
- function detectRecipes(f) {
27628
- const workflows = (f.list?.(".github/workflows") ?? []).filter((n) => WORKFLOW_RE.test(n)).sort();
27898
+ function detectRecipes(f2) {
27899
+ const workflows = (f2.list?.(".github/workflows") ?? []).filter((n) => WORKFLOW_RE.test(n)).sort();
27629
27900
  if (workflows.length === 0) return [];
27630
27901
  const evidence = workflows.map((n) => `.github/workflows/${n}`);
27631
27902
  return [
@@ -27652,10 +27923,10 @@ function detectRecipes(f) {
27652
27923
  }
27653
27924
  ];
27654
27925
  }
27655
- function suggestHooks(f) {
27656
- const recipes = detectRecipes(f);
27926
+ function suggestHooks(f2) {
27927
+ const recipes = detectRecipes(f2);
27657
27928
  const found = DETECTORS.flatMap((d) => {
27658
- const hooks = d.detect(f);
27929
+ const hooks = d.detect(f2);
27659
27930
  return hooks && Object.keys(hooks).length > 0 ? [{ source: d.source, hooks }] : [];
27660
27931
  });
27661
27932
  if (found.length === 0) {
@@ -27791,8 +28062,8 @@ function starterRepoConfig(hooks, release) {
27791
28062
  parseRepoConfig(text2, ".crew.yaml");
27792
28063
  return text2;
27793
28064
  }
27794
- function existingRepoConfig(f) {
27795
- return REPO_CONFIG_FILENAMES.find((n) => f.exists(n));
28065
+ function existingRepoConfig(f2) {
28066
+ return REPO_CONFIG_FILENAMES.find((n) => f2.exists(n));
27796
28067
  }
27797
28068
 
27798
28069
  // src/repos-hooks-agent.ts
@@ -28150,40 +28421,40 @@ ${body}`;
28150
28421
  const text2 = m ? m[2].trim() : body;
28151
28422
  const parent = continuation ? this.last : void 0;
28152
28423
  const section = repo ? "repositories" : sectionOf(label) ?? parent?.section ?? this.last?.section ?? "ship";
28153
- const f = { severity: classifySeverity(label, text2), section, label, text: text2, ...repo ? { repo } : {} };
28424
+ const f2 = { severity: classifySeverity(label, text2), section, label, text: text2, ...repo ? { repo } : {} };
28154
28425
  if (!repo) {
28155
28426
  const mentions = this.mentionedRepo(text2);
28156
- if (mentions) f.mentions = mentions;
28427
+ if (mentions) f2.mentions = mentions;
28157
28428
  }
28158
- this.findings.push(f);
28159
- this.last = f;
28429
+ this.findings.push(f2);
28430
+ this.last = f2;
28160
28431
  }
28161
28432
  }
28162
28433
  counts() {
28163
- const merged = groupFindings(this.findings.filter((f) => RANK[f.severity] >= RANK.note));
28434
+ const merged = groupFindings(this.findings.filter((f2) => RANK[f2.severity] >= RANK.note));
28164
28435
  const c = { blocker: 0, warning: 0, note: 0, passed: 0 };
28165
28436
  for (const g of merged) c[g.severity]++;
28166
- c.passed = this.findings.filter((f) => RANK[f.severity] < RANK.note).length;
28437
+ c.passed = this.findings.filter((f2) => RANK[f2.severity] < RANK.note).length;
28167
28438
  return c;
28168
28439
  }
28169
28440
  };
28170
28441
  function groupFindings(findings) {
28171
28442
  const out = [];
28172
28443
  const byKey = /* @__PURE__ */ new Map();
28173
- for (const f of findings) {
28174
- const repo = f.repo ?? f.mentions;
28444
+ for (const f2 of findings) {
28445
+ const repo = f2.repo ?? f2.mentions;
28175
28446
  if (!repo) {
28176
- out.push({ ...f, repos: [] });
28447
+ out.push({ ...f2, repos: [] });
28177
28448
  continue;
28178
28449
  }
28179
28450
  const norm = (s) => s.split(repo).join("<repo>");
28180
- const key = [f.severity, f.section, norm(f.label), norm(f.text)].join("\0");
28451
+ const key = [f2.severity, f2.section, norm(f2.label), norm(f2.text)].join("\0");
28181
28452
  const hit = byKey.get(key);
28182
28453
  if (hit) {
28183
28454
  if (!hit.repos.includes(repo)) hit.repos.push(repo);
28184
28455
  continue;
28185
28456
  }
28186
- const g = { ...f, repos: [repo] };
28457
+ const g = { ...f2, repos: [repo] };
28187
28458
  byKey.set(key, g);
28188
28459
  out.push(g);
28189
28460
  }
@@ -28210,7 +28481,7 @@ function renderDoctor(report, header, verbose) {
28210
28481
  const c = report.counts();
28211
28482
  const out = [...header];
28212
28483
  if (!verbose) {
28213
- const shown = groupFindings(report.findings.filter((f) => RANK[f.severity] >= RANK.note)).sort((a, b) => RANK[b.severity] - RANK[a.severity]);
28484
+ const shown = groupFindings(report.findings.filter((f2) => RANK[f2.severity] >= RANK.note)).sort((a, b) => RANK[b.severity] - RANK[a.severity]);
28214
28485
  for (const g of shown) {
28215
28486
  const sev = SEVERITY_WORD[g.severity];
28216
28487
  const where = g.repos.length ? ` [${reposPhrase(g.repos)}]` : "";
@@ -28226,24 +28497,24 @@ function renderDoctor(report, header, verbose) {
28226
28497
  `;
28227
28498
  }
28228
28499
  for (const s of DOCTOR_SECTIONS) {
28229
- const inSection = report.findings.filter((f) => f.section === s.id);
28500
+ const inSection = report.findings.filter((f2) => f2.section === s.id);
28230
28501
  if (inSection.length === 0) continue;
28231
28502
  out.push("", s.title, "-".repeat(s.title.length));
28232
28503
  const block = (items, indent, strip) => {
28233
- const labelOf2 = (f) => strip && f.label === `repo ${strip}` ? "path" : f.label;
28234
- const width = Math.min(26, Math.max(...items.map((f) => labelOf2(f) ? labelOf2(f).length + 1 : 0))) + 1;
28235
- for (const f of items) {
28236
- const l = labelOf2(f);
28504
+ const labelOf2 = (f2) => strip && f2.label === `repo ${strip}` ? "path" : f2.label;
28505
+ const width = Math.min(26, Math.max(...items.map((f2) => labelOf2(f2) ? labelOf2(f2).length + 1 : 0))) + 1;
28506
+ for (const f2 of items) {
28507
+ const l = labelOf2(f2);
28237
28508
  const lab = l ? `${l}:` : "";
28238
28509
  const col = lab.length >= width ? `${lab} ` : lab.padEnd(width);
28239
- out.push(`${" ".repeat(indent)}${col}${indentContinuation(f.text, indent + col.length)}`);
28510
+ out.push(`${" ".repeat(indent)}${col}${indentContinuation(f2.text, indent + col.length)}`);
28240
28511
  }
28241
28512
  };
28242
28513
  if (s.id === "repositories") {
28243
- const names = [...new Set(inSection.map((f) => f.repo ?? ""))];
28514
+ const names = [...new Set(inSection.map((f2) => f2.repo ?? ""))];
28244
28515
  for (const n of names) {
28245
28516
  out.push(n ? ` ${n}` : "");
28246
- block(inSection.filter((f) => (f.repo ?? "") === n), 4, n);
28517
+ block(inSection.filter((f2) => (f2.repo ?? "") === n), 4, n);
28247
28518
  }
28248
28519
  } else block(inSection, 0);
28249
28520
  }
@@ -28629,13 +28900,13 @@ function planSizeCapSweep(stateDir, maxBytes, now = Date.now()) {
28629
28900
  };
28630
28901
  add(join59(stateDir, "streams"), () => true);
28631
28902
  add(stateDir, (name) => ROTATED_EVENTS_RE.test(name));
28632
- let total = files.reduce((n, f) => n + f.size, 0);
28903
+ let total = files.reduce((n, f2) => n + f2.size, 0);
28633
28904
  const out = [];
28634
- for (const f of files.sort((a, b) => a.mtime - b.mtime)) {
28905
+ for (const f2 of files.sort((a, b) => a.mtime - b.mtime)) {
28635
28906
  if (total <= maxBytes) break;
28636
- if (f.mtime > now - DAY_MS2) break;
28637
- out.push(f.path);
28638
- total -= f.size;
28907
+ if (f2.mtime > now - DAY_MS2) break;
28908
+ out.push(f2.path);
28909
+ total -= f2.size;
28639
28910
  }
28640
28911
  return out;
28641
28912
  }
@@ -28726,7 +28997,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
28726
28997
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
28727
28998
  import { join as join60 } from "path";
28728
28999
  function builtVersion() {
28729
- return true ? "0.159.3" : null;
29000
+ return true ? "0.160.0" : null;
28730
29001
  }
28731
29002
  var REBUILD_HINT = "rebuild with npm run build";
28732
29003
  function newestMtime(path) {
@@ -28852,8 +29123,8 @@ function endpointsUrl(api, workspaceId, id) {
28852
29123
  return id ? `${base}/${id}` : base;
28853
29124
  }
28854
29125
  async function call(api, method, url, body) {
28855
- const f = api.fetchFn ?? fetch;
28856
- return f(url, {
29126
+ const f2 = api.fetchFn ?? fetch;
29127
+ return f2(url, {
28857
29128
  method,
28858
29129
  headers: {
28859
29130
  Authorization: `Bearer ${api.apiKey}`,
@@ -29098,7 +29369,7 @@ function readAllPersistedSyncWorkspaceIds(stateDir) {
29098
29369
  const dir = join61(stateDir, "passengers");
29099
29370
  if (!existsSync57(dir)) return [];
29100
29371
  const suffix = "-sync.json";
29101
- return readdirSync19(dir).filter((f) => f.endsWith(suffix)).map((f) => f.slice(0, -suffix.length));
29372
+ return readdirSync19(dir).filter((f2) => f2.endsWith(suffix)).map((f2) => f2.slice(0, -suffix.length));
29102
29373
  }
29103
29374
  function syncPassengerSyncDaemons(plans, cfg, stateDir, deps = {}) {
29104
29375
  const alive = deps.isPidAlive ?? isPidAlive;
@@ -29570,7 +29841,7 @@ function contractFixers(dir, baseRef, tickets, locate) {
29570
29841
  const branch = locate(t);
29571
29842
  if (!branch) continue;
29572
29843
  const changed2 = gitOk(dir, ["diff", "--name-only", `${baseRef}...${branch}`, "--", ...REPO_CONFIG_FILENAMES]);
29573
- const file = changed2?.split("\n").find((f) => f.trim() !== "");
29844
+ const file = changed2?.split("\n").find((f2) => f2.trim() !== "");
29574
29845
  if (!file) continue;
29575
29846
  const text2 = gitOk(dir, ["show", `${branch}:${file}`]);
29576
29847
  if (text2 === null) continue;
@@ -29669,13 +29940,13 @@ async function execute(h, args, streaming, after) {
29669
29940
  return done ? { status: 200, body: done } : { status: 502, body: { error: "the command finished without a result" } };
29670
29941
  };
29671
29942
  const finish = async (r) => {
29672
- const f = finishRaw(r);
29673
- return f.status === 200 && after ? { status: 200, body: await after(f.body) } : f;
29943
+ const f2 = finishRaw(r);
29944
+ return f2.status === 200 && after ? { status: 200, body: await after(f2.body) } : f2;
29674
29945
  };
29675
29946
  if (!streaming) {
29676
- const f = await finish(await h.run(args, () => {
29947
+ const f2 = await finish(await h.run(args, () => {
29677
29948
  }));
29678
- return reply(f.status, f.body);
29949
+ return reply(f2.status, f2.body);
29679
29950
  }
29680
29951
  return {
29681
29952
  status: 200,
@@ -29685,8 +29956,8 @@ async function execute(h, args, streaming, after) {
29685
29956
  const ev = parseLine2(line);
29686
29957
  if (ev) write(ev);
29687
29958
  });
29688
- const f = await finish(r);
29689
- write(f.status === 200 ? f.body : { event: "error", status: f.status, message: f.body.error });
29959
+ const f2 = await finish(r);
29960
+ write(f2.status === 200 ? f2.body : { event: "error", status: f2.status, message: f2.body.error });
29690
29961
  }
29691
29962
  };
29692
29963
  }
@@ -30040,12 +30311,12 @@ function waitForChange(dir, ms3, signal) {
30040
30311
  }
30041
30312
  var reply2 = (status2, body) => ({ status: status2, body });
30042
30313
  var err2 = (status2, message) => reply2(status2, { error: message });
30043
- function failureReply(what, f, log) {
30044
- log?.(`control API: could not produce the ${what} document: ${f.reason}: ${f.detail}`);
30314
+ function failureReply(what, f2, log) {
30315
+ log?.(`control API: could not produce the ${what} document: ${f2.reason}: ${f2.detail}`);
30045
30316
  return reply2(502, {
30046
30317
  error: `could not produce the ${what === "status" ? "status document" : "doctor report"}`,
30047
- reason: f.reason,
30048
- detail: f.detail
30318
+ reason: f2.reason,
30319
+ detail: f2.detail
30049
30320
  });
30050
30321
  }
30051
30322
  function pauseDoc(state) {
@@ -30593,7 +30864,7 @@ function createPeriscopeMcpServer(d, sc) {
30593
30864
  }, async ({ pattern }) => {
30594
30865
  const re = globToRegExp2(pattern);
30595
30866
  const listing = git(root, ["ls-files", "-z", "--cached", "--others", "--exclude-standard"]);
30596
- const hits = listing.split("\0").filter((f) => f && re.test(f)).slice(0, MAX_SEARCH_RESULTS);
30867
+ const hits = listing.split("\0").filter((f2) => f2 && re.test(f2)).slice(0, MAX_SEARCH_RESULTS);
30597
30868
  return text(hits.length ? hits.join("\n") : "No matches found");
30598
30869
  });
30599
30870
  server.registerTool("write_file", {
@@ -31950,6 +32221,9 @@ if (command === "passenger-sync-daemon") {
31950
32221
  problems.push(`tracker unreachable: ${e instanceof Error ? e.message : String(e)}`);
31951
32222
  }
31952
32223
  if (await tracker.eventLogTracksStatus() === false) problems.push(EVENT_LOG_STATUS_UNTRACKED(tracker.contract.columns.status));
32224
+ for (const l of interfaceReport(await readForRoute(c, cfg.ship), { storedMappingKey: c.resolved?.trackerInterface?.mappingKey, contractAuthored: c.contractAuthored })) {
32225
+ if (l.problem) problems.push(l.line);
32226
+ }
31953
32227
  const diff = await snapshotDiffFor(c);
31954
32228
  return { problems, readiness, snapshotStale: !!diff && isStale(diff) };
31955
32229
  }
@@ -32468,7 +32742,7 @@ ${changed2.map((c) => ` - ${c}
32468
32742
  );
32469
32743
  if (fixers.length === 0) throw refusal;
32470
32744
  remit.emit(
32471
- `${target.name}: the base contract is refused (${refusal.message}); ${fixers.map((f) => f.issueId).join(", ")} replace${fixers.length === 1 ? "s" : ""} ${fixers[0].file} \u2014 merging first`,
32745
+ `${target.name}: the base contract is refused (${refusal.message}); ${fixers.map((f2) => f2.issueId).join(", ")} replace${fixers.length === 1 ? "s" : ""} ${fixers[0].file} \u2014 merging first`,
32472
32746
  { step: "release" }
32473
32747
  );
32474
32748
  }
@@ -32718,9 +32992,9 @@ ${changed2.map((c) => ` - ${c}
32718
32992
  const ci = outcome.ci;
32719
32993
  const version = outcome.version ?? ci.tag ?? ci.sha.slice(0, 8);
32720
32994
  const batch = [...outcome.merged.length ? outcome.merged.map((m) => displayKey(m.ticket)) : tickets.filter((t) => t.status === verifiedStatus).map((t) => displayKey(t))];
32721
- const runs = ci.failures.map((f) => {
32722
- const lines2 = [`- ${describeCiFailure(f)}`];
32723
- if (f.logTail) lines2.push("", " ```", ...f.logTail.split("\n").map((l) => ` ${l}`), " ```");
32995
+ const runs = ci.failures.map((f2) => {
32996
+ const lines2 = [`- ${describeCiFailure(f2)}`];
32997
+ if (f2.logTail) lines2.push("", " ```", ...f2.logTail.split("\n").map((l) => ` ${l}`), " ```");
32724
32998
  return lines2.join("\n");
32725
32999
  }).join("\n");
32726
33000
  const news2 = {
@@ -32810,15 +33084,15 @@ ${cu.tail.trimEnd()}
32810
33084
  }
32811
33085
  if (outcome.flakes?.length && !dryRun) {
32812
33086
  const seat = releaseSeat(c);
32813
- for (const f of outcome.flakes) {
32814
- const files = f.files.length ? f.files.map((p) => `\`${p}\``).join(", ") : "no file named in the output";
33087
+ for (const f2 of outcome.flakes) {
33088
+ const files = f2.files.length ? f2.files.map((p) => `\`${p}\``).join(", ") : "no file named in the output";
32815
33089
  await applyFailureAlert(tracker, {
32816
33090
  level: "warn",
32817
- headline: `${scope}: flaky ${f.hook} gate`,
32818
- detail: `The \`${f.hook}\` hook (${f.label}) failed once during a release and passed on an immediate rerun of the same composition, so no branch was blamed and the release went on. Failing: ${files}.
33091
+ headline: `${scope}: flaky ${f2.hook} gate`,
33092
+ detail: `The \`${f2.hook}\` hook (${f2.label}) failed once during a release and passed on an immediate rerun of the same composition, so no branch was blamed and the release went on. Failing: ${files}.
32819
33093
 
32820
33094
  \`\`\`
32821
- ${f.tail.trimEnd()}
33095
+ ${f2.tail.trimEnd()}
32822
33096
  \`\`\``
32823
33097
  }, scope, all, seat, remit, dryRun, await alertPlacement()).catch((e) => {
32824
33098
  remit.warn(`could not file/update a flaky-gate ticket: ${e.message}`, { step: "release" });
@@ -32829,24 +33103,24 @@ ${f.tail.trimEnd()}
32829
33103
  const handedBack = [...await tracker.events("conflict_handed_back"), ...await tracker.events("pushed")];
32830
33104
  const flagged = await tracker.events("stranded_flagged");
32831
33105
  const seat = releaseSeat(c);
32832
- for (const f of outcome.conflicts ?? []) {
33106
+ for (const f2 of outcome.conflicts ?? []) {
32833
33107
  try {
32834
33108
  const bounce = planConflictBounce(
32835
33109
  target.dir,
32836
- f.candidate.ticket,
32837
- f.candidate.branch,
33110
+ f2.candidate.ticket,
33111
+ f2.candidate.branch,
32838
33112
  repo.branch.base,
32839
- f.paths,
33113
+ f2.paths,
32840
33114
  handedBack,
32841
33115
  outcome.merged.filter((m) => m.branch).map((m) => ({ key: m.ticket.issue_id, branch: m.branch }))
32842
33116
  );
32843
33117
  const r = await applyConflictBounce(tracker, bounce, tracker.contract, seat, remit, dryRun);
32844
33118
  if (r.kind === "failed") {
32845
- remit.warn(`could not hand back ${displayKey(f.candidate.ticket)}: ${r.why}`, { step: "merge" });
33119
+ remit.warn(`could not hand back ${displayKey(f2.candidate.ticket)}: ${r.why}`, { step: "merge" });
32846
33120
  }
32847
33121
  } catch (e) {
32848
33122
  remit.warn(
32849
- `could not hand back ${displayKey(f.candidate.ticket)}: ${e.message}`,
33123
+ `could not hand back ${displayKey(f2.candidate.ticket)}: ${e.message}`,
32850
33124
  { step: "merge" }
32851
33125
  );
32852
33126
  }
@@ -34178,9 +34452,9 @@ ${f.tail.trimEnd()}
34178
34452
  originOf,
34179
34453
  exists: (d) => existsSync60(d),
34180
34454
  isCheckout,
34181
- repoHasHooks: (d) => REPO_CONFIG_FILENAMES.some((f) => {
34455
+ repoHasHooks: (d) => REPO_CONFIG_FILENAMES.some((f2) => {
34182
34456
  try {
34183
- const path = resolvePath(d, f);
34457
+ const path = resolvePath(d, f2);
34184
34458
  return Object.keys(parseRepoConfig(readFileSync57(path, "utf8"), path).hooks).length > 0;
34185
34459
  } catch {
34186
34460
  return false;
@@ -34811,6 +35085,21 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, t
34811
35085
  ...resolvedStatusValues.length > 0 ? { resolved: [...DEFAULT_CONTRACT.statuses.resolved, ...resolvedStatusValues] } : {}
34812
35086
  }
34813
35087
  } : void 0;
35088
+ const declared = found.declaredContract && found.declaredMappingKey && found.interface?.kind === "declared" ? {
35089
+ contract: {
35090
+ ...found.declaredContract,
35091
+ statuses: {
35092
+ ...found.declaredContract.statuses,
35093
+ resolved: [.../* @__PURE__ */ new Set([...found.declaredContract.statuses.resolved, ...resolvedStatusValues])]
35094
+ }
35095
+ },
35096
+ trackerInterface: { declared: true, version: versionLabel(found.interface.version), mappingKey: found.declaredMappingKey }
35097
+ } : void 0;
35098
+ if (declared && existingRoute?.contractAuthored) emit.warn(`Note: ${OVERRIDE_IGNORED_MESSAGE}`);
35099
+ if (found.interface?.kind === "declared" && found.interface.accepted) {
35100
+ emit.note(`The app declares work-tracker interface ${versionLabel(found.interface.version)}${found.interface.conforms === false ? " (does not conform)" : found.interface.conforms ? " and conforms" : ""} \u2014 tables and columns read from its mapping`);
35101
+ }
35102
+ if (found.interface?.kind === "undeclared") emit.note(`Note: ${UNDECLARED_MESSAGE}`);
34814
35103
  const resolved = {
34815
35104
  workspaceId: found.workspaceId,
34816
35105
  projectId: found.projectId,
@@ -34834,7 +35123,7 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, t
34834
35123
  ...found.role ?? previous?.role ? { role: found.role ?? previous?.role } : {},
34835
35124
  ...capabilityMisses.length > 0 ? { capabilityMisses } : {},
34836
35125
  ...operator ? { operator } : {},
34837
- ...contract ? { contract } : {},
35126
+ ...declared ? { contract: declared.contract, trackerInterface: declared.trackerInterface } : contract ? { contract } : {},
34838
35127
  ...reviewedStatuses.length > 0 ? { reviewedStatuses } : {},
34839
35128
  // CREW-1055: connect only ever discovers ids — it never syncs
34840
35129
  // personas/skills itself — so carry forward whatever `crew agents
@@ -35308,9 +35597,9 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`);
35308
35597
  }
35309
35598
  const dropped = flag("prune") ? await cache.prune(served) : [];
35310
35599
  const mirrors = await cache.list();
35311
- const open = openShipAttention(new State(cfg.ship.stateDir));
35600
+ const open2 = openShipAttention(new State(cfg.ship.stateDir));
35312
35601
  const failures = served.flatMap((r) => {
35313
- const item = open.find((i) => i.kind === "sandbox_cache" && i.key === sandboxCacheKey(settings.volume, r));
35602
+ const item = open2.find((i) => i.kind === "sandbox_cache" && i.key === sandboxCacheKey(settings.volume, r));
35314
35603
  return item ? [{ repo: `${r.host}/${r.path}`, lastFailedAt: item.lastFailedAt ?? item.since, message: item.message }] : [];
35315
35604
  });
35316
35605
  if (flag("json")) {
@@ -35325,7 +35614,7 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`);
35325
35614
  process.stdout.write(`${m.repo.host}/${m.repo.path} last refresh ${m.lastRefresh ?? "never"}${m.intel ? ` intel ${m.intel.commit.slice(0, 12)} (${m.intel.indexedAt ?? "age unknown"})` : ""}
35326
35615
  `);
35327
35616
  }
35328
- for (const f of failures) process.stdout.write(`${f.repo} REFRESH FAILING (last failed ${f.lastFailedAt}): ${f.message}
35617
+ for (const f2 of failures) process.stdout.write(`${f2.repo} REFRESH FAILING (last failed ${f2.lastFailedAt}): ${f2.message}
35329
35618
  `);
35330
35619
  }
35331
35620
  if (refreshFailed) process.exitCode = 1;
@@ -35574,11 +35863,11 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`);
35574
35863
  branch: planWt.branch ?? "",
35575
35864
  startupSeconds: cfg.ship.intelStartupSeconds,
35576
35865
  prepare: async (path) => {
35577
- for (const f of repoWt.config.worktrees.copy) {
35578
- const src = join66(repoWt.dir, f);
35579
- if (!existsSync60(src) || existsSync60(join66(path, f))) continue;
35580
- mkdirSync43(dirOf2(join66(path, f)), { recursive: true });
35581
- copyFileSync2(src, join66(path, f));
35866
+ for (const f2 of repoWt.config.worktrees.copy) {
35867
+ const src = join66(repoWt.dir, f2);
35868
+ if (!existsSync60(src) || existsSync60(join66(path, f2))) continue;
35869
+ mkdirSync43(dirOf2(join66(path, f2)), { recursive: true });
35870
+ copyFileSync2(src, join66(path, f2));
35582
35871
  }
35583
35872
  const setup = repoWt.config.hooks.setup;
35584
35873
  return setup ? runScript(setup, { cwd: path, shell: shellWt }) : null;
@@ -35904,11 +36193,11 @@ ${where.join("\n")}`);
35904
36193
  return { path, branch: plan.branch ?? "" };
35905
36194
  },
35906
36195
  prepare: async (path) => {
35907
- for (const f of repoP.config.worktrees.copy) {
35908
- const src = join66(repoP.dir, f);
36196
+ for (const f2 of repoP.config.worktrees.copy) {
36197
+ const src = join66(repoP.dir, f2);
35909
36198
  if (!existsSync60(src)) continue;
35910
- mkdirSync43(dirOf2(join66(path, f)), { recursive: true });
35911
- copyFileSync2(src, join66(path, f));
36199
+ mkdirSync43(dirOf2(join66(path, f2)), { recursive: true });
36200
+ copyFileSync2(src, join66(path, f2));
35912
36201
  }
35913
36202
  const setup = repoP.config.hooks.setup;
35914
36203
  return setup ? runScript(setup, { cwd: path, shell: shellP, onLine: (l) => {
@@ -36044,8 +36333,8 @@ ${where.join("\n")}`);
36044
36333
  const tracker3 = new Tracker(route2, cfg.ship);
36045
36334
  const c = tracker3.contract;
36046
36335
  const key = `ISSUE-${n}`;
36047
- const open = await tracker3.openTickets();
36048
- const ticket = open.find((t) => t[c.columns.key] === key);
36336
+ const open2 = await tracker3.openTickets();
36337
+ const ticket = open2.find((t) => t[c.columns.key] === key);
36049
36338
  if (!ticket) {
36050
36339
  die("crew unassign", `no open ticket ${key} on ${route2.route} (already resolved, or not this route's)`, "`crew inbox` to list open tickets");
36051
36340
  }
@@ -36666,7 +36955,7 @@ ${where.join("\n")}`);
36666
36955
  const engagedTicketIds = shipRows.map((s) => s.engaged_ticket_id).filter((id) => !!id);
36667
36956
  const engagedTickets = engagedTicketIds.length ? await statusTracker.ticketsByIds(engagedTicketIds) : [];
36668
36957
  const issueLabelById = new Map(engagedTickets.map((t) => [t.id, displayKey(t)]));
36669
- const todo = await statusTracker.openTickets().then((open) => operatorTodo(open, statusTracker.contract, route2.resolved?.operator ?? "")).catch(() => []);
36958
+ const todo = await statusTracker.openTickets().then((open2) => operatorTodo(open2, statusTracker.contract, route2.resolved?.operator ?? "")).catch(() => []);
36670
36959
  const projects = projectModeLabels(await statusTracker.projectRowsWithModes().catch(() => []));
36671
36960
  const crewMinVersion = await readCrewFloor(route2, cfg.ship) ?? null;
36672
36961
  const runs = liveRuns(cfg.ship.stateDir);
@@ -36827,14 +37116,14 @@ ${where.join("\n")}`);
36827
37116
  let waitViews = [];
36828
37117
  let deferredReleases = [];
36829
37118
  try {
36830
- const open = await statusTracker.openTickets();
36831
- const blockerInfo = blockerInfoMap(open, await statusTracker.ticketsByIds(missingBlockerIds(open)));
36832
- heldReleases = describeHeld(heldByBlockers(open, statusTracker.contract.statuses.verified, blockerInfo));
36833
- waitViews = [...planFootprintsFor(route2, open, await readFootprintEvents(statusTracker), computeBlockedIds(open, blockerInfo)).waits.values()].map((w) => ({ ticket: displayKey(w.ticket), waitingFor: w.waitingFor, files: w.files }));
37119
+ const open2 = await statusTracker.openTickets();
37120
+ const blockerInfo = blockerInfoMap(open2, await statusTracker.ticketsByIds(missingBlockerIds(open2)));
37121
+ heldReleases = describeHeld(heldByBlockers(open2, statusTracker.contract.statuses.verified, blockerInfo));
37122
+ waitViews = [...planFootprintsFor(route2, open2, await readFootprintEvents(statusTracker), computeBlockedIds(open2, blockerInfo)).waits.values()].map((w) => ({ ticket: displayKey(w.ticket), waitingFor: w.waitingFor, files: w.files }));
36834
37123
  const minutes = Math.min(...(await resolvedRepos(route2)).map((r) => r.config.release.rightOfWayMinutes ?? DEFAULT_RIGHT_OF_WAY_MINUTES), DEFAULT_RIGHT_OF_WAY_MINUTES);
36835
- if (open.some((t) => t.status === statusTracker.contract.statuses.verified)) {
37124
+ if (open2.some((t) => t.status === statusTracker.contract.statuses.verified)) {
36836
37125
  deferredReleases = deferredFromLog(
36837
- open,
37126
+ open2,
36838
37127
  [...await statusTracker.events(DEFERRED_EVENT), ...await statusTracker.events("conflict_handed_back"), ...await statusTracker.events("conflict_escalated")],
36839
37128
  statusTracker.contract,
36840
37129
  Date.now(),
@@ -36953,7 +37242,7 @@ ${where.join("\n")}`);
36953
37242
  problems.push({ severity: "blocker", kind: "repo_config_invalid", route: c.route, repo: e.repo, message: `could not resolve this repo's configuration: ${e.detail}`, remedy: "fix the repo's .crew.yaml" });
36954
37243
  }
36955
37244
  for (const r of repos) {
36956
- const f = repoFindings({
37245
+ const f2 = repoFindings({
36957
37246
  route: c.route,
36958
37247
  repo: r.name,
36959
37248
  dir: r.dir,
@@ -36982,8 +37271,8 @@ ${where.join("\n")}`);
36982
37271
  ...lspFlavor(r.config.hooks.intel) && !lspBinaryFound(lspFlavor(r.config.hooks.intel), r.dir, (bin) => !!findOnPath(bin, doctorSchedulerPath)) ? [`${LSP_SERVERS[lspFlavor(r.config.hooks.intel)].bin} (${LSP_SERVERS[lspFlavor(r.config.hooks.intel)].install})`] : []
36983
37272
  ] } : void 0
36984
37273
  });
36985
- problems.push(...f.problems);
36986
- passed += f.passed;
37274
+ problems.push(...f2.problems);
37275
+ passed += f2.passed;
36987
37276
  }
36988
37277
  }
36989
37278
  if (!flag("offline")) {
@@ -37004,7 +37293,7 @@ ${where.join("\n")}`);
37004
37293
  else passed++;
37005
37294
  }
37006
37295
  for (const message of roleCapWarnings(cfg.ship)) problems.push({ severity: "note", kind: "role_cap_above_ship_cap", message });
37007
- for (const f of routeAvatarFailures(cfg.ship.stateDir, route2.route)) problems.push({ severity: "note", kind: "persona_avatar_upload_failed", route: route2.route, message: `${f.role} persona avatar failed to upload: ${f.detail}`, remedy: "run `crew agents sync` again" });
37296
+ for (const f2 of routeAvatarFailures(cfg.ship.stateDir, route2.route)) problems.push({ severity: "note", kind: "persona_avatar_upload_failed", route: route2.route, message: `${f2.role} persona avatar failed to upload: ${f2.detail}`, remedy: "run `crew agents sync` again" });
37008
37297
  if (daemonLiveness) {
37009
37298
  const dp = daemonProblem(daemonLiveness, route2.route);
37010
37299
  if (dp) problems.push(dp);
@@ -37083,13 +37372,13 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
37083
37372
  `);
37084
37373
  process.exitCode = 1;
37085
37374
  }
37086
- for (const f of deadTunnelFindings(deadTunnels(cfg.ship.stateDir), Boolean(dockerFinding))) {
37087
- R.line(`tunnel: DEAD ${f.message} \u2014 ${f.remedy}
37375
+ for (const f2 of deadTunnelFindings(deadTunnels(cfg.ship.stateDir), Boolean(dockerFinding))) {
37376
+ R.line(`tunnel: DEAD ${f2.message} \u2014 ${f2.remedy}
37088
37377
  `);
37089
37378
  }
37090
37379
  for (const w of roleCapWarnings(cfg.ship)) R.line(`role concurrency: WARN ${w}
37091
37380
  `);
37092
- for (const r of cfg.routes) for (const f of routeAvatarFailures(cfg.ship.stateDir, r.route)) R.line(`persona avatar: WARN ${r.route}: ${f.role} avatar failed to upload (${f.detail}); run \`crew agents sync\` again
37381
+ for (const r of cfg.routes) for (const f2 of routeAvatarFailures(cfg.ship.stateDir, r.route)) R.line(`persona avatar: WARN ${r.route}: ${f2.role} avatar failed to upload (${f2.detail}); run \`crew agents sync\` again
37093
37382
  `);
37094
37383
  for (const t of rejectedTunnels(cfg.ship.stateDir)) R.line(`relay tunnel: ATTENTION ${tunnelRejectedMessage(t.workspaceId, t.quickExits)}
37095
37384
  `);
@@ -37193,6 +37482,10 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
37193
37482
  `);
37194
37483
  }
37195
37484
  }
37485
+ for (const l of interfaceReport(await readForRoute(route2, cfg.ship), { storedMappingKey: route2.resolved?.trackerInterface?.mappingKey, contractAuthored: route2.contractAuthored })) {
37486
+ R.line(`${l.line.startsWith(" ") ? "" : `${l.problem ? "WARN " : ""}`}${l.line}
37487
+ `);
37488
+ }
37196
37489
  const contractProblems = validateContract(tracker.contract);
37197
37490
  R.line(
37198
37491
  contractProblems.length ? `contract: ${contractProblems.length} problem(s)
@@ -37301,19 +37594,19 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
37301
37594
  `);
37302
37595
  if (cfg.routes.some((x) => x.route === route2.route && x.enabled && x.hostPeriscopes)) {
37303
37596
  const { settled } = await settleRepos(reposOf(route2), (t) => t.name, (t) => resolveOneRepo(route2, t));
37304
- for (const f of routePeriscopeProblems({
37597
+ for (const f2 of routePeriscopeProblems({
37305
37598
  route: route2.route,
37306
37599
  hosts: true,
37307
37600
  tablePresent: flag("offline") ? void 0 : periscopes.present,
37308
37601
  snapshotStale: snapStale,
37309
37602
  repos: settled.map((r) => ({ name: r.name, hasPreviewHook: !!r.config.hooks.preview }))
37310
37603
  })) {
37311
- R.line(`periscopes: ${f.severity.toUpperCase()} ${f.message}
37604
+ R.line(`periscopes: ${f2.severity.toUpperCase()} ${f2.message}
37312
37605
  `);
37313
37606
  }
37314
37607
  if (!flag("offline")) {
37315
- for (const f of await duplicateLivePeriscopeProblems(route2, cfg.ship)) {
37316
- R.line(`periscopes: ${f.severity.toUpperCase()} ${f.message}
37608
+ for (const f2 of await duplicateLivePeriscopeProblems(route2, cfg.ship)) {
37609
+ R.line(`periscopes: ${f2.severity.toUpperCase()} ${f2.message}
37317
37610
  `);
37318
37611
  }
37319
37612
  }
@@ -37623,7 +37916,7 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
37623
37916
  const foreign = describeForeignLaunchdUnits(CREW_HOME);
37624
37917
  if (foreign.length > 0) {
37625
37918
  R.line(`foreign launchd units: not this checkout's \u2014 \`crew install\` or \`crew uninstall --all\` clears them
37626
- ${foreign.map((f) => ` ${f.trim()}`).join("\n")}
37919
+ ${foreign.map((f2) => ` ${f2.trim()}`).join("\n")}
37627
37920
  `);
37628
37921
  }
37629
37922
  }