@tablation/crew 0.149.3 → 0.149.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 +105 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -985,6 +985,14 @@ function staleTunnelAttentionKeys(openKeys, plannedIds) {
|
|
|
985
985
|
return !id.startsWith("periscope:") && !plannedIds.has(id);
|
|
986
986
|
});
|
|
987
987
|
}
|
|
988
|
+
function deadTunnels(stateDir, alive = isPidAlive) {
|
|
989
|
+
const out = [];
|
|
990
|
+
for (const workspaceId of readAllPersistedWorkspaceIds(stateDir)) {
|
|
991
|
+
const t = readPersistedTunnel(stateDir, workspaceId);
|
|
992
|
+
if (t && (t.status === "connected" || t.status === "connecting") && !alive(t.pid)) out.push({ workspaceId, pid: t.pid });
|
|
993
|
+
}
|
|
994
|
+
return out;
|
|
995
|
+
}
|
|
988
996
|
function rejectedTunnels(stateDir) {
|
|
989
997
|
const out = [];
|
|
990
998
|
for (const workspaceId of readAllPersistedWorkspaceIds(stateDir)) {
|
|
@@ -6707,12 +6715,18 @@ function repoStopFor(items, route2) {
|
|
|
6707
6715
|
return name ? stops.get(name) ?? null : null;
|
|
6708
6716
|
};
|
|
6709
6717
|
}
|
|
6718
|
+
var DOCKER_DAEMON_KEY = "docker_missing:daemon";
|
|
6719
|
+
var DOCKER_REMEDY = "start the Docker daemon (on macOS open Docker Desktop and add it to login items)";
|
|
6720
|
+
function dockerDaemonItem(nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
6721
|
+
return { kind: "docker_missing", key: DOCKER_DAEMON_KEY, since: nowIso, message: `the Docker daemon does not answer; ${DOCKER_REMEDY}. Sandbox image builds and Host Passengers containers wait; relay tunnels stay up for control` };
|
|
6722
|
+
}
|
|
6710
6723
|
function recheckEnvironmentStops(state, route2, ship, deps = {}) {
|
|
6711
6724
|
const onPath2 = deps.onPath ?? findOnPath;
|
|
6712
6725
|
const dockerProblem = deps.dockerProblem ?? dockerPathProblem;
|
|
6713
6726
|
const cleared = [];
|
|
6714
6727
|
for (const item of state.shipAttention().previous()) {
|
|
6715
6728
|
if (item.kind === "docker_missing") {
|
|
6729
|
+
if (item.key === DOCKER_DAEMON_KEY) continue;
|
|
6716
6730
|
if (!dockerProblem(ship)) {
|
|
6717
6731
|
clearShipAttention(state, item.key);
|
|
6718
6732
|
cleared.push("docker");
|
|
@@ -6887,6 +6901,18 @@ var SHELL_WORDS = /* @__PURE__ */ new Set([
|
|
|
6887
6901
|
"ok"
|
|
6888
6902
|
]);
|
|
6889
6903
|
|
|
6904
|
+
// src/passengers-cycle.ts
|
|
6905
|
+
async function dockerGate(deps) {
|
|
6906
|
+
if (deps.dockerUp) {
|
|
6907
|
+
deps.clear(DOCKER_DAEMON_KEY);
|
|
6908
|
+
return "proceed";
|
|
6909
|
+
}
|
|
6910
|
+
deps.warn(`Host Passengers is on for at least one route but ${deps.pathProblem() ?? "Docker is not available"} \u2014 skipping container sync this cycle`);
|
|
6911
|
+
await deps.raise(dockerDaemonItem(), deps.passengerRoutes[0]);
|
|
6912
|
+
await deps.syncTunnels([], /* @__PURE__ */ new Map(), deps.passengerRoutes);
|
|
6913
|
+
return "handled";
|
|
6914
|
+
}
|
|
6915
|
+
|
|
6890
6916
|
// src/doctor-problems.ts
|
|
6891
6917
|
var HOOK_NAMES2 = ["setup", "test", "build", "deploy"];
|
|
6892
6918
|
function repoFindings(o) {
|
|
@@ -6978,8 +7004,29 @@ function repoFindings(o) {
|
|
|
6978
7004
|
}
|
|
6979
7005
|
return { problems, passed };
|
|
6980
7006
|
}
|
|
7007
|
+
function dockerDaemonFinding(o) {
|
|
7008
|
+
if (!o.needed || o.up) return null;
|
|
7009
|
+
return {
|
|
7010
|
+
severity: "blocker",
|
|
7011
|
+
kind: "docker_daemon_down",
|
|
7012
|
+
message: "the Docker daemon does not answer `docker info`; Host Passengers containers, sandbox image builds and anything the relay reaches through them cannot work",
|
|
7013
|
+
remedy: DOCKER_REMEDY
|
|
7014
|
+
};
|
|
7015
|
+
}
|
|
7016
|
+
function deadTunnelFindings(dead, dockerDown) {
|
|
7017
|
+
return dead.map((t) => ({
|
|
7018
|
+
severity: "attention",
|
|
7019
|
+
kind: "tunnel_dead",
|
|
7020
|
+
message: `the relay tunnel for workspace ${t.workspaceId} is recorded as connected but its process ${t.pid} is gone`,
|
|
7021
|
+
remedy: dockerDown ? `run \`crew passengers\` to reopen it (control returns even while Docker is down); also: ${DOCKER_REMEDY}` : "run `crew passengers` to reopen it"
|
|
7022
|
+
}));
|
|
7023
|
+
}
|
|
7024
|
+
function visibleAttention(items, dockerFindingPresent) {
|
|
7025
|
+
return dockerFindingPresent ? items.filter((i) => i.key !== DOCKER_DAEMON_KEY) : items;
|
|
7026
|
+
}
|
|
6981
7027
|
function attentionProblems(items, already) {
|
|
6982
7028
|
const seen = new Set(already.filter((p) => p.kind === "hook_missing").map((p) => `hook_missing:${p.route}/${p.repo}/${p.hook}`));
|
|
7029
|
+
if (already.some((p) => p.kind === "docker_daemon_down")) seen.add(DOCKER_DAEMON_KEY);
|
|
6983
7030
|
return items.filter((i) => !seen.has(i.key)).map((i) => ({ severity: "attention", kind: i.kind, message: i.message }));
|
|
6984
7031
|
}
|
|
6985
7032
|
|
|
@@ -12225,6 +12272,12 @@ function failureLogIsEmpty(failure) {
|
|
|
12225
12272
|
}
|
|
12226
12273
|
async function sandboxBuildTick(repos, deps, force = false) {
|
|
12227
12274
|
const nowMs = (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime();
|
|
12275
|
+
const down = repos.length > 0 ? deps.daemonDown?.() : null;
|
|
12276
|
+
if (down) {
|
|
12277
|
+
deps.raise(down);
|
|
12278
|
+
deps.log("sandbox image: not building, the Docker daemon does not answer");
|
|
12279
|
+
return null;
|
|
12280
|
+
}
|
|
12228
12281
|
for (const r of repos) {
|
|
12229
12282
|
if (r.unreadable) {
|
|
12230
12283
|
deps.log(`sandbox image for ${r.name}: not building, ${r.unreadable}`);
|
|
@@ -26802,7 +26855,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
26802
26855
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
26803
26856
|
import { join as join58 } from "path";
|
|
26804
26857
|
function builtVersion() {
|
|
26805
|
-
return true ? "0.149.
|
|
26858
|
+
return true ? "0.149.4" : null;
|
|
26806
26859
|
}
|
|
26807
26860
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
26808
26861
|
function newestMtime(path) {
|
|
@@ -29390,7 +29443,12 @@ if (command === "passenger-sync-daemon") {
|
|
|
29390
29443
|
void raiseShipAttention({ state, emit: emit2, route: c, ship: cfg.ship }, item);
|
|
29391
29444
|
},
|
|
29392
29445
|
clear: (key) => clearShipAttention(state, key),
|
|
29393
|
-
log: (m) => emit2.emit(m)
|
|
29446
|
+
log: (m) => emit2.emit(m),
|
|
29447
|
+
daemonDown: () => {
|
|
29448
|
+
if (!dockerAvailable()) return dockerDaemonItem();
|
|
29449
|
+
clearShipAttention(state, DOCKER_DAEMON_KEY);
|
|
29450
|
+
return null;
|
|
29451
|
+
}
|
|
29394
29452
|
};
|
|
29395
29453
|
};
|
|
29396
29454
|
die2 = die, requireArmed2 = requireArmed, parseTicketNumber2 = parseTicketNumber, routeRelayUrl2 = routeRelayUrl, previewRelayFor2 = previewRelayFor, passengerApiKeys2 = passengerApiKeys, endpointApiFor2 = endpointApiFor, periscopeEndpointDeps2 = periscopeEndpointDeps, periscopeMcpDeps2 = periscopeMcpDeps, endpointReconcileDeps2 = endpointReconcileDeps, releaseRefused2 = releaseRefused, doctorMachineId2 = doctorMachineId, baseHealth2 = baseHealth, sandboxCacheRepos2 = sandboxCacheRepos, buildSandboxCachePass2 = buildSandboxCachePass, sandboxTickDeps2 = sandboxTickDeps;
|
|
@@ -29589,16 +29647,19 @@ if (command === "passenger-sync-daemon") {
|
|
|
29589
29647
|
const passengerRoutes = cfg.routes.filter((r) => r.enabled && r.hostPassengers);
|
|
29590
29648
|
if (passengerRoutes.length === 0) {
|
|
29591
29649
|
await syncShipTunnels([], /* @__PURE__ */ new Map(), []);
|
|
29650
|
+
if (!await shipNeedsDocker()) clearShipAttention(state, DOCKER_DAEMON_KEY);
|
|
29592
29651
|
return;
|
|
29593
29652
|
}
|
|
29594
|
-
|
|
29595
|
-
|
|
29596
|
-
|
|
29597
|
-
|
|
29598
|
-
|
|
29599
|
-
)
|
|
29600
|
-
|
|
29601
|
-
|
|
29653
|
+
const gate = await dockerGate({
|
|
29654
|
+
dockerUp: dockerAvailable(),
|
|
29655
|
+
passengerRoutes,
|
|
29656
|
+
pathProblem: () => dockerPathProblem(cfg.ship, COMMON_DOCKER_DIRS),
|
|
29657
|
+
warn: (message) => emit.warn(message, { step: "passengers" }),
|
|
29658
|
+
raise: (item, route3) => raiseShipAttention({ state, emit, route: route3, ship: cfg.ship }, item),
|
|
29659
|
+
clear: (key) => clearShipAttention(state, key),
|
|
29660
|
+
syncTunnels: (plans, targets, routes) => syncShipTunnels(plans, targets, routes)
|
|
29661
|
+
});
|
|
29662
|
+
if (gate === "handled") return;
|
|
29602
29663
|
try {
|
|
29603
29664
|
const refusedRepos = /* @__PURE__ */ new Map();
|
|
29604
29665
|
const checkouts = syncAllPassengerCheckouts(cfg, (repo, e) => refusedRepos.set(repo, e.message));
|
|
@@ -29971,6 +30032,21 @@ ${changed2.map((c) => ` - ${c}
|
|
|
29971
30032
|
for (const t of reposOf(c)) if (!refused.has(t.name)) clearShipAttention(state, repoContractRefusedKey(t.name));
|
|
29972
30033
|
return { settled, errors };
|
|
29973
30034
|
}
|
|
30035
|
+
async function shipNeedsDocker() {
|
|
30036
|
+
const enabled = cfg.routes.filter((r) => r.enabled);
|
|
30037
|
+
if (enabled.some((r) => r.hostPassengers)) return true;
|
|
30038
|
+
if (withShipSandbox(await sandboxReposOf(enabled)).length > 0) return true;
|
|
30039
|
+
for (const c of enabled) {
|
|
30040
|
+
let repos;
|
|
30041
|
+
try {
|
|
30042
|
+
repos = await resolvedRepos(c);
|
|
30043
|
+
} catch {
|
|
30044
|
+
continue;
|
|
30045
|
+
}
|
|
30046
|
+
if (repos.some((r) => Object.values(r.config.hooks).some((h) => typeof h === "string" && hookCommand(h) === "docker"))) return true;
|
|
30047
|
+
}
|
|
30048
|
+
return false;
|
|
30049
|
+
}
|
|
29974
30050
|
async function sandboxReposOf(routes) {
|
|
29975
30051
|
const out = /* @__PURE__ */ new Map();
|
|
29976
30052
|
for (const c of routes) {
|
|
@@ -34861,6 +34937,9 @@ watermark: ${state.watermark(routeSlug(route2.route))}
|
|
|
34861
34937
|
} catch {
|
|
34862
34938
|
}
|
|
34863
34939
|
}
|
|
34940
|
+
const dockerDownJson = dockerDaemonFinding({ needed: await shipNeedsDocker(), up: dockerAvailable() });
|
|
34941
|
+
if (dockerDownJson) problems.push(dockerDownJson);
|
|
34942
|
+
problems.push(...deadTunnelFindings(deadTunnels(cfg.ship.stateDir), Boolean(dockerDownJson)));
|
|
34864
34943
|
for (const t of rejectedTunnels(cfg.ship.stateDir)) {
|
|
34865
34944
|
problems.push({ severity: "attention", kind: TUNNEL_REJECTED_KEY, message: tunnelRejectedMessage(t.workspaceId, t.quickExits), remedy: "rotate the slug with `crew rotate-passenger-url`" });
|
|
34866
34945
|
}
|
|
@@ -34891,6 +34970,17 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
|
|
|
34891
34970
|
`);
|
|
34892
34971
|
process.exitCode = 1;
|
|
34893
34972
|
}
|
|
34973
|
+
const dockerFinding = dockerDaemonFinding({ needed: await shipNeedsDocker(), up: dockerAvailable() });
|
|
34974
|
+
const dockerNote = dockerFinding ? " (consequence of the Docker finding above)" : "";
|
|
34975
|
+
if (dockerFinding) {
|
|
34976
|
+
process.stdout.write(`docker: BLOCKER ${dockerFinding.message} \u2014 ${dockerFinding.remedy}
|
|
34977
|
+
`);
|
|
34978
|
+
process.exitCode = 1;
|
|
34979
|
+
}
|
|
34980
|
+
for (const f of deadTunnelFindings(deadTunnels(cfg.ship.stateDir), Boolean(dockerFinding))) {
|
|
34981
|
+
process.stdout.write(`tunnel: DEAD ${f.message} \u2014 ${f.remedy}
|
|
34982
|
+
`);
|
|
34983
|
+
}
|
|
34894
34984
|
for (const w of roleCapWarnings(cfg.ship)) process.stdout.write(`role concurrency: WARN ${w}
|
|
34895
34985
|
`);
|
|
34896
34986
|
for (const r of cfg.routes) for (const f of routeAvatarFailures(cfg.ship.stateDir, r.route)) process.stdout.write(`persona avatar: WARN ${r.route}: ${f.role} avatar failed to upload (${f.detail}); run \`crew agents sync\` again
|
|
@@ -35358,7 +35448,7 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
|
|
|
35358
35448
|
}
|
|
35359
35449
|
}
|
|
35360
35450
|
}
|
|
35361
|
-
for (const i of openShipAttention(state)) {
|
|
35451
|
+
for (const i of visibleAttention(openShipAttention(state), Boolean(dockerFinding))) {
|
|
35362
35452
|
process.stdout.write(`attention: ${i.kind} \u2014 ${i.message} (since ${i.since})
|
|
35363
35453
|
`);
|
|
35364
35454
|
}
|
|
@@ -35401,7 +35491,7 @@ ${foreign.join("\n")}
|
|
|
35401
35491
|
const imageOk = dockerOk && imagePresent(image);
|
|
35402
35492
|
process.stdout.write(
|
|
35403
35493
|
`host passengers: ON for ${passengerRoutes.map((r) => r.route).join(", ")}
|
|
35404
|
-
docker: ${dockerOk ? "OK" :
|
|
35494
|
+
docker: ${dockerOk ? "OK" : `NOT AVAILABLE${dockerNote}`}
|
|
35405
35495
|
ssh-keygen: ${keygenOk ? "OK" : "NOT AVAILABLE"}
|
|
35406
35496
|
image: ${image} (${imageOk ? "present" : "missing"})
|
|
35407
35497
|
relay host: ${cfg.ship.relayHost ? `${cfg.ship.relayHost}:${cfg.ship.relayPort}` : "not set (ship.relayHost) \u2014 containers will run with no tunnel"}
|
|
@@ -35450,7 +35540,7 @@ ${foreign.join("\n")}
|
|
|
35450
35540
|
const stateS = readSandboxState(cfg.ship.stateDir);
|
|
35451
35541
|
for (const r of declaredS) {
|
|
35452
35542
|
const st = sandboxImageStatus(stateS, planSandbox(r.name, r.decl, r.warm, r.bridge));
|
|
35453
|
-
process.stdout.write(`sandbox image: ${r.name}: ${st.status.toUpperCase()} \u2014 ${st.detail}
|
|
35543
|
+
process.stdout.write(`sandbox image: ${r.name}: ${st.status.toUpperCase()} \u2014 ${st.detail}${st.status === "ok" ? "" : dockerNote}
|
|
35454
35544
|
`);
|
|
35455
35545
|
}
|
|
35456
35546
|
}
|
|
@@ -35470,7 +35560,8 @@ ${foreign.join("\n")}
|
|
|
35470
35560
|
} catch {
|
|
35471
35561
|
key = void 0;
|
|
35472
35562
|
}
|
|
35473
|
-
|
|
35563
|
+
const relayLine = key ? describeRelayProbe(relayUrl, await probeRelayControl(relayUrl, key, cfg.ship.userAgent)) : "relay control: could not check (no API key for this route)";
|
|
35564
|
+
process.stdout.write(`${relayLine}${/FAILED/.test(relayLine) ? dockerNote : ""}
|
|
35474
35565
|
`);
|
|
35475
35566
|
}
|
|
35476
35567
|
}
|
package/package.json
CHANGED