@synkro-sh/cli 1.6.61 → 1.6.63

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/bootstrap.js CHANGED
@@ -9991,6 +9991,7 @@ __export(install_exports, {
9991
9991
  parseArgs: () => parseArgs,
9992
9992
  reconcileDeployLocation: () => reconcileDeployLocation,
9993
9993
  reconcileHarness: () => reconcileHarness,
9994
+ recycleCloudContainer: () => recycleCloudContainer,
9994
9995
  syncSkillFiles: () => syncSkillFiles,
9995
9996
  writeHookScripts: () => writeHookScripts
9996
9997
  });
@@ -10317,7 +10318,7 @@ function writeConfigEnv(opts) {
10317
10318
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
10318
10319
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
10319
10320
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
10320
- `SYNKRO_VERSION=${shellQuoteSingle("1.6.61")}`
10321
+ `SYNKRO_VERSION=${shellQuoteSingle("1.6.63")}`
10321
10322
  ];
10322
10323
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
10323
10324
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
@@ -10349,10 +10350,20 @@ async function provisionCloudContainer(opts) {
10349
10350
  process.exit(1);
10350
10351
  }
10351
10352
  const repo = detectGitRepo2() || void 0;
10353
+ const sf = readFullSynkroFile();
10352
10354
  const harness = [];
10353
10355
  if (opts.hasClaudeCode) harness.push("claude-code");
10354
10356
  if (opts.hasCursor) harness.push("cursor");
10355
- const total = parseInt(process.env.SYNKRO_WORKERS_PER_POOL || "8", 10);
10357
+ const envWorkers = parseInt(process.env.SYNKRO_WORKERS_PER_POOL || "", 10);
10358
+ const total = sf?.workers?.claude && sf.workers.claude > 0 ? sf.workers.claude : Number.isFinite(envWorkers) && envWorkers > 0 ? envWorkers : 4;
10359
+ const cursorTotal = sf?.workers?.cursor && sf.workers.cursor > 0 ? sf.workers.cursor : 0;
10360
+ let cursorApiKey = "";
10361
+ if (cursorTotal > 0) {
10362
+ try {
10363
+ cursorApiKey = readFileSync10(join10(SYNKRO_DIR5, "cursor-creds", "api-key"), "utf-8").trim();
10364
+ } catch {
10365
+ }
10366
+ }
10356
10367
  try {
10357
10368
  const resp = await fetch(`${opts.gatewayUrl}/api/v1/cli/cloud-provision`, {
10358
10369
  method: "POST",
@@ -10363,7 +10374,9 @@ async function provisionCloudContainer(opts) {
10363
10374
  email: opts.email,
10364
10375
  harness,
10365
10376
  claude_workers: total,
10366
- cursor_workers: 0,
10377
+ cursor_workers: cursorTotal,
10378
+ cursor_api_key: cursorApiKey,
10379
+ // never logged; gateway stores it as the org secret
10367
10380
  connected_repo: repo,
10368
10381
  ruleset: readFullSynkroFile()?.ruleset || "default",
10369
10382
  setup_token: setupToken
@@ -10495,7 +10508,7 @@ async function reconcileDeployLocation() {
10495
10508
  const sf = readFullSynkroFile();
10496
10509
  const desired = sf?.grader.location === "cloud" ? "cloud" : "local";
10497
10510
  const current = readPersistedDeployLocation();
10498
- if (desired === current) return desired;
10511
+ if (desired === current) return { location: desired, changed: false };
10499
10512
  const hasClaudeCode = sf ? sf.harness.includes("claude-code") : true;
10500
10513
  const hasCursor = sf ? sf.harness.includes("cursor") : false;
10501
10514
  console.log(`
@@ -10548,7 +10561,29 @@ synkro.toml: deploy location changed ${current} \u2192 ${desired}
10548
10561
  await applyMcpConfig({ gatewayUrl, jwt: token, hasClaudeCode, hasCursor, local: true });
10549
10562
  console.log(" \u2713 switched to local \u2014 bringing the local grader + MCP up\n");
10550
10563
  }
10551
- return desired;
10564
+ return { location: desired, changed: true };
10565
+ }
10566
+ async function recycleCloudContainer() {
10567
+ if (!isAuthenticated()) {
10568
+ console.error("Not authenticated \u2014 run `synkro login`.");
10569
+ return;
10570
+ }
10571
+ await ensureValidToken();
10572
+ const token = getAccessToken();
10573
+ if (!token) {
10574
+ console.error("No access token \u2014 run `synkro login`.");
10575
+ return;
10576
+ }
10577
+ const base = (process.env.SYNKRO_CONTAINERS_URL || "https://containers.synkro.sh").replace(/\/$/, "");
10578
+ console.log("Synkro: recycling the cloud grader container (destroy \u2192 fresh boot)\u2026");
10579
+ try {
10580
+ const r = await fetch(`${base}/recycle`, { method: "POST", headers: { Authorization: `Bearer ${token}` }, signal: AbortSignal.timeout(3e4) });
10581
+ if (r.ok) console.log(" \u2713 old container destroyed");
10582
+ else console.warn(` \u26A0 recycle returned HTTP ${r.status} \u2014 continuing to warm anyway.`);
10583
+ } catch {
10584
+ console.warn(" \u26A0 recycle request failed (network) \u2014 continuing to warm anyway.");
10585
+ }
10586
+ await verifyCloudGrader(token);
10552
10587
  }
10553
10588
  function resolveDeploymentMode() {
10554
10589
  const envOverride = process.env.SYNKRO_DEPLOYMENT_MODE?.toLowerCase();
@@ -11054,6 +11089,7 @@ async function installCommand(opts = {}) {
11054
11089
  }
11055
11090
  console.log();
11056
11091
  } else if (target === "cloud-container") {
11092
+ if (hasCursor) await promptCursorApiKey(opts);
11057
11093
  await provisionCloudContainer({ gatewayUrl, jwt: token, orgId, userId, email, hasClaudeCode, hasCursor });
11058
11094
  await verifyCloudGrader(token);
11059
11095
  }
@@ -13599,9 +13635,9 @@ async function updateCommand() {
13599
13635
  console.log("\nSynkro updated \u2014 now running the latest version.");
13600
13636
  }
13601
13637
  async function restartCommand(rest = []) {
13602
- const location = await reconcileDeployLocation();
13638
+ const { location, changed } = await reconcileDeployLocation();
13603
13639
  if (location === "cloud") {
13604
- console.log("Synkro: grading runs on Synkro Cloud \u2014 no local container to restart.");
13640
+ if (!changed) await recycleCloudContainer();
13605
13641
  return;
13606
13642
  }
13607
13643
  assertDockerAvailable();
@@ -13813,7 +13849,7 @@ var args = process.argv.slice(2);
13813
13849
  var cmd = args[0] || "";
13814
13850
  var subArgs = args.slice(1);
13815
13851
  function printVersion() {
13816
- console.log("1.6.61");
13852
+ console.log("1.6.63");
13817
13853
  }
13818
13854
  function printHelp2() {
13819
13855
  console.log(`Synkro CLI \u2014 runtime safety for AI coding agents