@tablation/crew 0.149.2 → 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 +121 -19
- 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)) {
|
|
@@ -5303,6 +5311,13 @@ import { createHash as createHash3 } from "crypto";
|
|
|
5303
5311
|
function isCompiledBinary(moduleUrl) {
|
|
5304
5312
|
return moduleUrl.includes("$bunfs");
|
|
5305
5313
|
}
|
|
5314
|
+
function selfLaunch(env = currentLaunchEnv()) {
|
|
5315
|
+
if (env.compiled) return { command: env.execPath, args: [] };
|
|
5316
|
+
return { command: env.execPath, args: [...env.execArgv, env.argv1 ?? "crew"] };
|
|
5317
|
+
}
|
|
5318
|
+
function currentLaunchEnv() {
|
|
5319
|
+
return { compiled: isCompiledBinary(import.meta.url), execPath: process.execPath, execArgv: process.execArgv, argv1: process.argv[1] };
|
|
5320
|
+
}
|
|
5306
5321
|
|
|
5307
5322
|
// src/install.ts
|
|
5308
5323
|
function crewInvocation(crewHome) {
|
|
@@ -6700,12 +6715,18 @@ function repoStopFor(items, route2) {
|
|
|
6700
6715
|
return name ? stops.get(name) ?? null : null;
|
|
6701
6716
|
};
|
|
6702
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
|
+
}
|
|
6703
6723
|
function recheckEnvironmentStops(state, route2, ship, deps = {}) {
|
|
6704
6724
|
const onPath2 = deps.onPath ?? findOnPath;
|
|
6705
6725
|
const dockerProblem = deps.dockerProblem ?? dockerPathProblem;
|
|
6706
6726
|
const cleared = [];
|
|
6707
6727
|
for (const item of state.shipAttention().previous()) {
|
|
6708
6728
|
if (item.kind === "docker_missing") {
|
|
6729
|
+
if (item.key === DOCKER_DAEMON_KEY) continue;
|
|
6709
6730
|
if (!dockerProblem(ship)) {
|
|
6710
6731
|
clearShipAttention(state, item.key);
|
|
6711
6732
|
cleared.push("docker");
|
|
@@ -6880,6 +6901,18 @@ var SHELL_WORDS = /* @__PURE__ */ new Set([
|
|
|
6880
6901
|
"ok"
|
|
6881
6902
|
]);
|
|
6882
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
|
+
|
|
6883
6916
|
// src/doctor-problems.ts
|
|
6884
6917
|
var HOOK_NAMES2 = ["setup", "test", "build", "deploy"];
|
|
6885
6918
|
function repoFindings(o) {
|
|
@@ -6971,8 +7004,29 @@ function repoFindings(o) {
|
|
|
6971
7004
|
}
|
|
6972
7005
|
return { problems, passed };
|
|
6973
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
|
+
}
|
|
6974
7027
|
function attentionProblems(items, already) {
|
|
6975
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);
|
|
6976
7030
|
return items.filter((i) => !seen.has(i.key)).map((i) => ({ severity: "attention", kind: i.kind, message: i.message }));
|
|
6977
7031
|
}
|
|
6978
7032
|
|
|
@@ -12218,6 +12272,12 @@ function failureLogIsEmpty(failure) {
|
|
|
12218
12272
|
}
|
|
12219
12273
|
async function sandboxBuildTick(repos, deps, force = false) {
|
|
12220
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
|
+
}
|
|
12221
12281
|
for (const r of repos) {
|
|
12222
12282
|
if (r.unreadable) {
|
|
12223
12283
|
deps.log(`sandbox image for ${r.name}: not building, ${r.unreadable}`);
|
|
@@ -13530,6 +13590,7 @@ function codeBridgeFor(o, harness) {
|
|
|
13530
13590
|
}
|
|
13531
13591
|
if (!wantsCodeBridge(intel)) return void 0;
|
|
13532
13592
|
const sandbox = o.ship.runner === "sandbox";
|
|
13593
|
+
const self = selfLaunch();
|
|
13533
13594
|
const args = sandbox ? [
|
|
13534
13595
|
SANDBOX_BRIDGE_PATH,
|
|
13535
13596
|
"--attach-file",
|
|
@@ -13543,8 +13604,8 @@ function codeBridgeFor(o, harness) {
|
|
|
13543
13604
|
"--ticket",
|
|
13544
13605
|
number,
|
|
13545
13606
|
...seed ? ["--seed-cache", seed] : []
|
|
13546
|
-
] : [...
|
|
13547
|
-
const bridge = { command: sandbox ? "node" :
|
|
13607
|
+
] : [...self.args, "intel", "bridge", o.route.route, number, "--state-dir", o.stateDir];
|
|
13608
|
+
const bridge = { command: sandbox ? "node" : self.command, args };
|
|
13548
13609
|
if (harness === "gemini") {
|
|
13549
13610
|
const text2 = `${JSON.stringify({ mcpServers: { [INTEL_SERVER_NAME]: { command: bridge.command, args } } }, null, 2)}
|
|
13550
13611
|
`;
|
|
@@ -26794,7 +26855,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
26794
26855
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
26795
26856
|
import { join as join58 } from "path";
|
|
26796
26857
|
function builtVersion() {
|
|
26797
|
-
return true ? "0.149.
|
|
26858
|
+
return true ? "0.149.4" : null;
|
|
26798
26859
|
}
|
|
26799
26860
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
26800
26861
|
function newestMtime(path) {
|
|
@@ -27138,7 +27199,8 @@ function syncPassengerSyncDaemons(plans, cfg, stateDir, deps = {}) {
|
|
|
27138
27199
|
}
|
|
27139
27200
|
const secret = existing && existing.mountsHash === plan.mountsHash ? existing.secret : generateSyncSecret();
|
|
27140
27201
|
const targets = passengerCheckoutSyncSpecs(cfg, plan.workspaceId);
|
|
27141
|
-
const
|
|
27202
|
+
const self = selfLaunch();
|
|
27203
|
+
const child = spawnFn(self.command, [...self.args, "passenger-sync-daemon"], {
|
|
27142
27204
|
...process.env,
|
|
27143
27205
|
PASSENGER_SYNC_PORT: String(port),
|
|
27144
27206
|
PASSENGER_SYNC_SECRET: secret,
|
|
@@ -27820,7 +27882,8 @@ async function handlePeriscopes(h, q2) {
|
|
|
27820
27882
|
}
|
|
27821
27883
|
function runCrew(args, onLine, timeoutMs = 20 * 6e4) {
|
|
27822
27884
|
return new Promise((resolve8) => {
|
|
27823
|
-
const
|
|
27885
|
+
const self = selfLaunch();
|
|
27886
|
+
const child = spawn11(self.command, [...self.args, ...args], { stdio: ["ignore", "pipe", "pipe"] });
|
|
27824
27887
|
let stdout = "";
|
|
27825
27888
|
let stderr = "";
|
|
27826
27889
|
let pending = "";
|
|
@@ -28333,7 +28396,8 @@ function schedulerHandler(control, run4 = runDetached) {
|
|
|
28333
28396
|
}
|
|
28334
28397
|
function crewJson(args, timeoutMs = 6e4) {
|
|
28335
28398
|
return new Promise((resolve8) => {
|
|
28336
|
-
|
|
28399
|
+
const self = selfLaunch();
|
|
28400
|
+
execFile6(self.command, [...self.args, ...args], { timeout: timeoutMs, maxBuffer: 16 * 1024 * 1024 }, (_e, stdout) => {
|
|
28337
28401
|
try {
|
|
28338
28402
|
const v = JSON.parse(String(stdout));
|
|
28339
28403
|
resolve8(v && typeof v === "object" && !Array.isArray(v) ? v : null);
|
|
@@ -29379,7 +29443,12 @@ if (command === "passenger-sync-daemon") {
|
|
|
29379
29443
|
void raiseShipAttention({ state, emit: emit2, route: c, ship: cfg.ship }, item);
|
|
29380
29444
|
},
|
|
29381
29445
|
clear: (key) => clearShipAttention(state, key),
|
|
29382
|
-
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
|
+
}
|
|
29383
29452
|
};
|
|
29384
29453
|
};
|
|
29385
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;
|
|
@@ -29578,16 +29647,19 @@ if (command === "passenger-sync-daemon") {
|
|
|
29578
29647
|
const passengerRoutes = cfg.routes.filter((r) => r.enabled && r.hostPassengers);
|
|
29579
29648
|
if (passengerRoutes.length === 0) {
|
|
29580
29649
|
await syncShipTunnels([], /* @__PURE__ */ new Map(), []);
|
|
29650
|
+
if (!await shipNeedsDocker()) clearShipAttention(state, DOCKER_DAEMON_KEY);
|
|
29581
29651
|
return;
|
|
29582
29652
|
}
|
|
29583
|
-
|
|
29584
|
-
|
|
29585
|
-
|
|
29586
|
-
|
|
29587
|
-
|
|
29588
|
-
)
|
|
29589
|
-
|
|
29590
|
-
|
|
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;
|
|
29591
29663
|
try {
|
|
29592
29664
|
const refusedRepos = /* @__PURE__ */ new Map();
|
|
29593
29665
|
const checkouts = syncAllPassengerCheckouts(cfg, (repo, e) => refusedRepos.set(repo, e.message));
|
|
@@ -29960,6 +30032,21 @@ ${changed2.map((c) => ` - ${c}
|
|
|
29960
30032
|
for (const t of reposOf(c)) if (!refused.has(t.name)) clearShipAttention(state, repoContractRefusedKey(t.name));
|
|
29961
30033
|
return { settled, errors };
|
|
29962
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
|
+
}
|
|
29963
30050
|
async function sandboxReposOf(routes) {
|
|
29964
30051
|
const out = /* @__PURE__ */ new Map();
|
|
29965
30052
|
for (const c of routes) {
|
|
@@ -34850,6 +34937,9 @@ watermark: ${state.watermark(routeSlug(route2.route))}
|
|
|
34850
34937
|
} catch {
|
|
34851
34938
|
}
|
|
34852
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)));
|
|
34853
34943
|
for (const t of rejectedTunnels(cfg.ship.stateDir)) {
|
|
34854
34944
|
problems.push({ severity: "attention", kind: TUNNEL_REJECTED_KEY, message: tunnelRejectedMessage(t.workspaceId, t.quickExits), remedy: "rotate the slug with `crew rotate-passenger-url`" });
|
|
34855
34945
|
}
|
|
@@ -34880,6 +34970,17 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
|
|
|
34880
34970
|
`);
|
|
34881
34971
|
process.exitCode = 1;
|
|
34882
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
|
+
}
|
|
34883
34984
|
for (const w of roleCapWarnings(cfg.ship)) process.stdout.write(`role concurrency: WARN ${w}
|
|
34884
34985
|
`);
|
|
34885
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
|
|
@@ -35347,7 +35448,7 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
|
|
|
35347
35448
|
}
|
|
35348
35449
|
}
|
|
35349
35450
|
}
|
|
35350
|
-
for (const i of openShipAttention(state)) {
|
|
35451
|
+
for (const i of visibleAttention(openShipAttention(state), Boolean(dockerFinding))) {
|
|
35351
35452
|
process.stdout.write(`attention: ${i.kind} \u2014 ${i.message} (since ${i.since})
|
|
35352
35453
|
`);
|
|
35353
35454
|
}
|
|
@@ -35390,7 +35491,7 @@ ${foreign.join("\n")}
|
|
|
35390
35491
|
const imageOk = dockerOk && imagePresent(image);
|
|
35391
35492
|
process.stdout.write(
|
|
35392
35493
|
`host passengers: ON for ${passengerRoutes.map((r) => r.route).join(", ")}
|
|
35393
|
-
docker: ${dockerOk ? "OK" :
|
|
35494
|
+
docker: ${dockerOk ? "OK" : `NOT AVAILABLE${dockerNote}`}
|
|
35394
35495
|
ssh-keygen: ${keygenOk ? "OK" : "NOT AVAILABLE"}
|
|
35395
35496
|
image: ${image} (${imageOk ? "present" : "missing"})
|
|
35396
35497
|
relay host: ${cfg.ship.relayHost ? `${cfg.ship.relayHost}:${cfg.ship.relayPort}` : "not set (ship.relayHost) \u2014 containers will run with no tunnel"}
|
|
@@ -35439,7 +35540,7 @@ ${foreign.join("\n")}
|
|
|
35439
35540
|
const stateS = readSandboxState(cfg.ship.stateDir);
|
|
35440
35541
|
for (const r of declaredS) {
|
|
35441
35542
|
const st = sandboxImageStatus(stateS, planSandbox(r.name, r.decl, r.warm, r.bridge));
|
|
35442
|
-
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}
|
|
35443
35544
|
`);
|
|
35444
35545
|
}
|
|
35445
35546
|
}
|
|
@@ -35459,7 +35560,8 @@ ${foreign.join("\n")}
|
|
|
35459
35560
|
} catch {
|
|
35460
35561
|
key = void 0;
|
|
35461
35562
|
}
|
|
35462
|
-
|
|
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 : ""}
|
|
35463
35565
|
`);
|
|
35464
35566
|
}
|
|
35465
35567
|
}
|
package/package.json
CHANGED