@tablation/crew 0.159.3 → 0.161.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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
@@ -4589,6 +4589,8 @@ function parseResolved(raw, m, where) {
4589
4589
  epicsModelId: raw.epicsModelId,
4590
4590
  mapsModelId: raw.mapsModelId,
4591
4591
  periscopesModelId: raw.periscopesModelId,
4592
+ questionsModelId: raw.questionsModelId,
4593
+ answersModelId: raw.answersModelId,
4592
4594
  locksModelId: raw.locksModelId,
4593
4595
  recordLinkViewId: raw.recordLinkViewId,
4594
4596
  reposModelId: raw.reposModelId,
@@ -4604,6 +4606,7 @@ function parseResolved(raw, m, where) {
4604
4606
  operator: m.req(raw.operator, `${where}.resolved.operator`),
4605
4607
  holds: holds2,
4606
4608
  contract: raw.contract ?? void 0,
4609
+ ...raw.trackerInterface?.declared === true && typeof raw.trackerInterface.mappingKey === "string" ? { trackerInterface: { declared: true, version: String(raw.trackerInterface.version ?? ""), mappingKey: raw.trackerInterface.mappingKey } } : {},
4607
4610
  ...typeof raw.releaseSeat === "string" && raw.releaseSeat ? { releaseSeat: raw.releaseSeat } : {},
4608
4611
  ...typeof raw.connectedAt === "string" && raw.connectedAt ? { connectedAt: raw.connectedAt } : {},
4609
4612
  ...typeof raw.releaseAgentId === "string" && raw.releaseAgentId ? { releaseAgentId: raw.releaseAgentId } : {},
@@ -5010,7 +5013,9 @@ function parseOneRoute(c, where, file, base, stateDir, raw, missing, crewHome, t
5010
5013
  };
5011
5014
  const resolvedFile = routeWellFormed ? readResolvedFile(stateDir, route2) : void 0;
5012
5015
  result.resolved = parseResolved(resolvedFile ?? c?.resolved, missing, where);
5013
- result.contract = resolvedFile?.contract ?? c?.contract ?? null;
5016
+ const declaredApp = resolvedFile?.trackerInterface?.declared === true;
5017
+ result.contract = declaredApp ? resolvedFile?.contract ?? null : resolvedFile?.contract ?? c?.contract ?? null;
5018
+ result.contractAuthored = !!c?.contract;
5014
5019
  missing.throwIfAny(file);
5015
5020
  return result;
5016
5021
  }
@@ -5206,10 +5211,10 @@ function ticketsByRepo(r, tickets) {
5206
5211
  const targets = reposOf(r);
5207
5212
  const byRepo = new Map(targets.map((t) => [t.name, []]));
5208
5213
  const unplaceable = [];
5209
- const single = Object.keys(r.repos).length === 0 && targets.length === 1;
5214
+ const single2 = Object.keys(r.repos).length === 0 && targets.length === 1;
5210
5215
  const names = r.resolved?.repoNames ?? {};
5211
5216
  for (const t of tickets) {
5212
- if (single) {
5217
+ if (single2) {
5213
5218
  byRepo.get(targets[0].name).push(t);
5214
5219
  continue;
5215
5220
  }
@@ -5377,14 +5382,14 @@ async function notify(route2, ship, n, emit, dryRun = false) {
5377
5382
  return false;
5378
5383
  }
5379
5384
  }
5380
- function withHookTail(detail, f) {
5381
- if (!f || !f.tail) return detail;
5385
+ function withHookTail(detail, f2) {
5386
+ if (!f2 || !f2.tail) return detail;
5382
5387
  return `${detail}
5383
5388
 
5384
- The \`${f.hook}\` hook (\`${f.label}\`) printed, last lines:
5389
+ The \`${f2.hook}\` hook (\`${f2.label}\`) printed, last lines:
5385
5390
 
5386
5391
  \`\`\`
5387
- ${f.tail}
5392
+ ${f2.tail}
5388
5393
  \`\`\``;
5389
5394
  }
5390
5395
  function describeRelease(o, route2, where) {
@@ -5991,15 +5996,15 @@ function loadedCrewLabels() {
5991
5996
  }
5992
5997
  function listLaunchdUnits(dir = launchAgentsDir(), loaded = []) {
5993
5998
  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);
5999
+ const units = files.filter((f2) => f2.startsWith(CREW_LAUNCHD_PREFIX) && f2.endsWith(".plist")).sort().map((f2) => {
6000
+ const plistPath = join19(dir, f2);
5996
6001
  let program = null;
5997
6002
  try {
5998
6003
  program = programFromPlist(readFileSync17(plistPath, "utf8"));
5999
6004
  } catch {
6000
6005
  }
6001
6006
  return {
6002
- label: f.slice(0, -".plist".length),
6007
+ label: f2.slice(0, -".plist".length),
6003
6008
  plistPath,
6004
6009
  program,
6005
6010
  programExists: program !== null && existsSync16(program)
@@ -6974,9 +6979,9 @@ function recheckEnvironmentStops(state, route2, ship, deps = {}) {
6974
6979
  return cleared;
6975
6980
  }
6976
6981
  function recheckBaseStops(state, route2) {
6977
- const open = state.shipAttention().previous().filter((i) => i.kind === "base_unsafe");
6982
+ const open2 = state.shipAttention().previous().filter((i) => i.kind === "base_unsafe");
6978
6983
  const cleared = [];
6979
- for (const item of open) {
6984
+ for (const item of open2) {
6980
6985
  const target = reposOf(route2).find((t) => baseUnsafeKey(t.name) === item.key);
6981
6986
  if (!target) continue;
6982
6987
  const cfg = resolveRepoConfig(loadRepoConfigTolerant(target.dir), void 0, target.dir);
@@ -7620,9 +7625,9 @@ var State = class _State {
7620
7625
  const gateFailed = `.test-gate-failed-${suffix}`;
7621
7626
  const gateReported = `.test-gate-reported-${suffix}`;
7622
7627
  const heldReported = `.release-held-${suffix}`;
7623
- const read = (f) => {
7628
+ const read = (f2) => {
7624
7629
  try {
7625
- return readFileSync21(this.path(f), "utf8").trim() || null;
7630
+ return readFileSync21(this.path(f2), "utf8").trim() || null;
7626
7631
  } catch {
7627
7632
  return null;
7628
7633
  }
@@ -7707,15 +7712,15 @@ var State = class _State {
7707
7712
  const ticketFile = `.fairness-ticket-${suffix}`;
7708
7713
  const sinceFile = `.fairness-since-${suffix}`;
7709
7714
  const ticketStreakFile = `.fairness-ticket-streak-${suffix}`;
7710
- const read = (f) => {
7715
+ const read = (f2) => {
7711
7716
  try {
7712
- return readFileSync21(this.path(f), "utf8").trim() || null;
7717
+ return readFileSync21(this.path(f2), "utf8").trim() || null;
7713
7718
  } catch {
7714
7719
  return null;
7715
7720
  }
7716
7721
  };
7717
7722
  const clear2 = () => {
7718
- for (const f of [streakFile, ticketFile, sinceFile, ticketStreakFile]) rmSync11(this.path(f), { force: true });
7723
+ for (const f2 of [streakFile, ticketFile, sinceFile, ticketStreakFile]) rmSync11(this.path(f2), { force: true });
7719
7724
  };
7720
7725
  return {
7721
7726
  /** Consecutive cycles this route had actionable work and did not win. */
@@ -8403,10 +8408,10 @@ var SEAT_WRITE_ISSUE_FIELDS = [
8403
8408
  "cost_usd"
8404
8409
  ];
8405
8410
  var canWrite = (level) => level === "WRITE" || level === "DELETE";
8406
- function refusedIssueFields(body, columns = SEAT_WRITE_ISSUE_FIELDS) {
8411
+ function refusedIssueFields(body, columns2 = SEAT_WRITE_ISSUE_FIELDS) {
8407
8412
  const fields = body?.fields;
8408
8413
  if (!fields || typeof fields !== "object") return [];
8409
- return columns.filter((c) => c in fields && !canWrite(fields[c]));
8414
+ return columns2.filter((c) => c in fields && !canWrite(fields[c]));
8410
8415
  }
8411
8416
  async function getJson(url, apiKey, o) {
8412
8417
  const res = await (o.fetchImpl ?? fetch)(url, {
@@ -8517,9 +8522,9 @@ exit 125
8517
8522
  ].join(" && ");
8518
8523
  }
8519
8524
  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)}`;
8525
+ return files.map((f2) => {
8526
+ const dir = f2.path.slice(0, f2.path.lastIndexOf("/")) || "/";
8527
+ return `mkdir -p ${shSingle(dir)} && printf %s ${shSingle(Buffer.from(f2.content, "utf8").toString("base64"))} | base64 -d > ${shSingle(f2.path)}`;
8523
8528
  }).join(" && ");
8524
8529
  }
8525
8530
  function shSingle(s) {
@@ -9067,89 +9072,244 @@ async function runBridge(stateDir, route2, ticket) {
9067
9072
  await bridge.stop();
9068
9073
  }
9069
9074
 
9075
+ // src/tracker-interface.ts
9076
+ var TRACKER_INTERFACE_NAME = "work-tracker";
9077
+ var ACCEPTED_INTERFACE_VERSIONS = { major: 1, minMinor: 0 };
9078
+ var ALLOW_UNDECLARED_TRACKER_APPS = true;
9079
+ var TABLE_ENTRIES = [
9080
+ { role: "issues", defaultName: "Issues", label: "Tickets table", whatBreaks: "Without it crew has no tickets to work." },
9081
+ { role: "comments", defaultName: "Comments", label: "Comments table", whatBreaks: "Without it crew cannot read answers or post progress." },
9082
+ { role: "crew", defaultName: "Crew", label: "Crew table", whatBreaks: "Without it crew has no seats to act as and no people to hand work to." },
9083
+ { role: "projects", defaultName: "Projects", label: "Projects table", optional: true, whatBreaks: "Without it tickets cannot be routed by project or work mode." },
9084
+ { role: "repos", defaultName: "Repos", label: "Repos table", optional: true, whatBreaks: "Without it a ticket cannot name the repository it belongs to." },
9085
+ { role: "ships", defaultName: "Ships", label: "Ships table", optional: true, whatBreaks: "Without it several machines cannot share one board." },
9086
+ { role: "epics", defaultName: "Epics", label: "Epics table", optional: true, whatBreaks: "Without it tickets cannot belong to an epic." },
9087
+ { role: "maps", defaultName: "Maps", label: "Maps table", optional: true, whatBreaks: "Without it a ticket cannot cite its epic\u2019s planning document." },
9088
+ { role: "periscopes", defaultName: "Periscopes", label: "Periscopes table", optional: true, whatBreaks: "Without it crew cannot host live previews." },
9089
+ { role: "locks", defaultName: "Locks", label: "Locks table", optional: true, whatBreaks: "Without it ships cannot take the release lock through the board." },
9090
+ { role: "questions", defaultName: "Questions", label: "Questions table", optional: true, whatBreaks: "Without it a seat that parks a ticket for an answer cannot also ask the question as a record with proposed answers; the comment still carries it." },
9091
+ { role: "answers", defaultName: "Answers", label: "Answers table", optional: true, whatBreaks: "Without it a question cannot offer proposed answers." }
9092
+ ];
9093
+ function f(table2, name, contractPath, defaultColumn, kind, label, whatBreaks, extra = {}) {
9094
+ return { role: `${table2}.${name}`, table: table2, contractPath, defaultColumn, kind, label, whatBreaks, ...extra };
9095
+ }
9096
+ var opt = { optional: true };
9097
+ var FIELD_ENTRIES = [
9098
+ f("issues", "key", "columns.key", "issue_id", "any", "Ticket key", "Without it tickets cannot be named in branches, comments or logs."),
9099
+ f("issues", "tag", "columns.tag", "issue_tag", "any", "Per-project ticket tag", "Without it branches fall back to plain `issue-<number>` names.", opt),
9100
+ f("issues", "title", "columns.title", "title", "text", "Title", "Without it crew cannot show or file a ticket."),
9101
+ f("issues", "status", "columns.status", "status", "choice", "Status", "Without it crew cannot tell which tickets to work."),
9102
+ f("issues", "assignee", "columns.assignee", "assignee_id", "link", "Assignee", "Without it crew cannot claim a ticket or see who holds one."),
9103
+ f("issues", "priority", "columns.priority", "priority", "choice", "Priority", "Without it tickets cannot be ordered by urgency."),
9104
+ f("issues", "severity", "columns.severity", "severity", "choice", "Severity", "Without it tickets cannot be ordered by severity."),
9105
+ f("issues", "slice", "columns.slice", "project_id", "link", "Project", "Without it tickets cannot be partitioned by project."),
9106
+ f("issues", "repo", "columns.repo", "repo_id", "link", "Repository", "Without it crew cannot tell which checkout a ticket belongs to."),
9107
+ f("issues", "parent", "columns.parent", "parent_id", "link", "Parent ticket", "Without it coordinating tickets cannot roll up their children.", opt),
9108
+ f("issues", "blockedBy", "columns.blockedBy", "blocked_by", "link", "Blocked by", "Without it crew cannot park a ticket behind its dependencies.", { multiple: "either" }),
9109
+ f("issues", "updatedAt", "columns.updatedAt", "updated_at", "any", "Updated at", "Without it crew cannot tell what changed since the last poll.", { builtin: ["updated_at"] }),
9110
+ f("issues", "needsDesign", "columns.needsDesign", "needs_design", "boolean", "Needs design", "Without it tickets cannot be split between the dev and design lanes.", opt),
9111
+ f("issues", "attachments", "columns.attachments", "attachments", "link", "Attachments", "Without it a seat cannot open a ticket\u2019s screenshots.", { ...opt, multiple: "either" }),
9112
+ f("issues", "reportType", "columns.reportType", "report_type", "choice", "Report type", "Without it questions, investigations and coordinating tickets are treated as builds.", opt),
9113
+ f("issues", "epic", "columns.epic", "epic_id", "link", "Epic", "Without it tickets cannot belong to an epic.", opt),
9114
+ f("issues", "author", "columns.author", "filed_by_id", "link", "Filed by", "Without it a filed ticket does not name its filer.", opt),
9115
+ 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),
9116
+ f("issues", "heldBy", "columns.heldBy", "held_by_ship_id", "link", "Held by ship", "Without it two machines can claim the same ticket.", opt),
9117
+ f("issues", "resolutionNote", "columns.resolutionNote", "resolution_note", "text", "Resolution note", "Without it a close that needs a reason cannot give one.", opt),
9118
+ f("issues", "verifiedSha", "columns.verifiedSha", "verified_sha", "text", "Verified commit", "Without it review cannot tell whether the verified branch changed.", opt),
9119
+ 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),
9120
+ f("issues", "branchUrl", "columns.branchUrl", "branch_url", "text", "Branch URL", "Without it the ticket does not link to its pushed branch.", opt),
9121
+ f("issues", "prUrl", "columns.prUrl", "pr_url", "text", "Pull request URL", "Without it the ticket does not link to its pull request.", opt),
9122
+ f("issues", "externalId", "columns.externalId", "external_id", "text", "External id", "Without it imported tickets cannot be told from hand-filed ones.", opt),
9123
+ f("issues", "position", "columns.position", "position", "number", "Manual position", "Without it the board\u2019s manual order is ignored.", opt),
9124
+ f("issues", "agentRuns", "columns.agentRuns", "agent_runs", "number", "Agent runs", "Without it per-ticket run counts are not kept.", opt),
9125
+ f("issues", "tokensIn", "columns.tokensIn", "tokens_in", "number", "Input tokens", "Without it per-ticket token spend is not kept.", opt),
9126
+ f("issues", "tokensOut", "columns.tokensOut", "tokens_out", "number", "Output tokens", "Without it per-ticket token spend is not kept.", opt),
9127
+ f("issues", "cacheReadTokens", "columns.cacheReadTokens", "cache_read_tokens", "number", "Cache read tokens", "Without it per-ticket token spend is not kept.", opt),
9128
+ f("issues", "cacheWriteTokens", "columns.cacheWriteTokens", "cache_write_tokens", "number", "Cache write tokens", "Without it per-ticket token spend is not kept.", opt),
9129
+ f("issues", "costUsd", "columns.costUsd", "cost_usd", "number", "Cost (USD)", "Without it per-ticket spend is not kept.", opt),
9130
+ f("issues", "crewAssisted", "columns.crewAssisted", "crew_assisted", "boolean", "Crew assisted", "Without it tickets the crew worked are not marked.", opt),
9131
+ f("projects", "workMode", "columns.workMode", "work_mode", "choice", "Work mode", "Without it every project is worked automatically.", opt),
9132
+ f("comments", "parent", "comments.parent", "ticket_id", "link", "Comment ticket", "Without it a comment cannot be tied to its ticket."),
9133
+ f("comments", "body", "comments.body", "body", "text", "Comment body", "Without it a comment has no text."),
9134
+ f("comments", "author", "comments.author", "team_member_id", "link", "Comment author", "Without it crew cannot tell its own comments from a person\u2019s."),
9135
+ f("comments", "createdAt", "comments.createdAt", "created_at", "any", "Comment time", "Without it comments cannot be ordered.", { builtin: ["created_at"] }),
9136
+ f("comments", "ship", "comments.ship", "ship_id", "link", "Posted from ship", "Without it a comment does not name the machine that posted it.", opt),
9137
+ 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),
9138
+ f("comments", "authorName", "comments.authorName", "author_name", "text", "Public author name", "Without it a public reporter\u2019s name is lost.", opt),
9139
+ // The optional questions part (interface 1.1, CREW-3588). The shapes are the
9140
+ // ones the platform's Record choices requirement asks of its questions and
9141
+ // answers tables; `questionsPartMapped` says when a mapping carries enough of
9142
+ // them for crew to write a question. Each role is optional here because the
9143
+ // whole part is: an app that maps none of it still conforms.
9144
+ f("questions", "parent", "questions.parent", "ticket_id", "link", "Question ticket", "Without it a question cannot be tied to the ticket it is about, so crew writes none.", { ...opt, linkTo: "issues" }),
9145
+ f("questions", "text", "questions.text", "question", "text", "Question text", "Without it a question has no words.", opt),
9146
+ f("questions", "status", "questions.status", "status", "choice", "Question status", "Without it crew cannot tell an open question from an answered or withdrawn one.", opt),
9147
+ f("questions", "askedBy", "questions.askedBy", "asked_by_id", "link", "Asked by", "Without it a question does not say which seat asked it, so crew cannot withdraw its own earlier question.", opt),
9148
+ f("questions", "addressedTo", "questions.addressedTo", "addressed_to_id", "link", "Addressed to", "Without it a question does not say who it is waiting on.", opt),
9149
+ f("questions", "answeredBy", "questions.answeredBy", "answered_by_id", "link", "Answered by", "Without it an answered question does not say who answered.", opt),
9150
+ f("questions", "chosenAnswer", "questions.chosenAnswer", "chosen_answer_id", "link", "Chosen answer", "Without it an answered question does not say which answer was chosen.", { ...opt, linkTo: "answers" }),
9151
+ f("answers", "question", "answers.question", "question_id", "link", "Answer question", "Without it an answer cannot be tied to its question, so crew offers none.", { ...opt, linkTo: "questions" }),
9152
+ f("answers", "label", "answers.label", "label", "text", "Answer label", "Without it an answer has no short label to show on a button.", opt),
9153
+ f("answers", "detail", "answers.detail", "detail", "text", "Answer detail", "Without it an answer has no full instruction to act on when chosen.", opt),
9154
+ f("answers", "order", "answers.order", "position", "number", "Answer order", "Without it the answers show in the order they were created, not the order the seat intended.", opt),
9155
+ f("epics", "status", "epics.statusColumn", "status", "choice", "Epic status", "Without it crew cannot keep an epic\u2019s status from its tickets.", opt),
9156
+ f("epics", "key", "epics.keyColumn", "epic_id", "any", "Epic key", "Without it an epic has no name in the log.", opt),
9157
+ f("maps", "epic", "maps.epicColumn", "epic_id", "link", "Map epic", "Without it a Map cannot be matched to its epic.", opt),
9158
+ f("maps", "title", "maps.titleColumn", "title", "text", "Map title", "Without it a Map has no name in a brief.", opt),
9159
+ f("maps", "content", "maps.contentColumn", "content", "text", "Map content", "Without it a brief cannot carry the Map.", opt),
9160
+ f("maps", "conversation", "maps.conversationColumn", "conversation", "text", "Map conversation", "Without it the interview record cannot be pointed at.", opt),
9161
+ f("maps", "status", "maps.statusColumn", "status", "choice", "Map status", "Without it the active Map cannot be told from a draft.", opt),
9162
+ f("maps", "version", "maps.versionColumn", "version", "any", "Map version", "Without it a brief cannot name the Map\u2019s version.", opt)
9163
+ ];
9164
+ var STATUS_MEANINGS = [
9165
+ { id: "new", label: "New", defaultValue: "new", open: true, resolved: false, meaning: "Filed, not yet approved by a person." },
9166
+ { id: "approved", label: "Approved", defaultValue: "accepted", contractKey: "approved", open: true, resolved: false, meaning: "A person authorized the work. Only a person sets it." },
9167
+ { 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." },
9168
+ { id: "building", label: "Building", defaultValue: "in_progress", contractKey: "building", open: true, resolved: false, meaning: "A seat is working it." },
9169
+ { id: "needsHuman", label: "Needs a person", defaultValue: "needs_info", contractKey: "needsHuman", open: true, resolved: false, meaning: "A person owes an answer." },
9170
+ { id: "handoff", label: "Handed off", defaultValue: "fixed", contractKey: "handoff", open: true, resolved: false, meaning: "Built, not yet checked. Open and not resolved." },
9171
+ { id: "verifying", label: "Verifying", defaultValue: "qa", contractKey: "verifying", open: true, resolved: false, meaning: "Being checked." },
9172
+ { id: "verified", label: "Verified", defaultValue: "verified", contractKey: "verified", open: true, resolved: true, meaning: "Checked and awaiting release. Resolves a blocker but is not closed." },
9173
+ { 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." },
9174
+ { id: "deployed", label: "Deployed", defaultValue: "closed_deployed", contractKey: "deployed", open: false, resolved: true, meaning: "Released; set by the release phase alone." },
9175
+ { id: "wontFix", label: "Won\u2019t fix", defaultValue: "closed_wont_fix", contractKey: "wontFix", open: false, resolved: true, meaning: "Called off without merging." },
9176
+ { id: "duplicate", label: "Duplicate", defaultValue: "closed_duplicate", open: false, resolved: true, meaning: "Closed in favor of another ticket." },
9177
+ { id: "completed", label: "Completed", defaultValue: "closed_completed", open: false, resolved: true, meaning: "Done with nothing to deploy." },
9178
+ { id: "cantReproduce", label: "Can\u2019t reproduce", defaultValue: "closed_cant_reproduce", open: false, resolved: true, meaning: "Closed as written, unreproducible." },
9179
+ { id: "draft", label: "Draft", defaultValue: "draft", contractKey: "draft", open: false, resolved: false, optional: true, meaning: "Held back; never polled." }
9180
+ ];
9181
+ var QUESTION_STATUS_MEANINGS = [
9182
+ { id: "open", label: "Open", defaultValue: "open", meaning: "Waiting for a person to answer." },
9183
+ { id: "answered", label: "Answered", defaultValue: "answered", meaning: "A person chose an answer or replied in writing." },
9184
+ { id: "withdrawn", label: "Withdrawn", defaultValue: "withdrawn", meaning: "The asker took it back, usually because it asked again on the same ticket." }
9185
+ ];
9186
+ function defaultGroup(group) {
9187
+ const out = {};
9188
+ for (const e of FIELD_ENTRIES) {
9189
+ const [g, key] = e.contractPath.split(".");
9190
+ if (g === group) out[key] = e.defaultColumn;
9191
+ }
9192
+ return out;
9193
+ }
9194
+ function defaultQuestionStatuses() {
9195
+ const v = (id) => QUESTION_STATUS_MEANINGS.find((q2) => q2.id === id).defaultValue;
9196
+ return { open: v("open"), answered: v("answered"), withdrawn: v("withdrawn") };
9197
+ }
9198
+ function defaultStatusValues() {
9199
+ const open2 = STATUS_MEANINGS.filter((s) => s.open && s.defaultValue).map((s) => s.defaultValue);
9200
+ const resolved = STATUS_MEANINGS.filter((s) => s.resolved && s.defaultValue).map((s) => s.defaultValue);
9201
+ const single2 = {};
9202
+ for (const s of STATUS_MEANINGS) if (s.contractKey) single2[s.contractKey] = s.defaultValue || null;
9203
+ return { open: open2, resolved, single: single2 };
9204
+ }
9205
+ function versionLabel(v) {
9206
+ return `${v.major}.${v.minor}`;
9207
+ }
9208
+ function acceptedLabel() {
9209
+ return `${ACCEPTED_INTERFACE_VERSIONS.major}.${ACCEPTED_INTERFACE_VERSIONS.minMinor} or a later ${ACCEPTED_INTERFACE_VERSIONS.major}.x`;
9210
+ }
9211
+ function versionAccepted(v) {
9212
+ return v.major === ACCEPTED_INTERFACE_VERSIONS.major && v.minor >= ACCEPTED_INTERFACE_VERSIONS.minMinor;
9213
+ }
9214
+ function sideToUpdate(v) {
9215
+ return v.major > ACCEPTED_INTERFACE_VERSIONS.major ? "crew" : "app";
9216
+ }
9217
+ function contractFromMapping(base, mapping) {
9218
+ const next = structuredClone(base);
9219
+ const groups = {
9220
+ columns: next.columns,
9221
+ comments: next.comments,
9222
+ epics: next.epics,
9223
+ maps: next.maps,
9224
+ questions: next.questions,
9225
+ answers: next.answers
9226
+ };
9227
+ for (const e of FIELD_ENTRIES) {
9228
+ const col = mapping.fields[e.role];
9229
+ const [group, key] = e.contractPath.split(".");
9230
+ if (!col) {
9231
+ if (group === "questions" || group === "answers") Object.assign(groups[group], { [key]: "" });
9232
+ continue;
9233
+ }
9234
+ Object.assign(groups[group], { [key]: col });
9235
+ }
9236
+ const mapped = mapping.values?.["status"] ?? {};
9237
+ const open2 = [];
9238
+ const resolved = [];
9239
+ for (const s of STATUS_MEANINGS) {
9240
+ const v = mapped[s.id] ?? (s.defaultValue || null);
9241
+ if (s.contractKey) Object.assign(next.statuses, { [s.contractKey]: v });
9242
+ if (!v) continue;
9243
+ if (s.open && !open2.includes(v)) open2.push(v);
9244
+ if (s.resolved && !resolved.includes(v)) resolved.push(v);
9245
+ }
9246
+ next.statuses.open = open2;
9247
+ next.statuses.resolved = resolved;
9248
+ const questionValues = mapping.values?.["questionStatus"] ?? {};
9249
+ for (const q2 of QUESTION_STATUS_MEANINGS) {
9250
+ Object.assign(next.questionStatuses, { [q2.id]: questionValues[q2.id] ?? q2.defaultValue });
9251
+ }
9252
+ return next;
9253
+ }
9254
+ function mappedTableName(mapping, role) {
9255
+ return mapping.tables?.[role];
9256
+ }
9257
+ var QUESTIONS_PART_ROLES = [
9258
+ "questions.parent",
9259
+ "questions.text",
9260
+ "questions.status",
9261
+ "questions.askedBy",
9262
+ "answers.question",
9263
+ "answers.label",
9264
+ "answers.detail"
9265
+ ];
9266
+ function questionsPartMapped(mapping) {
9267
+ return !!mapping.tables?.["questions"] && !!mapping.tables?.["answers"] && QUESTIONS_PART_ROLES.every((r) => !!mapping.fields?.[r]);
9268
+ }
9269
+ function describeShape(roleId) {
9270
+ const t = TABLE_ENTRIES.find((x) => x.role === roleId);
9271
+ if (t) return "a table";
9272
+ const e = FIELD_ENTRIES.find((x) => x.role === roleId);
9273
+ if (!e) return "unknown role";
9274
+ const kind = e.kind === "any" ? "any column" : e.kind === "link" ? `a ${e.multiple === "either" ? "link (one or several)" : "link"} field` : `a ${e.kind} field`;
9275
+ return `${kind} on the ${e.table} table${e.optional ? " (optional)" : ""}`;
9276
+ }
9277
+ function describeDifferences(unmet) {
9278
+ return unmet.map((u) => `role ${u.roleId} \u2014 expected ${describeShape(u.roleId)}; found: ${u.message}`);
9279
+ }
9280
+
9070
9281
  // src/contract.ts
9282
+ var STATUS_DEFAULTS = defaultStatusValues();
9283
+ var EPIC_DEFAULTS = defaultGroup("epics");
9284
+ var MAP_DEFAULTS = defaultGroup("maps");
9285
+ var single = (k) => STATUS_DEFAULTS.single[k];
9071
9286
  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
- },
9287
+ columns: defaultGroup("columns"),
9288
+ comments: defaultGroup("comments"),
9117
9289
  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"
9290
+ open: STATUS_DEFAULTS.open,
9291
+ resolved: STATUS_DEFAULTS.resolved,
9292
+ approved: single("approved"),
9293
+ parked: single("parked"),
9294
+ building: single("building"),
9295
+ handoff: single("handoff"),
9296
+ verifying: single("verifying"),
9297
+ verified: single("verified"),
9298
+ deployed: single("deployed"),
9299
+ needsHuman: single("needsHuman"),
9300
+ reviewing: STATUS_DEFAULTS.single.reviewing ?? null,
9301
+ wontFix: single("wontFix"),
9302
+ draft: single("draft")
9138
9303
  },
9139
9304
  epics: {
9140
- statusColumn: "status",
9141
- keyColumn: "epic_id",
9305
+ statusColumn: EPIC_DEFAULTS.statusColumn,
9306
+ keyColumn: EPIC_DEFAULTS.keyColumn,
9142
9307
  statuses: { planned: "planned", building: "in_progress", done: "done", cancelled: "cancelled" }
9143
9308
  },
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
- },
9309
+ maps: { ...MAP_DEFAULTS, activeStatus: "active" },
9310
+ questions: defaultGroup("questions"),
9311
+ answers: defaultGroup("answers"),
9312
+ questionStatuses: defaultQuestionStatuses(),
9153
9313
  priorityOrder: ["p0", "p1", "p2", "p3"],
9154
9314
  severityOrder: ["s1", "s2", "s3", "s4"],
9155
9315
  unknownPriorityRank: 2,
@@ -9173,6 +9333,9 @@ function resolveContract(override) {
9173
9333
  statuses: { ...DEFAULT_CONTRACT.epics.statuses, ...override.epics?.statuses }
9174
9334
  },
9175
9335
  maps: { ...DEFAULT_CONTRACT.maps, ...override.maps },
9336
+ questions: { ...DEFAULT_CONTRACT.questions, ...override.questions },
9337
+ answers: { ...DEFAULT_CONTRACT.answers, ...override.answers },
9338
+ questionStatuses: { ...DEFAULT_CONTRACT.questionStatuses, ...override.questionStatuses },
9176
9339
  priorityOrder: override.priorityOrder ?? DEFAULT_CONTRACT.priorityOrder,
9177
9340
  severityOrder: override.severityOrder ?? DEFAULT_CONTRACT.severityOrder,
9178
9341
  unknownPriorityRank: override.unknownPriorityRank ?? DEFAULT_CONTRACT.unknownPriorityRank,
@@ -9188,13 +9351,13 @@ function resolveContract(override) {
9188
9351
  }
9189
9352
  function validateContract(c) {
9190
9353
  const problems = [];
9191
- const open = new Set(c.statuses.open);
9354
+ const open2 = new Set(c.statuses.open);
9192
9355
  const resolved = new Set(c.statuses.resolved);
9193
9356
  for (const role of ["approved", "parked", "building", "handoff", "verifying", "needsHuman"]) {
9194
9357
  const v = c.statuses[role];
9195
- if (!open.has(v)) problems.push(`statuses.${role} ("${v}") is not listed in statuses.open`);
9358
+ if (!open2.has(v)) problems.push(`statuses.${role} ("${v}") is not listed in statuses.open`);
9196
9359
  }
9197
- if (c.statuses.reviewing && !open.has(c.statuses.reviewing)) {
9360
+ if (c.statuses.reviewing && !open2.has(c.statuses.reviewing)) {
9198
9361
  problems.push(`statuses.reviewing ("${c.statuses.reviewing}") is not listed in statuses.open`);
9199
9362
  }
9200
9363
  if (!resolved.has(c.statuses.deployed)) {
@@ -9482,7 +9645,7 @@ function referenceKeys(t) {
9482
9645
  return t.issue_tag && t.issue_tag !== t.issue_id ? [t.issue_id, t.issue_tag] : [t.issue_id];
9483
9646
  }
9484
9647
  var RESOLVED_STATUSES = new Set(DEFAULT_CONTRACT.statuses.resolved);
9485
- var encodeFilters = (f) => JSON.stringify(f);
9648
+ var encodeFilters = (f2) => JSON.stringify(f2);
9486
9649
  var encodeSort = (s) => JSON.stringify(s);
9487
9650
  var LIST_PAGE_SIZE = 500;
9488
9651
  var LIST_MAX_PAGES = 200;
@@ -10187,6 +10350,33 @@ var Tracker = class _Tracker {
10187
10350
  if (res.status === 404) throw new ConfigError(EVENT_LOG_MISSING);
10188
10351
  if (!res.ok) throw new Error(`posting a ${type} event failed: HTTP ${res.status}${await refusalReason(res)}`);
10189
10352
  }
10353
+ /**
10354
+ * The questions part's tables when this route's app maps it (interface 1.1,
10355
+ * CREW-3588), else null: an app at 1.0, an undeclared app, or a mapping that
10356
+ * leaves a table out. Nothing is written for a null.
10357
+ */
10358
+ questionsPart() {
10359
+ const r = this.route.resolved;
10360
+ return r?.questionsModelId && r.answersModelId ? { questionsModelId: r.questionsModelId, answersModelId: r.answersModelId } : null;
10361
+ }
10362
+ /** The seat's own open questions on a ticket (its askedBy, never a person's). */
10363
+ async listOpenQuestions(part, ticketId, askedBy) {
10364
+ const q2 = this.contract.questions;
10365
+ return this.client.records.list(part.questionsModelId, {
10366
+ filters: encodeFilters([
10367
+ { columnName: q2.parent, operator: "EQ", value: ticketId },
10368
+ { columnName: q2.status, operator: "EQ", value: this.contract.questionStatuses.open },
10369
+ { columnName: q2.askedBy, operator: "EQ", value: askedBy }
10370
+ ]),
10371
+ limit: 100
10372
+ });
10373
+ }
10374
+ async updateRecord(modelId, id, fields) {
10375
+ await this.client.records.update(modelId, id, fields);
10376
+ }
10377
+ async createRecord(modelId, fields) {
10378
+ return this.client.records.create(modelId, fields);
10379
+ }
10190
10380
  /** A ticket comment under a seat's identity (CREW-2363: the replayed hand-off comment). */
10191
10381
  async postComment(ticketId, body, memberId) {
10192
10382
  const auth = await this.authorshipProbe();
@@ -10324,7 +10514,7 @@ var Tracker = class _Tracker {
10324
10514
  }
10325
10515
  /** Whether Issues carries the optional `crew_assisted` column (CREW-3258). */
10326
10516
  async hasCrewAssistedColumn() {
10327
- this.crewAssistedColumn ??= this.columnNames(this.models.issues).then((f) => f.has(this.contract.columns.crewAssisted));
10517
+ this.crewAssistedColumn ??= this.columnNames(this.models.issues).then((f2) => f2.has(this.contract.columns.crewAssisted));
10328
10518
  return this.crewAssistedColumn;
10329
10519
  }
10330
10520
  /**
@@ -10394,7 +10584,7 @@ var Tracker = class _Tracker {
10394
10584
  async probeAttachments() {
10395
10585
  try {
10396
10586
  const model = await this.client.dataModels.get(this.models.issues);
10397
- const field = model.fields.find((f) => f.columnName === this.contract.columns.attachments);
10587
+ const field = model.fields.find((f2) => f2.columnName === this.contract.columns.attachments);
10398
10588
  const fieldType = field?.fieldType;
10399
10589
  const target = fieldType?.targetModelId;
10400
10590
  return { mediaLibraryModelId: typeof target === "string" && target ? target : null };
@@ -10405,7 +10595,7 @@ var Tracker = class _Tracker {
10405
10595
  async columnNames(modelId) {
10406
10596
  try {
10407
10597
  const model = await this.client.dataModels.get(modelId);
10408
- return new Set(model.fields.map((f) => f.columnName));
10598
+ return new Set(model.fields.map((f2) => f2.columnName));
10409
10599
  } catch {
10410
10600
  return /* @__PURE__ */ new Set();
10411
10601
  }
@@ -10547,11 +10737,11 @@ var Tracker = class _Tracker {
10547
10737
  [this.route.resolved?.shipsModelId, "Ships", ["kind", "instance_class", "relay_url"]]
10548
10738
  ];
10549
10739
  const missing = [];
10550
- for (const [modelId, label, columns] of wanted) {
10740
+ for (const [modelId, label, columns2] of wanted) {
10551
10741
  if (!modelId) continue;
10552
10742
  const have = await this.columnNames(modelId);
10553
10743
  if (have.size === 0) continue;
10554
- for (const c of columns) if (!have.has(c)) missing.push(`${label}.${c}`);
10744
+ for (const c of columns2) if (!have.has(c)) missing.push(`${label}.${c}`);
10555
10745
  }
10556
10746
  return missing;
10557
10747
  }
@@ -10750,7 +10940,7 @@ function planFootprints(input) {
10750
10940
  const candidates2 = tickets.filter((t) => isWaiting(t) && !input.dependencyBlocked?.has(t.id)).sort(byAge);
10751
10941
  for (const t of candidates2) {
10752
10942
  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)));
10943
+ const hits = held.filter((h) => h.ticket.id !== t.id && mine.some((f2) => h.files.has(f2)));
10754
10944
  if (mine.length === 0 || hits.length === 0) {
10755
10945
  if (mine.length) held.push({ ticket: t, files: new Set(mine) });
10756
10946
  continue;
@@ -10758,7 +10948,7 @@ function planFootprints(input) {
10758
10948
  waits.set(t.id, {
10759
10949
  ticket: t,
10760
10950
  waitingFor: hits.map((h) => displayKey(h.ticket)),
10761
- files: [...new Set(hits.flatMap((h) => mine.filter((f) => h.files.has(f))))].sort()
10951
+ files: [...new Set(hits.flatMap((h) => mine.filter((f2) => h.files.has(f2))))].sort()
10762
10952
  });
10763
10953
  }
10764
10954
  }
@@ -10774,12 +10964,12 @@ function mustYieldTo(self, input) {
10774
10964
  const x = input.declared.get(a.id).at, y = input.declared.get(b.id).at;
10775
10965
  return x !== y ? x < y : number(a) < number(b);
10776
10966
  };
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);
10967
+ 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
10968
  if (hits.length === 0) return null;
10779
10969
  return { waitingFor: hits.map((h) => displayKey(h.o)), files: [...new Set(hits.flatMap((h) => h.shared))].sort() };
10780
10970
  }
10781
10971
  function describeFiles(files, shown = 3) {
10782
- const head = files.slice(0, shown).map((f) => `\`${f}\``).join(", ");
10972
+ const head = files.slice(0, shown).map((f2) => `\`${f2}\``).join(", ");
10783
10973
  return files.length > shown ? `${head} and ${files.length - shown} more` : head;
10784
10974
  }
10785
10975
  function footprintWaitNote(w) {
@@ -10854,9 +11044,9 @@ function listPendingHandoffs(stateDir, route2) {
10854
11044
  const dir = pendingDirFor(stateDir);
10855
11045
  if (!existsSync22(dir)) return [];
10856
11046
  const out = [];
10857
- for (const f of readdirSync7(dir).filter((n) => n.endsWith(".json")).sort()) {
11047
+ for (const f2 of readdirSync7(dir).filter((n) => n.endsWith(".json")).sort()) {
10858
11048
  try {
10859
- const rec = JSON.parse(readFileSync24(join25(dir, f), "utf8"));
11049
+ const rec = JSON.parse(readFileSync24(join25(dir, f2), "utf8"));
10860
11050
  if (rec.version === 1 && rec.ticketRecordId && (!route2 || rec.route === route2)) out.push(rec);
10861
11051
  } catch {
10862
11052
  }
@@ -11857,7 +12047,7 @@ function columnsOf(target, modelId) {
11857
12047
  const key = `${target.baseUrl}|${target.workspaceId}|${modelId}`;
11858
12048
  let p = issueColumns.get(key);
11859
12049
  if (!p) {
11860
- p = request(target, "GET", `/data-models/${modelId}`).then((m) => new Set((m.fields ?? []).map((f) => f.columnName)));
12050
+ p = request(target, "GET", `/data-models/${modelId}`).then((m) => new Set((m.fields ?? []).map((f2) => f2.columnName)));
11861
12051
  p.catch(() => issueColumns.delete(key));
11862
12052
  issueColumns.set(key, p);
11863
12053
  }
@@ -12300,8 +12490,8 @@ async function replayQueuedAgentRuns(stateDir, route2, keyFor, log, now = /* @__
12300
12490
  const dir = queueDir(stateDir);
12301
12491
  if (!existsSync25(dir)) return 0;
12302
12492
  let sent = 0;
12303
- for (const f of readdirSync8(dir).filter((n) => n.endsWith(".json")).sort()) {
12304
- const path = join28(dir, f);
12493
+ for (const f2 of readdirSync8(dir).filter((n) => n.endsWith(".json")).sort()) {
12494
+ const path = join28(dir, f2);
12305
12495
  let q2;
12306
12496
  try {
12307
12497
  q2 = JSON.parse(readFileSync25(path, "utf8"));
@@ -12314,7 +12504,7 @@ async function replayQueuedAgentRuns(stateDir, route2, keyFor, log, now = /* @__
12314
12504
  if (!apiKey) continue;
12315
12505
  const sentRun = await reportAgentRun({ ...q2.target, apiKey }, q2.report);
12316
12506
  if (sentRun.counterWarning) log.warn(sentRun.counterWarning);
12317
- if (sentRun.counterRetry) queueTicketCounters(stateDir, f.replace(/\.json$/, ""), {
12507
+ if (sentRun.counterRetry) queueTicketCounters(stateDir, f2.replace(/\.json$/, ""), {
12318
12508
  version: 1,
12319
12509
  route: q2.route,
12320
12510
  role: q2.role,
@@ -12325,11 +12515,11 @@ async function replayQueuedAgentRuns(stateDir, route2, keyFor, log, now = /* @__
12325
12515
  });
12326
12516
  rmSync14(path, { force: true });
12327
12517
  sent += 1;
12328
- log.emit(`sent a queued Agent Log report (${f})`);
12518
+ log.emit(`sent a queued Agent Log report (${f2})`);
12329
12519
  } catch (e) {
12330
12520
  if (!(e instanceof AgentLogUnreachableError)) {
12331
12521
  rmSync14(path, { force: true });
12332
- log.warn(`dropped a queued Agent Log report (${f}): ${e.message}`);
12522
+ log.warn(`dropped a queued Agent Log report (${f2}): ${e.message}`);
12333
12523
  continue;
12334
12524
  }
12335
12525
  const attempts = q2.attempts + 1;
@@ -12353,8 +12543,8 @@ async function replayQueuedTicketCounters(stateDir, route2, keyFor, log, now = /
12353
12543
  const dir = countersDir(stateDir);
12354
12544
  if (!existsSync25(dir)) return 0;
12355
12545
  let sent = 0;
12356
- for (const f of readdirSync8(dir).filter((n) => n.endsWith(".json")).sort()) {
12357
- const path = join28(dir, f);
12546
+ for (const f2 of readdirSync8(dir).filter((n) => n.endsWith(".json")).sort()) {
12547
+ const path = join28(dir, f2);
12358
12548
  let q2;
12359
12549
  try {
12360
12550
  q2 = JSON.parse(readFileSync25(path, "utf8"));
@@ -12368,11 +12558,11 @@ async function replayQueuedTicketCounters(stateDir, route2, keyFor, log, now = /
12368
12558
  await writeCounters({ ...q2.target, apiKey }, q2.write);
12369
12559
  rmSync14(path, { force: true });
12370
12560
  sent += 1;
12371
- log.emit(`added a queued run's spend to ${q2.write.ticketReference ?? q2.write.recordId} (${f})`);
12561
+ log.emit(`added a queued run's spend to ${q2.write.ticketReference ?? q2.write.recordId} (${f2})`);
12372
12562
  } catch (e) {
12373
12563
  if (!isRetryable(e)) {
12374
12564
  rmSync14(path, { force: true });
12375
- log.warn(`dropped a queued ticket counter update (${f}): ${e.message}`);
12565
+ log.warn(`dropped a queued ticket counter update (${f2}): ${e.message}`);
12376
12566
  continue;
12377
12567
  }
12378
12568
  const attempts = q2.attempts + 1;
@@ -12819,7 +13009,7 @@ function readWarmFiles(dir, ref, patterns) {
12819
13009
  const res = patterns.map(globToRegExp);
12820
13010
  const out = {};
12821
13011
  let total = 0;
12822
- for (const path of all.filter((f) => res.some((re) => re.test(f))).sort()) {
13012
+ for (const path of all.filter((f2) => res.some((re) => re.test(f2))).sort()) {
12823
13013
  const content = git2(["show", `${ref}:${path}`]);
12824
13014
  total += content.length;
12825
13015
  if (total > WARM_MAX_BYTES) throw new Error(`sandbox.warm files exceed ${WARM_MAX_BYTES} bytes`);
@@ -13274,10 +13464,10 @@ function isForbidden(e) {
13274
13464
  return e instanceof TablationApiError2 && e.status === 403;
13275
13465
  }
13276
13466
  function promptSourceFields(model, prompt) {
13277
- return model.fields?.some((f) => f.columnName === "prompt_baseline") ? { prompt_source: "crew", prompt_baseline: prompt } : {};
13467
+ return model.fields?.some((f2) => f2.columnName === "prompt_baseline") ? { prompt_source: "crew", prompt_baseline: prompt } : {};
13278
13468
  }
13279
13469
  function hasPromptBaselineColumn(model) {
13280
- return model.fields?.some((f) => f.columnName === "prompt_baseline") === true;
13470
+ return model.fields?.some((f2) => f2.columnName === "prompt_baseline") === true;
13281
13471
  }
13282
13472
  function needsBaselineBackfill(model, row) {
13283
13473
  return hasPromptBaselineColumn(model) && row.prompt_customized !== true && (typeof row.prompt_baseline !== "string" || !row.prompt_source);
@@ -13312,7 +13502,7 @@ async function syncPersonas(route2, opts) {
13312
13502
  const cache = route2.resolved.agentPersonas ?? {};
13313
13503
  const outcomes = [];
13314
13504
  const agentPersonas = { ...cache };
13315
- const hasChatColumn = agentsModel.fields?.some((f) => f.columnName === "chat_enabled") === true;
13505
+ const hasChatColumn = agentsModel.fields?.some((f2) => f2.columnName === "chat_enabled") === true;
13316
13506
  const chatDeclared = {};
13317
13507
  for (const role of ROLE_NAMES) {
13318
13508
  const v = personaChatEnabled(route2.promptsDir, role);
@@ -13552,7 +13742,7 @@ async function linkCrewSeats(route2, client2, agentsModelId, agentPersonas, user
13552
13742
  }
13553
13743
  async function ensureCrewAgentField(route2, client2, crewModel, agentsModelId, userAgent) {
13554
13744
  const existing = crewModel.fields.find(
13555
- (f) => f.fieldType?.kind === "REFERENCE" && f.fieldType.targetModelId === agentsModelId && f.fieldType.isMultiple === false
13745
+ (f2) => f2.fieldType?.kind === "REFERENCE" && f2.fieldType.targetModelId === agentsModelId && f2.fieldType.isMultiple === false
13556
13746
  );
13557
13747
  if (existing) return existing.columnName;
13558
13748
  const workspaceId = route2.resolved.workspaceId;
@@ -13657,10 +13847,10 @@ function parseSkillFile(path) {
13657
13847
  function listLocalSkills(promptsDir) {
13658
13848
  const dir = join32(promptsDir, "skills");
13659
13849
  if (!existsSync28(dir)) return [];
13660
- return readdirSync9(dir).filter((f) => f.endsWith(".md")).map((f) => parseSkillFile(join32(dir, f)));
13850
+ return readdirSync9(dir).filter((f2) => f2.endsWith(".md")).map((f2) => parseSkillFile(join32(dir, f2)));
13661
13851
  }
13662
13852
  function personaColumn(model) {
13663
- for (const c of ["persona_id", "persona"]) if (model.fields?.some((f) => f.columnName === c)) return c;
13853
+ for (const c of ["persona_id", "persona"]) if (model.fields?.some((f2) => f2.columnName === c)) return c;
13664
13854
  return void 0;
13665
13855
  }
13666
13856
  var refId2 = (v) => typeof v === "string" ? v : v && typeof v === "object" && typeof v.id === "string" ? v.id : "";
@@ -13691,7 +13881,7 @@ async function syncSkills(route2, opts) {
13691
13881
  const outcomes = [];
13692
13882
  const agentSkills = { ...cache };
13693
13883
  const warnings = [];
13694
- const hasTrigger = skillsModel.fields?.some((f) => f.columnName === "trigger") === true;
13884
+ const hasTrigger = skillsModel.fields?.some((f2) => f2.columnName === "trigger") === true;
13695
13885
  const personaCol = personaColumn(skillsModel);
13696
13886
  let agentRows;
13697
13887
  const classified = /* @__PURE__ */ new Set();
@@ -14444,7 +14634,7 @@ function planAgentRun(o) {
14444
14634
  // resolved yet has nothing to authenticate the MCP connection with either.
14445
14635
  mcp: o.apiKey ? { url: `${o.route.baseUrl}/api/mcp`, keyVar: API_KEY_VAR } : void 0
14446
14636
  });
14447
- const columns = resolveContract(o.route.contract).columns;
14637
+ const columns2 = resolveContract(o.route.contract).columns;
14448
14638
  const agentLog = o.route.resolved && o.apiKey ? {
14449
14639
  baseUrl: o.route.baseUrl,
14450
14640
  workspaceId: o.route.resolved.workspaceId,
@@ -14454,15 +14644,15 @@ function planAgentRun(o) {
14454
14644
  ...o.route.resolved.models?.crew && o.route.resolved.seats?.[o.role] ? { actor: { table: o.route.resolved.models.crew, recordId: o.route.resolved.seats[o.role] } } : {},
14455
14645
  ...o.route.resolved.models?.issues ? { tickets: {
14456
14646
  issuesModelId: o.route.resolved.models.issues,
14457
- keyColumn: columns.key,
14458
- tagColumn: columns.tag,
14647
+ keyColumn: columns2.key,
14648
+ tagColumn: columns2.tag,
14459
14649
  counters: {
14460
- agentRuns: columns.agentRuns,
14461
- tokensIn: columns.tokensIn,
14462
- tokensOut: columns.tokensOut,
14463
- cacheReadTokens: columns.cacheReadTokens,
14464
- cacheWriteTokens: columns.cacheWriteTokens,
14465
- costUsd: columns.costUsd
14650
+ agentRuns: columns2.agentRuns,
14651
+ tokensIn: columns2.tokensIn,
14652
+ tokensOut: columns2.tokensOut,
14653
+ cacheReadTokens: columns2.cacheReadTokens,
14654
+ cacheWriteTokens: columns2.cacheWriteTokens,
14655
+ costUsd: columns2.costUsd
14466
14656
  }
14467
14657
  } } : {}
14468
14658
  } : void 0;
@@ -16372,27 +16562,27 @@ function probePushAuth(o, run4 = realGit, baseEnv = process.env) {
16372
16562
  const err3 = e;
16373
16563
  const raw = (err3.stderr ? String(err3.stderr) : err3.message).trim().split("\n").filter(Boolean).slice(-2).join(" / ");
16374
16564
  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) {
16565
+ const f2 = o.forge;
16566
+ if (!f2) return { state: "failed", detail: hostOfRemote(o.remoteUrl) ? `${hostOfRemote(o.remoteUrl)}: ${detail}` : detail, hint: pushAuthHint(o.remoteUrl) };
16567
+ if (!f2.hasToken) {
16378
16568
  return {
16379
16569
  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)`
16570
+ detail: `no token for forge ${f2.host}: ${detail}`,
16571
+ hint: `set one with \`crew forge set ${f2.host}\` (forges.${f2.host} in crew.yaml)`
16382
16572
  };
16383
16573
  }
16384
16574
  try {
16385
16575
  run4(o.dir, ["ls-remote", "--exit-code", o.remote, "HEAD"], env);
16386
16576
  return {
16387
16577
  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}\``
16578
+ detail: `the token for forge ${f2.host} is read-only (fetch works, push refused): ${detail}`,
16579
+ hint: `replace it with one that can write contents: \`crew forge rotate ${f2.host}\``
16390
16580
  };
16391
16581
  } catch {
16392
16582
  return {
16393
16583
  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}\``
16584
+ detail: `the token for forge ${f2.host} was refused: ${detail}`,
16585
+ hint: `check that it is current and has access to this repository: \`crew forge rotate ${f2.host}\``
16396
16586
  };
16397
16587
  }
16398
16588
  }
@@ -16850,7 +17040,10 @@ var VALUE_FLAGS = /* @__PURE__ */ new Set([
16850
17040
  "requested-by",
16851
17041
  "issue",
16852
17042
  "shell",
16853
- "resume"
17043
+ "resume",
17044
+ "question",
17045
+ "answer",
17046
+ "to"
16854
17047
  ]);
16855
17048
  function positionalArgs(argv2) {
16856
17049
  const out = [];
@@ -17575,10 +17768,10 @@ function fileMemberStore(dir) {
17575
17768
  return {};
17576
17769
  }
17577
17770
  },
17578
- write(f) {
17771
+ write(f2) {
17579
17772
  mkdirSync26(dirname20(file), { recursive: true, mode: 448 });
17580
17773
  const tmp = `${file}.tmp`;
17581
- writeFileSync28(tmp, `${JSON.stringify(f)}
17774
+ writeFileSync28(tmp, `${JSON.stringify(f2)}
17582
17775
  `, { mode: 384 });
17583
17776
  renameSync7(tmp, file);
17584
17777
  }
@@ -17938,11 +18131,11 @@ function planRepoRow(i) {
17938
18131
  project_id: i.projectId
17939
18132
  };
17940
18133
  }
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"})`);
18134
+ function resolveRepoProject(projects, opt2, routeAreaId) {
18135
+ if (opt2) {
18136
+ const want = opt2.toLowerCase();
18137
+ const hit = projects.find((p) => p.id === opt2 || p.name?.toLowerCase() === want);
18138
+ if (!hit) throw new ReposError(`no Projects row "${opt2}" (have: ${projects.map((p) => p.name ?? p.id).join(", ") || "none"})`);
17946
18139
  return hit.id;
17947
18140
  }
17948
18141
  if (routeAreaId) return routeAreaId;
@@ -17993,13 +18186,13 @@ function planRepoClone(i) {
17993
18186
 
17994
18187
  // src/doctor-fix.ts
17995
18188
  var sound = (r) => r.hasRepos && r.problems.length === 0;
17996
- function planFix(f) {
18189
+ function planFix(f2) {
17997
18190
  const actions = [];
17998
18191
  const notes = [];
17999
- for (const r of f.routes) {
18192
+ for (const r of f2.routes) {
18000
18193
  if (r.snapshotStale) actions.push({ kind: "refresh-snapshot", route: r.route });
18001
18194
  }
18002
- for (const r of f.routes) {
18195
+ for (const r of f2.routes) {
18003
18196
  if (!r.enabled && sound(r)) {
18004
18197
  actions.push({ kind: "enable", route: r.route });
18005
18198
  const gaps = r.readiness ?? [];
@@ -18010,8 +18203,8 @@ function planFix(f) {
18010
18203
  notes.push(`${r.route}: not enabled \u2014 ${r.hasRepos ? r.problems[0] : "no checkout is configured"}`);
18011
18204
  }
18012
18205
  }
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");
18206
+ if (f2.schedulerAbsent && f2.routes.some(sound)) {
18207
+ if (f2.host === "windows") notes.push("scheduler support is not built for Windows yet \u2014 nothing to install; run `crew run` by hand");
18015
18208
  else actions.push({ kind: "install" });
18016
18209
  }
18017
18210
  return { actions, notes };
@@ -18322,8 +18515,8 @@ function realProvisionDeps(crewHome) {
18322
18515
  return { status: res.status ?? 1, stdout: res.stdout ?? "", stderr: `${res.stderr ?? ""}${res.error ? String(res.error) : ""}` };
18323
18516
  };
18324
18517
  const configFile = () => {
18325
- const f = findConfigFile(crewHome);
18326
- return existsSync37(f) ? f : null;
18518
+ const f2 = findConfigFile(crewHome);
18519
+ return existsSync37(f2) ? f2 : null;
18327
18520
  };
18328
18521
  return {
18329
18522
  crew: spawnCrew,
@@ -18444,7 +18637,7 @@ function realPoolMemberDeps(o) {
18444
18637
  },
18445
18638
  hasShipConfig: () => existsSync38(findConfigFile(o.crewHome)),
18446
18639
  async provision(lease, instanceClass, shipKind) {
18447
- const hosts = lease.forges.map((f) => f.host.toLowerCase());
18640
+ const hosts = lease.forges.map((f2) => f2.host.toLowerCase());
18448
18641
  const lines2 = [];
18449
18642
  const outcome = await runProvision({
18450
18643
  key: lease.connectKey,
@@ -18458,7 +18651,7 @@ function realPoolMemberDeps(o) {
18458
18651
  maxConcurrentAgents: lease.maxConcurrentAgents,
18459
18652
  baseUrl: platformBaseUrl(o.platformUrl),
18460
18653
  forgeHosts: hosts,
18461
- tokens: Object.fromEntries(lease.forges.map((f) => [f.host.toLowerCase(), f.token])),
18654
+ tokens: Object.fromEntries(lease.forges.map((f2) => [f2.host.toLowerCase(), f2.token])),
18462
18655
  json: false,
18463
18656
  dryRun: false,
18464
18657
  choices: []
@@ -18471,7 +18664,7 @@ function realPoolMemberDeps(o) {
18471
18664
  return { ok: false, reason: `crew provision exited ${outcome.code}: ${lines2.at(-1) ?? "no detail"}` };
18472
18665
  },
18473
18666
  async applyTokens(forges) {
18474
- const want = new Map(forges.map((f) => [f.host.toLowerCase(), f.token]));
18667
+ const want = new Map(forges.map((f2) => [f2.host.toLowerCase(), f2.token]));
18475
18668
  for (const [host, token] of want) {
18476
18669
  const stored = provisionDeps.storedToken(host);
18477
18670
  if (stored === token) continue;
@@ -19032,9 +19225,9 @@ function planEpicSync(epics, outstanding, closed, c) {
19032
19225
  const steps = [];
19033
19226
  for (const epic of trackedEpics(epics, c)) {
19034
19227
  const from = statusOf(epic, c);
19035
- const open = openByEpic.get(epic.id) ?? [];
19228
+ const open2 = openByEpic.get(epic.id) ?? [];
19036
19229
  const label = epicLabel(epic, c);
19037
- if (open.length === 0) {
19230
+ if (open2.length === 0) {
19038
19231
  const n = closedCount.get(epic.id) ?? 0;
19039
19232
  if (from !== s.done && n > 0) {
19040
19233
  steps.push({
@@ -19048,7 +19241,7 @@ function planEpicSync(epics, outstanding, closed, c) {
19048
19241
  }
19049
19242
  continue;
19050
19243
  }
19051
- const active = open.filter((t) => worked.has(t.status));
19244
+ const active = open2.filter((t) => worked.has(t.status));
19052
19245
  if (active.length && from !== s.building) {
19053
19246
  steps.push({
19054
19247
  action: from === s.done ? "reopen" : "start",
@@ -19377,6 +19570,141 @@ ${waiting.map((t) => `| ${displayKey2(t)} | ${t.status} | ${blockers(t, i)} |`).
19377
19570
  ]);
19378
19571
  }
19379
19572
 
19573
+ // src/tracker-interface-read.ts
19574
+ var INTERFACE_MISMATCH_KEY = "tracker_interface";
19575
+ var INTERFACE_UNDECLARED_KEY = "tracker_interface_undeclared";
19576
+ function statusOf2(e) {
19577
+ return typeof e?.status === "number" ? e.status : void 0;
19578
+ }
19579
+ async function findImplementers(get2, workspaceId) {
19580
+ try {
19581
+ return await get2(
19582
+ `/app-interfaces/implementers?workspaceId=${encodeURIComponent(workspaceId)}&name=${encodeURIComponent(TRACKER_INTERFACE_NAME)}`
19583
+ );
19584
+ } catch (e) {
19585
+ if (statusOf2(e) === 404) return [];
19586
+ return "unreadable";
19587
+ }
19588
+ }
19589
+ async function readInterfaceState(get2, workspaceId, projectId) {
19590
+ const found = await findImplementers(get2, workspaceId);
19591
+ if (found === "unreadable") return { kind: "unreadable" };
19592
+ const mine = found.find((i) => i.project.id === projectId && i.interfaceName === TRACKER_INTERFACE_NAME);
19593
+ if (!mine) return { kind: "undeclared" };
19594
+ const mapping = {
19595
+ tables: { ...mine.mapping.tables },
19596
+ fields: { ...mine.mapping.fields },
19597
+ values: { ...mine.mapping.values }
19598
+ };
19599
+ const accepted = versionAccepted(mine.version);
19600
+ let conforms = null;
19601
+ let unmet = [];
19602
+ try {
19603
+ const rows = await get2(`/projects/${encodeURIComponent(projectId)}/interfaces`);
19604
+ const row = rows.find((r) => r.name === TRACKER_INTERFACE_NAME);
19605
+ if (row) {
19606
+ conforms = row.conforms;
19607
+ unmet = row.unmet ?? [];
19608
+ }
19609
+ } catch {
19610
+ }
19611
+ return { kind: "declared", version: mine.version, accepted, mapping, conforms, unmet };
19612
+ }
19613
+ function mappingKey(m) {
19614
+ 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);
19615
+ }
19616
+ function versionMismatchMessage(v) {
19617
+ const side = sideToUpdate(v);
19618
+ 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";
19619
+ }
19620
+ function nonConformingMessage(unmet) {
19621
+ 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`;
19622
+ }
19623
+ 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";
19624
+ 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";
19625
+ 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";
19626
+ function blockingMessage(state, storedMappingKey) {
19627
+ if (state.kind !== "declared") return null;
19628
+ if (!state.accepted) return versionMismatchMessage(state.version);
19629
+ if (state.conforms === false) return nonConformingMessage(state.unmet);
19630
+ if (storedMappingKey !== void 0 && storedMappingKey !== mappingKey(state.mapping)) return MAPPING_CHANGED_MESSAGE;
19631
+ return null;
19632
+ }
19633
+ function mismatchItem(message, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19634
+ return { kind: "tracker_interface", key: INTERFACE_MISMATCH_KEY, since: nowIso, message };
19635
+ }
19636
+ function undeclaredItem(nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19637
+ return { kind: "tracker_interface", key: INTERFACE_UNDECLARED_KEY, since: nowIso, message: UNDECLARED_MESSAGE };
19638
+ }
19639
+ function overrideItem(nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19640
+ return { kind: "tracker_interface", key: `${INTERFACE_MISMATCH_KEY}_override`, since: nowIso, message: OVERRIDE_IGNORED_MESSAGE };
19641
+ }
19642
+ function open(state, key) {
19643
+ return state.shipAttention().previous().find((i) => i.key === key)?.message ?? null;
19644
+ }
19645
+ async function checkTrackerInterface(o, deps = {}) {
19646
+ const r = o.route.resolved;
19647
+ if (!r?.projectId) return null;
19648
+ const state = await (deps.read ?? readForRoute)(o.route, o.ship);
19649
+ if (state.kind === "unreadable") return open(o.state, INTERFACE_MISMATCH_KEY);
19650
+ if (state.kind === "undeclared") {
19651
+ clearShipAttention(o.state, INTERFACE_MISMATCH_KEY);
19652
+ clearShipAttention(o.state, `${INTERFACE_MISMATCH_KEY}_override`);
19653
+ if (ALLOW_UNDECLARED_TRACKER_APPS) {
19654
+ await raiseShipAttention(o, undeclaredItem());
19655
+ return null;
19656
+ }
19657
+ 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";
19658
+ await raiseShipAttention(o, mismatchItem(message2));
19659
+ return message2;
19660
+ }
19661
+ clearShipAttention(o.state, INTERFACE_UNDECLARED_KEY);
19662
+ if (o.route.contractAuthored) await raiseShipAttention(o, overrideItem());
19663
+ else clearShipAttention(o.state, `${INTERFACE_MISMATCH_KEY}_override`);
19664
+ const message = blockingMessage(state, r.trackerInterface?.mappingKey);
19665
+ if (message) {
19666
+ await raiseShipAttention(o, mismatchItem(message));
19667
+ return message;
19668
+ }
19669
+ clearShipAttention(o.state, INTERFACE_MISMATCH_KEY);
19670
+ return null;
19671
+ }
19672
+ async function readForRoute(route2, ship) {
19673
+ const r = route2.resolved;
19674
+ if (!r?.projectId) return { kind: "unreadable" };
19675
+ const get2 = async (path) => {
19676
+ const res = await fetch(`${route2.baseUrl.replace(/\/+$/, "")}/api${path}`, {
19677
+ headers: { Authorization: `Bearer ${resolveApiKey(route2)}`, "User-Agent": ship.userAgent }
19678
+ });
19679
+ if (!res.ok) throw Object.assign(new Error(`HTTP ${res.status}`), { status: res.status });
19680
+ return await res.json();
19681
+ };
19682
+ try {
19683
+ return await readInterfaceState(get2, r.workspaceId, r.projectId);
19684
+ } catch {
19685
+ return { kind: "unreadable" };
19686
+ }
19687
+ }
19688
+ function interfaceReport(state, o) {
19689
+ if (state.kind === "unreadable") return [{ line: "work tracker interface: could not be read from the platform", problem: false }];
19690
+ if (state.kind === "undeclared") {
19691
+ return [{
19692
+ 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",
19693
+ problem: !ALLOW_UNDECLARED_TRACKER_APPS
19694
+ }];
19695
+ }
19696
+ const lines2 = [];
19697
+ const blocking = blockingMessage(state, o.storedMappingKey);
19698
+ if (!state.accepted) lines2.push({ line: `work tracker interface: ${versionMismatchMessage(state.version)}`, problem: true });
19699
+ else if (state.conforms === false) {
19700
+ lines2.push({ line: `work tracker interface ${versionLabel(state.version)}: does not conform`, problem: true });
19701
+ for (const d of describeDifferences(state.unmet)) lines2.push({ line: ` - ${d}`, problem: true });
19702
+ } else if (blocking) lines2.push({ line: `work tracker interface: ${blocking}`, problem: true });
19703
+ else lines2.push({ line: `work tracker interface ${versionLabel(state.version)}: ${state.conforms ? "conforms" : "declared (conformance not visible to this key)"}`, problem: false });
19704
+ if (o.contractAuthored) lines2.push({ line: `work tracker interface: ${OVERRIDE_IGNORED_MESSAGE}`, problem: false });
19705
+ return lines2;
19706
+ }
19707
+
19380
19708
  // src/sandbox-hygiene.ts
19381
19709
  import { execFile as execFile3 } from "child_process";
19382
19710
  import { existsSync as existsSync39, statfsSync as statfsSync2 } from "fs";
@@ -19659,10 +19987,10 @@ async function runStalledSweep(o, stalled) {
19659
19987
  const scoped = r.attention.map((i) => scope ? { ...i, key: stalledKey(i.key.slice("stalled:".length), scope) } : i);
19660
19988
  const keep = new Set(scoped.map((i) => i.key));
19661
19989
  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);
19990
+ for (const open2 of o.state.shipAttention().previous()) {
19991
+ if (open2.kind !== "stalled" || keep.has(open2.key)) continue;
19992
+ const unscoped = !/^stalled:[^:]+:/.test(open2.key);
19993
+ if (unscoped || open2.key.startsWith(prefix)) clearShipAttention(o.state, open2.key);
19666
19994
  }
19667
19995
  return r;
19668
19996
  }
@@ -19835,7 +20163,7 @@ async function decideCycle(o) {
19835
20163
  emit.emit(`${what}: no longer missing from the scheduler PATH \u2014 stop cleared`, { step: "select" });
19836
20164
  }
19837
20165
  await checkRepoDisks({ state, emit, route: route2, ship });
19838
- const floorStop = await checkCrewFloor({ state, emit, route: route2, ship });
20166
+ const floorStop = await checkCrewFloor({ state, emit, route: route2, ship }) ?? await checkTrackerInterface({ state, emit, route: route2, ship });
19839
20167
  const itemStop = repoStopFor(openShipAttention(state), route2);
19840
20168
  const diskStop = diskFullStop(state);
19841
20169
  const selectionInput = {
@@ -20470,7 +20798,7 @@ function planBuildFailureBounce(cwd, c, base, remote) {
20470
20798
  }
20471
20799
  function outsideNote(b) {
20472
20800
  if (b.inBranch !== false || !b.failingFiles?.length) return "";
20473
- const shown = b.failingFiles.slice(0, 5).map((f) => `\`${f}\``).join(", ");
20801
+ const shown = b.failingFiles.slice(0, 5).map((f2) => `\`${f2}\``).join(", ");
20474
20802
  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
20803
 
20476
20804
  `;
@@ -20508,8 +20836,8 @@ function failureComparison(b, previousNote) {
20508
20836
  if (!before.length || !now.length) {
20509
20837
  lines2.push("- Same failure both times? Unknown: the output of at least one run names no file.");
20510
20838
  } 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.`);
20839
+ const same2 = now.filter((f2) => before.includes(f2));
20840
+ 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
20841
  }
20514
20842
  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
20843
  return lines2.join("\n");
@@ -20719,12 +21047,12 @@ var overlap = (a, b) => {
20719
21047
  return a.filter((p) => set.has(p));
20720
21048
  };
20721
21049
  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]));
21050
+ const { open: open2, lapsed } = handBacks(tickets, events, contract, now, ttlMinutes);
21051
+ const own = new Map(open2.map((h) => [h.ticket.id, h]));
20724
21052
  const deferrals = [];
20725
21053
  for (const c of candidates2) {
20726
21054
  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);
21055
+ 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
21056
  if (first) deferrals.push({ ticket: c.ticket, waitingFor: first.ticket, paths: overlap(c.paths, first.paths), since: first.at });
20729
21057
  }
20730
21058
  const lapsedUsed = lapsed.filter((h) => candidates2.some((c) => c.ticket.id !== h.ticket.id && overlap(c.paths, h.paths).length > 0));
@@ -20743,12 +21071,12 @@ function deferralComment(d, base, ttlMinutes) {
20743
21071
  ${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
21072
  }
20745
21073
  function deferredFromLog(tickets, events, contract, now, ttlMinutes) {
20746
- const { open } = handBacks(tickets, events, contract, now, ttlMinutes);
21074
+ const { open: open2 } = handBacks(tickets, events, contract, now, ttlMinutes);
20747
21075
  const out = [];
20748
21076
  for (const t of tickets) {
20749
21077
  if (t.status !== contract.statuses.verified) continue;
20750
21078
  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));
21079
+ const hb = last && open2.find((h) => h.ticket.id === last.metadata?.waiting_for && h.at <= stampMs(last));
20752
21080
  if (hb) out.push({ ticket: t, waitingFor: hb.ticket });
20753
21081
  }
20754
21082
  return out;
@@ -20775,7 +21103,7 @@ function platformAdmitters(dir, baseRef, ship, tickets, locate) {
20775
21103
  const branch = locate(t);
20776
21104
  if (!branch) continue;
20777
21105
  const changed2 = gitOk(dir, ["diff", "--name-only", `${baseRef}...${branch}`, "--", ...REPO_CONFIG_FILENAMES]);
20778
- const file = changed2?.split("\n").find((f) => f.trim() !== "");
21106
+ const file = changed2?.split("\n").find((f2) => f2.trim() !== "");
20779
21107
  if (!file) continue;
20780
21108
  const text2 = gitOk(dir, ["show", `${branch}:${file}`]);
20781
21109
  if (text2 === null) continue;
@@ -20946,10 +21274,10 @@ function parseChoices(argv2) {
20946
21274
  function choiceData(key, options) {
20947
21275
  return { key, options, answer: `--choose ${key}=<value>` };
20948
21276
  }
20949
- function usesFlagAnswers(f, isTTY) {
20950
- if (f.noWizard) return true;
21277
+ function usesFlagAnswers(f2, isTTY) {
21278
+ if (f2.noWizard) return true;
20951
21279
  if (isTTY) return false;
20952
- return !!(f.shipName || f.agentBin || f.extraPath || f.hostPassengers);
21280
+ return !!(f2.shipName || f2.agentBin || f2.extraPath || f2.hostPassengers);
20953
21281
  }
20954
21282
  function agentBinSearchDirs(home, pathEnv, extraPath) {
20955
21283
  const dirs = [
@@ -20968,7 +21296,7 @@ function findAgentBin(name, env, extraPath, isExec) {
20968
21296
  const searched = agentBinSearchDirs(env.home ?? homedir10(), env.pathEnv, extraPath);
20969
21297
  return { bin: findOnPath2(name, searched.join(delimiter2), isExec), searched };
20970
21298
  }
20971
- function flagWizardAnswers(f, env) {
21299
+ function flagWizardAnswers(f2, env) {
20972
21300
  const isExec = env.isExecutable ?? ((p) => {
20973
21301
  try {
20974
21302
  accessSync4(p, constants4.X_OK);
@@ -20977,19 +21305,19 @@ function flagWizardAnswers(f, env) {
20977
21305
  return false;
20978
21306
  }
20979
21307
  });
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;
21308
+ if (f2.agentBin && !isExec(f2.agentBin)) return { error: `--agent-bin ${f2.agentBin} is not an executable file` };
21309
+ const found = f2.agentBin ? void 0 : findAgentBin("claude", env, f2.extraPath, isExec);
21310
+ const agentBin = f2.agentBin ?? found?.bin;
20983
21311
  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]);
21312
+ const dockerPath = f2.hostPassengers ? findOnPath2("docker", env.pathEnv, isExec) : void 0;
21313
+ const extraPath = f2.extraPath ?? deriveExtraPath([dirname25(env.nodePath), pnpmPath ? dirname25(pnpmPath) : void 0, dockerPath ? dirname25(dockerPath) : void 0]);
20986
21314
  return {
20987
21315
  answers: {
20988
- name: f.shipName?.trim() || env.hostname,
21316
+ name: f2.shipName?.trim() || env.hostname,
20989
21317
  platform: env.platform,
20990
21318
  agentBin: agentBin ?? "claude",
20991
21319
  extraPath,
20992
- hostPassengers: f.hostPassengers
21320
+ hostPassengers: f2.hostPassengers
20993
21321
  },
20994
21322
  ...agentBin ? {} : { agentBinSearched: found?.searched ?? [] }
20995
21323
  };
@@ -21453,8 +21781,8 @@ async function applyExternalClosures(tracker, closures, contract, emit, dryRun,
21453
21781
  // src/pr-links.ts
21454
21782
  function selectPull(pulls, firstPushedAt) {
21455
21783
  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;
21784
+ const open2 = byNewest.find((p) => p.open);
21785
+ if (open2) return open2;
21458
21786
  const cutoff = firstPushedAt ? Date.parse(firstPushedAt) : NaN;
21459
21787
  if (Number.isNaN(cutoff)) return null;
21460
21788
  return byNewest.find((p) => Date.parse(p.createdAt) > cutoff) ?? null;
@@ -21664,7 +21992,7 @@ async function runReview(r, verified, reviewing) {
21664
21992
  }
21665
21993
  return out;
21666
21994
  }
21667
- async function applyReview(tracker, contract, outcome, remote, emit, seat, columns, dryRun) {
21995
+ async function applyReview(tracker, contract, outcome, remote, emit, seat, columns2, dryRun) {
21668
21996
  const reviewing = contract.statuses.reviewing;
21669
21997
  for (const h of outcome.handoffs) {
21670
21998
  if (!reviewing) break;
@@ -21683,8 +22011,8 @@ ${h.prFailure.tail}
21683
22011
  try {
21684
22012
  await tracker.updateTicket(t.id, {
21685
22013
  [contract.columns.status]: reviewing,
21686
- ...h.prRef && columns.prRef ? { [contract.columns.prRef]: h.prRef } : {},
21687
- ...h.prUrl && columns.prUrl ? { [contract.columns.prUrl]: h.prUrl } : {}
22014
+ ...h.prRef && columns2.prRef ? { [contract.columns.prRef]: h.prRef } : {},
22015
+ ...h.prUrl && columns2.prUrl ? { [contract.columns.prUrl]: h.prUrl } : {}
21688
22016
  }, t.updated_at);
21689
22017
  await tracker.postEvent(t.id, lines2.join("\n\n"), seat, "review");
21690
22018
  emit.emit(`moved to ${reviewing}`, { ticket: t.issue_id });
@@ -21905,8 +22233,8 @@ async function reviewHandoff(o, closures, verifiedCandidates, reviewing) {
21905
22233
  for (const p of problems) o.emit.error(`${o.scope ?? "release"}: ${p}`);
21906
22234
  return void 0;
21907
22235
  }
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 }));
22236
+ const open2 = new Set(closures.filter((c) => c.closure.state !== "merged").map((c) => c.ticket.id));
22237
+ const verified = verifiedCandidates.filter((c) => !!c.branch && open2.has(c.ticket.id)).map((c) => ({ ticket: c.ticket, branch: c.branch }));
21910
22238
  const outcome = await runReview({
21911
22239
  cwd: o.cwd,
21912
22240
  repo: o.repo,
@@ -21919,7 +22247,7 @@ async function reviewHandoff(o, closures, verifiedCandidates, reviewing) {
21919
22247
  const r = await hook(o, "pr", env);
21920
22248
  return r ? { code: r.code, output: r.output } : null;
21921
22249
  }
21922
- }, verified, reviewing.filter((r) => open.has(r.ticket.id)));
22250
+ }, verified, reviewing.filter((r) => open2.has(r.ticket.id)));
21923
22251
  return outcome.handoffs.length || outcome.requeues.length ? outcome : void 0;
21924
22252
  }
21925
22253
  async function confirmExternalReleased(o, closures) {
@@ -22057,7 +22385,7 @@ async function bump(o, size) {
22057
22385
  }
22058
22386
  return printed;
22059
22387
  }
22060
- const files = o.repo.release.versionFiles.map((f) => join48(o.cwd, f));
22388
+ const files = o.repo.release.versionFiles.map((f2) => join48(o.cwd, f2));
22061
22389
  const first = files[0];
22062
22390
  if (!existsAt(first, existsSync42)) {
22063
22391
  o.emit.error(`no ${o.repo.release.versionFiles[0]} to read a version from`);
@@ -22081,14 +22409,14 @@ async function bump(o, size) {
22081
22409
  o.emit.emit(`would bump ${current} -> ${version} in ${files.length} file(s)`);
22082
22410
  return version;
22083
22411
  }
22084
- for (const f of files) {
22085
- const src = readTextAt(f, (p) => readFileSync41(p, "utf8"));
22412
+ for (const f2 of files) {
22413
+ const src = readTextAt(f2, (p) => readFileSync41(p, "utf8"));
22086
22414
  const out = src.replace(/("version"\s*:\s*")[^"]*(")/, `$1${version}$2`);
22087
22415
  if (out === src) {
22088
- o.emit.error(`no version field in ${f}`);
22416
+ o.emit.error(`no version field in ${f2}`);
22089
22417
  return null;
22090
22418
  }
22091
- writeTextAt(f, out, writeFileSync34);
22419
+ writeTextAt(f2, out, writeFileSync34);
22092
22420
  }
22093
22421
  return version;
22094
22422
  }
@@ -22121,7 +22449,7 @@ async function confirm(o, expected, ci) {
22121
22449
  o.emit.emit(`confirmed live: ${live2.slice(0, 12)}`);
22122
22450
  return true;
22123
22451
  }
22124
- if (ci?.failures.some((f) => f.run.ref === "tag")) {
22452
+ if (ci?.failures.some((f2) => f2.run.ref === "tag")) {
22125
22453
  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
22454
  return false;
22127
22455
  }
@@ -22161,14 +22489,14 @@ async function sweepCi(o, w, live2) {
22161
22489
  return;
22162
22490
  }
22163
22491
  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 } });
22492
+ if (w.failures.some((f3) => f3.run.id === run4.id)) continue;
22493
+ const f2 = await w.provider.failure(w.q, run4);
22494
+ w.failures.push(f2);
22495
+ o.emit.error(`CI run failed for ${w.version}: ${describeCiFailure(f2)}`, { data: { run: run4.id, ref: run4.ref } });
22168
22496
  }
22169
- w.failures = w.failures.filter((f) => failed.some((r) => r.id === f.run.id));
22497
+ w.failures = w.failures.filter((f2) => failed.some((r) => r.id === f2.run.id));
22170
22498
  if (o.attention) {
22171
- const url = w.failures.find((f) => f.run.url)?.run.url;
22499
+ const url = w.failures.find((f2) => f2.run.url)?.run.url;
22172
22500
  await o.attention.raise({
22173
22501
  kind: "ci_run_failed",
22174
22502
  key: ciKey(o, w.version),
@@ -22265,11 +22593,11 @@ function openReleaseCheckout(o) {
22265
22593
  close();
22266
22594
  throw e;
22267
22595
  }
22268
- for (const f of o.repo.worktrees.copy) {
22269
- const src = join48(o.cwd, f);
22596
+ for (const f2 of o.repo.worktrees.copy) {
22597
+ const src = join48(o.cwd, f2);
22270
22598
  if (!existsSync42(src)) continue;
22271
- mkdirSync30(dirname26(join48(dir, f)), { recursive: true });
22272
- copyFileSync(src, join48(dir, f));
22599
+ mkdirSync30(dirname26(join48(dir, f2)), { recursive: true });
22600
+ copyFileSync(src, join48(dir, f2));
22273
22601
  }
22274
22602
  return { dir, branch, close };
22275
22603
  }
@@ -23393,12 +23721,12 @@ function since(iso, now = Date.now()) {
23393
23721
  if (hours < 48) return `${hours}h`;
23394
23722
  return `${Math.round(hours / 24)}d`;
23395
23723
  }
23396
- function renderFleet(f, state) {
23397
- const rows = f.entries.map((e) => {
23724
+ function renderFleet(f2, state) {
23725
+ const rows = f2.entries.map((e) => {
23398
23726
  if (e.error) return ` ${e.route.route.padEnd(16)} unreachable \u2014 ${e.error}`;
23399
23727
  if (!e.role) return ` ${e.route.route.padEnd(16)} nothing pending`;
23400
23728
  const pending = e.decision?.selection.pending.join(" ") ?? "";
23401
- const win = f.winner?.route.route === e.route.route ? " <- runs this cycle" : "";
23729
+ const win = f2.winner?.route.route === e.route.route ? " <- runs this cycle" : "";
23402
23730
  const streak = state?.fairness(e.route.route).streak() ?? 0;
23403
23731
  const passedOver = !win && streak >= LOUD_STREAK ? ` ! passed over ${streak} cycles running` : "";
23404
23732
  return ` ${e.route.route.padEnd(16)} ${e.role.padEnd(7)} rank ${String(e.rank).padStart(12)} pending: ${pending}${win}${passedOver}`;
@@ -23759,7 +24087,7 @@ async function readMirrorWarmFiles(cache, repo, base, patterns) {
23759
24087
  const res = patterns.map(globToRegExp);
23760
24088
  const out = {};
23761
24089
  let total = 0;
23762
- for (const path of (await cache.listFiles(repo, base)).filter((f) => res.some((re) => re.test(f))).sort()) {
24090
+ for (const path of (await cache.listFiles(repo, base)).filter((f2) => res.some((re) => re.test(f2))).sort()) {
23763
24091
  const content = await cache.showFile(repo, base, path);
23764
24092
  if (content === null) continue;
23765
24093
  total += content.length;
@@ -23832,10 +24160,10 @@ async function reconcileSeatAttention(route2, probes, io) {
23832
24160
  }
23833
24161
  }
23834
24162
  var missingRoles = (probes) => probes.filter((p) => p.state === "missing").map((p) => p.role);
23835
- function mergeSeatAttention(open, route2, probes, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
24163
+ function mergeSeatAttention(open2, route2, probes, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
23836
24164
  const slug2 = routeSlug(route2.route);
23837
24165
  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");
24166
+ const kept = open2.filter((i) => i.kind !== "seat_missing" || !settled.has(i.key) || settled.get(i.key) === "missing");
23839
24167
  const have = new Set(kept.map((i) => i.key));
23840
24168
  const added = probes.filter((p) => p.state === "missing" && !have.has(seatMissingKey(slug2, p.role))).map((p) => seatMissingItem(slug2, p.role, nowIso));
23841
24169
  return [...kept, ...added];
@@ -24113,9 +24441,9 @@ ${res.url}
24113
24441
  ${res.codeTools}
24114
24442
  `;
24115
24443
  }
24116
- function shouldOpen(f) {
24117
- if (f.noOpen || f.json) return false;
24118
- return f.open || f.terminal;
24444
+ function shouldOpen(f2) {
24445
+ if (f2.noOpen || f2.json) return false;
24446
+ return f2.open || f2.terminal;
24119
24447
  }
24120
24448
  function progressComment(url, handoff) {
24121
24449
  return [
@@ -24342,14 +24670,14 @@ function rowForCwd(rows, cwd) {
24342
24670
  }
24343
24671
  var PROTOTYPE_HEADING = "## Prototype";
24344
24672
  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);
24673
+ const added = files.reduce((n, f2) => n + f2.added, 0);
24674
+ const removed = files.reduce((n, f2) => n + f2.removed, 0);
24347
24675
  return [
24348
24676
  PROTOTYPE_HEADING,
24349
24677
  "",
24350
24678
  "This branch began as a Periscope prototype and may be rewritten rather than treated as reviewed work.",
24351
24679
  "",
24352
- ...files.length === 0 ? ["No files differ from the base."] : files.map((f) => `- \`${f.path}\` (+${f.added} \u2212${f.removed})`),
24680
+ ...files.length === 0 ? ["No files differ from the base."] : files.map((f2) => `- \`${f2.path}\` (+${f2.added} \u2212${f2.removed})`),
24353
24681
  "",
24354
24682
  `${files.length} file${files.length === 1 ? "" : "s"} changed, ${added} insertion${added === 1 ? "" : "s"}(+), ${removed} deletion${removed === 1 ? "" : "s"}(\u2212)`
24355
24683
  ].join("\n");
@@ -24604,9 +24932,9 @@ function readDaemonStarted(stateDir) {
24604
24932
  }
24605
24933
  }
24606
24934
  function configChangedAfter(files, startedAt) {
24607
- for (const f of files) {
24935
+ for (const f2 of files) {
24608
24936
  try {
24609
- if (statSync14(f).mtimeMs > startedAt) return f;
24937
+ if (statSync14(f2).mtimeMs > startedAt) return f2;
24610
24938
  } catch {
24611
24939
  }
24612
24940
  }
@@ -25721,11 +26049,11 @@ function fallbackStateDir(configFile) {
25721
26049
  }
25722
26050
 
25723
26051
  // src/projects-cmd.ts
25724
- async function buildProjectsReport(routes, open) {
26052
+ async function buildProjectsReport(routes, open2) {
25725
26053
  return Promise.all(routes.map(async (r) => {
25726
26054
  const areaId = r.areaId ?? null;
25727
26055
  try {
25728
- const rows = await open(r.route).projectRowsWithModes();
26056
+ const rows = await open2(r.route).projectRowsWithModes();
25729
26057
  return {
25730
26058
  route: r.route,
25731
26059
  areaId,
@@ -26138,12 +26466,12 @@ var WORKING_STEPS = /* @__PURE__ */ new Set(["worktree", "agent", "reconcile", "
26138
26466
  function byRoute(events, route2) {
26139
26467
  return route2 ? events.filter((e) => e.route === route2) : events;
26140
26468
  }
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;
26469
+ function matches(e, f2) {
26470
+ if (f2.role && e.role !== f2.role) return false;
26471
+ if (f2.ticket && e.ticket !== f2.ticket) return false;
26472
+ if (f2.route && e.route !== f2.route) return false;
26473
+ if (f2.level === "warn" && e.level === "info") return false;
26474
+ if (f2.level === "error" && e.level !== "error") return false;
26147
26475
  return true;
26148
26476
  }
26149
26477
  function localTime(iso) {
@@ -26470,6 +26798,58 @@ function renderStatus(v, opts) {
26470
26798
  return out;
26471
26799
  }
26472
26800
 
26801
+ // src/questions.ts
26802
+ var MIN_ANSWERS = 2;
26803
+ var MAX_ANSWERS = 4;
26804
+ function validateAsk(req) {
26805
+ const problems = [];
26806
+ if (!req.question.trim()) problems.push("the question is empty");
26807
+ const n = req.answers.length;
26808
+ if (n === 1) problems.push(`one proposed answer is not a choice \u2014 give ${MIN_ANSWERS} to ${MAX_ANSWERS}, or none for a question that needs a free-form answer`);
26809
+ if (n > MAX_ANSWERS) problems.push(`${n} proposed answers is too many \u2014 give ${MIN_ANSWERS} to ${MAX_ANSWERS}`);
26810
+ req.answers.forEach((a, i) => {
26811
+ if (!a.label.trim()) problems.push(`answer ${i + 1} has no label`);
26812
+ if (!a.detail.trim()) problems.push(`answer ${i + 1} has no detail`);
26813
+ });
26814
+ return problems;
26815
+ }
26816
+ function columns(pairs) {
26817
+ return Object.fromEntries(pairs.filter(([name, value2]) => name && value2 !== void 0));
26818
+ }
26819
+ async function askQuestion(store, part, contract, req) {
26820
+ const q2 = contract.questions;
26821
+ const a = contract.answers;
26822
+ const st = contract.questionStatuses;
26823
+ const earlier = await store.listOpenQuestions(part, req.ticketId, req.askedBy);
26824
+ for (const old of earlier) await store.updateRecord(part.questionsModelId, old.id, { [q2.status]: st.withdrawn });
26825
+ const made = await store.createRecord(part.questionsModelId, columns([
26826
+ [q2.parent, req.ticketId],
26827
+ [q2.text, req.question.trim()],
26828
+ [q2.status, st.open],
26829
+ [q2.askedBy, req.askedBy],
26830
+ [q2.addressedTo, req.addressedTo]
26831
+ ]));
26832
+ const answerIds = [];
26833
+ try {
26834
+ for (const [i, ans] of req.answers.entries()) {
26835
+ const row = await store.createRecord(part.answersModelId, columns([
26836
+ [a.question, made.id],
26837
+ [a.label, ans.label.trim()],
26838
+ [a.detail, ans.detail.trim()],
26839
+ [a.order, i + 1]
26840
+ ]));
26841
+ answerIds.push(row.id);
26842
+ }
26843
+ } catch (e) {
26844
+ try {
26845
+ await store.updateRecord(part.questionsModelId, made.id, { [q2.status]: st.withdrawn });
26846
+ } catch {
26847
+ }
26848
+ throw e;
26849
+ }
26850
+ return { withdrawn: earlier.map((e) => e.id), questionId: made.id, answerIds };
26851
+ }
26852
+
26473
26853
  // src/connect.ts
26474
26854
  var ConnectHttpError = class extends Error {
26475
26855
  status;
@@ -26660,9 +27040,12 @@ async function discover(o) {
26660
27040
  }
26661
27041
  } else {
26662
27042
  const projects = await get(o, `/projects?workspaceId=${ws.id}`);
27043
+ const implementers = await findImplementers((path) => get(o, path), ws.id);
27044
+ const declaredHere = implementers === "unreadable" ? [] : implementers.filter((i) => projects.some((p) => p.id === i.project.id));
26663
27045
  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) {
27046
+ const declaredCandidate = declaredHere.length === 1 ? projects.find((p) => p.id === declaredHere[0].project.id) : void 0;
27047
+ const defaultCandidate = declaredCandidate ?? projects.find((p) => !!p.sourceTemplateId && issuesKeys.has(p.sourceTemplateId)) ?? projects.find((p) => eq(p.slug ?? "", "issues"));
27048
+ if (defaultCandidate && (declaredCandidate || (await missingTables(o, defaultCandidate.id)).length === 0)) {
26666
27049
  out.projectId = defaultCandidate.id;
26667
27050
  out.projectSlug = defaultCandidate.slug;
26668
27051
  out.projectName = defaultCandidate.name;
@@ -26691,22 +27074,53 @@ async function discover(o) {
26691
27074
  }
26692
27075
  if (!out.projectId) return out;
26693
27076
  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(", ")}`);
27077
+ const iface = await readInterfaceState((path) => get(o, path), ws.id, out.projectId);
27078
+ out.interface = iface;
27079
+ const usesMapping = iface.kind === "declared" && iface.accepted;
27080
+ const mapping = iface.kind === "declared" ? iface.mapping : void 0;
27081
+ let contractNow = DEFAULT_CONTRACT;
27082
+ if (iface.kind === "declared" && mapping) {
27083
+ if (!iface.accepted) problems.push(versionMismatchMessage(iface.version));
27084
+ else {
27085
+ out.declaredContract = contractFromMapping(DEFAULT_CONTRACT, mapping);
27086
+ out.declaredMappingKey = mappingKey(mapping);
27087
+ contractNow = out.declaredContract;
27088
+ if (iface.conforms === false) {
27089
+ problems.push(
27090
+ `the app declares work-tracker interface ${versionLabel(iface.version)} but does not conform:
27091
+ ` + describeDifferences(iface.unmet).join("\n ")
27092
+ );
27093
+ }
27094
+ }
27095
+ }
27096
+ const tableByRole = (role) => {
27097
+ if (usesMapping) {
27098
+ const name = mappedTableName(mapping, role);
27099
+ return name ? models.find((m) => eq(m.name, name))?.id : void 0;
27100
+ }
27101
+ const entry = TABLE_ENTRIES.find((t) => t.role === role);
27102
+ return entry ? models.find((m) => eq(m.name, entry.defaultName))?.id : void 0;
27103
+ };
27104
+ const find = (role) => tableByRole(role);
27105
+ const have = () => models.map((m) => m.name).join(", ");
27106
+ for (const role of ["issues", "comments", "crew"]) {
27107
+ const id = find(role);
27108
+ if (id) out.models[role] = id;
27109
+ else {
27110
+ const wanted = usesMapping ? mappedTableName(mapping, role) ?? `(no table mapped for ${role})` : TABLE_ENTRIES.find((t) => t.role === role).defaultName;
27111
+ problems.push(`no "${wanted}" table \u2014 have: ${have()}`);
27112
+ }
26699
27113
  }
26700
27114
  if (out.models.issues) {
26701
27115
  try {
26702
27116
  const issuesModel = await get(o, `/data-models/${out.models.issues}`);
26703
- const statusField = issuesModel.fields.find((f) => f.columnName === DEFAULT_CONTRACT.columns.status);
27117
+ const statusField = issuesModel.fields.find((f2) => f2.columnName === contractNow.columns.status);
26704
27118
  const known = /* @__PURE__ */ new Set([
26705
- ...DEFAULT_CONTRACT.statuses.open,
26706
- ...DEFAULT_CONTRACT.statuses.resolved,
26707
- DEFAULT_CONTRACT.statuses.draft
27119
+ ...contractNow.statuses.open,
27120
+ ...contractNow.statuses.resolved,
27121
+ contractNow.statuses.draft
26708
27122
  ]);
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 }));
27123
+ 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
27124
  } catch {
26711
27125
  }
26712
27126
  }
@@ -26716,8 +27130,8 @@ async function discover(o) {
26716
27130
  try {
26717
27131
  const model = await get(o, `/data-models/${out.models.issues}`);
26718
27132
  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));
27133
+ if (Array.isArray(tracked2) && !tracked2.includes(contractNow.columns.status)) {
27134
+ problems.push(EVENT_LOG_STATUS_UNTRACKED(contractNow.columns.status));
26721
27135
  }
26722
27136
  } catch {
26723
27137
  }
@@ -26725,13 +27139,21 @@ async function discover(o) {
26725
27139
  if (e instanceof ConnectHttpError && e.status === 404) problems.push(EVENT_LOG_MISSING);
26726
27140
  }
26727
27141
  }
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");
27142
+ out.areaModelId = find("projects");
27143
+ out.reposModelId = find("repos");
27144
+ out.shipsModelId = find("ships");
27145
+ out.epicsModelId = find("epics");
27146
+ out.mapsModelId = find("maps");
27147
+ out.periscopesModelId = find("periscopes");
27148
+ if (usesMapping && mapping && questionsPartMapped(mapping)) {
27149
+ out.questionsModelId = find("questions");
27150
+ out.answersModelId = find("answers");
27151
+ if (!out.questionsModelId || !out.answersModelId) {
27152
+ out.questionsModelId = void 0;
27153
+ out.answersModelId = void 0;
27154
+ }
27155
+ }
27156
+ out.locksModelId = find("locks");
26735
27157
  try {
26736
27158
  const views = await get(o, `/views?workspaceId=${ws.id}`);
26737
27159
  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 +27206,10 @@ async function discover(o) {
26784
27206
  const shipOptions = /* @__PURE__ */ new Map();
26785
27207
  try {
26786
27208
  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)));
27209
+ shipColumns = new Set((shipsModel.fields ?? []).map((f2) => f2.columnName));
27210
+ for (const f2 of shipsModel.fields ?? []) {
27211
+ const opts = f2.fieldType?.choiceOptions;
27212
+ if (Array.isArray(opts)) shipOptions.set(f2.columnName, new Set(opts.map((x) => x.value)));
26791
27213
  }
26792
27214
  } catch {
26793
27215
  }
@@ -27575,14 +27997,14 @@ function renderRepoCheck(r) {
27575
27997
 
27576
27998
  // src/repos-hooks.ts
27577
27999
  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";
28000
+ function packageManager(f2) {
28001
+ if (f2.exists("pnpm-lock.yaml")) return "pnpm";
28002
+ if (f2.exists("yarn.lock")) return "yarn";
28003
+ if (f2.exists("bun.lock") || f2.exists("bun.lockb")) return "bun";
27582
28004
  return "npm";
27583
28005
  }
27584
- function fromPackageJson(f) {
27585
- const text2 = f.read("package.json");
28006
+ function fromPackageJson(f2) {
28007
+ const text2 = f2.read("package.json");
27586
28008
  if (text2 === void 0) return void 0;
27587
28009
  let pkg;
27588
28010
  try {
@@ -27591,7 +28013,7 @@ function fromPackageJson(f) {
27591
28013
  return void 0;
27592
28014
  }
27593
28015
  if (!pkg || typeof pkg !== "object") return void 0;
27594
- const pm = packageManager(f);
28016
+ const pm = packageManager(f2);
27595
28017
  const scripts = pkg.scripts && typeof pkg.scripts === "object" ? pkg.scripts : {};
27596
28018
  const out = {};
27597
28019
  if (typeof scripts.test === "string") out.test = `${pm} test`;
@@ -27602,14 +28024,14 @@ function fromPackageJson(f) {
27602
28024
  }
27603
28025
  return out;
27604
28026
  }
27605
- function fromPackageSwift(f) {
27606
- return f.exists("Package.swift") ? { test: "swift test", build: "swift build" } : void 0;
28027
+ function fromPackageSwift(f2) {
28028
+ return f2.exists("Package.swift") ? { test: "swift test", build: "swift build" } : void 0;
27607
28029
  }
27608
- function fromPyproject(f) {
27609
- return f.exists("pyproject.toml") ? { test: "pytest" } : void 0;
28030
+ function fromPyproject(f2) {
28031
+ return f2.exists("pyproject.toml") ? { test: "pytest" } : void 0;
27610
28032
  }
27611
- function fromMakefile(f) {
27612
- const text2 = f.read("Makefile") ?? f.read("makefile") ?? f.read("GNUmakefile");
28033
+ function fromMakefile(f2) {
28034
+ const text2 = f2.read("Makefile") ?? f2.read("makefile") ?? f2.read("GNUmakefile");
27613
28035
  if (text2 === void 0) return void 0;
27614
28036
  const out = {};
27615
28037
  for (const target of ["test", "build"]) {
@@ -27624,8 +28046,8 @@ var DETECTORS = [
27624
28046
  { source: "Makefile", detect: fromMakefile }
27625
28047
  ];
27626
28048
  var WORKFLOW_RE = /\.ya?ml$/;
27627
- function detectRecipes(f) {
27628
- const workflows = (f.list?.(".github/workflows") ?? []).filter((n) => WORKFLOW_RE.test(n)).sort();
28049
+ function detectRecipes(f2) {
28050
+ const workflows = (f2.list?.(".github/workflows") ?? []).filter((n) => WORKFLOW_RE.test(n)).sort();
27629
28051
  if (workflows.length === 0) return [];
27630
28052
  const evidence = workflows.map((n) => `.github/workflows/${n}`);
27631
28053
  return [
@@ -27652,10 +28074,10 @@ function detectRecipes(f) {
27652
28074
  }
27653
28075
  ];
27654
28076
  }
27655
- function suggestHooks(f) {
27656
- const recipes = detectRecipes(f);
28077
+ function suggestHooks(f2) {
28078
+ const recipes = detectRecipes(f2);
27657
28079
  const found = DETECTORS.flatMap((d) => {
27658
- const hooks = d.detect(f);
28080
+ const hooks = d.detect(f2);
27659
28081
  return hooks && Object.keys(hooks).length > 0 ? [{ source: d.source, hooks }] : [];
27660
28082
  });
27661
28083
  if (found.length === 0) {
@@ -27791,8 +28213,8 @@ function starterRepoConfig(hooks, release) {
27791
28213
  parseRepoConfig(text2, ".crew.yaml");
27792
28214
  return text2;
27793
28215
  }
27794
- function existingRepoConfig(f) {
27795
- return REPO_CONFIG_FILENAMES.find((n) => f.exists(n));
28216
+ function existingRepoConfig(f2) {
28217
+ return REPO_CONFIG_FILENAMES.find((n) => f2.exists(n));
27796
28218
  }
27797
28219
 
27798
28220
  // src/repos-hooks-agent.ts
@@ -28150,40 +28572,40 @@ ${body}`;
28150
28572
  const text2 = m ? m[2].trim() : body;
28151
28573
  const parent = continuation ? this.last : void 0;
28152
28574
  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 } : {} };
28575
+ const f2 = { severity: classifySeverity(label, text2), section, label, text: text2, ...repo ? { repo } : {} };
28154
28576
  if (!repo) {
28155
28577
  const mentions = this.mentionedRepo(text2);
28156
- if (mentions) f.mentions = mentions;
28578
+ if (mentions) f2.mentions = mentions;
28157
28579
  }
28158
- this.findings.push(f);
28159
- this.last = f;
28580
+ this.findings.push(f2);
28581
+ this.last = f2;
28160
28582
  }
28161
28583
  }
28162
28584
  counts() {
28163
- const merged = groupFindings(this.findings.filter((f) => RANK[f.severity] >= RANK.note));
28585
+ const merged = groupFindings(this.findings.filter((f2) => RANK[f2.severity] >= RANK.note));
28164
28586
  const c = { blocker: 0, warning: 0, note: 0, passed: 0 };
28165
28587
  for (const g of merged) c[g.severity]++;
28166
- c.passed = this.findings.filter((f) => RANK[f.severity] < RANK.note).length;
28588
+ c.passed = this.findings.filter((f2) => RANK[f2.severity] < RANK.note).length;
28167
28589
  return c;
28168
28590
  }
28169
28591
  };
28170
28592
  function groupFindings(findings) {
28171
28593
  const out = [];
28172
28594
  const byKey = /* @__PURE__ */ new Map();
28173
- for (const f of findings) {
28174
- const repo = f.repo ?? f.mentions;
28595
+ for (const f2 of findings) {
28596
+ const repo = f2.repo ?? f2.mentions;
28175
28597
  if (!repo) {
28176
- out.push({ ...f, repos: [] });
28598
+ out.push({ ...f2, repos: [] });
28177
28599
  continue;
28178
28600
  }
28179
28601
  const norm = (s) => s.split(repo).join("<repo>");
28180
- const key = [f.severity, f.section, norm(f.label), norm(f.text)].join("\0");
28602
+ const key = [f2.severity, f2.section, norm(f2.label), norm(f2.text)].join("\0");
28181
28603
  const hit = byKey.get(key);
28182
28604
  if (hit) {
28183
28605
  if (!hit.repos.includes(repo)) hit.repos.push(repo);
28184
28606
  continue;
28185
28607
  }
28186
- const g = { ...f, repos: [repo] };
28608
+ const g = { ...f2, repos: [repo] };
28187
28609
  byKey.set(key, g);
28188
28610
  out.push(g);
28189
28611
  }
@@ -28210,7 +28632,7 @@ function renderDoctor(report, header, verbose) {
28210
28632
  const c = report.counts();
28211
28633
  const out = [...header];
28212
28634
  if (!verbose) {
28213
- const shown = groupFindings(report.findings.filter((f) => RANK[f.severity] >= RANK.note)).sort((a, b) => RANK[b.severity] - RANK[a.severity]);
28635
+ const shown = groupFindings(report.findings.filter((f2) => RANK[f2.severity] >= RANK.note)).sort((a, b) => RANK[b.severity] - RANK[a.severity]);
28214
28636
  for (const g of shown) {
28215
28637
  const sev = SEVERITY_WORD[g.severity];
28216
28638
  const where = g.repos.length ? ` [${reposPhrase(g.repos)}]` : "";
@@ -28226,24 +28648,24 @@ function renderDoctor(report, header, verbose) {
28226
28648
  `;
28227
28649
  }
28228
28650
  for (const s of DOCTOR_SECTIONS) {
28229
- const inSection = report.findings.filter((f) => f.section === s.id);
28651
+ const inSection = report.findings.filter((f2) => f2.section === s.id);
28230
28652
  if (inSection.length === 0) continue;
28231
28653
  out.push("", s.title, "-".repeat(s.title.length));
28232
28654
  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);
28655
+ const labelOf2 = (f2) => strip && f2.label === `repo ${strip}` ? "path" : f2.label;
28656
+ const width = Math.min(26, Math.max(...items.map((f2) => labelOf2(f2) ? labelOf2(f2).length + 1 : 0))) + 1;
28657
+ for (const f2 of items) {
28658
+ const l = labelOf2(f2);
28237
28659
  const lab = l ? `${l}:` : "";
28238
28660
  const col = lab.length >= width ? `${lab} ` : lab.padEnd(width);
28239
- out.push(`${" ".repeat(indent)}${col}${indentContinuation(f.text, indent + col.length)}`);
28661
+ out.push(`${" ".repeat(indent)}${col}${indentContinuation(f2.text, indent + col.length)}`);
28240
28662
  }
28241
28663
  };
28242
28664
  if (s.id === "repositories") {
28243
- const names = [...new Set(inSection.map((f) => f.repo ?? ""))];
28665
+ const names = [...new Set(inSection.map((f2) => f2.repo ?? ""))];
28244
28666
  for (const n of names) {
28245
28667
  out.push(n ? ` ${n}` : "");
28246
- block(inSection.filter((f) => (f.repo ?? "") === n), 4, n);
28668
+ block(inSection.filter((f2) => (f2.repo ?? "") === n), 4, n);
28247
28669
  }
28248
28670
  } else block(inSection, 0);
28249
28671
  }
@@ -28629,13 +29051,13 @@ function planSizeCapSweep(stateDir, maxBytes, now = Date.now()) {
28629
29051
  };
28630
29052
  add(join59(stateDir, "streams"), () => true);
28631
29053
  add(stateDir, (name) => ROTATED_EVENTS_RE.test(name));
28632
- let total = files.reduce((n, f) => n + f.size, 0);
29054
+ let total = files.reduce((n, f2) => n + f2.size, 0);
28633
29055
  const out = [];
28634
- for (const f of files.sort((a, b) => a.mtime - b.mtime)) {
29056
+ for (const f2 of files.sort((a, b) => a.mtime - b.mtime)) {
28635
29057
  if (total <= maxBytes) break;
28636
- if (f.mtime > now - DAY_MS2) break;
28637
- out.push(f.path);
28638
- total -= f.size;
29058
+ if (f2.mtime > now - DAY_MS2) break;
29059
+ out.push(f2.path);
29060
+ total -= f2.size;
28639
29061
  }
28640
29062
  return out;
28641
29063
  }
@@ -28726,7 +29148,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
28726
29148
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
28727
29149
  import { join as join60 } from "path";
28728
29150
  function builtVersion() {
28729
- return true ? "0.159.3" : null;
29151
+ return true ? "0.161.0" : null;
28730
29152
  }
28731
29153
  var REBUILD_HINT = "rebuild with npm run build";
28732
29154
  function newestMtime(path) {
@@ -28852,8 +29274,8 @@ function endpointsUrl(api, workspaceId, id) {
28852
29274
  return id ? `${base}/${id}` : base;
28853
29275
  }
28854
29276
  async function call(api, method, url, body) {
28855
- const f = api.fetchFn ?? fetch;
28856
- return f(url, {
29277
+ const f2 = api.fetchFn ?? fetch;
29278
+ return f2(url, {
28857
29279
  method,
28858
29280
  headers: {
28859
29281
  Authorization: `Bearer ${api.apiKey}`,
@@ -29098,7 +29520,7 @@ function readAllPersistedSyncWorkspaceIds(stateDir) {
29098
29520
  const dir = join61(stateDir, "passengers");
29099
29521
  if (!existsSync57(dir)) return [];
29100
29522
  const suffix = "-sync.json";
29101
- return readdirSync19(dir).filter((f) => f.endsWith(suffix)).map((f) => f.slice(0, -suffix.length));
29523
+ return readdirSync19(dir).filter((f2) => f2.endsWith(suffix)).map((f2) => f2.slice(0, -suffix.length));
29102
29524
  }
29103
29525
  function syncPassengerSyncDaemons(plans, cfg, stateDir, deps = {}) {
29104
29526
  const alive = deps.isPidAlive ?? isPidAlive;
@@ -29570,7 +29992,7 @@ function contractFixers(dir, baseRef, tickets, locate) {
29570
29992
  const branch = locate(t);
29571
29993
  if (!branch) continue;
29572
29994
  const changed2 = gitOk(dir, ["diff", "--name-only", `${baseRef}...${branch}`, "--", ...REPO_CONFIG_FILENAMES]);
29573
- const file = changed2?.split("\n").find((f) => f.trim() !== "");
29995
+ const file = changed2?.split("\n").find((f2) => f2.trim() !== "");
29574
29996
  if (!file) continue;
29575
29997
  const text2 = gitOk(dir, ["show", `${branch}:${file}`]);
29576
29998
  if (text2 === null) continue;
@@ -29669,13 +30091,13 @@ async function execute(h, args, streaming, after) {
29669
30091
  return done ? { status: 200, body: done } : { status: 502, body: { error: "the command finished without a result" } };
29670
30092
  };
29671
30093
  const finish = async (r) => {
29672
- const f = finishRaw(r);
29673
- return f.status === 200 && after ? { status: 200, body: await after(f.body) } : f;
30094
+ const f2 = finishRaw(r);
30095
+ return f2.status === 200 && after ? { status: 200, body: await after(f2.body) } : f2;
29674
30096
  };
29675
30097
  if (!streaming) {
29676
- const f = await finish(await h.run(args, () => {
30098
+ const f2 = await finish(await h.run(args, () => {
29677
30099
  }));
29678
- return reply(f.status, f.body);
30100
+ return reply(f2.status, f2.body);
29679
30101
  }
29680
30102
  return {
29681
30103
  status: 200,
@@ -29685,8 +30107,8 @@ async function execute(h, args, streaming, after) {
29685
30107
  const ev = parseLine2(line);
29686
30108
  if (ev) write(ev);
29687
30109
  });
29688
- const f = await finish(r);
29689
- write(f.status === 200 ? f.body : { event: "error", status: f.status, message: f.body.error });
30110
+ const f2 = await finish(r);
30111
+ write(f2.status === 200 ? f2.body : { event: "error", status: f2.status, message: f2.body.error });
29690
30112
  }
29691
30113
  };
29692
30114
  }
@@ -30040,12 +30462,12 @@ function waitForChange(dir, ms3, signal) {
30040
30462
  }
30041
30463
  var reply2 = (status2, body) => ({ status: status2, body });
30042
30464
  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}`);
30465
+ function failureReply(what, f2, log) {
30466
+ log?.(`control API: could not produce the ${what} document: ${f2.reason}: ${f2.detail}`);
30045
30467
  return reply2(502, {
30046
30468
  error: `could not produce the ${what === "status" ? "status document" : "doctor report"}`,
30047
- reason: f.reason,
30048
- detail: f.detail
30469
+ reason: f2.reason,
30470
+ detail: f2.detail
30049
30471
  });
30050
30472
  }
30051
30473
  function pauseDoc(state) {
@@ -30593,7 +31015,7 @@ function createPeriscopeMcpServer(d, sc) {
30593
31015
  }, async ({ pattern }) => {
30594
31016
  const re = globToRegExp2(pattern);
30595
31017
  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);
31018
+ const hits = listing.split("\0").filter((f2) => f2 && re.test(f2)).slice(0, MAX_SEARCH_RESULTS);
30597
31019
  return text(hits.length ? hits.join("\n") : "No matches found");
30598
31020
  });
30599
31021
  server.registerTool("write_file", {
@@ -30956,6 +31378,8 @@ function usage(problem, requested = false) {
30956
31378
  crew shell-init [--shell zsh|bash|fish] print the periscope shell function (install: eval "$(crew shell-init)")
30957
31379
  crew worktree [route] NNN cut (or refresh) this run's worktree for a ticket from the remote; prints its path
30958
31380
  crew unassign [route] NNN hand back a session's ticket \u2014 clears assignee, next cycle picks it up
31381
+ crew ask [route] NNN --question TEXT [--answer "LABEL :: DETAIL"]... [--to CREW_ROW_ID] [--role dev|design|qa]
31382
+ write a parked ticket's question as a record with 2-4 proposed answers (none for a free-form question); a no-op when the app maps no questions part
30959
31383
  crew footprint [route] NNN [path...] record the files a ticket will change (once), then print PROCEED or YIELD against active work
30960
31384
  crew sandbox cache [--refresh|--prune|--reset] [--json] list the sandbox cache volume's mirrors; --refresh runs the daemon's cache pass once (creates missing mirrors), --prune drops unserved repositories, --reset recreates the volume
30961
31385
  crew sync [route] fast-forward the checkout and its worktrees from the remote
@@ -31087,6 +31511,7 @@ var KNOWN_COMMANDS = /* @__PURE__ */ new Set([
31087
31511
  "sync",
31088
31512
  "unassign",
31089
31513
  "footprint",
31514
+ "ask",
31090
31515
  "uninstall",
31091
31516
  "watch",
31092
31517
  "whoami",
@@ -31950,6 +32375,9 @@ if (command === "passenger-sync-daemon") {
31950
32375
  problems.push(`tracker unreachable: ${e instanceof Error ? e.message : String(e)}`);
31951
32376
  }
31952
32377
  if (await tracker.eventLogTracksStatus() === false) problems.push(EVENT_LOG_STATUS_UNTRACKED(tracker.contract.columns.status));
32378
+ for (const l of interfaceReport(await readForRoute(c, cfg.ship), { storedMappingKey: c.resolved?.trackerInterface?.mappingKey, contractAuthored: c.contractAuthored })) {
32379
+ if (l.problem) problems.push(l.line);
32380
+ }
31953
32381
  const diff = await snapshotDiffFor(c);
31954
32382
  return { problems, readiness, snapshotStale: !!diff && isStale(diff) };
31955
32383
  }
@@ -32468,7 +32896,7 @@ ${changed2.map((c) => ` - ${c}
32468
32896
  );
32469
32897
  if (fixers.length === 0) throw refusal;
32470
32898
  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`,
32899
+ `${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
32900
  { step: "release" }
32473
32901
  );
32474
32902
  }
@@ -32718,9 +33146,9 @@ ${changed2.map((c) => ` - ${c}
32718
33146
  const ci = outcome.ci;
32719
33147
  const version = outcome.version ?? ci.tag ?? ci.sha.slice(0, 8);
32720
33148
  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}`), " ```");
33149
+ const runs = ci.failures.map((f2) => {
33150
+ const lines2 = [`- ${describeCiFailure(f2)}`];
33151
+ if (f2.logTail) lines2.push("", " ```", ...f2.logTail.split("\n").map((l) => ` ${l}`), " ```");
32724
33152
  return lines2.join("\n");
32725
33153
  }).join("\n");
32726
33154
  const news2 = {
@@ -32810,15 +33238,15 @@ ${cu.tail.trimEnd()}
32810
33238
  }
32811
33239
  if (outcome.flakes?.length && !dryRun) {
32812
33240
  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";
33241
+ for (const f2 of outcome.flakes) {
33242
+ const files = f2.files.length ? f2.files.map((p) => `\`${p}\``).join(", ") : "no file named in the output";
32815
33243
  await applyFailureAlert(tracker, {
32816
33244
  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}.
33245
+ headline: `${scope}: flaky ${f2.hook} gate`,
33246
+ 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
33247
 
32820
33248
  \`\`\`
32821
- ${f.tail.trimEnd()}
33249
+ ${f2.tail.trimEnd()}
32822
33250
  \`\`\``
32823
33251
  }, scope, all, seat, remit, dryRun, await alertPlacement()).catch((e) => {
32824
33252
  remit.warn(`could not file/update a flaky-gate ticket: ${e.message}`, { step: "release" });
@@ -32829,24 +33257,24 @@ ${f.tail.trimEnd()}
32829
33257
  const handedBack = [...await tracker.events("conflict_handed_back"), ...await tracker.events("pushed")];
32830
33258
  const flagged = await tracker.events("stranded_flagged");
32831
33259
  const seat = releaseSeat(c);
32832
- for (const f of outcome.conflicts ?? []) {
33260
+ for (const f2 of outcome.conflicts ?? []) {
32833
33261
  try {
32834
33262
  const bounce = planConflictBounce(
32835
33263
  target.dir,
32836
- f.candidate.ticket,
32837
- f.candidate.branch,
33264
+ f2.candidate.ticket,
33265
+ f2.candidate.branch,
32838
33266
  repo.branch.base,
32839
- f.paths,
33267
+ f2.paths,
32840
33268
  handedBack,
32841
33269
  outcome.merged.filter((m) => m.branch).map((m) => ({ key: m.ticket.issue_id, branch: m.branch }))
32842
33270
  );
32843
33271
  const r = await applyConflictBounce(tracker, bounce, tracker.contract, seat, remit, dryRun);
32844
33272
  if (r.kind === "failed") {
32845
- remit.warn(`could not hand back ${displayKey(f.candidate.ticket)}: ${r.why}`, { step: "merge" });
33273
+ remit.warn(`could not hand back ${displayKey(f2.candidate.ticket)}: ${r.why}`, { step: "merge" });
32846
33274
  }
32847
33275
  } catch (e) {
32848
33276
  remit.warn(
32849
- `could not hand back ${displayKey(f.candidate.ticket)}: ${e.message}`,
33277
+ `could not hand back ${displayKey(f2.candidate.ticket)}: ${e.message}`,
32850
33278
  { step: "merge" }
32851
33279
  );
32852
33280
  }
@@ -34178,9 +34606,9 @@ ${f.tail.trimEnd()}
34178
34606
  originOf,
34179
34607
  exists: (d) => existsSync60(d),
34180
34608
  isCheckout,
34181
- repoHasHooks: (d) => REPO_CONFIG_FILENAMES.some((f) => {
34609
+ repoHasHooks: (d) => REPO_CONFIG_FILENAMES.some((f2) => {
34182
34610
  try {
34183
- const path = resolvePath(d, f);
34611
+ const path = resolvePath(d, f2);
34184
34612
  return Object.keys(parseRepoConfig(readFileSync57(path, "utf8"), path).hooks).length > 0;
34185
34613
  } catch {
34186
34614
  return false;
@@ -34811,6 +35239,21 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, t
34811
35239
  ...resolvedStatusValues.length > 0 ? { resolved: [...DEFAULT_CONTRACT.statuses.resolved, ...resolvedStatusValues] } : {}
34812
35240
  }
34813
35241
  } : void 0;
35242
+ const declared = found.declaredContract && found.declaredMappingKey && found.interface?.kind === "declared" ? {
35243
+ contract: {
35244
+ ...found.declaredContract,
35245
+ statuses: {
35246
+ ...found.declaredContract.statuses,
35247
+ resolved: [.../* @__PURE__ */ new Set([...found.declaredContract.statuses.resolved, ...resolvedStatusValues])]
35248
+ }
35249
+ },
35250
+ trackerInterface: { declared: true, version: versionLabel(found.interface.version), mappingKey: found.declaredMappingKey }
35251
+ } : void 0;
35252
+ if (declared && existingRoute?.contractAuthored) emit.warn(`Note: ${OVERRIDE_IGNORED_MESSAGE}`);
35253
+ if (found.interface?.kind === "declared" && found.interface.accepted) {
35254
+ 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`);
35255
+ }
35256
+ if (found.interface?.kind === "undeclared") emit.note(`Note: ${UNDECLARED_MESSAGE}`);
34814
35257
  const resolved = {
34815
35258
  workspaceId: found.workspaceId,
34816
35259
  projectId: found.projectId,
@@ -34820,6 +35263,8 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, t
34820
35263
  epicsModelId: found.epicsModelId,
34821
35264
  mapsModelId: found.mapsModelId,
34822
35265
  periscopesModelId: found.periscopesModelId,
35266
+ questionsModelId: found.questionsModelId,
35267
+ answersModelId: found.answersModelId,
34823
35268
  locksModelId: found.locksModelId,
34824
35269
  recordLinkViewId: found.recordLinkViewId,
34825
35270
  reposModelId: found.reposModelId,
@@ -34834,7 +35279,7 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, t
34834
35279
  ...found.role ?? previous?.role ? { role: found.role ?? previous?.role } : {},
34835
35280
  ...capabilityMisses.length > 0 ? { capabilityMisses } : {},
34836
35281
  ...operator ? { operator } : {},
34837
- ...contract ? { contract } : {},
35282
+ ...declared ? { contract: declared.contract, trackerInterface: declared.trackerInterface } : contract ? { contract } : {},
34838
35283
  ...reviewedStatuses.length > 0 ? { reviewedStatuses } : {},
34839
35284
  // CREW-1055: connect only ever discovers ids — it never syncs
34840
35285
  // personas/skills itself — so carry forward whatever `crew agents
@@ -35308,9 +35753,9 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`);
35308
35753
  }
35309
35754
  const dropped = flag("prune") ? await cache.prune(served) : [];
35310
35755
  const mirrors = await cache.list();
35311
- const open = openShipAttention(new State(cfg.ship.stateDir));
35756
+ const open2 = openShipAttention(new State(cfg.ship.stateDir));
35312
35757
  const failures = served.flatMap((r) => {
35313
- const item = open.find((i) => i.kind === "sandbox_cache" && i.key === sandboxCacheKey(settings.volume, r));
35758
+ const item = open2.find((i) => i.kind === "sandbox_cache" && i.key === sandboxCacheKey(settings.volume, r));
35314
35759
  return item ? [{ repo: `${r.host}/${r.path}`, lastFailedAt: item.lastFailedAt ?? item.since, message: item.message }] : [];
35315
35760
  });
35316
35761
  if (flag("json")) {
@@ -35325,7 +35770,7 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`);
35325
35770
  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
35771
  `);
35327
35772
  }
35328
- for (const f of failures) process.stdout.write(`${f.repo} REFRESH FAILING (last failed ${f.lastFailedAt}): ${f.message}
35773
+ for (const f2 of failures) process.stdout.write(`${f2.repo} REFRESH FAILING (last failed ${f2.lastFailedAt}): ${f2.message}
35329
35774
  `);
35330
35775
  }
35331
35776
  if (refreshFailed) process.exitCode = 1;
@@ -35574,11 +36019,11 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`);
35574
36019
  branch: planWt.branch ?? "",
35575
36020
  startupSeconds: cfg.ship.intelStartupSeconds,
35576
36021
  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));
36022
+ for (const f2 of repoWt.config.worktrees.copy) {
36023
+ const src = join66(repoWt.dir, f2);
36024
+ if (!existsSync60(src) || existsSync60(join66(path, f2))) continue;
36025
+ mkdirSync43(dirOf2(join66(path, f2)), { recursive: true });
36026
+ copyFileSync2(src, join66(path, f2));
35582
36027
  }
35583
36028
  const setup = repoWt.config.hooks.setup;
35584
36029
  return setup ? runScript(setup, { cwd: path, shell: shellWt }) : null;
@@ -35904,11 +36349,11 @@ ${where.join("\n")}`);
35904
36349
  return { path, branch: plan.branch ?? "" };
35905
36350
  },
35906
36351
  prepare: async (path) => {
35907
- for (const f of repoP.config.worktrees.copy) {
35908
- const src = join66(repoP.dir, f);
36352
+ for (const f2 of repoP.config.worktrees.copy) {
36353
+ const src = join66(repoP.dir, f2);
35909
36354
  if (!existsSync60(src)) continue;
35910
- mkdirSync43(dirOf2(join66(path, f)), { recursive: true });
35911
- copyFileSync2(src, join66(path, f));
36355
+ mkdirSync43(dirOf2(join66(path, f2)), { recursive: true });
36356
+ copyFileSync2(src, join66(path, f2));
35912
36357
  }
35913
36358
  const setup = repoP.config.hooks.setup;
35914
36359
  return setup ? runScript(setup, { cwd: path, shell: shellP, onLine: (l) => {
@@ -36044,8 +36489,8 @@ ${where.join("\n")}`);
36044
36489
  const tracker3 = new Tracker(route2, cfg.ship);
36045
36490
  const c = tracker3.contract;
36046
36491
  const key = `ISSUE-${n}`;
36047
- const open = await tracker3.openTickets();
36048
- const ticket = open.find((t) => t[c.columns.key] === key);
36492
+ const open2 = await tracker3.openTickets();
36493
+ const ticket = open2.find((t) => t[c.columns.key] === key);
36049
36494
  if (!ticket) {
36050
36495
  die("crew unassign", `no open ticket ${key} on ${route2.route} (already resolved, or not this route's)`, "`crew inbox` to list open tickets");
36051
36496
  }
@@ -36070,6 +36515,59 @@ ${where.join("\n")}`);
36070
36515
  }
36071
36516
  break;
36072
36517
  }
36518
+ case "ask": {
36519
+ const argsA = positional.slice(1);
36520
+ const nA = argsA.map(parseTicketNumber).find((x) => x !== null);
36521
+ const usageA = '`crew ask 326 --question "Which way?" --answer "Option A :: Do A" --answer "Option B :: Do B" --to <crew row id>`';
36522
+ if (!nA) {
36523
+ die("crew ask", "need a ticket number (326, ISSUE-326, or TABL-326)", usageA);
36524
+ }
36525
+ const questionA = value("question");
36526
+ if (!questionA) {
36527
+ die("crew ask", "need --question TEXT", usageA);
36528
+ }
36529
+ const answersA = [];
36530
+ argv.forEach((a, i) => {
36531
+ if (a !== "--answer") return;
36532
+ const raw = argv[i + 1] ?? "";
36533
+ const at = raw.indexOf("::");
36534
+ if (at < 0) {
36535
+ die("crew ask", `--answer "${raw}" needs a label and a detail separated by "::"`, usageA);
36536
+ }
36537
+ answersA.push({ label: raw.slice(0, at).trim(), detail: raw.slice(at + 2).trim() });
36538
+ });
36539
+ const trA = new Tracker(route2, cfg.ship);
36540
+ const partA = trA.questionsPart();
36541
+ if (!partA) {
36542
+ process.stdout.write("no questions part: this app does not map one, so nothing was written \u2014 post the comment as usual\n");
36543
+ break;
36544
+ }
36545
+ const openA = await trA.openTickets();
36546
+ const ticketA = openA.find((t) => t[trA.contract.columns.key] === `ISSUE-${nA}`);
36547
+ if (!ticketA) {
36548
+ die("crew ask", `no open ticket ISSUE-${nA} on ${route2.route}`, "`crew inbox` to list open tickets");
36549
+ }
36550
+ const seatsA = route2.resolved?.seats ?? {};
36551
+ const roleA = value("role") ?? "dev";
36552
+ const holderA = ticketA[trA.contract.columns.assignee];
36553
+ const askedByA = holderA && Object.values(seatsA).includes(holderA) ? holderA : seatsA[roleA];
36554
+ if (!askedByA) {
36555
+ die("crew ask", `no seat for role "${roleA}" on ${route2.route}`, "pass --role dev|design|qa");
36556
+ }
36557
+ const reqA = { ticketId: ticketA.id, question: questionA, answers: answersA, askedBy: askedByA, addressedTo: value("to") };
36558
+ const problemsA = validateAsk(reqA);
36559
+ if (problemsA.length) {
36560
+ die("crew ask", problemsA.join("; "), `${MIN_ANSWERS} to ${MAX_ANSWERS} --answer flags, or none for a free-form question`);
36561
+ }
36562
+ if (dryRun) {
36563
+ emit.emit(`would withdraw this seat's open questions on ${displayKey(ticketA)}, then ask one with ${answersA.length} proposed answer(s)`);
36564
+ break;
36565
+ }
36566
+ const doneA = await askQuestion(trA, partA, trA.contract, reqA);
36567
+ process.stdout.write(`asked on ${displayKey(ticketA)}: question ${doneA.questionId} with ${doneA.answerIds.length} answer(s)${doneA.withdrawn.length ? `, withdrew ${doneA.withdrawn.length} earlier` : ""}
36568
+ `);
36569
+ break;
36570
+ }
36073
36571
  case "footprint": {
36074
36572
  const args = positional.slice(1);
36075
36573
  const at = args.findIndex((a) => parseTicketNumber(a) !== null);
@@ -36666,7 +37164,7 @@ ${where.join("\n")}`);
36666
37164
  const engagedTicketIds = shipRows.map((s) => s.engaged_ticket_id).filter((id) => !!id);
36667
37165
  const engagedTickets = engagedTicketIds.length ? await statusTracker.ticketsByIds(engagedTicketIds) : [];
36668
37166
  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(() => []);
37167
+ const todo = await statusTracker.openTickets().then((open2) => operatorTodo(open2, statusTracker.contract, route2.resolved?.operator ?? "")).catch(() => []);
36670
37168
  const projects = projectModeLabels(await statusTracker.projectRowsWithModes().catch(() => []));
36671
37169
  const crewMinVersion = await readCrewFloor(route2, cfg.ship) ?? null;
36672
37170
  const runs = liveRuns(cfg.ship.stateDir);
@@ -36827,14 +37325,14 @@ ${where.join("\n")}`);
36827
37325
  let waitViews = [];
36828
37326
  let deferredReleases = [];
36829
37327
  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 }));
37328
+ const open2 = await statusTracker.openTickets();
37329
+ const blockerInfo = blockerInfoMap(open2, await statusTracker.ticketsByIds(missingBlockerIds(open2)));
37330
+ heldReleases = describeHeld(heldByBlockers(open2, statusTracker.contract.statuses.verified, blockerInfo));
37331
+ 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
37332
  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)) {
37333
+ if (open2.some((t) => t.status === statusTracker.contract.statuses.verified)) {
36836
37334
  deferredReleases = deferredFromLog(
36837
- open,
37335
+ open2,
36838
37336
  [...await statusTracker.events(DEFERRED_EVENT), ...await statusTracker.events("conflict_handed_back"), ...await statusTracker.events("conflict_escalated")],
36839
37337
  statusTracker.contract,
36840
37338
  Date.now(),
@@ -36953,7 +37451,7 @@ ${where.join("\n")}`);
36953
37451
  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
37452
  }
36955
37453
  for (const r of repos) {
36956
- const f = repoFindings({
37454
+ const f2 = repoFindings({
36957
37455
  route: c.route,
36958
37456
  repo: r.name,
36959
37457
  dir: r.dir,
@@ -36982,8 +37480,8 @@ ${where.join("\n")}`);
36982
37480
  ...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
37481
  ] } : void 0
36984
37482
  });
36985
- problems.push(...f.problems);
36986
- passed += f.passed;
37483
+ problems.push(...f2.problems);
37484
+ passed += f2.passed;
36987
37485
  }
36988
37486
  }
36989
37487
  if (!flag("offline")) {
@@ -37004,7 +37502,7 @@ ${where.join("\n")}`);
37004
37502
  else passed++;
37005
37503
  }
37006
37504
  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" });
37505
+ 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
37506
  if (daemonLiveness) {
37009
37507
  const dp = daemonProblem(daemonLiveness, route2.route);
37010
37508
  if (dp) problems.push(dp);
@@ -37083,13 +37581,13 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
37083
37581
  `);
37084
37582
  process.exitCode = 1;
37085
37583
  }
37086
- for (const f of deadTunnelFindings(deadTunnels(cfg.ship.stateDir), Boolean(dockerFinding))) {
37087
- R.line(`tunnel: DEAD ${f.message} \u2014 ${f.remedy}
37584
+ for (const f2 of deadTunnelFindings(deadTunnels(cfg.ship.stateDir), Boolean(dockerFinding))) {
37585
+ R.line(`tunnel: DEAD ${f2.message} \u2014 ${f2.remedy}
37088
37586
  `);
37089
37587
  }
37090
37588
  for (const w of roleCapWarnings(cfg.ship)) R.line(`role concurrency: WARN ${w}
37091
37589
  `);
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
37590
+ 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
37591
  `);
37094
37592
  for (const t of rejectedTunnels(cfg.ship.stateDir)) R.line(`relay tunnel: ATTENTION ${tunnelRejectedMessage(t.workspaceId, t.quickExits)}
37095
37593
  `);
@@ -37193,6 +37691,10 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
37193
37691
  `);
37194
37692
  }
37195
37693
  }
37694
+ for (const l of interfaceReport(await readForRoute(route2, cfg.ship), { storedMappingKey: route2.resolved?.trackerInterface?.mappingKey, contractAuthored: route2.contractAuthored })) {
37695
+ R.line(`${l.line.startsWith(" ") ? "" : `${l.problem ? "WARN " : ""}`}${l.line}
37696
+ `);
37697
+ }
37196
37698
  const contractProblems = validateContract(tracker.contract);
37197
37699
  R.line(
37198
37700
  contractProblems.length ? `contract: ${contractProblems.length} problem(s)
@@ -37301,19 +37803,19 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
37301
37803
  `);
37302
37804
  if (cfg.routes.some((x) => x.route === route2.route && x.enabled && x.hostPeriscopes)) {
37303
37805
  const { settled } = await settleRepos(reposOf(route2), (t) => t.name, (t) => resolveOneRepo(route2, t));
37304
- for (const f of routePeriscopeProblems({
37806
+ for (const f2 of routePeriscopeProblems({
37305
37807
  route: route2.route,
37306
37808
  hosts: true,
37307
37809
  tablePresent: flag("offline") ? void 0 : periscopes.present,
37308
37810
  snapshotStale: snapStale,
37309
37811
  repos: settled.map((r) => ({ name: r.name, hasPreviewHook: !!r.config.hooks.preview }))
37310
37812
  })) {
37311
- R.line(`periscopes: ${f.severity.toUpperCase()} ${f.message}
37813
+ R.line(`periscopes: ${f2.severity.toUpperCase()} ${f2.message}
37312
37814
  `);
37313
37815
  }
37314
37816
  if (!flag("offline")) {
37315
- for (const f of await duplicateLivePeriscopeProblems(route2, cfg.ship)) {
37316
- R.line(`periscopes: ${f.severity.toUpperCase()} ${f.message}
37817
+ for (const f2 of await duplicateLivePeriscopeProblems(route2, cfg.ship)) {
37818
+ R.line(`periscopes: ${f2.severity.toUpperCase()} ${f2.message}
37317
37819
  `);
37318
37820
  }
37319
37821
  }
@@ -37623,7 +38125,7 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
37623
38125
  const foreign = describeForeignLaunchdUnits(CREW_HOME);
37624
38126
  if (foreign.length > 0) {
37625
38127
  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")}
38128
+ ${foreign.map((f2) => ` ${f2.trim()}`).join("\n")}
37627
38129
  `);
37628
38130
  }
37629
38131
  }