@tablation/crew 0.130.3 → 0.130.5

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.
Files changed (2) hide show
  1. package/dist/cli.js +34 -8
  2. 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: { ...Object.fromEntries(blank.map((v) => [v, ""])), ANTHROPIC_BASE_URL: baseUrl } });
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 crewCommandLine() {
2431
- return [process.execPath, ...process.execArgv, process.argv[1] ?? "crew"].map(shq).join(" ");
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 };
@@ -11662,6 +11671,9 @@ var SandboxRunner = class {
11662
11671
  const { cfg } = this;
11663
11672
  const secretKeys = Object.keys(plan.setEnv);
11664
11673
  if (cfg.forgeTokenVar && o.env[cfg.forgeTokenVar] !== void 0 && !secretKeys.includes(cfg.forgeTokenVar)) secretKeys.push(cfg.forgeTokenVar);
11674
+ for (const [k, v] of Object.entries(plan.setEnv)) {
11675
+ if (/[\r\n]/.test(v)) throw new Error(`the sandbox environment variable ${k} contains a newline, which the sandbox gateway refuses`);
11676
+ }
11665
11677
  const createEnv = { ...process.env, ...plan.setEnv };
11666
11678
  if (cfg.forgeTokenVar && o.env[cfg.forgeTokenVar] !== void 0) createEnv[cfg.forgeTokenVar] = o.env[cfg.forgeTokenVar];
11667
11679
  let policyFile = cfg.policy;
@@ -13972,6 +13984,16 @@ function formatToolCheck(t) {
13972
13984
  return `${label}${t.need === "required" ? "NOT FOUND" : "not found"} [${t.need}] \u2014 ${t.hint}
13973
13985
  `;
13974
13986
  }
13987
+ function probeCredentialHelper(command2, run3 = realHelperRun) {
13988
+ const r = run3(`${command2} credential get --no-miss`, "protocol=https\nhost=crew-probe.invalid\n\n");
13989
+ if (r.status === 0 && !/unknown command|usage:/i.test(r.stderr)) return { state: "ok" };
13990
+ const why = r.stderr.trim().split("\n")[0] || `exit ${r.status}`;
13991
+ 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" };
13992
+ }
13993
+ var realHelperRun = (cmd, input) => {
13994
+ const r = spawnSync8("sh", ["-c", cmd], { input, encoding: "utf8", timeout: 15e3 });
13995
+ return { status: r.status, stderr: r.stderr ?? (r.error ? String(r.error) : "") };
13996
+ };
13975
13997
  function formatPushAuth(repo, r) {
13976
13998
  const label = `push auth ${repo}:`.padEnd(19);
13977
13999
  if (r.state === "ok") return `${label}ok
@@ -14317,6 +14339,7 @@ var VALUE_FLAGS = /* @__PURE__ */ new Set([
14317
14339
  "ship-kind",
14318
14340
  "instance-class",
14319
14341
  "relay-host",
14342
+ "relay-http-port",
14320
14343
  "max-concurrent-agents",
14321
14344
  "url",
14322
14345
  "tail",
@@ -15570,7 +15593,7 @@ async function runProvision(o, deps, write, human) {
15570
15593
  const configPath = deps.configFile();
15571
15594
  if (!configPath) return fail2(PROVISION_EXIT.failed, "connect finished but no crew.yaml exists", { stage: "connect" });
15572
15595
  summary.configPath = configPath;
15573
- for (const [key, value2] of [["relayHost", o.relayHost], ["maxConcurrentAgents", o.maxConcurrentAgents]]) {
15596
+ for (const [key, value2] of [["relayHost", o.relayHost], ["relayHttpPort", o.relayHttpPort], ["maxConcurrentAgents", o.maxConcurrentAgents]]) {
15574
15597
  if (value2 === void 0 || value2 === "") continue;
15575
15598
  if (deps.setShipSetting(key, value2)) {
15576
15599
  summary.changed = true;
@@ -15733,6 +15756,7 @@ function provisionOptionsFrom(argv2, env) {
15733
15756
  shipKind: one("ship-kind"),
15734
15757
  instanceClass: one("instance-class"),
15735
15758
  relayHost: one("relay-host"),
15759
+ relayHttpPort: Number.isInteger(Number(one("relay-http-port"))) && Number(one("relay-http-port")) > 0 ? Number(one("relay-http-port")) : void 0,
15736
15760
  maxConcurrentAgents: Number.isInteger(Number(one("max-concurrent-agents"))) && Number(one("max-concurrent-agents")) > 0 ? Number(one("max-concurrent-agents")) : void 0,
15737
15761
  agentBin: one("agent-bin"),
15738
15762
  runner: one("runner") === "host" || one("runner") === "sandbox" ? one("runner") : void 0,
@@ -16129,6 +16153,7 @@ function realPoolMemberDeps(o) {
16129
16153
  shipKind,
16130
16154
  instanceClass,
16131
16155
  relayHost: lease.relayHost,
16156
+ relayHttpPort: lease.relayHttpPort,
16132
16157
  maxConcurrentAgents: lease.maxConcurrentAgents,
16133
16158
  baseUrl: platformBaseUrl(o.platformUrl),
16134
16159
  forgeHosts: hosts,
@@ -31681,6 +31706,7 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
31681
31706
  if (ov.toolchain) process.stdout.write(`repo toolchain: ${repoName} \u2192 ${ov.toolchain} (binary and MCP checked above, as for every ship toolchain)
31682
31707
  `);
31683
31708
  }
31709
+ if (cfg.ship.forges) process.stdout.write(formatPushAuth("credential helper", probeCredentialHelper(crewCommandLine())).replace("push auth credential helper:", "credential helper:".padEnd(19)));
31684
31710
  for (const p of pushAuth) process.stdout.write(formatPushAuth(`${p.repo}`, p.result));
31685
31711
  for (const t of toolRows) process.stdout.write(formatToolCheck(t));
31686
31712
  process.stdout.write(`git: ${gitPath ? `OK (${gitPath})` : "NOT FOUND on the scheduler PATH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.130.3",
3
+ "version": "0.130.5",
4
4
  "description": "A standing team of headless agents that picks work off a Tablation board, does it on a machine you control, and reports back.",
5
5
  "type": "module",
6
6
  "license": "MIT",