@tablation/crew 0.143.2 → 0.143.4
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/dist/cli.js +72 -11
- package/package.json +1 -1
- package/prompts/default/skills/crew-lane-agent.md +3 -1
package/dist/cli.js
CHANGED
|
@@ -976,6 +976,15 @@ var TUNNEL_REJECTED_KEY = "tunnel_rejected";
|
|
|
976
976
|
function tunnelRejectedMessage(workspaceId, quickExits) {
|
|
977
977
|
return `the relay tunnel for workspace ${workspaceId} exited before settling on ${quickExits} consecutive cycles, which is how a refused claim looks (the relay logs "slug already owned by another workspace/ssh key") \u2014 rotate the slug with \`crew rotate-passenger-url\` or check the relay journal. If the relay logged no rejection, a Linux passengers unit without KillMode=process kills the tunnel when the sync exits (CREW-2994): run \`crew install\`, and see \`crew doctor\``;
|
|
978
978
|
}
|
|
979
|
+
function staleTunnelAttentionKeys(openKeys, plannedIds) {
|
|
980
|
+
const prefixes = [`${TUNNEL_REJECTED_KEY}:`, `${RELAY_CONTROL_UNSUPPORTED_KEY}:`];
|
|
981
|
+
return openKeys.filter((key) => {
|
|
982
|
+
const prefix = prefixes.find((p) => key.startsWith(p));
|
|
983
|
+
if (!prefix) return false;
|
|
984
|
+
const id = key.slice(prefix.length);
|
|
985
|
+
return !id.startsWith("periscope:") && !plannedIds.has(id);
|
|
986
|
+
});
|
|
987
|
+
}
|
|
979
988
|
function rejectedTunnels(stateDir) {
|
|
980
989
|
const out = [];
|
|
981
990
|
for (const workspaceId of readAllPersistedWorkspaceIds(stateDir)) {
|
|
@@ -1036,6 +1045,11 @@ function periscopeTunnelRejectedItem(ticket, quickExits, nowIso) {
|
|
|
1036
1045
|
message: `the relay preview tunnel for periscope ${ticket} exited before settling on ${quickExits} consecutive passes; its link does not work. Check that the relay supports the \`preview\` tunnel kind (crew-relay) and that the route key is accepted, or end the periscope.`
|
|
1037
1046
|
};
|
|
1038
1047
|
}
|
|
1048
|
+
function staleTunnelKeys(openKeys, sidecars) {
|
|
1049
|
+
const watched = new Set(sidecars.filter((sc) => sc.slug && !sc.tunnelStopped).map((sc) => periscopeTunnelKey(sc.ticket)));
|
|
1050
|
+
const prefix = `${TUNNEL_REJECTED_KEY}:periscope:`;
|
|
1051
|
+
return openKeys.filter((key) => key.startsWith(prefix) && !watched.has(key));
|
|
1052
|
+
}
|
|
1039
1053
|
async function runPeriscopeTunnelPass(d) {
|
|
1040
1054
|
let respawned = 0;
|
|
1041
1055
|
for (const sc of d.sidecars()) {
|
|
@@ -17976,6 +17990,9 @@ function acceptedBy(t, i) {
|
|
|
17976
17990
|
}
|
|
17977
17991
|
function parkTarget(t, i) {
|
|
17978
17992
|
const person = (m) => m && (m.kind === "hold" || m.kind === "person") ? m : void 0;
|
|
17993
|
+
const heldHere = !!t.held_by_ship_id && t.held_by_ship_id === i.myShipId && !!i.workModes && modeOf(t, i.workModes) === "hybrid";
|
|
17994
|
+
const heldOp = heldHere ? operatorOf(i.roster) : void 0;
|
|
17995
|
+
if (heldOp) return { step: "operator", member: heldOp };
|
|
17979
17996
|
const a = acceptor(t, i);
|
|
17980
17997
|
const unverified = a && !a.member ? a.name : void 0;
|
|
17981
17998
|
const byAcceptor = person(a?.member);
|
|
@@ -22899,6 +22916,7 @@ async function applyRouteDecision(o, ctx, decision) {
|
|
|
22899
22916
|
openKeys: () => openShipAttention(o.state).filter((i) => i.kind === "periscope_idle").map((i) => i.key),
|
|
22900
22917
|
warn: (message) => emit.warn(message, { step: "sweep" })
|
|
22901
22918
|
});
|
|
22919
|
+
for (const key of staleTunnelKeys(openShipAttention(o.state).map((i) => i.key), readPeriscopeSidecars(o.ship.stateDir))) clearShipAttention(o.state, key);
|
|
22902
22920
|
if (o.ship.relayPreviews && o.ship.relayHost) {
|
|
22903
22921
|
const ship = o.ship;
|
|
22904
22922
|
const relayHost = ship.relayHost;
|
|
@@ -24406,13 +24424,32 @@ function renderInbox(items, byConnection = false, subject) {
|
|
|
24406
24424
|
var ConnectHttpError = class extends Error {
|
|
24407
24425
|
status;
|
|
24408
24426
|
path;
|
|
24409
|
-
constructor(status2, path, statusText) {
|
|
24410
|
-
super(`${path}: ${status2} ${statusText}`);
|
|
24427
|
+
constructor(status2, path, statusText, detail) {
|
|
24428
|
+
super(`${path}: ${status2} ${statusText}${detail ? ` \u2014 ${detail}` : ""}`);
|
|
24411
24429
|
this.name = "ConnectHttpError";
|
|
24412
24430
|
this.status = status2;
|
|
24413
24431
|
this.path = path;
|
|
24414
24432
|
}
|
|
24415
24433
|
};
|
|
24434
|
+
async function errorDetail(res) {
|
|
24435
|
+
let text2 = "";
|
|
24436
|
+
try {
|
|
24437
|
+
text2 = (await res.text()).trim();
|
|
24438
|
+
} catch {
|
|
24439
|
+
return "";
|
|
24440
|
+
}
|
|
24441
|
+
if (!text2) return "";
|
|
24442
|
+
try {
|
|
24443
|
+
const m = JSON.parse(text2).message;
|
|
24444
|
+
if (typeof m === "string" && m) return m.slice(0, 300);
|
|
24445
|
+
if (Array.isArray(m) && m.length > 0) return m.map(String).join("; ").slice(0, 300);
|
|
24446
|
+
} catch {
|
|
24447
|
+
}
|
|
24448
|
+
return text2.slice(0, 300);
|
|
24449
|
+
}
|
|
24450
|
+
async function httpError(res, path) {
|
|
24451
|
+
return new ConnectHttpError(res.status, path, res.statusText, await errorDetail(res));
|
|
24452
|
+
}
|
|
24416
24453
|
async function get(o, path) {
|
|
24417
24454
|
const res = await fetch(`${o.baseUrl.replace(/\/+$/, "")}/api${path}`, {
|
|
24418
24455
|
headers: {
|
|
@@ -24421,7 +24458,7 @@ async function get(o, path) {
|
|
|
24421
24458
|
"User-Agent": o.userAgent ?? "Mozilla/5.0 TablationCrewAgent/1.0"
|
|
24422
24459
|
}
|
|
24423
24460
|
});
|
|
24424
|
-
if (!res.ok) throw
|
|
24461
|
+
if (!res.ok) throw await httpError(res, path);
|
|
24425
24462
|
return await res.json();
|
|
24426
24463
|
}
|
|
24427
24464
|
async function post2(o, path, body) {
|
|
@@ -24434,7 +24471,7 @@ async function post2(o, path, body) {
|
|
|
24434
24471
|
},
|
|
24435
24472
|
body: JSON.stringify(body)
|
|
24436
24473
|
});
|
|
24437
|
-
if (!res.ok) throw
|
|
24474
|
+
if (!res.ok) throw await httpError(res, path);
|
|
24438
24475
|
return await res.json();
|
|
24439
24476
|
}
|
|
24440
24477
|
async function patch(o, path, body) {
|
|
@@ -24447,7 +24484,7 @@ async function patch(o, path, body) {
|
|
|
24447
24484
|
},
|
|
24448
24485
|
body: JSON.stringify(body)
|
|
24449
24486
|
});
|
|
24450
|
-
if (!res.ok) throw
|
|
24487
|
+
if (!res.ok) throw await httpError(res, path);
|
|
24451
24488
|
return await res.json();
|
|
24452
24489
|
}
|
|
24453
24490
|
async function del(o, path) {
|
|
@@ -24458,7 +24495,7 @@ async function del(o, path) {
|
|
|
24458
24495
|
"User-Agent": o.userAgent ?? "Mozilla/5.0 TablationCrewAgent/1.0"
|
|
24459
24496
|
}
|
|
24460
24497
|
});
|
|
24461
|
-
if (!res.ok) throw
|
|
24498
|
+
if (!res.ok) throw await httpError(res, path);
|
|
24462
24499
|
}
|
|
24463
24500
|
async function provisionReleaseLocks(o, locksModelId, route2, repoNames) {
|
|
24464
24501
|
const scopes = [...new Set(repoNames)].sort().map((r) => releaseLockScope(route2, r));
|
|
@@ -24688,11 +24725,26 @@ async function discover(o) {
|
|
|
24688
24725
|
const hostPassengers = o.ship.hostPassengers ?? false;
|
|
24689
24726
|
const sshPublicKey = o.ship.sshPublicKey;
|
|
24690
24727
|
let shipColumns = /* @__PURE__ */ new Set();
|
|
24728
|
+
const shipOptions = /* @__PURE__ */ new Map();
|
|
24691
24729
|
try {
|
|
24692
24730
|
const shipsModel = await get(o, `/data-models/${out.shipsModelId}`);
|
|
24693
24731
|
shipColumns = new Set((shipsModel.fields ?? []).map((f) => f.columnName));
|
|
24732
|
+
for (const f of shipsModel.fields ?? []) {
|
|
24733
|
+
const opts = f.fieldType?.choiceOptions;
|
|
24734
|
+
if (Array.isArray(opts)) shipOptions.set(f.columnName, new Set(opts.map((x) => x.value)));
|
|
24735
|
+
}
|
|
24694
24736
|
} catch {
|
|
24695
24737
|
}
|
|
24738
|
+
const skippedChoice = /* @__PURE__ */ new Set();
|
|
24739
|
+
const choiceOk = (column, value2) => {
|
|
24740
|
+
const opts = shipOptions.get(column);
|
|
24741
|
+
if (!opts || opts.has(value2)) return true;
|
|
24742
|
+
if (!skippedChoice.has(`${column}=${value2}`)) {
|
|
24743
|
+
skippedChoice.add(`${column}=${value2}`);
|
|
24744
|
+
provisioning.push(`workspace's Ships ${column} type has no "${value2}" option \u2014 left ${column} unset; update the template`);
|
|
24745
|
+
}
|
|
24746
|
+
return false;
|
|
24747
|
+
};
|
|
24696
24748
|
const hostPeriscopes = shipColumns.has("host_periscopes") ? o.ship.hostPeriscopes : void 0;
|
|
24697
24749
|
let ownerId;
|
|
24698
24750
|
if (out.meId) {
|
|
@@ -24737,8 +24789,8 @@ async function discover(o) {
|
|
|
24737
24789
|
if (writeMachineId) patchBody.machine_id = machineId;
|
|
24738
24790
|
if ((mine[0].host_passengers ?? false) !== hostPassengers) patchBody.host_passengers = hostPassengers;
|
|
24739
24791
|
if (hostPeriscopes !== void 0 && (mine[0].host_periscopes ?? false) !== hostPeriscopes) patchBody.host_periscopes = hostPeriscopes;
|
|
24740
|
-
if (o.ship.kind && shipColumns.has("kind") && (mine[0].kind ?? "") !== o.ship.kind) patchBody.kind = o.ship.kind;
|
|
24741
|
-
if (o.ship.instanceClass && shipColumns.has("instance_class") && (mine[0].instance_class ?? "") !== o.ship.instanceClass) patchBody.instance_class = o.ship.instanceClass;
|
|
24792
|
+
if (o.ship.kind && shipColumns.has("kind") && choiceOk("kind", o.ship.kind) && (mine[0].kind ?? "") !== o.ship.kind) patchBody.kind = o.ship.kind;
|
|
24793
|
+
if (o.ship.instanceClass && shipColumns.has("instance_class") && choiceOk("instance_class", o.ship.instanceClass) && (mine[0].instance_class ?? "") !== o.ship.instanceClass) patchBody.instance_class = o.ship.instanceClass;
|
|
24742
24794
|
if (sshPublicKey !== void 0 && (mine[0].ssh_public_key ?? "") !== sshPublicKey) {
|
|
24743
24795
|
patchBody.ssh_public_key = sshPublicKey;
|
|
24744
24796
|
}
|
|
@@ -24751,6 +24803,10 @@ async function discover(o) {
|
|
|
24751
24803
|
if ("owner_id" in patchBody) provisioning.push(`recorded owner on Ships row "${o.ship.name}"`);
|
|
24752
24804
|
}
|
|
24753
24805
|
} else if (mine.length === 0) {
|
|
24806
|
+
if (o.ship.platform && shipOptions.get("platform") && !shipOptions.get("platform").has(o.ship.platform)) {
|
|
24807
|
+
throw new Error(`workspace's Ships platform type has no "${o.ship.platform}" option \u2014 update the template`);
|
|
24808
|
+
}
|
|
24809
|
+
const kindValue = o.ship.kind ?? "developer_machine";
|
|
24754
24810
|
const created = await post2(o, `/data-models/${out.shipsModelId}/records`, {
|
|
24755
24811
|
name: o.ship.name,
|
|
24756
24812
|
...o.ship.platform ? { platform: o.ship.platform } : {},
|
|
@@ -24761,8 +24817,8 @@ async function discover(o) {
|
|
|
24761
24817
|
...writeMachineId ? { machine_id: machineId } : {},
|
|
24762
24818
|
// ISSUE-2791: a ship connecting by hand is a developer machine; the
|
|
24763
24819
|
// column arrives with a template update, so only written when present.
|
|
24764
|
-
...shipColumns.has("kind") ? { kind:
|
|
24765
|
-
...o.ship.instanceClass && shipColumns.has("instance_class") ? { instance_class: o.ship.instanceClass } : {}
|
|
24820
|
+
...shipColumns.has("kind") && choiceOk("kind", kindValue) ? { kind: kindValue } : {},
|
|
24821
|
+
...o.ship.instanceClass && shipColumns.has("instance_class") && choiceOk("instance_class", o.ship.instanceClass) ? { instance_class: o.ship.instanceClass } : {}
|
|
24766
24822
|
});
|
|
24767
24823
|
shipRowId = created.id;
|
|
24768
24824
|
out.shipRow = { id: shipRowId, name: o.ship.name, action: "created", matchedBy };
|
|
@@ -26285,7 +26341,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
26285
26341
|
import { existsSync as existsSync55, readdirSync as readdirSync17, statSync as statSync16 } from "fs";
|
|
26286
26342
|
import { join as join56 } from "path";
|
|
26287
26343
|
function builtVersion() {
|
|
26288
|
-
return true ? "0.143.
|
|
26344
|
+
return true ? "0.143.4" : null;
|
|
26289
26345
|
}
|
|
26290
26346
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
26291
26347
|
function newestMtime(path) {
|
|
@@ -29106,6 +29162,10 @@ if (command === "passenger-sync-daemon") {
|
|
|
29106
29162
|
apiKeys: passengerApiKeys(apiRoutes),
|
|
29107
29163
|
controlSocket: controlSocketFor(cfg.ship.stateDir),
|
|
29108
29164
|
onStatus: (workspaceId, status2, info) => {
|
|
29165
|
+
if (status2 === "disconnected" && !planned.has(workspaceId)) {
|
|
29166
|
+
clearShipAttention(state, `${TUNNEL_REJECTED_KEY}:${workspaceId}`);
|
|
29167
|
+
clearShipAttention(state, `${RELAY_CONTROL_UNSUPPORTED_KEY}:${workspaceId}`);
|
|
29168
|
+
}
|
|
29109
29169
|
const owningRoute = apiRoutes.find((r) => r.resolved?.workspaceId === workspaceId);
|
|
29110
29170
|
if (!owningRoute) return;
|
|
29111
29171
|
pending.push(
|
|
@@ -29137,6 +29197,7 @@ if (command === "passenger-sync-daemon") {
|
|
|
29137
29197
|
for (const plan of containerPlans) pending.push(reconcileEndpoint(plan.workspaceId, reconcile));
|
|
29138
29198
|
for (const plan of plans) pending.push(reconcileRelayUrl(plan.workspaceId, apiRoutes));
|
|
29139
29199
|
await Promise.all(pending);
|
|
29200
|
+
for (const key of staleTunnelAttentionKeys(openShipAttention(state).map((i) => i.key), planned)) clearShipAttention(state, key);
|
|
29140
29201
|
await reconcilePeriscopeEndpoints();
|
|
29141
29202
|
} catch (e) {
|
|
29142
29203
|
emit.warn(`ship tunnel sync failed: ${e.message}`, { step: "passengers" });
|
package/package.json
CHANGED
|
@@ -568,7 +568,9 @@ ticket looks:
|
|
|
568
568
|
person — a comment alone is not a stop.
|
|
569
569
|
|
|
570
570
|
The decision belongs to whoever made the call on the ticket, so the digest
|
|
571
|
-
resolves `park to` in this order and the first that resolves wins: (
|
|
571
|
+
resolves `park to` in this order and the first that resolves wins: (0) in a
|
|
572
|
+
`hybrid` project, the **ship operator** of the ship currently holding the
|
|
573
|
+
ticket (`held_by_ship_id` is this ship); (1) the
|
|
572
574
|
**acceptor**, the person who last moved the ticket into `accepted` (the
|
|
573
575
|
`accepted by` column; a lane, workflow or the system promoting it does not
|
|
574
576
|
count); (2) the **filer**, only when a hold or a linked person, never a
|