@tablation/crew 0.157.0 → 0.157.2
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/README.md +2 -2
- package/dist/cli.js +188 -49
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ and reports back on the board.
|
|
|
10
10
|
|
|
11
11
|
Each **seat** is a row in the board's Crew table that happens to be a robot,
|
|
12
12
|
with a brief (`prompts/<promptSet>/`, see "Prompt sets" below) and a slice
|
|
13
|
-
of the queue. A seat is
|
|
14
|
-
queue digest and in the comments it writes on tickets. Everything the crew
|
|
13
|
+
of the queue. A seat is linked to its Agents row and is found by that link, not its name; it
|
|
14
|
+
answers to the name in that table, in the queue digest and in the comments it writes on tickets. Everything the crew
|
|
15
15
|
knows about a run — what to build, what is blocked, what has shipped — is
|
|
16
16
|
table data, and every step it takes is visible as a status change or a
|
|
17
17
|
comment on the ticket. There is no hidden state and no queue but the board.
|
package/dist/cli.js
CHANGED
|
@@ -4454,6 +4454,18 @@ function readResolvedFile(stateDir, route2) {
|
|
|
4454
4454
|
throw new ConfigError(`${path}: not valid JSON \u2014 ${e.message}`);
|
|
4455
4455
|
}
|
|
4456
4456
|
}
|
|
4457
|
+
function readStoredSeats(stateDir, route2) {
|
|
4458
|
+
let raw;
|
|
4459
|
+
try {
|
|
4460
|
+
raw = readResolvedFile(stateDir, route2);
|
|
4461
|
+
} catch {
|
|
4462
|
+
return void 0;
|
|
4463
|
+
}
|
|
4464
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
4465
|
+
const seats2 = {};
|
|
4466
|
+
for (const role of ROLE_NAMES) if (typeof raw.seats?.[role] === "string" && raw.seats[role]) seats2[role] = raw.seats[role];
|
|
4467
|
+
return { seats: seats2, ...typeof raw.releaseSeat === "string" && raw.releaseSeat ? { releaseSeat: raw.releaseSeat } : {} };
|
|
4468
|
+
}
|
|
4457
4469
|
function parseResolved(raw, m, where) {
|
|
4458
4470
|
if (!raw) return void 0;
|
|
4459
4471
|
const seats2 = {};
|
|
@@ -7136,7 +7148,7 @@ function visibleAttention(items, dockerFindingPresent) {
|
|
|
7136
7148
|
function attentionProblems(items, already) {
|
|
7137
7149
|
const seen = new Set(already.filter((p) => p.kind === "hook_missing").map((p) => `hook_missing:${p.route}/${p.repo}/${p.hook}`));
|
|
7138
7150
|
if (already.some((p) => p.kind === "docker_daemon_down")) seen.add(DOCKER_DAEMON_KEY);
|
|
7139
|
-
return items.filter((i) => !seen.has(i.key)).map((i) => ({ severity: "attention", kind: i.kind, message: i.message }));
|
|
7151
|
+
return items.filter((i) => !seen.has(i.key) && i.kind !== "seat_missing").map((i) => ({ severity: "attention", kind: i.kind, message: i.message }));
|
|
7140
7152
|
}
|
|
7141
7153
|
var NO_PROJECTS_REMEDY = "run `crew projects add NAME --prefix PREFIX` (or add a row to the Projects table)";
|
|
7142
7154
|
function noProjectsFinding(route2, projectCount) {
|
|
@@ -9217,7 +9229,7 @@ import { basename as basename7 } from "path";
|
|
|
9217
9229
|
|
|
9218
9230
|
// src/tracker.ts
|
|
9219
9231
|
import { hostname } from "os";
|
|
9220
|
-
import { TablationClient } from "@tablation/client";
|
|
9232
|
+
import { TablationApiError, TablationClient } from "@tablation/client";
|
|
9221
9233
|
|
|
9222
9234
|
// src/work-mode.ts
|
|
9223
9235
|
function projectWorkModes(rows, contract) {
|
|
@@ -9516,6 +9528,15 @@ var Tracker = class {
|
|
|
9516
9528
|
async comments(limit = 500) {
|
|
9517
9529
|
return this.client.records.list(this.models.comments, { limit });
|
|
9518
9530
|
}
|
|
9531
|
+
/** One Crew row, or null when the tracker answers 404 (CREW-3449). Any other failure throws. */
|
|
9532
|
+
async crewRow(id) {
|
|
9533
|
+
try {
|
|
9534
|
+
return await this.client.records.get(this.models.crew, id);
|
|
9535
|
+
} catch (e) {
|
|
9536
|
+
if (e instanceof TablationApiError && e.status === 404) return null;
|
|
9537
|
+
throw e;
|
|
9538
|
+
}
|
|
9539
|
+
}
|
|
9519
9540
|
async crewRows() {
|
|
9520
9541
|
return this.client.records.list(this.models.crew, { limit: 200 });
|
|
9521
9542
|
}
|
|
@@ -12854,7 +12875,7 @@ function expandSkillMarkers(text2, lookup2, opts = {}) {
|
|
|
12854
12875
|
import { readFileSync as readFileSync30, readdirSync as readdirSync9, existsSync as existsSync28 } from "fs";
|
|
12855
12876
|
import { join as join32 } from "path";
|
|
12856
12877
|
import { parse as parseYaml2 } from "yaml";
|
|
12857
|
-
import { TablationClient as TablationClient3, StaleWriteError as StaleWriteError3, TablationApiError as
|
|
12878
|
+
import { TablationClient as TablationClient3, StaleWriteError as StaleWriteError3, TablationApiError as TablationApiError3 } from "@tablation/client";
|
|
12858
12879
|
|
|
12859
12880
|
// src/prompt-additions.ts
|
|
12860
12881
|
var PROMPT_ADDITIONS_SEPARATOR = "---\n\nAdditional instructions from this workspace. Where they conflict with anything above, these take precedence.";
|
|
@@ -12886,7 +12907,7 @@ function readPersonaFile(path) {
|
|
|
12886
12907
|
// src/agents.ts
|
|
12887
12908
|
import { readFileSync as readFileSync29, existsSync as existsSync27 } from "fs";
|
|
12888
12909
|
import { join as join31 } from "path";
|
|
12889
|
-
import { TablationClient as TablationClient2, StaleWriteError as StaleWriteError2, TablationApiError } from "@tablation/client";
|
|
12910
|
+
import { TablationClient as TablationClient2, StaleWriteError as StaleWriteError2, TablationApiError as TablationApiError2 } from "@tablation/client";
|
|
12890
12911
|
var PERSONA_NAME = {
|
|
12891
12912
|
dev: "Developer",
|
|
12892
12913
|
design: "Design",
|
|
@@ -13038,7 +13059,7 @@ async function fetchKeyRole(route2, userAgent) {
|
|
|
13038
13059
|
}
|
|
13039
13060
|
}
|
|
13040
13061
|
function isForbidden(e) {
|
|
13041
|
-
return e instanceof
|
|
13062
|
+
return e instanceof TablationApiError2 && e.status === 403;
|
|
13042
13063
|
}
|
|
13043
13064
|
function promptSourceFields(model, prompt) {
|
|
13044
13065
|
return model.fields?.some((f) => f.columnName === "prompt_baseline") ? { prompt_source: "crew", prompt_baseline: prompt } : {};
|
|
@@ -13050,7 +13071,7 @@ function needsBaselineBackfill(model, row) {
|
|
|
13050
13071
|
return hasPromptBaselineColumn(model) && row.prompt_customized !== true && (typeof row.prompt_baseline !== "string" || !row.prompt_source);
|
|
13051
13072
|
}
|
|
13052
13073
|
function isPromptGateRejection(e) {
|
|
13053
|
-
return e instanceof
|
|
13074
|
+
return e instanceof TablationApiError2 && e.status === 422;
|
|
13054
13075
|
}
|
|
13055
13076
|
var RELEASE_AGENT_NAME = "Release agent";
|
|
13056
13077
|
var RELEASE_AGENT_PROMPT = "Principal for the crew release phase (merge, deploy, release comments). It runs no model; this row only gives those tracker writes an agent identity.";
|
|
@@ -13068,7 +13089,7 @@ async function syncPersonas(route2, opts) {
|
|
|
13068
13089
|
try {
|
|
13069
13090
|
agentsModel = await client2.dataModels.get("agents", workspaceId);
|
|
13070
13091
|
} catch (e) {
|
|
13071
|
-
if (e instanceof
|
|
13092
|
+
if (e instanceof TablationApiError2 && e.status === 404) {
|
|
13072
13093
|
throw new AgentsSyncError(
|
|
13073
13094
|
`workspace ${workspaceId} has no Agents table yet \u2014 every workspace auto-provisions one (ISSUE-465); an older workspace may still need its one-time backfill`
|
|
13074
13095
|
);
|
|
@@ -13265,7 +13286,7 @@ async function getSeatRow(client2, crewModelId, seatId) {
|
|
|
13265
13286
|
try {
|
|
13266
13287
|
return await client2.records.get(crewModelId, seatId);
|
|
13267
13288
|
} catch (e) {
|
|
13268
|
-
if (e instanceof
|
|
13289
|
+
if (e instanceof TablationApiError2 && e.status === 404) return null;
|
|
13269
13290
|
throw e;
|
|
13270
13291
|
}
|
|
13271
13292
|
}
|
|
@@ -13445,7 +13466,7 @@ async function syncSkills(route2, opts) {
|
|
|
13445
13466
|
try {
|
|
13446
13467
|
skillsModel = await client2.dataModels.get("agent_skills", workspaceId);
|
|
13447
13468
|
} catch (e) {
|
|
13448
|
-
if (e instanceof
|
|
13469
|
+
if (e instanceof TablationApiError3 && e.status === 404) {
|
|
13449
13470
|
throw new SkillSyncError(
|
|
13450
13471
|
`workspace ${workspaceId} has no Agent Skills table yet \u2014 every workspace auto-provisions one; an older workspace may still need its one-time backfill`
|
|
13451
13472
|
);
|
|
@@ -13487,7 +13508,7 @@ async function syncSkills(route2, opts) {
|
|
|
13487
13508
|
const agentsModel = await client2.dataModels.get("agents", workspaceId);
|
|
13488
13509
|
agentRows = await client2.records.list(agentsModel.id, { limit: 200 });
|
|
13489
13510
|
} catch (e) {
|
|
13490
|
-
if (!(e instanceof
|
|
13511
|
+
if (!(e instanceof TablationApiError3)) throw e;
|
|
13491
13512
|
agentRows = [];
|
|
13492
13513
|
}
|
|
13493
13514
|
}
|
|
@@ -18315,7 +18336,7 @@ function realPoolMemberDeps(o) {
|
|
|
18315
18336
|
}
|
|
18316
18337
|
|
|
18317
18338
|
// src/crew-floor.ts
|
|
18318
|
-
import { TablationApiError as
|
|
18339
|
+
import { TablationApiError as TablationApiError4 } from "@tablation/client";
|
|
18319
18340
|
var CREW_OUTDATED_KEY = "crew_outdated";
|
|
18320
18341
|
function parseVersion(v) {
|
|
18321
18342
|
const m = /^v?(\d+)\.(\d+)\.(\d+)/.exec(v.trim());
|
|
@@ -18375,7 +18396,7 @@ function openOutdated(state) {
|
|
|
18375
18396
|
return state.shipAttention().previous().find((i) => i.key === CREW_OUTDATED_KEY)?.message ?? null;
|
|
18376
18397
|
}
|
|
18377
18398
|
function isUpgradeRequired(err3) {
|
|
18378
|
-
return err3 instanceof
|
|
18399
|
+
return err3 instanceof TablationApiError4 && err3.status === 426;
|
|
18379
18400
|
}
|
|
18380
18401
|
async function raiseFromUpgradeRequired(o, err3) {
|
|
18381
18402
|
const have = sentVersion(o.ship) ?? "unknown";
|
|
@@ -23455,6 +23476,60 @@ function explainRefusal(readable, unreadable) {
|
|
|
23455
23476
|
return parts.join(", ");
|
|
23456
23477
|
}
|
|
23457
23478
|
|
|
23479
|
+
// src/seat-missing.ts
|
|
23480
|
+
import { TablationApiError as TablationApiError5 } from "@tablation/client";
|
|
23481
|
+
var SEAT_MISSING_REMEDY = "run `crew connect` to pick a seat";
|
|
23482
|
+
async function probeSeats(route2, read) {
|
|
23483
|
+
const r = route2.resolved;
|
|
23484
|
+
if (!r) return [];
|
|
23485
|
+
const wanted = [];
|
|
23486
|
+
for (const role of ROLE_NAMES) if (r.seats[role]) wanted.push({ role, seatId: r.seats[role] });
|
|
23487
|
+
if (r.releaseSeat) wanted.push({ role: "release", seatId: r.releaseSeat });
|
|
23488
|
+
const byId = /* @__PURE__ */ new Map();
|
|
23489
|
+
const probeOne = async (id) => {
|
|
23490
|
+
try {
|
|
23491
|
+
return { state: await read(id) === null ? "missing" : "present" };
|
|
23492
|
+
} catch (e) {
|
|
23493
|
+
if (e instanceof TablationApiError5 && e.status === 404) return { state: "missing" };
|
|
23494
|
+
return { state: "unknown", detail: e.message };
|
|
23495
|
+
}
|
|
23496
|
+
};
|
|
23497
|
+
for (const w of wanted) if (!byId.has(w.seatId)) byId.set(w.seatId, probeOne(w.seatId));
|
|
23498
|
+
return Promise.all(wanted.map(async (w) => ({ ...w, ...await byId.get(w.seatId) })));
|
|
23499
|
+
}
|
|
23500
|
+
var seatMissingKey = (route2, role) => `seat_missing:${route2}:${role}`;
|
|
23501
|
+
function seatMissingMessage(route2, role) {
|
|
23502
|
+
return `${route2}: the ${role} seat's Crew row no longer exists, so that role is skipped \u2014 ${SEAT_MISSING_REMEDY}. Clears automatically once the seat resolves`;
|
|
23503
|
+
}
|
|
23504
|
+
function seatMissingItem(route2, role, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
23505
|
+
return { kind: "seat_missing", key: seatMissingKey(route2, role), since: nowIso, message: seatMissingMessage(route2, role) };
|
|
23506
|
+
}
|
|
23507
|
+
async function reconcileSeatAttention(route2, probes, io) {
|
|
23508
|
+
const slug2 = routeSlug(route2.route);
|
|
23509
|
+
for (const p of probes) {
|
|
23510
|
+
if (p.state === "missing") await io.raise(seatMissingItem(slug2, p.role));
|
|
23511
|
+
else if (p.state === "present") io.clear(seatMissingKey(slug2, p.role));
|
|
23512
|
+
}
|
|
23513
|
+
}
|
|
23514
|
+
var missingRoles = (probes) => probes.filter((p) => p.state === "missing").map((p) => p.role);
|
|
23515
|
+
function mergeSeatAttention(open, route2, probes, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
23516
|
+
const slug2 = routeSlug(route2.route);
|
|
23517
|
+
const settled = new Map(probes.filter((p) => p.state !== "unknown").map((p) => [seatMissingKey(slug2, p.role), p.state]));
|
|
23518
|
+
const kept = open.filter((i) => i.kind !== "seat_missing" || !settled.has(i.key) || settled.get(i.key) === "missing");
|
|
23519
|
+
const have = new Set(kept.map((i) => i.key));
|
|
23520
|
+
const added = probes.filter((p) => p.state === "missing" && !have.has(seatMissingKey(slug2, p.role))).map((p) => seatMissingItem(slug2, p.role, nowIso));
|
|
23521
|
+
return [...kept, ...added];
|
|
23522
|
+
}
|
|
23523
|
+
function seatMissingProblems(route2, probes) {
|
|
23524
|
+
return probes.filter((p) => p.state === "missing").map((p) => ({
|
|
23525
|
+
severity: "blocker",
|
|
23526
|
+
kind: "seat_missing",
|
|
23527
|
+
route: route2.route,
|
|
23528
|
+
message: `route ${route2.route}: the ${p.role} seat's Crew row (${p.seatId}) no longer exists, so that role is skipped`,
|
|
23529
|
+
remedy: SEAT_MISSING_REMEDY
|
|
23530
|
+
}));
|
|
23531
|
+
}
|
|
23532
|
+
|
|
23458
23533
|
// src/ssh-keys.ts
|
|
23459
23534
|
import { execFileSync as execFileSync13 } from "child_process";
|
|
23460
23535
|
import { existsSync as existsSync46, mkdirSync as mkdirSync34, readFileSync as readFileSync44, chmodSync as chmodSync3 } from "fs";
|
|
@@ -24267,9 +24342,29 @@ async function runOnePassUnguarded(o) {
|
|
|
24267
24342
|
const { ctx } = await prepareRoutePass(o);
|
|
24268
24343
|
const decision = await (o.decide ?? decideCycle)(ctx);
|
|
24269
24344
|
await applyRouteDecision(o, ctx, decision);
|
|
24270
|
-
const
|
|
24345
|
+
const pending = await dropRolesWithMissingSeat(o, ctx, decision.selection.pending);
|
|
24346
|
+
const { started, skipped } = await fillSlots(o, [{ ctx, decision, roles: pending }]);
|
|
24271
24347
|
await publishShipAttention(o.state, o.route, o.ship);
|
|
24272
|
-
return { pending
|
|
24348
|
+
return { pending, started, skipped };
|
|
24349
|
+
}
|
|
24350
|
+
async function dropRolesWithMissingSeat(o, ctx, pending) {
|
|
24351
|
+
if (!o.route.resolved) return pending;
|
|
24352
|
+
try {
|
|
24353
|
+
const tracker = new Tracker(o.route, o.ship);
|
|
24354
|
+
const probes = await probeSeats(o.route, (id) => tracker.crewRow(id));
|
|
24355
|
+
await reconcileSeatAttention(o.route, probes, {
|
|
24356
|
+
raise: (item) => raiseShipAttention({ state: o.state, emit: ctx.emit, route: o.route, ship: o.ship }, item),
|
|
24357
|
+
clear: (key) => clearShipAttention(o.state, key)
|
|
24358
|
+
});
|
|
24359
|
+
const missing = new Set(missingRoles(probes));
|
|
24360
|
+
for (const role of missing) {
|
|
24361
|
+
ctx.emit.warn(`${role} skipped this cycle: its configured seat's Crew row no longer exists (${SEAT_MISSING_REMEDY})`, { step: "select", role: role === "release" ? void 0 : role });
|
|
24362
|
+
}
|
|
24363
|
+
return pending.filter((r) => !missing.has(r));
|
|
24364
|
+
} catch (e) {
|
|
24365
|
+
ctx.emit.warn(`could not check the configured seats: ${e.message}`, { step: "select" });
|
|
24366
|
+
return pending;
|
|
24367
|
+
}
|
|
24273
24368
|
}
|
|
24274
24369
|
async function prepareRoutePass(o) {
|
|
24275
24370
|
await hydrateApiKeys([o.route], o.getSessionStore);
|
|
@@ -26187,12 +26282,13 @@ async function listWorkspaces(o) {
|
|
|
26187
26282
|
return res.workspaces.map((w) => ({ slug: w.path ?? w.slug, name: w.name, role: w.role }));
|
|
26188
26283
|
}
|
|
26189
26284
|
var eq = (a, b) => (a ?? "").trim().toLowerCase() === b.trim().toLowerCase();
|
|
26190
|
-
function
|
|
26191
|
-
const linked = agentId ? rows.
|
|
26192
|
-
if (linked)
|
|
26193
|
-
|
|
26194
|
-
|
|
26195
|
-
|
|
26285
|
+
function pickSeat(rows, agentId, storedId) {
|
|
26286
|
+
const linked = agentId ? rows.filter((x) => x.agent_id === agentId) : [];
|
|
26287
|
+
if (storedId && linked.some((x) => x.id === storedId)) return { id: storedId, via: "agent" };
|
|
26288
|
+
if (linked.length === 1) return { id: linked[0].id, via: "agent" };
|
|
26289
|
+
if (linked.length > 1) return { ambiguous: linked };
|
|
26290
|
+
const kept = storedId ? rows.find((x) => x.id === storedId && (!agentId || !x.agent_id)) : void 0;
|
|
26291
|
+
return kept ? { id: kept.id, via: "stored" } : {};
|
|
26196
26292
|
}
|
|
26197
26293
|
var REQUIRED_TABLES = ["Issues"];
|
|
26198
26294
|
async function missingTables(o, projectId) {
|
|
@@ -26212,7 +26308,8 @@ async function discover(o) {
|
|
|
26212
26308
|
holds: [],
|
|
26213
26309
|
candidates: [],
|
|
26214
26310
|
problems,
|
|
26215
|
-
provisioning
|
|
26311
|
+
provisioning,
|
|
26312
|
+
notes: []
|
|
26216
26313
|
};
|
|
26217
26314
|
try {
|
|
26218
26315
|
const me = await get(o, `/auth/me?workspaceId=${ws.id}`);
|
|
@@ -26469,7 +26566,8 @@ async function discover(o) {
|
|
|
26469
26566
|
}
|
|
26470
26567
|
}
|
|
26471
26568
|
let agentIdFor = () => void 0;
|
|
26472
|
-
|
|
26569
|
+
let agentsGap = () => "the Agents table could not be read with this key";
|
|
26570
|
+
if (out.models.crew) {
|
|
26473
26571
|
try {
|
|
26474
26572
|
const agentsModel = await get(o, `/data-models/agents?workspaceId=${ws.id}`);
|
|
26475
26573
|
const agentRows = await get(
|
|
@@ -26477,6 +26575,7 @@ async function discover(o) {
|
|
|
26477
26575
|
`/data-models/${agentsModel.id}/records?limit=200`
|
|
26478
26576
|
);
|
|
26479
26577
|
agentIdFor = (role) => agentRows.find((r) => r.name === PERSONA_NAME[role])?.id;
|
|
26578
|
+
agentsGap = (role) => `the Agents table has no "${PERSONA_NAME[role]}" row`;
|
|
26480
26579
|
} catch {
|
|
26481
26580
|
}
|
|
26482
26581
|
}
|
|
@@ -26500,46 +26599,64 @@ async function discover(o) {
|
|
|
26500
26599
|
}
|
|
26501
26600
|
const scoped = seatShipId ? rows.filter((r) => r.ship_id === seatShipId) : rows.filter((r) => !r.ship_id);
|
|
26502
26601
|
const unclaimed = seatShipId ? rows.filter((r) => !r.ship_id) : [];
|
|
26602
|
+
const stored = o.storedSeats?.(`${out.workspaceSlug}/${out.projectSlug ?? out.projectId}`);
|
|
26603
|
+
const listRows = (rs) => rs.map((r) => `"${r.name ?? ""}" (${r.id})`).join(", ");
|
|
26503
26604
|
for (const role of ["dev", "design", "qa", "triage"]) {
|
|
26504
|
-
const
|
|
26505
|
-
let
|
|
26605
|
+
const agentId = agentIdFor(role);
|
|
26606
|
+
let pick = pickSeat(scoped, agentId, stored?.seats?.[role]);
|
|
26607
|
+
let id = pick.id;
|
|
26506
26608
|
let seatAction = "matched";
|
|
26507
|
-
if (!id &&
|
|
26508
|
-
const
|
|
26509
|
-
if (
|
|
26510
|
-
|
|
26609
|
+
if (!id && !pick.ambiguous && agentId && seatShipId) {
|
|
26610
|
+
const legacy = pickSeat(unclaimed, agentId);
|
|
26611
|
+
if (legacy.ambiguous) pick = legacy;
|
|
26612
|
+
else if (legacy.id) {
|
|
26613
|
+
id = legacy.id;
|
|
26511
26614
|
seatAction = "claimed";
|
|
26615
|
+
if (shipRowId) {
|
|
26616
|
+
await patch(o, `/data-models/${out.models.crew}/records/${id}`, { ship_id: shipRowId });
|
|
26617
|
+
provisioning.push(`claimed existing Crew row for the ${role} seat`);
|
|
26618
|
+
}
|
|
26512
26619
|
}
|
|
26513
|
-
}
|
|
26514
|
-
|
|
26515
|
-
|
|
26516
|
-
|
|
26517
|
-
|
|
26518
|
-
|
|
26519
|
-
|
|
26520
|
-
} else {
|
|
26620
|
+
}
|
|
26621
|
+
if (pick.ambiguous) {
|
|
26622
|
+
problems.push(`${pick.ambiguous.length} Crew rows on this ship are linked to the ${PERSONA_NAME[role]} agent, so the ${role} seat is ambiguous: ${listRows(pick.ambiguous)} \u2014 unlink all but one`);
|
|
26623
|
+
continue;
|
|
26624
|
+
}
|
|
26625
|
+
if (!id && agentId) {
|
|
26626
|
+
if (shipRowId) {
|
|
26521
26627
|
const created = await post2(o, `/data-models/${out.models.crew}/records`, {
|
|
26522
26628
|
name: `${PERSONA_NAME[role]} agent`,
|
|
26523
26629
|
ship_id: shipRowId,
|
|
26524
|
-
|
|
26630
|
+
agent_id: agentId
|
|
26525
26631
|
});
|
|
26526
26632
|
id = created.id;
|
|
26527
26633
|
seatAction = "created";
|
|
26528
26634
|
provisioning.push(`created Crew row for the ${role} seat`);
|
|
26635
|
+
} else if (o.dryRun && out.shipsModelId) {
|
|
26636
|
+
(out.seatRows ??= []).push({ role, id: "", action: "would-create" });
|
|
26637
|
+
continue;
|
|
26529
26638
|
}
|
|
26530
26639
|
}
|
|
26531
26640
|
if (id) {
|
|
26532
26641
|
out.seats[role] = id;
|
|
26533
26642
|
const rowShip = rows.find((r) => r.id === id)?.ship_id ?? shipRowId ?? void 0;
|
|
26534
26643
|
(out.seatRows ??= []).push({ role, id, action: seatAction, ...rowShip ? { shipId: rowShip } : {} });
|
|
26535
|
-
|
|
26536
|
-
|
|
26537
|
-
|
|
26644
|
+
if (pick.via === "stored") (out.notes ??= []).push(`${role} seat kept by its stored id; it is not linked to its Agent \u2014 run \`crew agents sync\` to link it`);
|
|
26645
|
+
} else if (!agentId) {
|
|
26646
|
+
problems.push(`${role} seat: ${agentsGap(role)}, so no Crew row can be matched or created for it (seats are never matched by name) \u2014 run \`crew agents sync\`, then connect again`);
|
|
26647
|
+
} else problems.push(`no Crew row on this ship is linked to the ${PERSONA_NAME[role]} agent for the ${role} seat \u2014 link one, or omit that role`);
|
|
26648
|
+
}
|
|
26649
|
+
const pairAgent = agentIdFor("pair");
|
|
26650
|
+
let pairPick = pickSeat(scoped, pairAgent, stored?.seats?.pair);
|
|
26651
|
+
if (!pairPick.id && !pairPick.ambiguous && pairAgent && seatShipId) pairPick = pickSeat(unclaimed, pairAgent);
|
|
26652
|
+
if (pairPick.ambiguous) {
|
|
26653
|
+
problems.push(`${pairPick.ambiguous.length} Crew rows are linked to the Pair agent, so the pair seat is ambiguous: ${listRows(pairPick.ambiguous)} \u2014 unlink all but one`);
|
|
26654
|
+
} else if (pairPick.id) {
|
|
26655
|
+
out.seats.pair = pairPick.id;
|
|
26656
|
+
if (pairPick.via === "stored") (out.notes ??= []).push("pair seat kept by its stored id; it is not linked to its Agent \u2014 run `crew agents sync` to link it");
|
|
26538
26657
|
}
|
|
26539
|
-
const pairId = seatFor(scoped, "pair") || (seatShipId ? seatFor(unclaimed, "pair") : void 0);
|
|
26540
|
-
if (pairId) out.seats.pair = pairId;
|
|
26541
26658
|
if (shipRowId) {
|
|
26542
|
-
const releaseId =
|
|
26659
|
+
const releaseId = stored?.releaseSeat && scoped.some((r) => r.id === stored.releaseSeat) ? stored.releaseSeat : void 0;
|
|
26543
26660
|
if (releaseId) out.releaseSeat = releaseId;
|
|
26544
26661
|
else {
|
|
26545
26662
|
const created = await post2(o, `/data-models/${out.models.crew}/records`, {
|
|
@@ -28249,7 +28366,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
28249
28366
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
28250
28367
|
import { join as join60 } from "path";
|
|
28251
28368
|
function builtVersion() {
|
|
28252
|
-
return true ? "0.157.
|
|
28369
|
+
return true ? "0.157.2" : null;
|
|
28253
28370
|
}
|
|
28254
28371
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
28255
28372
|
function newestMtime(path) {
|
|
@@ -34083,7 +34200,7 @@ Waiting for approval`
|
|
|
34083
34200
|
lastSyncedName: (r) => readSyncedName(resolvedPathFor(cfg.ship.stateDir, r))
|
|
34084
34201
|
};
|
|
34085
34202
|
const runConnect = async (ws, proj) => {
|
|
34086
|
-
let found = await discover({ ...authOpts, workspace: ws, project: proj, area: value("area"), ship, dryRun, interactive: canAsk || connectEvents.json });
|
|
34203
|
+
let found = await discover({ ...authOpts, workspace: ws, project: proj, area: value("area"), ship, dryRun, interactive: canAsk || connectEvents.json, storedSeats: (r) => readStoredSeats(cfg.ship.stateDir, r) });
|
|
34087
34204
|
if (store && keychainBacked && sessionAddress && sessionAddress !== found.workspaceSlug) {
|
|
34088
34205
|
if (await adoptSessionAddress({
|
|
34089
34206
|
store,
|
|
@@ -34132,7 +34249,7 @@ Waiting for approval`
|
|
|
34132
34249
|
const installedSlug = await offerTemplateInstall(authOpts, found.workspaceId, canAsk ? void 0 : true);
|
|
34133
34250
|
if (installedSlug) {
|
|
34134
34251
|
connectEvents.emit("template_installed", `installed project ${installedSlug}`, { projectSlug: installedSlug });
|
|
34135
|
-
found = await discover({ ...authOpts, workspace: ws, project: installedSlug, area: value("area"), ship, dryRun, interactive: canAsk || connectEvents.json });
|
|
34252
|
+
found = await discover({ ...authOpts, workspace: ws, project: installedSlug, area: value("area"), ship, dryRun, interactive: canAsk || connectEvents.json, storedSeats: (r) => readStoredSeats(cfg.ship.stateDir, r) });
|
|
34136
34253
|
}
|
|
34137
34254
|
}
|
|
34138
34255
|
}
|
|
@@ -34427,6 +34544,7 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, t
|
|
|
34427
34544
|
emit.note(`Provisioned for this machine (${ship.name}):`);
|
|
34428
34545
|
for (const p of found.provisioning) emit.note(` - ${p}`);
|
|
34429
34546
|
}
|
|
34547
|
+
for (const n of found.notes ?? []) emit.note(`Note: ${n}`);
|
|
34430
34548
|
if (found.problems.length) {
|
|
34431
34549
|
emit.warn(`Unresolved \u2014 fix these before arming it:
|
|
34432
34550
|
${found.problems.map((p) => ` - ${p}`).join("\n")}`);
|
|
@@ -36110,6 +36228,8 @@ ${where.join("\n")}`);
|
|
|
36110
36228
|
const repos = await resolvedRepos(route2);
|
|
36111
36229
|
const seatIds = route2.resolved?.seats ?? {};
|
|
36112
36230
|
const crewRows = Object.keys(seatIds).length ? await statusTracker.crewRows() : [];
|
|
36231
|
+
const seatProbes = await probeSeats(route2, (id) => statusTracker.crewRow(id));
|
|
36232
|
+
const seatProbeOf = (role) => seatProbes.find((p) => p.role === role);
|
|
36113
36233
|
const crewRowById = new Map(crewRows.map((c) => [c.id, c]));
|
|
36114
36234
|
const agentPersonas = route2.resolved?.agentPersonas ?? {};
|
|
36115
36235
|
const seats2 = ROLE_NAMES.filter((r) => r !== "pair").map((r) => {
|
|
@@ -36121,6 +36241,8 @@ ${where.join("\n")}`);
|
|
|
36121
36241
|
role: r,
|
|
36122
36242
|
label: ROLE_LABEL[r],
|
|
36123
36243
|
crewId: seatId ?? null,
|
|
36244
|
+
// Additive (CREW-3449): true only when the tracker answered 404 for this seat's Crew row.
|
|
36245
|
+
missing: seatProbeOf(r)?.state === "missing",
|
|
36124
36246
|
name: crewRow?.name ?? null,
|
|
36125
36247
|
personaName,
|
|
36126
36248
|
// Additive (CREW-2822): how many runs this seat has live right now.
|
|
@@ -36156,7 +36278,7 @@ ${where.join("\n")}`);
|
|
|
36156
36278
|
eventFile: eventFileFor(cfg.ship.stateDir),
|
|
36157
36279
|
// Additive (CREW-1373): open ship-level items, including the
|
|
36158
36280
|
// derived `release_stale`. `version` stays 1.
|
|
36159
|
-
attention: openShipAttention(state),
|
|
36281
|
+
attention: mergeSeatAttention(openShipAttention(state), route2, seatProbes),
|
|
36160
36282
|
// Additive (CREW-2495): this ship's Ships-row name and whether it has drifted from `name`.
|
|
36161
36283
|
rowName: nameSync.rowName ?? null,
|
|
36162
36284
|
nameDrift: nameSync.drift,
|
|
@@ -36240,7 +36362,7 @@ ${where.join("\n")}`);
|
|
|
36240
36362
|
`);
|
|
36241
36363
|
break;
|
|
36242
36364
|
}
|
|
36243
|
-
const shipAttention = openShipAttention(state);
|
|
36365
|
+
const shipAttention = mergeSeatAttention(openShipAttention(state), route2, await probeSeats(route2, (id) => statusTracker.crewRow(id)));
|
|
36244
36366
|
let heldReleases = [];
|
|
36245
36367
|
let waitViews = [];
|
|
36246
36368
|
let deferredReleases = [];
|
|
@@ -36474,6 +36596,9 @@ ${where.join("\n")}`);
|
|
|
36474
36596
|
if (jsonGit && !jsonGit.ok) {
|
|
36475
36597
|
problems.push({ severity: "blocker", kind: "git_unrunnable", message: `git failed to run: ${jsonGit.detail}`, remedy: "fix the git on the scheduler PATH (on macOS, install the Xcode command line tools), then re-run `crew doctor`" });
|
|
36476
36598
|
}
|
|
36599
|
+
if (!flag("offline") && route2.resolved) {
|
|
36600
|
+
problems.push(...seatMissingProblems(route2, await probeSeats(route2, (id) => new Tracker(route2, cfg.ship).crewRow(id))));
|
|
36601
|
+
}
|
|
36477
36602
|
problems.push(...attentionProblems(openShipAttention(state), problems));
|
|
36478
36603
|
if (problems.some((p) => p.severity === "blocker")) process.exitCode = 1;
|
|
36479
36604
|
process.stdout.write(`${JSON.stringify({ offline: flag("offline"), pushAuth, tools: toolRows, daemon: daemonLiveness, problems, passed }, null, 2)}
|
|
@@ -36992,7 +37117,21 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
|
|
|
36992
37117
|
}
|
|
36993
37118
|
}
|
|
36994
37119
|
}
|
|
36995
|
-
|
|
37120
|
+
if (!flag("offline")) {
|
|
37121
|
+
for (const r of cfg.routes) {
|
|
37122
|
+
if (!r.resolved) continue;
|
|
37123
|
+
try {
|
|
37124
|
+
const tracker2 = new Tracker(r, cfg.ship);
|
|
37125
|
+
for (const p of seatMissingProblems(r, await probeSeats(r, (id) => tracker2.crewRow(id)))) {
|
|
37126
|
+
R.line(`seat: BLOCKER ${p.message} \u2014 ${p.remedy}
|
|
37127
|
+
`);
|
|
37128
|
+
process.exitCode = 1;
|
|
37129
|
+
}
|
|
37130
|
+
} catch {
|
|
37131
|
+
}
|
|
37132
|
+
}
|
|
37133
|
+
}
|
|
37134
|
+
for (const i of visibleAttention(openShipAttention(state), Boolean(dockerFinding)).filter((x) => x.kind !== "seat_missing")) {
|
|
36996
37135
|
R.line(`attention: ${i.kind} \u2014 ${i.message} (since ${i.since})
|
|
36997
37136
|
`);
|
|
36998
37137
|
}
|
package/package.json
CHANGED