@tablation/crew 0.147.0 → 0.148.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/crew.example.yaml CHANGED
@@ -132,6 +132,11 @@ routes:
132
132
  # dev/design/QA policy this repo ships with) when omitted. See
133
133
  # prompts/default/ for the shape a custom set needs to have.
134
134
  # promptSet: "dev-qa"
135
+ # Roles whose run start marks the ticket's optional `crew_assisted` Yes/No
136
+ # column true (CREW-3258): a record that the crew's building or verifying
137
+ # lane worked it. Defaults to [dev, qa]; [] turns the marking off for this
138
+ # route. Ignored on a workspace whose Issues table lacks the column.
139
+ # assistedRoles: [dev, qa]
135
140
  # What a host must be to build a repo lives in THAT repo's own .crew.yaml
136
141
  # (any | unix | macos | linux | windows) — never here. A route can span
137
142
  # repos with different needs; the ship refuses a route only when it can
package/dist/cli.js CHANGED
@@ -4020,6 +4020,7 @@ var ROLE_LABEL = {
4020
4020
  triage: "Triage",
4021
4021
  pair: "Pair"
4022
4022
  };
4023
+ var DEFAULT_ASSISTED_ROLES = ["dev", "qa"];
4023
4024
  var ConfigError = class extends Error {
4024
4025
  };
4025
4026
  var DEFAULT_MAX_PERISCOPES = 3;
@@ -4150,7 +4151,8 @@ var ROUTE_KEYS = /* @__PURE__ */ new Set([
4150
4151
  "hostPassengers",
4151
4152
  "hostPeriscopes",
4152
4153
  "toolchain",
4153
- "maxRunMinutes"
4154
+ "maxRunMinutes",
4155
+ "assistedRoles"
4154
4156
  ]);
4155
4157
  function parseWorktreeName(v, where, file) {
4156
4158
  const problem = typeof v === "string" ? worktreeNameProblem(v) : "must be a string";
@@ -4602,6 +4604,22 @@ function parseMaxRunMinutes(raw, where, missing) {
4602
4604
  }
4603
4605
  return n;
4604
4606
  }
4607
+ function parseAssistedRoles(raw, where, missing) {
4608
+ if (raw === void 0) return void 0;
4609
+ if (!Array.isArray(raw)) {
4610
+ missing.add(`${where} must be a list of roles (expected any of ${ROLE_NAMES.join(", ")}), [] to turn the marking off`);
4611
+ return void 0;
4612
+ }
4613
+ const out = [];
4614
+ for (const r of raw) {
4615
+ if (!ROLE_NAMES.includes(String(r))) {
4616
+ missing.add(`${where} has "${String(r)}", which is not a role (expected any of ${ROLE_NAMES.join(", ")})`);
4617
+ continue;
4618
+ }
4619
+ if (!out.includes(r)) out.push(r);
4620
+ }
4621
+ return out;
4622
+ }
4605
4623
  function parsePair(raw, missing) {
4606
4624
  if (raw === void 0) return void 0;
4607
4625
  if (!Array.isArray(raw)) {
@@ -4690,6 +4708,7 @@ function parseOneRoute(c, where, file, base, stateDir, raw, missing, crewHome, t
4690
4708
  rejectUnknownKeys(c, ROUTE_KEYS, `${where}`, file);
4691
4709
  const toolchain = c?.toolchain === void 0 ? void 0 : String(c.toolchain);
4692
4710
  const maxRunMinutes = parseMaxRunMinutes(c?.maxRunMinutes, `${where}.maxRunMinutes`, missing);
4711
+ const assistedRoles = parseAssistedRoles(c?.assistedRoles, `${where}.assistedRoles`, missing);
4693
4712
  if (toolchain !== void 0 && !toolchainNames.has(toolchain)) {
4694
4713
  missing.add(`${where}.toolchain "${toolchain}" is not defined in ship.toolchains (have: ${[...toolchainNames].join(", ")})`);
4695
4714
  }
@@ -4754,6 +4773,7 @@ function parseOneRoute(c, where, file, base, stateDir, raw, missing, crewHome, t
4754
4773
  worktreePrefix: c?.worktreePrefix ? String(c.worktreePrefix) : void 0,
4755
4774
  ...toolchain !== void 0 ? { toolchain } : {},
4756
4775
  ...maxRunMinutes !== void 0 ? { maxRunMinutes } : {},
4776
+ ...assistedRoles !== void 0 ? { assistedRoles } : {},
4757
4777
  promptsDir: resolvePromptsDir(c?.promptSet ? String(c.promptSet) : void 0, crewHome, base),
4758
4778
  weight,
4759
4779
  baseUrl: String(c?.baseUrl ?? raw.ship?.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, ""),
@@ -8776,7 +8796,8 @@ var DEFAULT_CONTRACT = {
8776
8796
  tokensOut: "tokens_out",
8777
8797
  cacheReadTokens: "cache_read_tokens",
8778
8798
  cacheWriteTokens: "cache_write_tokens",
8779
- costUsd: "cost_usd"
8799
+ costUsd: "cost_usd",
8800
+ crewAssisted: "crew_assisted"
8780
8801
  },
8781
8802
  comments: {
8782
8803
  parent: "ticket_id",
@@ -9171,6 +9192,7 @@ var Tracker = class {
9171
9192
  * so concurrent first writes share one round of field-metadata reads.
9172
9193
  */
9173
9194
  authorship;
9195
+ crewAssistedColumn;
9174
9196
  attachments;
9175
9197
  stateDir;
9176
9198
  /**
@@ -9817,6 +9839,11 @@ var Tracker = class {
9817
9839
  shipId: auth.shipId
9818
9840
  };
9819
9841
  }
9842
+ /** Whether Issues carries the optional `crew_assisted` column (CREW-3258). */
9843
+ async hasCrewAssistedColumn() {
9844
+ this.crewAssistedColumn ??= this.columnNames(this.models.issues).then((f) => f.has(this.contract.columns.crewAssisted));
9845
+ return this.crewAssistedColumn;
9846
+ }
9820
9847
  /**
9821
9848
  * Which of the optional review columns (`verified_sha`, `pr_ref`) the Issues
9822
9849
  * table carries. A table without them has not adopted the review hand-off:
@@ -19154,6 +19181,27 @@ async function claimStillHeld(tracker, t, buildingStatus, affinity) {
19154
19181
  return null;
19155
19182
  }
19156
19183
 
19184
+ // src/crew-assisted.ts
19185
+ function countsAsAssisted(route2, role) {
19186
+ return (route2.assistedRoles ?? DEFAULT_ASSISTED_ROLES).includes(role);
19187
+ }
19188
+ async function markCrewAssisted(tracker, route2, role, ticket) {
19189
+ if (!countsAsAssisted(route2, role)) return false;
19190
+ const column = tracker.contract.columns.crewAssisted;
19191
+ if (ticket[column] === true) return false;
19192
+ if (!await tracker.hasCrewAssistedColumn()) return false;
19193
+ await tracker.updateTicket(ticket.id, { [column]: true });
19194
+ return true;
19195
+ }
19196
+ async function markCrewAssistedAtLaunch(tracker, route2, role, ticketId, ticket, warn) {
19197
+ if (!ticketId || !countsAsAssisted(route2, role)) return;
19198
+ try {
19199
+ await markCrewAssisted(tracker, route2, role, ticket ?? await tracker.ticket(ticketId));
19200
+ } catch (e) {
19201
+ warn(`could not mark the ticket crew-assisted: ${e.message}`);
19202
+ }
19203
+ }
19204
+
19157
19205
  // src/repo-refresh.ts
19158
19206
  import { existsSync as existsSync40, mkdirSync as mkdirSync28, readFileSync as readFileSync40, writeFileSync as writeFileSync32 } from "fs";
19159
19207
  import { dirname as dirname22 } from "path";
@@ -23849,6 +23897,7 @@ async function runRoleAgentLocked(role, decision, ctx, hooks, held) {
23849
23897
  if (workingId) {
23850
23898
  try {
23851
23899
  const before = await tracker.ticket(workingId);
23900
+ await markCrewAssistedAtLaunch(tracker, route2, role, workingId, before, (m) => emit.warn(m, { step: "agent" }));
23852
23901
  const col = tracker.contract.columns;
23853
23902
  const tipBefore = branchProgress(route2, before);
23854
23903
  if (role === "dev" || role === "design") {
@@ -26727,7 +26776,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
26727
26776
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
26728
26777
  import { join as join58 } from "path";
26729
26778
  function builtVersion() {
26730
- return true ? "0.147.0" : null;
26779
+ return true ? "0.148.0" : null;
26731
26780
  }
26732
26781
  var REBUILD_HINT = "rebuild with npm run build";
26733
26782
  function newestMtime(path) {
@@ -30905,6 +30954,7 @@ ${f.tail.trimEnd()}
30905
30954
  }
30906
30955
  try {
30907
30956
  const runStart = (/* @__PURE__ */ new Date()).toISOString();
30957
+ await markCrewAssistedAtLaunch(fleetTracker, w.route, w.role, fleetWorkingId ?? null, void 0, (m) => wemit.warn(m, { step: "agent" }));
30908
30958
  await spawnAgent(fleetPlan, wemit);
30909
30959
  await guardRunHandoff(w.route, cfg.ship, fleetTracker, w.role, fleetWorkingId, wemit, runStart);
30910
30960
  } finally {
@@ -31147,6 +31197,7 @@ ${f.tail.trimEnd()}
31147
31197
  }
31148
31198
  try {
31149
31199
  const runStart = (/* @__PURE__ */ new Date()).toISOString();
31200
+ await markCrewAssistedAtLaunch(tracker2, route2, current, workingId ?? null, void 0, (m) => emit.warn(m, { step: "agent" }));
31150
31201
  await spawnAgent(plan, emit);
31151
31202
  await guardRunHandoff(route2, cfg.ship, tracker2, current, workingId, emit, runStart);
31152
31203
  } finally {
@@ -34998,6 +35049,11 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
34998
35049
  process.stdout.write(
34999
35050
  await tracker.hasPublicReplyColumn() ? `public replies: Comments.${tracker.contract.comments.publicReply} present \u2014 public reporters are labelled in the digest
35000
35051
  ` : `public replies: Comments.${tracker.contract.comments.publicReply} absent \u2014 no public intake form, nothing to guard
35052
+ `
35053
+ );
35054
+ process.stdout.write(
35055
+ await tracker.hasCrewAssistedColumn() ? `crew assisted: Issues.${tracker.contract.columns.crewAssisted} present \u2014 Dev/QA runs mark the ticket
35056
+ ` : `crew assisted: Issues.${tracker.contract.columns.crewAssisted} absent \u2014 tickets are not marked; update the Issues template to adopt it
35001
35057
  `
35002
35058
  );
35003
35059
  const periscopes = await tracker.periscopesStatus();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.147.0",
3
+ "version": "0.148.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",