@tablation/crew 0.164.2 → 0.164.3

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 +29 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -10345,13 +10345,15 @@ var Tracker = class _Tracker {
10345
10345
  *
10346
10346
  * `ticketRecordId` is the ticket's own row id (`Ticket.id`), not its
10347
10347
  * `issue_id` label — the field it fills is a Reference, not text.
10348
- * Omitted (as on the idle transition) leaves the column alone, so it
10349
- * keeps reading as "current/last issue" rather than clearing to blank
10350
- * the moment a run ends.
10348
+ * An idle seat has no current issue (CREW-3689): the idle write clears
10349
+ * the column in the same patch, so a stale pointer never reads as a stuck
10350
+ * seat. The last ticket a seat worked stays in the agent log. A working
10351
+ * write with no id leaves the column alone.
10351
10352
  */
10352
10353
  async setCrewStatus(memberId, status2, ticketRecordId) {
10353
10354
  const patch2 = { status: status2, status_updated_at: (/* @__PURE__ */ new Date()).toISOString() };
10354
- if (ticketRecordId !== void 0) patch2.current_issue_id = ticketRecordId;
10355
+ if (status2 === "idle") patch2.current_issue_id = null;
10356
+ else if (ticketRecordId !== void 0) patch2.current_issue_id = ticketRecordId;
10355
10357
  await this.client.records.update(this.models.crew, memberId, patch2);
10356
10358
  }
10357
10359
  /**
@@ -15881,6 +15883,27 @@ async function settleRunEnd(o) {
15881
15883
  emit.warn(`could not beat ship idle: ${e.message}`, { step: "agent" });
15882
15884
  }
15883
15885
  }
15886
+ function staleIdleSeats(route2, crewRows, runs) {
15887
+ const slug2 = routeSlug(route2.route);
15888
+ const out = [];
15889
+ for (const [role, memberId] of Object.entries(route2.resolved?.seats ?? {})) {
15890
+ if (!memberId) continue;
15891
+ const row = crewRows.find((r) => r.id === memberId);
15892
+ if (!row?.current_issue_id || row.status === "working") continue;
15893
+ if (runs.some((r) => r.role === role && r.route === slug2)) continue;
15894
+ out.push({ role, memberId });
15895
+ }
15896
+ return out;
15897
+ }
15898
+ async function clearStaleIdleSeats(tracker, route2, crewRows, runs, emit) {
15899
+ for (const s of staleIdleSeats(route2, crewRows, runs)) {
15900
+ try {
15901
+ await tracker.setCrewStatus(s.memberId, "idle");
15902
+ } catch (e) {
15903
+ emit.warn(`could not clear ${s.role} seat's current issue: ${e.message}`, { step: "poll" });
15904
+ }
15905
+ }
15906
+ }
15884
15907
  function pidAlive2(pid) {
15885
15908
  try {
15886
15909
  process.kill(pid, 0);
@@ -20169,6 +20192,7 @@ async function decideCycle(o) {
20169
20192
  tracker.crewRows(),
20170
20193
  optional("project work modes", tracker.projectWorkModes(), /* @__PURE__ */ new Map())
20171
20194
  ]);
20195
+ await clearStaleIdleSeats(tracker, route2, crewRows, liveRuns(state.dir), emit);
20172
20196
  const scopeHolds = new Set(holdIds(buildRoster(configuredMembers(route2), crewRows)));
20173
20197
  const scope = {
20174
20198
  modes: projectModes,
@@ -29330,7 +29354,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
29330
29354
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
29331
29355
  import { join as join60 } from "path";
29332
29356
  function builtVersion() {
29333
- return true ? "0.164.2" : null;
29357
+ return true ? "0.164.3" : null;
29334
29358
  }
29335
29359
  var REBUILD_HINT = "rebuild with npm run build";
29336
29360
  function newestMtime(path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.164.2",
3
+ "version": "0.164.3",
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",