@tablation/crew 0.161.0 → 0.163.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 +44 -23
  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),
@@ -9128,6 +9129,8 @@ var FIELD_ENTRIES = [
9128
9129
  f("issues", "cacheWriteTokens", "columns.cacheWriteTokens", "cache_write_tokens", "number", "Cache write tokens", "Without it per-ticket token spend is not kept.", opt),
9129
9130
  f("issues", "costUsd", "columns.costUsd", "cost_usd", "number", "Cost (USD)", "Without it per-ticket spend is not kept.", opt),
9130
9131
  f("issues", "crewAssisted", "columns.crewAssisted", "crew_assisted", "boolean", "Crew assisted", "Without it tickets the crew worked are not marked.", opt),
9132
+ f("issues", "description", "columns.description", "description", "text", "Description", "Without it the platform cannot tell its own setup tickets from a first ticket, and cannot write one.", opt),
9133
+ f("issues", "needsPlanning", "columns.needsPlanning", "needs_planning", "boolean", "Needs planning", "Without it the platform counts every ticket in a demand status as plannable, including ones a person still owes scoping.", opt),
9131
9134
  f("projects", "workMode", "columns.workMode", "work_mode", "choice", "Work mode", "Without it every project is worked automatically.", opt),
9132
9135
  f("comments", "parent", "comments.parent", "ticket_id", "link", "Comment ticket", "Without it a comment cannot be tied to its ticket."),
9133
9136
  f("comments", "body", "comments.body", "body", "text", "Comment body", "Without it a comment has no text."),
@@ -9136,6 +9139,16 @@ var FIELD_ENTRIES = [
9136
9139
  f("comments", "ship", "comments.ship", "ship_id", "link", "Posted from ship", "Without it a comment does not name the machine that posted it.", opt),
9137
9140
  f("comments", "publicReply", "comments.publicReply", "is_public_reply", "boolean", "Public reply", "Without it replies from a public form are read as the team\u2019s.", opt),
9138
9141
  f("comments", "authorName", "comments.authorName", "author_name", "text", "Public author name", "Without it a public reporter\u2019s name is lost.", opt),
9142
+ // Read by the platform's scheduler, project setup checklist and repository
9143
+ // pages (interface 1.2, CREW-3633). All optional: the platform reports a role
9144
+ // it needs but the app did not map as 'not ready' with that reason.
9145
+ f("repos", "name", "repos.name", "name", "text", "Repository name", "Without it a repository has no short name to show or route by.", opt),
9146
+ f("repos", "remote", "repos.remote", "remote", "text", "Repository remote", "Without it the platform cannot tell which `owner/name` a repository is.", opt),
9147
+ f("repos", "enabled", "repos.enabled", "enabled", "boolean", "Repository enabled", "Without it the platform cannot tell a repository crew works from one it has switched off.", opt),
9148
+ f("repos", "ciProvider", "repos.ciProvider", "ci_provider", "any", "CI provider", "Without it the platform cannot tell which CI system a repository uses (a text or choice field).", opt),
9149
+ f("repos", "appUrl", "repos.appUrl", "app_url", "text", "App URL", "Without it the setup checklist has no link to where the app is served.", opt),
9150
+ f("repos", "project", "repos.project", "project_id", "link", "Repository project", "Without it setup tickets cannot tell which project a repository belongs to.", { ...opt, linkTo: "projects" }),
9151
+ f("crew", "userId", "crew.userId", "user_id", "any", "Workspace membership", "Without it the platform cannot find the adding member\u2019s seat (the field holds the workspace membership id of the person the seat is).", opt),
9139
9152
  // The optional questions part (interface 1.1, CREW-3588). The shapes are the
9140
9153
  // ones the platform's Record choices requirement asks of its questions and
9141
9154
  // answers tables; `questionsPartMapped` says when a mapping carries enough of
@@ -9153,13 +9166,13 @@ var FIELD_ENTRIES = [
9153
9166
  f("answers", "detail", "answers.detail", "detail", "text", "Answer detail", "Without it an answer has no full instruction to act on when chosen.", opt),
9154
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),
9155
9168
  f("epics", "status", "epics.statusColumn", "status", "choice", "Epic status", "Without it crew cannot keep an epic\u2019s status from its tickets.", opt),
9156
- 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 }),
9157
9170
  f("maps", "epic", "maps.epicColumn", "epic_id", "link", "Map epic", "Without it a Map cannot be matched to its epic.", opt),
9158
9171
  f("maps", "title", "maps.titleColumn", "title", "text", "Map title", "Without it a Map has no name in a brief.", opt),
9159
9172
  f("maps", "content", "maps.contentColumn", "content", "text", "Map content", "Without it a brief cannot carry the Map.", opt),
9160
9173
  f("maps", "conversation", "maps.conversationColumn", "conversation", "text", "Map conversation", "Without it the interview record cannot be pointed at.", opt),
9161
9174
  f("maps", "status", "maps.statusColumn", "status", "choice", "Map status", "Without it the active Map cannot be told from a draft.", opt),
9162
- 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 })
9163
9176
  ];
9164
9177
  var STATUS_MEANINGS = [
9165
9178
  { id: "new", label: "New", defaultValue: "new", open: true, resolved: false, meaning: "Filed, not yet approved by a person." },
@@ -9222,7 +9235,9 @@ function contractFromMapping(base, mapping) {
9222
9235
  epics: next.epics,
9223
9236
  maps: next.maps,
9224
9237
  questions: next.questions,
9225
- answers: next.answers
9238
+ answers: next.answers,
9239
+ repos: next.repos,
9240
+ crew: next.crew
9226
9241
  };
9227
9242
  for (const e of FIELD_ENTRIES) {
9228
9243
  const col = mapping.fields[e.role];
@@ -9271,7 +9286,9 @@ function describeShape(roleId) {
9271
9286
  if (t) return "a table";
9272
9287
  const e = FIELD_ENTRIES.find((x) => x.role === roleId);
9273
9288
  if (!e) return "unknown role";
9274
- 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;
9275
9292
  return `${kind} on the ${e.table} table${e.optional ? " (optional)" : ""}`;
9276
9293
  }
9277
9294
  function describeDifferences(unmet) {
@@ -9309,6 +9326,8 @@ var DEFAULT_CONTRACT = {
9309
9326
  maps: { ...MAP_DEFAULTS, activeStatus: "active" },
9310
9327
  questions: defaultGroup("questions"),
9311
9328
  answers: defaultGroup("answers"),
9329
+ repos: defaultGroup("repos"),
9330
+ crew: defaultGroup("crew"),
9312
9331
  questionStatuses: defaultQuestionStatuses(),
9313
9332
  priorityOrder: ["p0", "p1", "p2", "p3"],
9314
9333
  severityOrder: ["s1", "s2", "s3", "s4"],
@@ -9335,6 +9354,8 @@ function resolveContract(override) {
9335
9354
  maps: { ...DEFAULT_CONTRACT.maps, ...override.maps },
9336
9355
  questions: { ...DEFAULT_CONTRACT.questions, ...override.questions },
9337
9356
  answers: { ...DEFAULT_CONTRACT.answers, ...override.answers },
9357
+ repos: { ...DEFAULT_CONTRACT.repos, ...override.repos },
9358
+ crew: { ...DEFAULT_CONTRACT.crew, ...override.crew },
9338
9359
  questionStatuses: { ...DEFAULT_CONTRACT.questionStatuses, ...override.questionStatuses },
9339
9360
  priorityOrder: override.priorityOrder ?? DEFAULT_CONTRACT.priorityOrder,
9340
9361
  severityOrder: override.severityOrder ?? DEFAULT_CONTRACT.severityOrder,
@@ -13651,13 +13672,13 @@ async function syncPersonas(route2, opts) {
13651
13672
  ...opts.readOnly ? { readOnly: true } : {}
13652
13673
  };
13653
13674
  }
13654
- async function linkReleaseSeat(route2, client2, agentsModel, userAgent, readOnly) {
13675
+ async function linkReleaseSeat(route2, client2, agentsModel, userAgent, readOnly2) {
13655
13676
  const seatId = route2.resolved.releaseSeat;
13656
13677
  if (!seatId) return {};
13657
13678
  const rows = await client2.records.list(agentsModel.id, { limit: 200 });
13658
13679
  let agentId = rows.find((r) => r.name === RELEASE_AGENT_NAME)?.id;
13659
13680
  if (!agentId) {
13660
- 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\`` };
13661
13682
  try {
13662
13683
  agentId = (await client2.records.create(agentsModel.id, {
13663
13684
  name: RELEASE_AGENT_NAME,
@@ -13696,11 +13717,11 @@ var NO_WRITE_NOTE = "this key has no write access to the Agents table";
13696
13717
  var CREW_FIELD_MISSING_NOTE = "Crew table has no Agent field yet \u2014 a workspace admin's `crew agents sync` adds it";
13697
13718
  var CrewAgentFieldMissing = class extends Error {
13698
13719
  };
13699
- async function linkCrewSeats(route2, client2, agentsModelId, agentPersonas, userAgent, readOnly) {
13720
+ async function linkCrewSeats(route2, client2, agentsModelId, agentPersonas, userAgent, readOnly2) {
13700
13721
  const seats2 = route2.resolved.seats;
13701
13722
  const rolesWithSeats = ROLE_NAMES.filter((role) => seats2[role] && agentPersonas[role]);
13702
13723
  if (rolesWithSeats.length === 0) {
13703
- 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" }));
13704
13725
  return ROLE_NAMES.map((role) => ({ role, action: seats2[role] ? "persona_diverged" : "no_seat" }));
13705
13726
  }
13706
13727
  const crewModelId = route2.resolved.models.crew;
@@ -13723,7 +13744,7 @@ async function linkCrewSeats(route2, client2, agentsModelId, agentPersonas, user
13723
13744
  continue;
13724
13745
  }
13725
13746
  if (!agentId) {
13726
- outcomes.push({ role, action: readOnly ? "no_agents_row" : "persona_diverged" });
13747
+ outcomes.push({ role, action: readOnly2 ? "no_agents_row" : "persona_diverged" });
13727
13748
  continue;
13728
13749
  }
13729
13750
  const seatRow = await getSeatRow(client2, crewModelId, seatId);
@@ -27694,14 +27715,14 @@ async function runAgentsSync(target, o) {
27694
27715
  const dryRun = o.dryRun ?? false;
27695
27716
  const force = o.force ?? false;
27696
27717
  const keyRole = target.resolved?.role ?? await fetchKeyRole(target, o.userAgent);
27697
- let readOnly = !isAdminRole(keyRole);
27718
+ let readOnly2 = !isAdminRole(keyRole);
27698
27719
  const runPersonas = (ro) => syncPersonas(target, { userAgent: o.userAgent, dryRun, force, readOnly: ro });
27699
27720
  let personaResult;
27700
27721
  try {
27701
- personaResult = await runPersonas(readOnly);
27722
+ personaResult = await runPersonas(readOnly2);
27702
27723
  } catch (e) {
27703
- if (readOnly || !isForbidden(e)) throw e;
27704
- readOnly = true;
27724
+ if (readOnly2 || !isForbidden(e)) throw e;
27725
+ readOnly2 = true;
27705
27726
  personaResult = await runPersonas(true);
27706
27727
  }
27707
27728
  o.say(`route: ${target.route}`);
@@ -27712,18 +27733,18 @@ async function runAgentsSync(target, o) {
27712
27733
  const briefs = Object.fromEntries(ROLE_NAMES.map((r) => [r, personaDefaultPrompt(target.promptsDir, r)]));
27713
27734
  for (const w of skillMarkerWarnings(target.promptsDir, briefs)) o.warn(`warning: ${w}`);
27714
27735
  let skillResult;
27715
- if (!readOnly) {
27736
+ if (!readOnly2) {
27716
27737
  try {
27717
27738
  skillResult = await syncSkills(target, { userAgent: o.userAgent, dryRun, force });
27718
27739
  } catch (e) {
27719
- if (isForbidden(e)) readOnly = true;
27740
+ if (isForbidden(e)) readOnly2 = true;
27720
27741
  else throw e;
27721
27742
  }
27722
27743
  }
27723
27744
  for (const l of summarizeOutcomes(skillResult?.outcomes ?? [], describeSkillSyncOutcome, (s) => s.action === "unchanged", "skill", o.verbose ?? false)) o.say(l);
27724
27745
  for (const w of skillResult?.warnings ?? []) o.warn(`warning: ${w}`);
27725
27746
  const avatarFailures2 = {};
27726
- if (!readOnly && !dryRun) {
27747
+ if (!readOnly2 && !dryRun) {
27727
27748
  for (const a of await syncPersonaAvatars(target, personaResult.agentPersonas, { userAgent: o.userAgent })) {
27728
27749
  const line = describeAvatarOutcome(a, PERSONA_NAME[a.role]);
27729
27750
  if (a.status === "failed") {
@@ -27737,7 +27758,7 @@ async function runAgentsSync(target, o) {
27737
27758
  const raw = existsSync53(resolvedPath) ? JSON.parse(readFileSync51(resolvedPath, "utf8")) : {};
27738
27759
  raw.agentPersonas = personaResult.agentPersonas;
27739
27760
  if (skillResult) raw.agentSkills = skillResult.agentSkills;
27740
- if (!readOnly) raw.avatarSyncFailures = avatarFailures2;
27761
+ if (!readOnly2) raw.avatarSyncFailures = avatarFailures2;
27741
27762
  if (personaResult.releaseAgentId) raw.releaseAgentId = personaResult.releaseAgentId;
27742
27763
  mkdirSync39(dirname32(resolvedPath), { recursive: true });
27743
27764
  writeFileSync41(resolvedPath, `${JSON.stringify(raw, null, 2)}
@@ -27747,11 +27768,11 @@ async function runAgentsSync(target, o) {
27747
27768
  if (personaResult.releaseAgentId) target.resolved.releaseAgentId = personaResult.releaseAgentId;
27748
27769
  }
27749
27770
  }
27750
- if (readOnly) {
27771
+ if (readOnly2) {
27751
27772
  o.say("personas and skills: not synced (this key is not a workspace admin; the workspace's rows are used as they are)");
27752
27773
  }
27753
27774
  const diverged = personaResult.outcomes.some((p) => p.action === "diverged") || (skillResult?.outcomes.some((s) => s.action === "diverged") ?? false);
27754
- return { personaResult, skillResult, readOnly, diverged };
27775
+ return { personaResult, skillResult, readOnly: readOnly2, diverged };
27755
27776
  }
27756
27777
 
27757
27778
  // src/logbook.ts
@@ -29148,7 +29169,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
29148
29169
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
29149
29170
  import { join as join60 } from "path";
29150
29171
  function builtVersion() {
29151
- return true ? "0.161.0" : null;
29172
+ return true ? "0.163.0" : null;
29152
29173
  }
29153
29174
  var REBUILD_HINT = "rebuild with npm run build";
29154
29175
  function newestMtime(path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.161.0",
3
+ "version": "0.163.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",