@tablation/crew 0.152.0 → 0.152.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +23 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -9403,6 +9403,14 @@ var Tracker = class {
9403
9403
  limit: 500
9404
9404
  });
9405
9405
  }
9406
+ /** Tickets by `issue_id` (CREW-3323: resolving a run's key to its display tag). */
9407
+ async ticketsByKeys(keys) {
9408
+ if (keys.length === 0) return [];
9409
+ return this.client.records.list(this.models.issues, {
9410
+ filters: encodeFilters([{ columnName: this.contract.columns.key, operator: "IN", value: keys }]),
9411
+ limit: 500
9412
+ });
9413
+ }
9406
9414
  async ticket(id) {
9407
9415
  return this.client.records.get(this.models.issues, id);
9408
9416
  }
@@ -14920,7 +14928,8 @@ function describeRun(run4, route2, seatIds, worktreeOf = (d, n) => {
14920
14928
  return {
14921
14929
  role: run4.role,
14922
14930
  seat: ownRoute ? seatIds[run4.role] ?? null : null,
14923
- ticket: run4.ticket,
14931
+ // CREW-3323: the display tag when the board knows one; `num` and matching stay on the key the run carries.
14932
+ ticket: run4.ticket ? o.tags?.get(run4.ticket) ?? run4.ticket : run4.ticket,
14924
14933
  ticketRecordId: run4.ticketRecordId,
14925
14934
  repo: run4.repo ?? null,
14926
14935
  worktree: repoDir && num2 ? worktreeOf(repoDir, num2) : null,
@@ -27374,7 +27383,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
27374
27383
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
27375
27384
  import { join as join59 } from "path";
27376
27385
  function builtVersion() {
27377
- return true ? "0.152.0" : null;
27386
+ return true ? "0.152.1" : null;
27378
27387
  }
27379
27388
  var REBUILD_HINT = "rebuild with npm run build";
27380
27389
  function newestMtime(path) {
@@ -35071,7 +35080,7 @@ ${where.join("\n")}`);
35071
35080
  const shipRows = await statusTracker.shipRows();
35072
35081
  const engagedTicketIds = shipRows.map((s) => s.engaged_ticket_id).filter((id) => !!id);
35073
35082
  const engagedTickets = engagedTicketIds.length ? await statusTracker.ticketsByIds(engagedTicketIds) : [];
35074
- const issueLabelById = new Map(engagedTickets.map((t) => [t.id, t.issue_id]));
35083
+ const issueLabelById = new Map(engagedTickets.map((t) => [t.id, displayKey(t)]));
35075
35084
  const todo = await statusTracker.openTickets().then((open) => operatorTodo(open, statusTracker.contract, route2.resolved?.operator ?? "")).catch(() => []);
35076
35085
  const projects = projectModeLabels(await statusTracker.projectRowsWithModes().catch(() => []));
35077
35086
  const crewMinVersion = await readCrewFloor(route2, cfg.ship) ?? null;
@@ -35080,6 +35089,13 @@ ${where.join("\n")}`);
35080
35089
  (await statusTracker.ticketsByIds([...new Set(runs.map((x) => x.ticketRecordId).filter((id) => !!id))]).catch(() => [])).map((t) => [t.id, t.title ?? null])
35081
35090
  );
35082
35091
  const lastRuns = lastRunsBySeat(cfg.ship.stateDir);
35092
+ const wantedKeys = [...new Set([...runs.map((x) => x.ticket), ...[...lastRuns.values()].map((l) => l.ticket)].filter((k) => !!k))];
35093
+ const tagByKey = /* @__PURE__ */ new Map();
35094
+ for (const t of [
35095
+ ...await statusTracker.ticketsByIds([...new Set(runs.map((x) => x.ticketRecordId).filter((id) => !!id))]).catch(() => []),
35096
+ ...await statusTracker.ticketsByKeys(wantedKeys).catch(() => [])
35097
+ ]) tagByKey.set(t.issue_id, displayKey(t));
35098
+ const tagOf = (k) => k ? tagByKey.get(k) ?? k : null;
35083
35099
  const periscopes = await periscopesForStatus(cfg.ship.stateDir);
35084
35100
  const runPreviews = new Map(periscopes.filter((p) => p.serving).map((p) => [p.ticketRecordId, p.url]));
35085
35101
  if (flag("json")) {
@@ -35103,7 +35119,7 @@ ${where.join("\n")}`);
35103
35119
  // Additive (CREW-2822): how many runs this seat has live right now.
35104
35120
  running: runs.filter((x) => x.role === r && x.route === routeSlug(route2.route)).length,
35105
35121
  // Additive (CREW-3247): this seat's newest finished run on this ship, or null.
35106
- lastRun: ((l) => l ? { ticket: l.ticket, startedAt: l.startedAt, finishedAt: l.finishedAt, outcome: l.outcome, exitCode: l.exitCode } : null)(lastRuns.get(`${routeSlug(route2.route)}/${r}`))
35122
+ lastRun: ((l) => l ? { ticket: tagOf(l.ticket), startedAt: l.startedAt, finishedAt: l.finishedAt, outcome: l.outcome, exitCode: l.exitCode } : null)(lastRuns.get(`${routeSlug(route2.route)}/${r}`))
35107
35123
  };
35108
35124
  });
35109
35125
  process.stdout.write(`${JSON.stringify({
@@ -35153,7 +35169,7 @@ ${where.join("\n")}`);
35153
35169
  seats: seats2
35154
35170
  },
35155
35171
  // Additive (CREW-2822): every live run on this ship. `version` stays 1.
35156
- runs: runs.map((x) => describeRun(x, route2, seatIds, void 0, { titles: runTitles, previews: runPreviews })),
35172
+ runs: runs.map((x) => describeRun(x, route2, seatIds, void 0, { titles: runTitles, previews: runPreviews, tags: tagByKey })),
35157
35173
  // Additive (CREW-2857): every live periscope on this ship, from its local record. `version` stays 1.
35158
35174
  periscopes,
35159
35175
  watermark: state.watermark(routeSlug(route2.route)),
@@ -35240,7 +35256,7 @@ ${where.join("\n")}`);
35240
35256
  });
35241
35257
  }
35242
35258
  const reloadWaitingAt = readReloadRequestedAt(cfg.ship.stateDir);
35243
- const lastRunView = [...lastRuns.values()].filter((l) => l.route === routeSlug(route2.route)).map((l) => ({ role: l.role, ticket: l.ticket, finishedAt: l.finishedAt, outcome: l.outcome }));
35259
+ const lastRunView = [...lastRuns.values()].filter((l) => l.route === routeSlug(route2.route)).map((l) => ({ role: l.role, ticket: tagOf(l.ticket), finishedAt: l.finishedAt, outcome: l.outcome }));
35244
35260
  for (const line of renderStatus({
35245
35261
  ship: { name: cfg.ship.name, platform: cfg.ship.platform },
35246
35262
  route: { name: route2.route, dir: route2.dir, enabled: route2.enabled },
@@ -35255,7 +35271,7 @@ ${where.join("\n")}`);
35255
35271
  watermark: String(state.watermark(routeSlug(route2.route))),
35256
35272
  projects: projects.map((p) => p.label),
35257
35273
  reloadRequestedSecondsAgo: reloadWaitingAt === null ? null : Math.max(0, Math.round((Date.now() - reloadWaitingAt) / 1e3)),
35258
- runs: runs.map((x) => ({ role: x.role, ticket: x.ticket, repo: x.repo, pid: x.pid, spawnedAt: x.spawnedAt, deadline: x.deadline })),
35274
+ runs: runs.map((x) => ({ role: x.role, ticket: tagOf(x.ticket), repo: x.repo, pid: x.pid, spawnedAt: x.spawnedAt, deadline: x.deadline })),
35259
35275
  lastRuns: lastRunView,
35260
35276
  attention: shipAttention.map((i) => ({ kind: i.kind, message: i.message, since: i.since })),
35261
35277
  waiting: todo.map((i) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.152.0",
3
+ "version": "0.152.1",
4
4
  "description": "A standing team of headless agents that picks work off a Tablation board, does it on a machine you control, and reports back.",
5
5
  "type": "module",
6
6
  "license": "MIT",