@synkro-sh/cli 1.4.52 → 1.4.53

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
@@ -997,17 +997,13 @@ export function detectRepo(cwd: string): string {
997
997
  // \u2500\u2500\u2500 Channel Health \u2500\u2500\u2500
998
998
 
999
999
  export async function channelUp(port = 8929): Promise<boolean> {
1000
- try {
1001
- await fetch('http://127.0.0.1:' + port, { signal: AbortSignal.timeout(500) });
1002
- return true;
1003
- } catch (e: any) {
1004
- // If we got a connection error vs a response error, check:
1005
- // fetch throws TypeError for connection refused, but any HTTP response means the port is open
1006
- if (e?.name === 'TimeoutError') return false;
1007
- if (e?.cause?.code === 'ECONNREFUSED' || e?.code === 'ECONNREFUSED') return false;
1008
- // Any other error (like bad response) means the port is actually open
1009
- return true;
1010
- }
1000
+ return new Promise(resolve => {
1001
+ const sock = require('node:net').connect(port, '127.0.0.1');
1002
+ const done = (ok: boolean) => { try { sock.destroy(); } catch {} resolve(ok); };
1003
+ sock.once('connect', () => done(true));
1004
+ sock.once('error', () => done(false));
1005
+ sock.setTimeout(500, () => done(false));
1006
+ });
1011
1007
  }
1012
1008
 
1013
1009
  export async function cweChannelUp(): Promise<boolean> {
@@ -1137,8 +1133,7 @@ export async function localGrade(surface: string, prompt: string): Promise<strin
1137
1133
  }
1138
1134
 
1139
1135
  export async function localGradeCwe(prompt: string): Promise<string> {
1140
- if (!(await cweChannelUp())) throw new Error('SYNKRO_CHANNEL_DOWN');
1141
- return spawnGrade('cwe', prompt, { SYNKRO_CHANNEL_PORT: '8930' }, 12000);
1136
+ return spawnGrade('cwe', prompt, { SYNKRO_CHANNEL_PORT: '8930' }, 22000);
1142
1137
  }
1143
1138
 
1144
1139
  // \u2500\u2500\u2500 Verdict Parsing \u2500\u2500\u2500
@@ -1876,8 +1871,9 @@ async function main() {
1876
1871
  let gradeResp: string;
1877
1872
  try {
1878
1873
  gradeResp = await localGradeCwe(graderPrompt);
1879
- } catch {
1880
- outputJson({ systemMessage: cweTag + ' ' + fileShort + ' \\u2192 grader unavailable, skipped' });
1874
+ } catch (gradeErr: any) {
1875
+ const reason = gradeErr?.message || String(gradeErr);
1876
+ outputJson({ systemMessage: cweTag + ' ' + fileShort + ' \\u2192 grader unavailable (' + reason + '), skipped' });
1881
1877
  return;
1882
1878
  }
1883
1879
 
@@ -5049,7 +5045,7 @@ function writeConfigEnv(opts) {
5049
5045
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
5050
5046
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
5051
5047
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
5052
- `SYNKRO_VERSION=${shellQuoteSingle("1.4.52")}`
5048
+ `SYNKRO_VERSION=${shellQuoteSingle("1.4.53")}`
5053
5049
  ];
5054
5050
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
5055
5051
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);