@tablation/crew 0.162.0 → 0.163.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 +55 -44
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -9094,9 +9094,10 @@ function f(table2, name, contractPath, defaultColumn, kind, label, whatBreaks, e
9094
9094
  return { role: `${table2}.${name}`, table: table2, contractPath, defaultColumn, kind, label, whatBreaks, ...extra };
9095
9095
  }
9096
9096
  var opt = { optional: true };
9097
+ var readOnly = { computed: "either" };
9097
9098
  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),
9099
+ f("issues", "key", "columns.key", "issue_id", "any", "Ticket key", "Without it tickets cannot be named in branches, comments or logs.", readOnly),
9100
+ f("issues", "tag", "columns.tag", "issue_tag", "any", "Per-project ticket tag", "Without it branches fall back to plain `issue-<number>` names.", { ...opt, ...readOnly }),
9100
9101
  f("issues", "title", "columns.title", "title", "text", "Title", "Without it crew cannot show or file a ticket."),
9101
9102
  f("issues", "status", "columns.status", "status", "choice", "Status", "Without it crew cannot tell which tickets to work."),
9102
9103
  f("issues", "assignee", "columns.assignee", "assignee_id", "link", "Assignee", "Without it crew cannot claim a ticket or see who holds one."),
@@ -9108,7 +9109,7 @@ var FIELD_ENTRIES = [
9108
9109
  f("issues", "blockedBy", "columns.blockedBy", "blocked_by", "link", "Blocked by", "Without it crew cannot park a ticket behind its dependencies.", { multiple: "either" }),
9109
9110
  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
9111
  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", "attachments", "columns.attachments", "attachments", "file", "Attachments", "Without it a seat cannot open a ticket\u2019s screenshots.", { ...opt, multiple: "either" }),
9112
9113
  f("issues", "reportType", "columns.reportType", "report_type", "choice", "Report type", "Without it questions, investigations and coordinating tickets are treated as builds.", opt),
9113
9114
  f("issues", "epic", "columns.epic", "epic_id", "link", "Epic", "Without it tickets cannot belong to an epic.", opt),
9114
9115
  f("issues", "author", "columns.author", "filed_by_id", "link", "Filed by", "Without it a filed ticket does not name its filer.", opt),
@@ -9165,13 +9166,13 @@ var FIELD_ENTRIES = [
9165
9166
  f("answers", "detail", "answers.detail", "detail", "text", "Answer detail", "Without it an answer has no full instruction to act on when chosen.", opt),
9166
9167
  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),
9167
9168
  f("epics", "status", "epics.statusColumn", "status", "choice", "Epic status", "Without it crew cannot keep an epic\u2019s status from its tickets.", opt),
9168
- f("epics", "key", "epics.keyColumn", "epic_id", "any", "Epic key", "Without it an epic has no name in the log.", opt),
9169
+ f("epics", "key", "epics.keyColumn", "epic_id", "any", "Epic key", "Without it an epic has no name in the log.", { ...opt, ...readOnly }),
9169
9170
  f("maps", "epic", "maps.epicColumn", "epic_id", "link", "Map epic", "Without it a Map cannot be matched to its epic.", opt),
9170
9171
  f("maps", "title", "maps.titleColumn", "title", "text", "Map title", "Without it a Map has no name in a brief.", opt),
9171
9172
  f("maps", "content", "maps.contentColumn", "content", "text", "Map content", "Without it a brief cannot carry the Map.", opt),
9172
9173
  f("maps", "conversation", "maps.conversationColumn", "conversation", "text", "Map conversation", "Without it the interview record cannot be pointed at.", opt),
9173
9174
  f("maps", "status", "maps.statusColumn", "status", "choice", "Map status", "Without it the active Map cannot be told from a draft.", opt),
9174
- f("maps", "version", "maps.versionColumn", "version", "any", "Map version", "Without it a brief cannot name the Map\u2019s version.", opt)
9175
+ f("maps", "version", "maps.versionColumn", "version", "any", "Map version", "Without it a brief cannot name the Map\u2019s version.", { ...opt, ...readOnly })
9175
9176
  ];
9176
9177
  var STATUS_MEANINGS = [
9177
9178
  { id: "new", label: "New", defaultValue: "new", open: true, resolved: false, meaning: "Filed, not yet approved by a person." },
@@ -9285,7 +9286,9 @@ function describeShape(roleId) {
9285
9286
  if (t) return "a table";
9286
9287
  const e = FIELD_ENTRIES.find((x) => x.role === roleId);
9287
9288
  if (!e) return "unknown role";
9288
- const kind = e.kind === "any" ? "any column" : e.kind === "link" ? `a ${e.multiple === "either" ? "link (one or several)" : "link"} field` : `a ${e.kind} field`;
9289
+ const several = e.multiple === "either" ? " (one or several)" : "";
9290
+ const base = e.kind === "any" ? "any column" : e.kind === "link" || e.kind === "file" ? `a ${e.kind}${several} field` : `a ${e.kind} field`;
9291
+ const kind = e.computed === "either" ? `${base}, plain or computed` : base;
9289
9292
  return `${kind} on the ${e.table} table${e.optional ? " (optional)" : ""}`;
9290
9293
  }
9291
9294
  function describeDifferences(unmet) {
@@ -13669,13 +13672,13 @@ async function syncPersonas(route2, opts) {
13669
13672
  ...opts.readOnly ? { readOnly: true } : {}
13670
13673
  };
13671
13674
  }
13672
- async function linkReleaseSeat(route2, client2, agentsModel, userAgent, readOnly) {
13675
+ async function linkReleaseSeat(route2, client2, agentsModel, userAgent, readOnly2) {
13673
13676
  const seatId = route2.resolved.releaseSeat;
13674
13677
  if (!seatId) return {};
13675
13678
  const rows = await client2.records.list(agentsModel.id, { limit: 200 });
13676
13679
  let agentId = rows.find((r) => r.name === RELEASE_AGENT_NAME)?.id;
13677
13680
  if (!agentId) {
13678
- if (readOnly) return { note: `Release: no "${RELEASE_AGENT_NAME}" Agents row in this workspace \u2014 writes as the ship until a workspace admin runs \`crew agents sync\`` };
13681
+ if (readOnly2) return { note: `Release: no "${RELEASE_AGENT_NAME}" Agents row in this workspace \u2014 writes as the ship until a workspace admin runs \`crew agents sync\`` };
13679
13682
  try {
13680
13683
  agentId = (await client2.records.create(agentsModel.id, {
13681
13684
  name: RELEASE_AGENT_NAME,
@@ -13714,11 +13717,11 @@ var NO_WRITE_NOTE = "this key has no write access to the Agents table";
13714
13717
  var CREW_FIELD_MISSING_NOTE = "Crew table has no Agent field yet \u2014 a workspace admin's `crew agents sync` adds it";
13715
13718
  var CrewAgentFieldMissing = class extends Error {
13716
13719
  };
13717
- async function linkCrewSeats(route2, client2, agentsModelId, agentPersonas, userAgent, readOnly) {
13720
+ async function linkCrewSeats(route2, client2, agentsModelId, agentPersonas, userAgent, readOnly2) {
13718
13721
  const seats2 = route2.resolved.seats;
13719
13722
  const rolesWithSeats = ROLE_NAMES.filter((role) => seats2[role] && agentPersonas[role]);
13720
13723
  if (rolesWithSeats.length === 0) {
13721
- if (readOnly) return ROLE_NAMES.map((role) => ({ role, action: seats2[role] ? "no_agents_row" : "no_seat" }));
13724
+ if (readOnly2) return ROLE_NAMES.map((role) => ({ role, action: seats2[role] ? "no_agents_row" : "no_seat" }));
13722
13725
  return ROLE_NAMES.map((role) => ({ role, action: seats2[role] ? "persona_diverged" : "no_seat" }));
13723
13726
  }
13724
13727
  const crewModelId = route2.resolved.models.crew;
@@ -13741,7 +13744,7 @@ async function linkCrewSeats(route2, client2, agentsModelId, agentPersonas, user
13741
13744
  continue;
13742
13745
  }
13743
13746
  if (!agentId) {
13744
- outcomes.push({ role, action: readOnly ? "no_agents_row" : "persona_diverged" });
13747
+ outcomes.push({ role, action: readOnly2 ? "no_agents_row" : "persona_diverged" });
13745
13748
  continue;
13746
13749
  }
13747
13750
  const seatRow = await getSeatRow(client2, crewModelId, seatId);
@@ -14527,7 +14530,7 @@ function streamShowsAllowanceRefusal(streamPath) {
14527
14530
  }
14528
14531
  return false;
14529
14532
  }
14530
- var digestPathFor = (stateDir, routeLabel, role, runId) => join34(stateDir, `digest-${routeLabel}-${role}${runId ? `-${runId}` : ""}.md`);
14533
+ var digestPathFor = (stateDir, routeLabel2, role, runId) => join34(stateDir, `digest-${routeLabel2}-${role}${runId ? `-${runId}` : ""}.md`);
14531
14534
  function codeBridgeFor(o, harness) {
14532
14535
  if (!o.ticket) return void 0;
14533
14536
  const number = /(\d+)$/.exec(o.ticket)?.[1];
@@ -14584,9 +14587,9 @@ function planAgentRun(o) {
14584
14587
  const commonPath = join34(o.route.promptsDir, "personas", "common.md");
14585
14588
  const usesCommon = !SELF_CONTAINED_ROLES.has(o.role) && existsSync29(commonPath);
14586
14589
  const now = o.now ?? (() => Date.now());
14587
- const routeLabel = routeSlug(o.route.route);
14588
- const ownDigest = o.runId ? digestPathFor(o.stateDir, routeLabel, o.role, o.runId) : void 0;
14589
- const digestPath2 = ownDigest && existsSync29(ownDigest) ? ownDigest : digestPathFor(o.stateDir, routeLabel, o.role);
14590
+ const routeLabel2 = routeSlug(o.route.route);
14591
+ const ownDigest = o.runId ? digestPathFor(o.stateDir, routeLabel2, o.role, o.runId) : void 0;
14592
+ const digestPath2 = ownDigest && existsSync29(ownDigest) ? ownDigest : digestPathFor(o.stateDir, routeLabel2, o.role);
14590
14593
  let digest;
14591
14594
  let ageSeconds;
14592
14595
  if (existsSync29(digestPath2)) {
@@ -14618,7 +14621,7 @@ function planAgentRun(o) {
14618
14621
  });
14619
14622
  const promptSha = createHash6("sha256").update(expanded.text).digest("hex");
14620
14623
  const streamsDir = join34(o.stateDir, "streams");
14621
- const base = `${routeLabel}-${o.role}-${o.cycle}${o.runId ? `-${o.runId}` : ""}`;
14624
+ const base = `${routeLabel2}-${o.role}-${o.cycle}${o.runId ? `-${o.runId}` : ""}`;
14622
14625
  const seat = resolveSeat(o.ship, o.route, o.role, o.agentPersona ?? (o.agentModel ? { model: o.agentModel } : {}), o.repo);
14623
14626
  const { model } = seat;
14624
14627
  let toolchain = seat.toolchain;
@@ -14676,7 +14679,7 @@ function planAgentRun(o) {
14676
14679
  } : void 0;
14677
14680
  return {
14678
14681
  role: o.role,
14679
- route: routeLabel,
14682
+ route: routeLabel2,
14680
14683
  // The route's directory, which is a STARTING POINT and not the
14681
14684
  // ticket's repo: the session picks its own working directory even when
14682
14685
  // the runner already selected a ticket (`o.repo` is known then, and
@@ -19591,6 +19594,9 @@ ${waiting.map((t) => `| ${displayKey2(t)} | ${t.status} | ${blockers(t, i)} |`).
19591
19594
  // src/tracker-interface-read.ts
19592
19595
  var INTERFACE_MISMATCH_KEY = "tracker_interface";
19593
19596
  var INTERFACE_UNDECLARED_KEY = "tracker_interface_undeclared";
19597
+ var INTERFACE_OVERRIDE_KEY = `${INTERFACE_MISMATCH_KEY}_override`;
19598
+ var interfaceKey = (base, route2) => `${base}:${route2}`;
19599
+ var routeLabel = (route2) => `route ${route2}: `;
19594
19600
  function statusOf2(e) {
19595
19601
  return typeof e?.status === "number" ? e.status : void 0;
19596
19602
  }
@@ -19648,14 +19654,14 @@ function blockingMessage(state, storedMappingKey) {
19648
19654
  if (storedMappingKey !== void 0 && storedMappingKey !== mappingKey(state.mapping)) return MAPPING_CHANGED_MESSAGE;
19649
19655
  return null;
19650
19656
  }
19651
- function mismatchItem(message, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19652
- return { kind: "tracker_interface", key: INTERFACE_MISMATCH_KEY, since: nowIso, message };
19657
+ function mismatchItem(route2, message, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19658
+ return { kind: "tracker_interface", key: interfaceKey(INTERFACE_MISMATCH_KEY, route2), since: nowIso, message: routeLabel(route2) + message };
19653
19659
  }
19654
- function undeclaredItem(nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19655
- return { kind: "tracker_interface", key: INTERFACE_UNDECLARED_KEY, since: nowIso, message: UNDECLARED_MESSAGE };
19660
+ function undeclaredItem(route2, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19661
+ return { kind: "tracker_interface", key: interfaceKey(INTERFACE_UNDECLARED_KEY, route2), since: nowIso, message: routeLabel(route2) + UNDECLARED_MESSAGE };
19656
19662
  }
19657
- function overrideItem(nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19658
- return { kind: "tracker_interface", key: `${INTERFACE_MISMATCH_KEY}_override`, since: nowIso, message: OVERRIDE_IGNORED_MESSAGE };
19663
+ function overrideItem(route2, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
19664
+ return { kind: "tracker_interface", key: interfaceKey(INTERFACE_OVERRIDE_KEY, route2), since: nowIso, message: routeLabel(route2) + OVERRIDE_IGNORED_MESSAGE };
19659
19665
  }
19660
19666
  function open(state, key) {
19661
19667
  return state.shipAttention().previous().find((i) => i.key === key)?.message ?? null;
@@ -19663,28 +19669,33 @@ function open(state, key) {
19663
19669
  async function checkTrackerInterface(o, deps = {}) {
19664
19670
  const r = o.route.resolved;
19665
19671
  if (!r?.projectId) return null;
19672
+ const name = o.route.route;
19673
+ const mismatchKey = interfaceKey(INTERFACE_MISMATCH_KEY, name);
19674
+ const undeclaredKey = interfaceKey(INTERFACE_UNDECLARED_KEY, name);
19675
+ const overrideKey = interfaceKey(INTERFACE_OVERRIDE_KEY, name);
19676
+ for (const legacy of [INTERFACE_MISMATCH_KEY, INTERFACE_UNDECLARED_KEY, INTERFACE_OVERRIDE_KEY]) clearShipAttention(o.state, legacy);
19666
19677
  const state = await (deps.read ?? readForRoute)(o.route, o.ship);
19667
- if (state.kind === "unreadable") return open(o.state, INTERFACE_MISMATCH_KEY);
19678
+ if (state.kind === "unreadable") return open(o.state, mismatchKey);
19668
19679
  if (state.kind === "undeclared") {
19669
- clearShipAttention(o.state, INTERFACE_MISMATCH_KEY);
19670
- clearShipAttention(o.state, `${INTERFACE_MISMATCH_KEY}_override`);
19680
+ clearShipAttention(o.state, mismatchKey);
19681
+ clearShipAttention(o.state, overrideKey);
19671
19682
  if (ALLOW_UNDECLARED_TRACKER_APPS) {
19672
- await raiseShipAttention(o, undeclaredItem());
19683
+ await raiseShipAttention(o, undeclaredItem(name));
19673
19684
  return null;
19674
19685
  }
19675
19686
  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";
19676
- await raiseShipAttention(o, mismatchItem(message2));
19687
+ await raiseShipAttention(o, mismatchItem(name, message2));
19677
19688
  return message2;
19678
19689
  }
19679
- clearShipAttention(o.state, INTERFACE_UNDECLARED_KEY);
19680
- if (o.route.contractAuthored) await raiseShipAttention(o, overrideItem());
19681
- else clearShipAttention(o.state, `${INTERFACE_MISMATCH_KEY}_override`);
19690
+ clearShipAttention(o.state, undeclaredKey);
19691
+ if (o.route.contractAuthored) await raiseShipAttention(o, overrideItem(name));
19692
+ else clearShipAttention(o.state, overrideKey);
19682
19693
  const message = blockingMessage(state, r.trackerInterface?.mappingKey);
19683
19694
  if (message) {
19684
- await raiseShipAttention(o, mismatchItem(message));
19695
+ await raiseShipAttention(o, mismatchItem(name, message));
19685
19696
  return message;
19686
19697
  }
19687
- clearShipAttention(o.state, INTERFACE_MISMATCH_KEY);
19698
+ clearShipAttention(o.state, mismatchKey);
19688
19699
  return null;
19689
19700
  }
19690
19701
  async function readForRoute(route2, ship) {
@@ -27712,14 +27723,14 @@ async function runAgentsSync(target, o) {
27712
27723
  const dryRun = o.dryRun ?? false;
27713
27724
  const force = o.force ?? false;
27714
27725
  const keyRole = target.resolved?.role ?? await fetchKeyRole(target, o.userAgent);
27715
- let readOnly = !isAdminRole(keyRole);
27726
+ let readOnly2 = !isAdminRole(keyRole);
27716
27727
  const runPersonas = (ro) => syncPersonas(target, { userAgent: o.userAgent, dryRun, force, readOnly: ro });
27717
27728
  let personaResult;
27718
27729
  try {
27719
- personaResult = await runPersonas(readOnly);
27730
+ personaResult = await runPersonas(readOnly2);
27720
27731
  } catch (e) {
27721
- if (readOnly || !isForbidden(e)) throw e;
27722
- readOnly = true;
27732
+ if (readOnly2 || !isForbidden(e)) throw e;
27733
+ readOnly2 = true;
27723
27734
  personaResult = await runPersonas(true);
27724
27735
  }
27725
27736
  o.say(`route: ${target.route}`);
@@ -27730,18 +27741,18 @@ async function runAgentsSync(target, o) {
27730
27741
  const briefs = Object.fromEntries(ROLE_NAMES.map((r) => [r, personaDefaultPrompt(target.promptsDir, r)]));
27731
27742
  for (const w of skillMarkerWarnings(target.promptsDir, briefs)) o.warn(`warning: ${w}`);
27732
27743
  let skillResult;
27733
- if (!readOnly) {
27744
+ if (!readOnly2) {
27734
27745
  try {
27735
27746
  skillResult = await syncSkills(target, { userAgent: o.userAgent, dryRun, force });
27736
27747
  } catch (e) {
27737
- if (isForbidden(e)) readOnly = true;
27748
+ if (isForbidden(e)) readOnly2 = true;
27738
27749
  else throw e;
27739
27750
  }
27740
27751
  }
27741
27752
  for (const l of summarizeOutcomes(skillResult?.outcomes ?? [], describeSkillSyncOutcome, (s) => s.action === "unchanged", "skill", o.verbose ?? false)) o.say(l);
27742
27753
  for (const w of skillResult?.warnings ?? []) o.warn(`warning: ${w}`);
27743
27754
  const avatarFailures2 = {};
27744
- if (!readOnly && !dryRun) {
27755
+ if (!readOnly2 && !dryRun) {
27745
27756
  for (const a of await syncPersonaAvatars(target, personaResult.agentPersonas, { userAgent: o.userAgent })) {
27746
27757
  const line = describeAvatarOutcome(a, PERSONA_NAME[a.role]);
27747
27758
  if (a.status === "failed") {
@@ -27755,7 +27766,7 @@ async function runAgentsSync(target, o) {
27755
27766
  const raw = existsSync53(resolvedPath) ? JSON.parse(readFileSync51(resolvedPath, "utf8")) : {};
27756
27767
  raw.agentPersonas = personaResult.agentPersonas;
27757
27768
  if (skillResult) raw.agentSkills = skillResult.agentSkills;
27758
- if (!readOnly) raw.avatarSyncFailures = avatarFailures2;
27769
+ if (!readOnly2) raw.avatarSyncFailures = avatarFailures2;
27759
27770
  if (personaResult.releaseAgentId) raw.releaseAgentId = personaResult.releaseAgentId;
27760
27771
  mkdirSync39(dirname32(resolvedPath), { recursive: true });
27761
27772
  writeFileSync41(resolvedPath, `${JSON.stringify(raw, null, 2)}
@@ -27765,11 +27776,11 @@ async function runAgentsSync(target, o) {
27765
27776
  if (personaResult.releaseAgentId) target.resolved.releaseAgentId = personaResult.releaseAgentId;
27766
27777
  }
27767
27778
  }
27768
- if (readOnly) {
27779
+ if (readOnly2) {
27769
27780
  o.say("personas and skills: not synced (this key is not a workspace admin; the workspace's rows are used as they are)");
27770
27781
  }
27771
27782
  const diverged = personaResult.outcomes.some((p) => p.action === "diverged") || (skillResult?.outcomes.some((s) => s.action === "diverged") ?? false);
27772
- return { personaResult, skillResult, readOnly, diverged };
27783
+ return { personaResult, skillResult, readOnly: readOnly2, diverged };
27773
27784
  }
27774
27785
 
27775
27786
  // src/logbook.ts
@@ -29166,7 +29177,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
29166
29177
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
29167
29178
  import { join as join60 } from "path";
29168
29179
  function builtVersion() {
29169
- return true ? "0.162.0" : null;
29180
+ return true ? "0.163.1" : null;
29170
29181
  }
29171
29182
  var REBUILD_HINT = "rebuild with npm run build";
29172
29183
  function newestMtime(path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.162.0",
3
+ "version": "0.163.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",