@synkro-sh/cli 1.6.93 → 1.6.94

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
@@ -1775,6 +1775,27 @@ async function hostedGrade(role: GradeRole, prompt: string, jwt: string, timeout
1775
1775
  return String(data.result || '');
1776
1776
  }
1777
1777
 
1778
+ // Cloud task-adherence: fire the task-only 'task-drift' surface on the org's
1779
+ // container and return ONLY the progress systemMessage (informational \u2014 never
1780
+ // blocks an edit). Fail-silent: any hiccup returns '' so task tracking can't
1781
+ // break grading. The payload IS a ScanEnvelope; the container runs getActiveTask
1782
+ // (resolved per (org,user,repo) via active_tasks) + taskDrift and returns the
1783
+ // decision. Secrets are scrubbed before the envelope crosses the network.
1784
+ export async function cloudTaskDrift(envelope: Record<string, unknown>, jwt: string, timeoutMs = 20000): Promise<string> {
1785
+ try {
1786
+ const body = JSON.stringify({ role: 'task-drift', payload: scrubSecrets(JSON.stringify(envelope)), content: '' });
1787
+ const resp = await fetch(CONTAINERS_URL + '/grade/submit', {
1788
+ method: 'POST',
1789
+ headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + jwt },
1790
+ body,
1791
+ signal: AbortSignal.timeout(timeoutMs),
1792
+ });
1793
+ if (!resp.ok) return '';
1794
+ const j = await resp.json() as { systemMessage?: unknown };
1795
+ return typeof j?.systemMessage === 'string' ? j.systemMessage : '';
1796
+ } catch { return ''; }
1797
+ }
1798
+
1778
1799
  // Option B: when a cloud grade fails (esp. a timeout), the REAL reason lives
1779
1800
  // inside the container, not on the wire \u2014 the client only ever sees "timed out".
1780
1801
  // Pull the org's per-worker claude/cursor sick reasons + log tails from the
@@ -4265,7 +4286,7 @@ export function outputEmpty(): void {
4265
4286
  `;
4266
4287
  EDIT_PRECHECK_TS = `#!/usr/bin/env bun
4267
4288
  import {
4268
- loadJwt, ensureFreshJwt, detectRepo, loadConfig, route, tag, localGrade,
4289
+ loadJwt, ensureFreshJwt, detectRepo, loadConfig, route, tag, localGrade, cloudTaskDrift,
4269
4290
  parseVerdict, parseCombinedVerdict, combinedEditGradeEnabled, dispatchCapture, dispatchFinding, ruleMode, reconstructContent, editSecretDenial, isPathUnder, postWithRetry,
4270
4291
  readStdin, extractTranscript, readLastPrompt, findNearestDeps, filePathFromToolInput,
4271
4292
  appendSessionAction, readSessionLog, compressSessionLog, sessionLogForGrade, log,
@@ -4422,6 +4443,15 @@ async function main() {
4422
4443
  ].join('\\n');
4423
4444
  const graderPrompt = buildGraderPrompt(proposedShort);
4424
4445
 
4446
+ // Cloud task-adherence (additive, informational): fire the task-only grade in
4447
+ // PARALLEL with the rule grade so it adds no latency, then merge its progress
4448
+ // message into the pass output. Fail-silent ('' on any issue). Sent as a
4449
+ // synthetic Write of the reconstructed content so the container needs no base
4450
+ // bytes. cwd = the repo identifier the container keys active_tasks on.
4451
+ const taskDriftP: Promise<string> = process.env.SYNKRO_DEPLOY_LOCATION === 'cloud'
4452
+ ? cloudTaskDrift({ payload: { tool_name: 'Write', tool_input: { file_path: filePath, content: proposedShort } }, harness: agentKind, cwd: gitRepo, sessionId }, jwt)
4453
+ : Promise.resolve('');
4454
+
4425
4455
  // \u2500\u2500\u2500 Combined org-rules + CWE in ONE inference (SYNKRO_COMBINED_EDIT_GRADE) \u2500\u2500\u2500
4426
4456
  // Self-contained early-return branch \u2014 the default two-grade path below is
4427
4457
  // left untouched. Appends the CWE rule set to the rules prompt, runs one
@@ -4527,7 +4557,8 @@ async function main() {
4527
4557
  ccModel: captureModel, ...lineMetrics,
4528
4558
  });
4529
4559
  const cPassLine = tagStr + ' editGuard ' + fileShort + ' \u2192 pass: ' + (ruleVerdict.reason || 'clean (rules + CWE)');
4530
- outputJson({ systemMessage: cPassLine, hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext: 'Synkro combined edit judge (rules + CWE). ' + (ruleVerdict.reason || 'clean') } });
4560
+ const cTaskMsg = await taskDriftP;
4561
+ outputJson({ systemMessage: cPassLine + (cTaskMsg ? '\\n' + cTaskMsg : ''), hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext: 'Synkro combined edit judge (rules + CWE). ' + (ruleVerdict.reason || 'clean') } });
4531
4562
  return;
4532
4563
  }
4533
4564
 
@@ -4573,7 +4604,8 @@ async function main() {
4573
4604
  ccModel: captureModel, ...lineMetrics,
4574
4605
  });
4575
4606
  const passLine = tagStr + ' editGuard ' + fileShort + ' \u2192 pass: ' + (verdict.reason || 'no policy violations detected');
4576
- outputJson({ systemMessage: passLine, hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext: 'Synkro local edit judge. ' + (verdict.reason || 'no policy violations detected') } });
4607
+ const rTaskMsg = await taskDriftP;
4608
+ outputJson({ systemMessage: passLine + (rTaskMsg ? '\\n' + rTaskMsg : ''), hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext: 'Synkro local edit judge. ' + (verdict.reason || 'no policy violations detected') } });
4577
4609
  return;
4578
4610
  }
4579
4611
 
@@ -11237,7 +11269,7 @@ function writeConfigEnv(opts) {
11237
11269
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
11238
11270
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
11239
11271
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
11240
- `SYNKRO_VERSION=${shellQuoteSingle("1.6.93")}`
11272
+ `SYNKRO_VERSION=${shellQuoteSingle("1.6.94")}`
11241
11273
  ];
11242
11274
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
11243
11275
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
@@ -15302,7 +15334,7 @@ var args = process.argv.slice(2);
15302
15334
  var cmd = args[0] || "";
15303
15335
  var subArgs = args.slice(1);
15304
15336
  function printVersion() {
15305
- console.log("1.6.93");
15337
+ console.log("1.6.94");
15306
15338
  }
15307
15339
  function printHelp2() {
15308
15340
  console.log(`Synkro CLI \u2014 runtime safety for AI coding agents