@tablation/crew 0.172.1 → 0.173.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +61 -27
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -13710,6 +13710,13 @@ var TICKET_KEY_RE = /\b[A-Z][A-Z0-9]{1,9}-\d+\b/g;
13710
13710
  function ticketMentions(text2) {
13711
13711
  return [...text2.matchAll(TICKET_KEY_RE)].map((m) => m[0]);
13712
13712
  }
13713
+ function canonicalTicketKey(key, hint) {
13714
+ if (!hint || hint === key) return key;
13715
+ const issue = /^ISSUE-(\d+)$/.exec(key);
13716
+ if (!issue) return key;
13717
+ const tagged = /^[A-Z][A-Z0-9]{1,9}-(\d+)$/.exec(hint);
13718
+ return tagged && tagged[1] === issue[1] && !hint.startsWith("ISSUE-") ? hint : key;
13719
+ }
13713
13720
  var TicketAttributionTracker = class {
13714
13721
  #tokensByTicket = /* @__PURE__ */ new Map();
13715
13722
  #turns = 0;
@@ -16059,7 +16066,8 @@ var RunObserver = class {
16059
16066
  if (ev.kind === "tool") this.attribution.noteWrite(ev.tool, ev.input);
16060
16067
  if (ev.kind === "tool") this.beforeFirstEdit.note(ev.tool, ev.target, this.muted ? void 0 : Date.now() - this.startMs);
16061
16068
  if (ev.kind === "tool" && isClaimWrite(ev.tool, ev.input)) {
16062
- const claimed = this.attribution.current;
16069
+ const named = this.attribution.current;
16070
+ const claimed = named ? canonicalTicketKey(named, plan.ticket) : void 0;
16063
16071
  if (claimed && claimed !== this.liveTicket) {
16064
16072
  if (!this.muted) {
16065
16073
  this.eventsSink?.write(`${JSON.stringify({
@@ -16152,7 +16160,9 @@ async function finishRun(id, obs, emit, startedAt, end, agentLogKey, hintMoved)
16152
16160
  } catch {
16153
16161
  }
16154
16162
  }
16155
- const { ticket: attributedTicket, by: attributedBy } = obs.attribution.decide(obs.liveTicket, { hintMoved: moved });
16163
+ const decided = obs.attribution.decide(obs.liveTicket, { hintMoved: moved });
16164
+ const attributedBy = decided.by;
16165
+ const attributedTicket = decided.ticket ? canonicalTicketKey(decided.ticket, id.ticket) : void 0;
16156
16166
  const identity = { toolchain: id.toolchain, harness: id.harness, provider: id.provider };
16157
16167
  const { result } = obs;
16158
16168
  const pending = end.interrupted ? null : obs.handoff.pending();
@@ -25448,7 +25458,7 @@ async function reconcileRouteShipName(o) {
25448
25458
  stateDir: o.ship.stateDir,
25449
25459
  ship: o.ship,
25450
25460
  machineId,
25451
- rows: () => tracker.shipRows(),
25461
+ rows: o.rows ?? (() => tracker.shipRows()),
25452
25462
  rename: (id, name) => tracker.renameShipRow(id, name),
25453
25463
  emit: o.emit,
25454
25464
  readOnly: o.readOnly
@@ -30773,7 +30783,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
30773
30783
  import { existsSync as existsSync58, readdirSync as readdirSync18, statSync as statSync18 } from "fs";
30774
30784
  import { join as join62 } from "path";
30775
30785
  function builtVersion() {
30776
- return true ? "0.172.1" : null;
30786
+ return true ? "0.173.0" : null;
30777
30787
  }
30778
30788
  var REBUILD_HINT = "rebuild with npm run build";
30779
30789
  function newestMtime(path) {
@@ -32811,6 +32821,20 @@ function findPeriscope(sidecars, segment) {
32811
32821
  }
32812
32822
 
32813
32823
  // src/cli.ts
32824
+ var TRACKER_BLOCKS = [
32825
+ "todo",
32826
+ "ships",
32827
+ "route.projects",
32828
+ "route.crewMinVersion",
32829
+ "ship.rowName",
32830
+ "ship.nameDrift",
32831
+ "crew.repos[].worktreePrefix(area prefix)",
32832
+ "crew.seats[].name",
32833
+ "crew.seats[].personaName",
32834
+ "crew.seats[].missing",
32835
+ "runs[].title",
32836
+ "runs[].ticket(display tag)"
32837
+ ];
32814
32838
  var CREW_HOME = isCompiledBinary(import.meta.url) ? dirname39(process.execPath) : resolve8(dirname39(fileURLToPath2(import.meta.url)), "..");
32815
32839
  {
32816
32840
  const v = crewVersion(CREW_HOME);
@@ -32973,6 +32997,7 @@ function usage(problem, requested = false) {
32973
32997
  crew watch [route] live view of what the crew is doing
32974
32998
  crew --version [--json] print the crew version on one line (also: crew version); --json adds home and compiled
32975
32999
  crew status [route] [--json] [--verbose] what is running and what needs a person; --verbose adds configuration and full lists; --json for a machine reader
33000
+ crew status [route] --json --no-tracker the same document from this ship alone, with no tracker request; leaves out todo, ships, projects, crewMinVersion, seat names, rowName/nameDrift and the area worktree prefix
32976
33001
  crew projects [--route R] [--json] the Projects rows each route can read (id, name, prefix, work mode)
32977
33002
  crew routes available [--json] the tracker apps you can reach that this machine has no route for (read-only; starts no sign-in)
32978
33003
  crew projects add [route] NAME --prefix P [--work-mode automatic|hybrid|manual] [--json] [--dry-run] create a Projects row
@@ -34103,11 +34128,11 @@ if (command === "passenger-sync-daemon") {
34103
34128
  ${changed2.map((c) => ` - ${c}
34104
34129
  `).join("")}` : "fix: nothing changed\n");
34105
34130
  }
34106
- async function resolvedRepos(c) {
34107
- return (await resolveRoute(c)).settled;
34131
+ async function resolvedRepos(c, opts = {}) {
34132
+ return (await resolveRoute(c, opts)).settled;
34108
34133
  }
34109
- async function resolveRoute(c) {
34110
- const { settled, errors } = await settleRepos(reposOf(c), (t) => t.name, (t) => resolveOneRepo(c, t));
34134
+ async function resolveRoute(c, opts = {}) {
34135
+ const { settled, errors } = await settleRepos(reposOf(c), (t) => t.name, (t) => resolveOneRepo(c, t, opts));
34111
34136
  for (const e of errors) {
34112
34137
  try {
34113
34138
  await raiseShipAttention({ state, emit }, repoContractRefusedItem(e.repo, e.detail));
@@ -34182,7 +34207,7 @@ ${changed2.map((c) => ` - ${c}
34182
34207
  const t = repo ? reposOf(c).find((r) => r.name === repo) : void 0;
34183
34208
  return t && cfg.ship.runner === "sandbox" ? repoContractFor(cfg.ship, c, t) : void 0;
34184
34209
  }
34185
- async function resolveOneRepo(c, t) {
34210
+ async function resolveOneRepo(c, t, opts = {}) {
34186
34211
  {
34187
34212
  const id = repoIdForName(c, t.name);
34188
34213
  const o = c.repoOverrides[t.name];
@@ -34204,7 +34229,8 @@ ${changed2.map((c) => ` - ${c}
34204
34229
  // that declares its own `worktrees.prefix` shadows either, and
34205
34230
  // `doctor` reports that the way it reports every other shadowed
34206
34231
  // setting.
34207
- worktrees: { prefix: shipWorktreePrefixFor(c) ?? await areaWorktreePrefix(c, id), nameOverride: o?.worktreeName }
34232
+ // CREW-4019: `status --json --no-tracker` makes no tracker request, so the area's prefix is not read.
34233
+ worktrees: { prefix: shipWorktreePrefixFor(c) ?? (opts.noTracker ? void 0 : await areaWorktreePrefix(c, id)), nameOverride: o?.worktreeName }
34208
34234
  }, t.dir)
34209
34235
  };
34210
34236
  }
@@ -38976,21 +39002,27 @@ ${where.join("\n")}`);
38976
39002
  }
38977
39003
  process.exit(1);
38978
39004
  }
38979
- const shipRows = await statusTracker.shipRows();
39005
+ const noTracker = flag("no-tracker");
39006
+ if (noTracker && !flag("json")) die("crew status", "--no-tracker applies to --json", "`crew status --json --no-tracker`");
39007
+ let openRead;
39008
+ const openTicketsOnce = () => openRead ??= statusTracker.openTickets();
39009
+ const trackerReadAt = (/* @__PURE__ */ new Date()).toISOString();
39010
+ const shipRows = noTracker ? [] : await statusTracker.shipRows();
38980
39011
  const engagedTicketIds = shipRows.map((s) => s.engaged_ticket_id).filter((id) => !!id);
38981
39012
  const engagedTickets = engagedTicketIds.length ? await statusTracker.ticketsByIds(engagedTicketIds) : [];
38982
39013
  const issueLabelById = new Map(engagedTickets.map((t) => [t.id, displayKey(t)]));
38983
- const todo = await statusTracker.openTickets().then((open2) => operatorTodo(open2, statusTracker.contract, route2.resolved?.operator ?? "")).catch(() => []);
38984
- const projects = projectModeLabels(await statusTracker.projectRowsWithModes().catch(() => []));
38985
- const crewMinVersion = await readCrewFloor(route2, cfg.ship) ?? null;
39014
+ const todo = noTracker ? [] : await openTicketsOnce().then((open2) => operatorTodo(open2, statusTracker.contract, route2.resolved?.operator ?? "")).catch(() => []);
39015
+ const projects = noTracker ? [] : projectModeLabels(await statusTracker.projectRowsWithModes().catch(() => []));
39016
+ const crewMinVersion = noTracker ? null : await readCrewFloor(route2, cfg.ship) ?? null;
38986
39017
  const runs = liveRuns(cfg.ship.stateDir);
38987
39018
  const runTitles = new Map(
38988
- (await statusTracker.ticketsByIds([...new Set(runs.map((x) => x.ticketRecordId).filter((id) => !!id))]).catch(() => [])).map((t) => [t.id, t.title ?? null])
39019
+ (noTracker ? [] : await statusTracker.ticketsByIds([...new Set(runs.map((x) => x.ticketRecordId).filter((id) => !!id))]).catch(() => [])).map((t) => [t.id, t.title ?? null])
38989
39020
  );
38990
39021
  const lastRuns = lastRunsBySeat(cfg.ship.stateDir);
38991
39022
  const thisSlug = routeSlug(route2.route);
38992
39023
  const otherSources = /* @__PURE__ */ new Map();
38993
39024
  const sourceFor = (slug2) => {
39025
+ if (noTracker) return void 0;
38994
39026
  if (slug2 === thisSlug) return statusTracker;
38995
39027
  if (!otherSources.has(slug2)) {
38996
39028
  const rt = cfg.routes.find((x) => routeSlug(x.route) === slug2);
@@ -39009,11 +39041,11 @@ ${where.join("\n")}`);
39009
39041
  const periscopes = await periscopesForStatus(cfg.ship.stateDir);
39010
39042
  const runPreviews = new Map(periscopes.filter((p) => p.serving).map((p) => [p.ticketRecordId, p.url]));
39011
39043
  if (flag("json")) {
39012
- const nameSync = await reconcileRouteShipName({ route: route2, ship: cfg.ship, configFile: cfg.configFile, readOnly: true });
39013
- const repos = await resolvedRepos(route2);
39044
+ const nameSync = noTracker ? void 0 : await reconcileRouteShipName({ route: route2, ship: cfg.ship, configFile: cfg.configFile, readOnly: true, rows: async () => shipRows });
39045
+ const repos = await resolvedRepos(route2, { noTracker });
39014
39046
  const seatIds = route2.resolved?.seats ?? {};
39015
- const crewRows = Object.keys(seatIds).length ? await statusTracker.crewRows() : [];
39016
- const seatProbes = await probeSeats(route2, (id) => statusTracker.crewRow(id));
39047
+ const crewRows = !noTracker && Object.keys(seatIds).length ? await statusTracker.crewRows() : [];
39048
+ const seatProbes = noTracker ? [] : await probeSeats(route2, (id) => statusTracker.crewRow(id));
39017
39049
  const seatProbeOf = (role) => seatProbes.find((p) => p.role === role);
39018
39050
  const crewRowById = new Map(crewRows.map((c) => [c.id, c]));
39019
39051
  const agentPersonas = route2.resolved?.agentPersonas ?? {};
@@ -39065,15 +39097,17 @@ ${where.join("\n")}`);
39065
39097
  // derived `release_stale`. `version` stays 1.
39066
39098
  attention: mergeSeatAttention(openShipAttention(state), route2, seatProbes),
39067
39099
  // Additive (CREW-2495): this ship's Ships-row name and whether it has drifted from `name`.
39068
- rowName: nameSync.rowName ?? null,
39069
- nameDrift: nameSync.drift,
39100
+ ...nameSync ? { rowName: nameSync.rowName ?? null, nameDrift: nameSync.drift } : {},
39070
39101
  // Additive (CREW-2803): the relay URL this route's tunnel is reachable at, or null.
39071
39102
  relayUrl: routeRelayUrl(route2),
39072
39103
  // Additive (CREW-2887): when a `crew reload` request was written and not yet honored, else null.
39073
39104
  reloadRequestedAt: ((at) => at === null ? null : new Date(at).toISOString())(readReloadRequestedAt(cfg.ship.stateDir))
39074
39105
  },
39106
+ // Additive (CREW-4019): when the tracker-derived blocks were read, or that they were left out
39107
+ // (`--no-tracker`) and which. A block named in `omitted` is absent, never empty.
39108
+ tracker: noTracker ? { read: false, readAt: null, omitted: [...TRACKER_BLOCKS] } : { read: true, readAt: trackerReadAt, omitted: [] },
39075
39109
  // Additive (CREW-1402): what the operator owes. `version` stays 1.
39076
- todo: todo.map((i) => ({ ticket: displayKey(i.ticket), title: i.ticket.title ?? null, reasons: i.reasons })),
39110
+ ...noTracker ? {} : { todo: todo.map((i) => ({ ticket: displayKey(i.ticket), title: i.ticket.title ?? null, reasons: i.reasons })) },
39077
39111
  crew: {
39078
39112
  paused: state.isPaused(),
39079
39113
  // The release timer honors the whole-crew pause too, so this is
@@ -39091,9 +39125,9 @@ ${where.join("\n")}`);
39091
39125
  name: route2.route,
39092
39126
  // Additive (CREW-2248): the running version and the workspace's floor. `version` stays 1.
39093
39127
  crewVersion: sentVersion(cfg.ship),
39094
- crewMinVersion,
39128
+ ...noTracker ? {} : { crewMinVersion },
39095
39129
  // Additive (CREW-1496): each project and its work mode. `version` stays 1.
39096
- projects: projects.map((p) => ({ id: p.id, name: p.name, workMode: p.mode })),
39130
+ ...noTracker ? {} : { projects: projects.map((p) => ({ id: p.id, name: p.name, workMode: p.mode })) },
39097
39131
  dir: route2.dir,
39098
39132
  // Additive (CREW-2548): open tickets with no repository, as of the last cycle.
39099
39133
  unroutable: state.unroutable(route2.route).previous().length,
@@ -39133,7 +39167,7 @@ ${where.join("\n")}`);
39133
39167
  })),
39134
39168
  waiting: waiting ? { ticket: waiting.ticket, since: waiting.since, streak: fairness.streak() } : null
39135
39169
  },
39136
- ships: shipRows.map((s) => ({
39170
+ ...noTracker ? {} : { ships: shipRows.map((s) => ({
39137
39171
  ...shipIdentityJson(s),
39138
39172
  name: s.name ?? null,
39139
39173
  lastSeen: s.last_seen ?? null,
@@ -39142,7 +39176,7 @@ ${where.join("\n")}`);
39142
39176
  engagedRoute: s.engaged_connection ?? null,
39143
39177
  engagedTicket: s.engaged_ticket_id ? issueLabelById.get(s.engaged_ticket_id) ?? null : null,
39144
39178
  attention: s.attention ?? []
39145
- }))
39179
+ })) }
39146
39180
  }, null, 2)}
39147
39181
  `);
39148
39182
  break;
@@ -39152,7 +39186,7 @@ ${where.join("\n")}`);
39152
39186
  let waitViews = [];
39153
39187
  let deferredReleases = [];
39154
39188
  try {
39155
- const open2 = await statusTracker.openTickets();
39189
+ const open2 = await openTicketsOnce();
39156
39190
  const blockerInfo = blockerInfoMap(open2, await statusTracker.ticketsByIds(missingBlockerIds(open2)));
39157
39191
  heldReleases = describeHeld(heldByBlockers(open2, statusTracker.contract.statuses.verified, blockerInfo, new Set(statusTracker.contract.statuses.resolved)));
39158
39192
  waitViews = [...planFootprintsFor(route2, open2, await readFootprintEvents(statusTracker), computeBlockedIds(open2, blockerInfo, { resolved: new Set(statusTracker.contract.statuses.resolved) })).waits.values()].map((w) => ({ ticket: displayKey(w.ticket), waitingFor: w.waitingFor, files: w.files }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.172.1",
3
+ "version": "0.173.0",
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",