@tablation/crew 0.130.4 → 0.130.6
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 +69 -19
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1267,9 +1267,13 @@ function inferenceHeaders(inf) {
|
|
|
1267
1267
|
];
|
|
1268
1268
|
return lines2.length > 0 ? lines2.join("\n") : void 0;
|
|
1269
1269
|
}
|
|
1270
|
-
function workspaceSettings(baseUrl) {
|
|
1270
|
+
function workspaceSettings(baseUrl, headers) {
|
|
1271
1271
|
const blank = BILLING_VARS_TO_UNSET.filter((v) => v !== "ANTHROPIC_AUTH_TOKEN");
|
|
1272
|
-
return JSON.stringify({ env: {
|
|
1272
|
+
return JSON.stringify({ env: {
|
|
1273
|
+
...Object.fromEntries(blank.map((v) => [v, ""])),
|
|
1274
|
+
ANTHROPIC_BASE_URL: baseUrl,
|
|
1275
|
+
...headers ? { ANTHROPIC_CUSTOM_HEADERS: headers } : {}
|
|
1276
|
+
} });
|
|
1273
1277
|
}
|
|
1274
1278
|
function subscriptionSettings() {
|
|
1275
1279
|
return JSON.stringify({ env: Object.fromEntries(BILLING_VARS_TO_UNSET.map((v) => [v, ""])) });
|
|
@@ -1355,7 +1359,7 @@ var claudeAdapter = {
|
|
|
1355
1359
|
// which denies the LSP tool above.
|
|
1356
1360
|
...isOmlxLauncher(spec) ? [] : (o.pluginDirs ?? []).flatMap((d) => ["--plugin-dir", d]),
|
|
1357
1361
|
...spec.auth === "subscription" ? ["--settings", subscriptionSettings()] : [],
|
|
1358
|
-
...spec.auth === "workspace" && spec.inference ? ["--settings", workspaceSettings(spec.inference.baseUrl)] : [],
|
|
1362
|
+
...spec.auth === "workspace" && spec.inference ? ["--settings", workspaceSettings(spec.inference.baseUrl, inferenceHeaders(spec.inference))] : [],
|
|
1359
1363
|
...spec.args
|
|
1360
1364
|
];
|
|
1361
1365
|
return wrapInvocation(spec, { model: o.model, args });
|
|
@@ -1372,8 +1376,7 @@ var claudeAdapter = {
|
|
|
1372
1376
|
...spec.auth === "workspace" ? withoutProviderVars(spec.env) : spec.env,
|
|
1373
1377
|
...spec.auth === "workspace" && spec.inference ? {
|
|
1374
1378
|
ANTHROPIC_BASE_URL: spec.inference.baseUrl,
|
|
1375
|
-
ANTHROPIC_AUTH_TOKEN: spec.inference.token
|
|
1376
|
-
...inferenceHeaders(spec.inference) ? { ANTHROPIC_CUSTOM_HEADERS: inferenceHeaders(spec.inference) } : {}
|
|
1379
|
+
ANTHROPIC_AUTH_TOKEN: spec.inference.token
|
|
1377
1380
|
} : {}
|
|
1378
1381
|
};
|
|
1379
1382
|
},
|
|
@@ -2427,8 +2430,14 @@ function gitCredentialEnv(o, base = process.env) {
|
|
|
2427
2430
|
return out;
|
|
2428
2431
|
}
|
|
2429
2432
|
var shq = (v) => `'${v.replace(/'/g, `'\\''`)}'`;
|
|
2430
|
-
function
|
|
2431
|
-
|
|
2433
|
+
function isCompiledCrew(p) {
|
|
2434
|
+
const entry = p.argv[1];
|
|
2435
|
+
if (entry === void 0) return true;
|
|
2436
|
+
return entry.startsWith("/$bunfs/") || entry.includes("/~BUN/") || entry === p.execPath;
|
|
2437
|
+
}
|
|
2438
|
+
function crewCommandLine(p = process) {
|
|
2439
|
+
const parts = isCompiledCrew(p) ? [p.execPath] : [p.execPath, ...p.execArgv, p.argv[1]];
|
|
2440
|
+
return parts.map(shq).join(" ");
|
|
2432
2441
|
}
|
|
2433
2442
|
function tokenEnvFor(host, token) {
|
|
2434
2443
|
const out = { CREW_FORGE_TOKEN: token };
|
|
@@ -4742,7 +4751,10 @@ The \`${f.hook}\` hook (\`${f.label}\`) printed, last lines:
|
|
|
4742
4751
|
${f.tail}
|
|
4743
4752
|
\`\`\``;
|
|
4744
4753
|
}
|
|
4745
|
-
function describeRelease(o, route2) {
|
|
4754
|
+
function describeRelease(o, route2, where) {
|
|
4755
|
+
const shipNote = where?.ship ? `
|
|
4756
|
+
|
|
4757
|
+
Failed on ship ${where.ship}${where.runner === "sandbox" ? " (sandbox runner, released on the host rather than from a release sandbox)" : ""}; other ships' releases of this repository are unaffected.` : "";
|
|
4746
4758
|
if (o.integrated) {
|
|
4747
4759
|
return {
|
|
4748
4760
|
level: "ok",
|
|
@@ -4778,7 +4790,7 @@ ${o.isolation}` : ""),
|
|
|
4778
4790
|
level: "fail",
|
|
4779
4791
|
headline: `${route2}: release blocked \u2014 setup failed`,
|
|
4780
4792
|
detail: withHookTail(
|
|
4781
|
-
|
|
4793
|
+
`the setup hook failed in the release checkout; the target stays on the previous release${shipNote}`,
|
|
4782
4794
|
o.hookFailure
|
|
4783
4795
|
)
|
|
4784
4796
|
};
|
|
@@ -5050,7 +5062,11 @@ ${userLine}ExecStart=${[...crewInvocation(crewHome), ...subcommandFor(job, "syst
|
|
|
5050
5062
|
WorkingDirectory=${crewHome}
|
|
5051
5063
|
${systemdEnvLines(ship)}
|
|
5052
5064
|
StandardOutput=append:${schedulerLog}
|
|
5053
|
-
StandardError=append:${schedulerLog}
|
|
5065
|
+
StandardError=append:${schedulerLog}${job === "passengers" ? `
|
|
5066
|
+
# CREW-2994: the sync spawns the relay tunnel (a detached ssh) and exits. The
|
|
5067
|
+
# default KillMode=control-group would kill that ssh with the rest of this
|
|
5068
|
+
# one-shot unit's cgroup, so no tunnel would ever survive to "connected".
|
|
5069
|
+
KillMode=process` : ""}
|
|
5054
5070
|
`;
|
|
5055
5071
|
const timer = `# Written by \`crew install\` \u2014 re-run it rather than hand-editing this file.
|
|
5056
5072
|
[Unit]
|
|
@@ -11662,6 +11678,9 @@ var SandboxRunner = class {
|
|
|
11662
11678
|
const { cfg } = this;
|
|
11663
11679
|
const secretKeys = Object.keys(plan.setEnv);
|
|
11664
11680
|
if (cfg.forgeTokenVar && o.env[cfg.forgeTokenVar] !== void 0 && !secretKeys.includes(cfg.forgeTokenVar)) secretKeys.push(cfg.forgeTokenVar);
|
|
11681
|
+
for (const [k, v] of Object.entries(plan.setEnv)) {
|
|
11682
|
+
if (/[\r\n]/.test(v)) throw new Error(`the sandbox environment variable ${k} contains a newline, which the sandbox gateway refuses`);
|
|
11683
|
+
}
|
|
11665
11684
|
const createEnv = { ...process.env, ...plan.setEnv };
|
|
11666
11685
|
if (cfg.forgeTokenVar && o.env[cfg.forgeTokenVar] !== void 0) createEnv[cfg.forgeTokenVar] = o.env[cfg.forgeTokenVar];
|
|
11667
11686
|
let policyFile = cfg.policy;
|
|
@@ -13972,6 +13991,16 @@ function formatToolCheck(t) {
|
|
|
13972
13991
|
return `${label}${t.need === "required" ? "NOT FOUND" : "not found"} [${t.need}] \u2014 ${t.hint}
|
|
13973
13992
|
`;
|
|
13974
13993
|
}
|
|
13994
|
+
function probeCredentialHelper(command2, run3 = realHelperRun) {
|
|
13995
|
+
const r = run3(`${command2} credential get --no-miss`, "protocol=https\nhost=crew-probe.invalid\n\n");
|
|
13996
|
+
if (r.status === 0 && !/unknown command|usage:/i.test(r.stderr)) return { state: "ok" };
|
|
13997
|
+
const why = r.stderr.trim().split("\n")[0] || `exit ${r.status}`;
|
|
13998
|
+
return { state: "failed", detail: `the git credential helper command does not run: ${why}`, hint: "reinstall crew; git cannot authenticate to a private repository until this works" };
|
|
13999
|
+
}
|
|
14000
|
+
var realHelperRun = (cmd, input) => {
|
|
14001
|
+
const r = spawnSync8("sh", ["-c", cmd], { input, encoding: "utf8", timeout: 15e3 });
|
|
14002
|
+
return { status: r.status, stderr: r.stderr ?? (r.error ? String(r.error) : "") };
|
|
14003
|
+
};
|
|
13975
14004
|
function formatPushAuth(repo, r) {
|
|
13976
14005
|
const label = `push auth ${repo}:`.padEnd(19);
|
|
13977
14006
|
if (r.state === "ok") return `${label}ok
|
|
@@ -16084,7 +16113,7 @@ function readAllPersistedWorkspaceIds(stateDir) {
|
|
|
16084
16113
|
}
|
|
16085
16114
|
var TUNNEL_REJECTED_KEY = "tunnel_rejected";
|
|
16086
16115
|
function tunnelRejectedMessage(workspaceId, quickExits) {
|
|
16087
|
-
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
|
|
16116
|
+
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\``;
|
|
16088
16117
|
}
|
|
16089
16118
|
function rejectedTunnels(stateDir) {
|
|
16090
16119
|
const out = [];
|
|
@@ -19993,6 +20022,9 @@ function mirrorOutcome(m) {
|
|
|
19993
20022
|
function lacksCheckout(ship, dir) {
|
|
19994
20023
|
return ship.runner === "sandbox" && !existsSync39(dir) && !remoteOf(dir);
|
|
19995
20024
|
}
|
|
20025
|
+
function skipsHostCheckout(ship) {
|
|
20026
|
+
return ship.runner === "sandbox";
|
|
20027
|
+
}
|
|
19996
20028
|
function mirrorRepoOfTarget(t) {
|
|
19997
20029
|
return mirrorRepoOf({ remote: t.remote, forgeHost: t.forgeHost });
|
|
19998
20030
|
}
|
|
@@ -24462,7 +24494,7 @@ async function runRoleAgentLocked(role, decision, ctx, hooks, held) {
|
|
|
24462
24494
|
const target = repoTargetFor(route2, result.ticket.repo_id);
|
|
24463
24495
|
ticketRepo = target?.name;
|
|
24464
24496
|
try {
|
|
24465
|
-
if (target && ensureRepoCheckout(target.dir, target.remote, { scheme: ship.cloneScheme, host: target.forgeHost })) {
|
|
24497
|
+
if (target && !skipsHostCheckout(ship) && ensureRepoCheckout(target.dir, target.remote, { scheme: ship.cloneScheme, host: target.forgeHost })) {
|
|
24466
24498
|
emit.emit(`cloned ${target.name} into ${target.dir}`, { step: "select", role });
|
|
24467
24499
|
}
|
|
24468
24500
|
} catch (e) {
|
|
@@ -26952,7 +26984,7 @@ ${changed2.map((c) => ` - ${c}
|
|
|
26952
26984
|
async function releasePhase(c, target, opts = {}) {
|
|
26953
26985
|
const scope = releaseLockScope(c.route, target.name);
|
|
26954
26986
|
const remit = emit.forRoute(c.route);
|
|
26955
|
-
if (
|
|
26987
|
+
if (cfg.ship.runner === "sandbox") {
|
|
26956
26988
|
let mode = null;
|
|
26957
26989
|
let contract = null;
|
|
26958
26990
|
const settings = cacheSettingsOf(cfg.ship.sandbox);
|
|
@@ -26968,9 +27000,11 @@ ${changed2.map((c) => ` - ${c}
|
|
|
26968
27000
|
if (releasesFromSandbox(mode) && settings && mirror && contract) {
|
|
26969
27001
|
return releaseFromSandbox(c, target, contract, mirror, opts);
|
|
26970
27002
|
}
|
|
26971
|
-
|
|
26972
|
-
|
|
26973
|
-
|
|
27003
|
+
if (lacksCheckout(cfg.ship, target.dir)) {
|
|
27004
|
+
const note = noCheckoutReleaseNote(target.name, mode);
|
|
27005
|
+
if (firstReport(`${scope0(c, target)}:release`)) remit.emit(note, { step: "release" });
|
|
27006
|
+
return { scope: releaseLockScope(c.route, target.name), tests: "skipped", outcome: "skipped", detail: note };
|
|
27007
|
+
}
|
|
26974
27008
|
}
|
|
26975
27009
|
const relLock = dryRun ? void 0 : state.acquire(`release-${scope}`);
|
|
26976
27010
|
if (relLock && !relLock.ok) {
|
|
@@ -27295,7 +27329,7 @@ ${changed2.map((c) => ` - ${c}
|
|
|
27295
27329
|
}
|
|
27296
27330
|
return placement;
|
|
27297
27331
|
};
|
|
27298
|
-
const news = describeRelease(outcome, scope);
|
|
27332
|
+
const news = describeRelease(outcome, scope, { ship: cfg.ship.name, runner: cfg.ship.runner });
|
|
27299
27333
|
if (news) {
|
|
27300
27334
|
const notified = await notify(c, cfg.ship, news, remit, dryRun);
|
|
27301
27335
|
if (!notified && news.level === "fail") {
|
|
@@ -27633,7 +27667,7 @@ ${cu.tail.trimEnd()}
|
|
|
27633
27667
|
const target = repoTargetFor(w.route, result.ticket.repo_id);
|
|
27634
27668
|
fleetTicketRepo = target?.name;
|
|
27635
27669
|
try {
|
|
27636
|
-
if (target && ensureRepoCheckout(target.dir, target.remote, { scheme: cfg.ship.cloneScheme, host: target.forgeHost })) {
|
|
27670
|
+
if (target && !skipsHostCheckout(cfg.ship) && ensureRepoCheckout(target.dir, target.remote, { scheme: cfg.ship.cloneScheme, host: target.forgeHost })) {
|
|
27637
27671
|
wemit.emit(`cloned ${target.name} into ${target.dir}`, { step: "select", role: w.role });
|
|
27638
27672
|
}
|
|
27639
27673
|
} catch (e) {
|
|
@@ -27851,7 +27885,7 @@ ${cu.tail.trimEnd()}
|
|
|
27851
27885
|
const target = repoTargetFor(route2, result.ticket.repo_id);
|
|
27852
27886
|
ticketRepo = target?.name;
|
|
27853
27887
|
try {
|
|
27854
|
-
if (target && ensureRepoCheckout(target.dir, target.remote, { scheme: cfg.ship.cloneScheme, host: target.forgeHost })) {
|
|
27888
|
+
if (target && !skipsHostCheckout(cfg.ship) && ensureRepoCheckout(target.dir, target.remote, { scheme: cfg.ship.cloneScheme, host: target.forgeHost })) {
|
|
27855
27889
|
emit.emit(`cloned ${target.name} into ${target.dir}`, { step: "select", role: current });
|
|
27856
27890
|
}
|
|
27857
27891
|
} catch (e) {
|
|
@@ -31392,6 +31426,21 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
|
|
|
31392
31426
|
);
|
|
31393
31427
|
}
|
|
31394
31428
|
}
|
|
31429
|
+
if (host === "linux" && detectSystemd() && cfg.ship.relayHost) {
|
|
31430
|
+
const pPlan = planInstall(cfg.ship, CREW_HOME, host, true, "passengers", installContext());
|
|
31431
|
+
const keeps = unitAbandonsAgents(pPlan, (p) => {
|
|
31432
|
+
try {
|
|
31433
|
+
return readFileSync47(p, "utf8");
|
|
31434
|
+
} catch {
|
|
31435
|
+
return null;
|
|
31436
|
+
}
|
|
31437
|
+
});
|
|
31438
|
+
if (keeps === false) {
|
|
31439
|
+
process.stdout.write(
|
|
31440
|
+
"passengers unit: WARN the installed unit lacks KillMode=process, so systemd kills the relay tunnel each time the sync exits (tunnel never reaches connected); run `crew install`\n"
|
|
31441
|
+
);
|
|
31442
|
+
}
|
|
31443
|
+
}
|
|
31395
31444
|
if (host === "linux" && detectSystemd()) {
|
|
31396
31445
|
const ctl = planDaemonControl(CREW_HOME, host, true);
|
|
31397
31446
|
const unitPlan = planInstall(cfg.ship, CREW_HOME, host, true, "run", installContext());
|
|
@@ -31684,6 +31733,7 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
|
|
|
31684
31733
|
if (ov.toolchain) process.stdout.write(`repo toolchain: ${repoName} \u2192 ${ov.toolchain} (binary and MCP checked above, as for every ship toolchain)
|
|
31685
31734
|
`);
|
|
31686
31735
|
}
|
|
31736
|
+
if (cfg.ship.forges) process.stdout.write(formatPushAuth("credential helper", probeCredentialHelper(crewCommandLine())).replace("push auth credential helper:", "credential helper:".padEnd(19)));
|
|
31687
31737
|
for (const p of pushAuth) process.stdout.write(formatPushAuth(`${p.repo}`, p.result));
|
|
31688
31738
|
for (const t of toolRows) process.stdout.write(formatToolCheck(t));
|
|
31689
31739
|
process.stdout.write(`git: ${gitPath ? `OK (${gitPath})` : "NOT FOUND on the scheduler PATH"}
|
package/package.json
CHANGED