@synkro-sh/cli 1.6.43 → 1.6.44

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
@@ -1499,7 +1499,12 @@ async function cloudGrade(surface: string, prompt: string, jwt: string, timeoutM
1499
1499
  return String(data.verdict || '');
1500
1500
  }
1501
1501
 
1502
- export async function localGrade(surface: string, prompt: string, timeoutMs = 30000, agentKind: AgentKind = 'claude_code'): Promise<string> {
1502
+ // Default 24s \u2014 MUST stay below the CC hook timeout (30s for edit/bash/cwe in
1503
+ // ccHookConfig.ts) so the AbortSignal fires and the caller's catch fails open
1504
+ // cleanly. If this matches or exceeds the CC budget, CC force-kills the bun
1505
+ // process mid-fetch (exit 142 / SIGALRM) and surfaces the in-flight grader
1506
+ // prompt as a hook error instead of a clean pass.
1507
+ export async function localGrade(surface: string, prompt: string, timeoutMs = 24000, agentKind: AgentKind = 'claude_code'): Promise<string> {
1503
1508
  const jwt = loadJwt();
1504
1509
  if (!jwt) throw new Error('NO_JWT');
1505
1510
  // BYOK grading mode routes the grade through an LLM API instead of the
@@ -1511,7 +1516,10 @@ export async function localGrade(surface: string, prompt: string, timeoutMs = 30
1511
1516
  return channelGrade(ROLE_MAP[surface] || 'grade-edit', prompt, jwt, 18929, timeoutMs, agentKind);
1512
1517
  }
1513
1518
 
1514
- export async function localGradeCwe(prompt: string, agentKind: AgentKind = 'claude_code', timeoutMs = 45000): Promise<string> {
1519
+ // Default 24s \u2014 was 45000, which EXCEEDED the CC cwe hook timeout (30s) and
1520
+ // guaranteed a force-kill on any slow grade. Two cwe chunks grade in parallel
1521
+ // within the same CC budget, so each must finish well under it.
1522
+ export async function localGradeCwe(prompt: string, agentKind: AgentKind = 'claude_code', timeoutMs = 24000): Promise<string> {
1515
1523
  const jwt = loadJwt();
1516
1524
  if (!jwt) throw new Error('NO_JWT');
1517
1525
  return channelGrade('grade-cwe', prompt, jwt, 18930, timeoutMs, agentKind);
@@ -8262,7 +8270,7 @@ function writeConfigEnv(opts) {
8262
8270
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
8263
8271
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
8264
8272
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
8265
- `SYNKRO_VERSION=${shellQuoteSingle("1.6.43")}`
8273
+ `SYNKRO_VERSION=${shellQuoteSingle("1.6.44")}`
8266
8274
  ];
8267
8275
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
8268
8276
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
@@ -8439,28 +8447,59 @@ async function installCommand(opts = {}) {
8439
8447
  const ghToken = null;
8440
8448
  setApiBaseUrl(`${gatewayUrl}/api`);
8441
8449
  await promptRepoConnection({ linkRepo: opts.linkRepo });
8450
+ const existingSynkro = readFullSynkroFile();
8442
8451
  const detected = detectAgents();
8443
- if (detected.length === 0) {
8444
- console.error("No supported coding agents detected. Install Claude Code or Cursor first.");
8445
- process.exit(1);
8446
- }
8447
- console.log("Detected agents:");
8448
- for (const a of detected) {
8449
- console.log(` \u2713 ${a.name}${a.version ? ` (${a.version})` : ""}`);
8450
- }
8451
- console.log();
8452
- const agents = await promptAgentSelection(detected);
8453
- if (agents.length < detected.length) {
8454
- console.log(`Installing hooks for: ${agents.map((a) => a.name).join(", ")}
8452
+ let agents;
8453
+ let gradingMode;
8454
+ let storageMode;
8455
+ let transcriptConsent = true;
8456
+ if (existingSynkro) {
8457
+ const wantCC = existingSynkro.harness.includes("claude-code");
8458
+ const wantCursor = existingSynkro.harness.includes("cursor");
8459
+ agents = detected.filter(
8460
+ (a) => a.kind === "claude_code" && wantCC || a.kind === "cursor" && wantCursor
8461
+ );
8462
+ if (agents.length === 0 && detected.length > 0) agents = detected;
8463
+ gradingMode = existingSynkro.grader.mode === "byok" ? "byok" : "local";
8464
+ storageMode = "local";
8465
+ console.log(`Using .synkro config:`);
8466
+ console.log(` harness: ${existingSynkro.harness.join(", ")}`);
8467
+ console.log(` grading: ${gradingMode} pool: ${existingSynkro.grader.pool}`);
8468
+ for (const a of agents) {
8469
+ console.log(` \u2713 ${a.name}${a.version ? ` (${a.version})` : ""}`);
8470
+ }
8471
+ console.log();
8472
+ } else {
8473
+ if (detected.length === 0) {
8474
+ console.error("No supported coding agents detected. Install Claude Code or Cursor first.");
8475
+ process.exit(1);
8476
+ }
8477
+ console.log("Detected agents:");
8478
+ for (const a of detected) {
8479
+ console.log(` \u2713 ${a.name}${a.version ? ` (${a.version})` : ""}`);
8480
+ }
8481
+ console.log();
8482
+ agents = await promptAgentSelection(detected);
8483
+ if (agents.length < detected.length) {
8484
+ console.log(`Installing hooks for: ${agents.map((a) => a.name).join(", ")}
8455
8485
  `);
8456
- }
8457
- const gradingMode = await promptGradingMode();
8458
- const storageMode = await promptStorageMode();
8459
- console.log(` grading: ${gradingMode} storage: ${storageMode}
8486
+ }
8487
+ gradingMode = await promptGradingMode();
8488
+ storageMode = await promptStorageMode();
8489
+ console.log(` grading: ${gradingMode} storage: ${storageMode}
8460
8490
  `);
8461
- if (gradingMode === "byok") {
8462
- console.log(" BYOK grading uses your own provider key \u2014 register one in the");
8463
- console.log(" dashboard under Settings \u2192 Provider Keys if you have not already.\n");
8491
+ if (gradingMode === "byok") {
8492
+ console.log(" BYOK grading uses your own provider key \u2014 register one in the");
8493
+ console.log(" dashboard under Settings \u2192 Provider Keys if you have not already.\n");
8494
+ }
8495
+ if (process.stdin.isTTY) {
8496
+ transcriptConsent = await promptTranscriptConsent();
8497
+ if (transcriptConsent) {
8498
+ console.log(" \u2713 Session import enabled\n");
8499
+ } else {
8500
+ console.log(" \u2717 Session import skipped\n");
8501
+ }
8502
+ }
8464
8503
  }
8465
8504
  ensureSynkroDir();
8466
8505
  const scripts = writeHookScripts();
@@ -8476,15 +8515,6 @@ async function installCommand(opts = {}) {
8476
8515
  } catch {
8477
8516
  }
8478
8517
  }
8479
- let transcriptConsent = true;
8480
- if (process.stdin.isTTY) {
8481
- transcriptConsent = await promptTranscriptConsent();
8482
- if (transcriptConsent) {
8483
- console.log(" \u2713 Session import enabled\n");
8484
- } else {
8485
- console.log(" \u2717 Session import skipped\n");
8486
- }
8487
- }
8488
8518
  let hasClaudeCode = false;
8489
8519
  let hasCursor = false;
8490
8520
  for (const agent of agents) {
@@ -11325,7 +11355,7 @@ var args = process.argv.slice(2);
11325
11355
  var cmd = args[0] || "";
11326
11356
  var subArgs = args.slice(1);
11327
11357
  function printVersion() {
11328
- console.log("1.6.43");
11358
+ console.log("1.6.44");
11329
11359
  }
11330
11360
  function printHelp2() {
11331
11361
  console.log(`Synkro CLI \u2014 runtime safety for AI coding agents