@synkro-sh/cli 1.4.61 → 1.4.62
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 +45 -11
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -2
package/dist/bootstrap.js
CHANGED
|
@@ -1285,6 +1285,20 @@ export function dispatchCapture(
|
|
|
1285
1285
|
if (repo) body.repo = repo;
|
|
1286
1286
|
if (sessionId) body.session_id = sessionId;
|
|
1287
1287
|
|
|
1288
|
+
// Local telemetry always gets full content \u2014 data never leaves the machine
|
|
1289
|
+
const localBody = { ...body };
|
|
1290
|
+
if (opts) {
|
|
1291
|
+
if (opts.command) localBody.command = opts.command;
|
|
1292
|
+
if (opts.reasoning) localBody.reasoning = opts.reasoning;
|
|
1293
|
+
if (opts.rulesChecked) localBody.rules_checked = opts.rulesChecked;
|
|
1294
|
+
if (opts.violatedRules) localBody.violated_rules = opts.violatedRules;
|
|
1295
|
+
if (opts.recentUserMessages) localBody.recent_user_messages = opts.recentUserMessages;
|
|
1296
|
+
}
|
|
1297
|
+
appendLocalTelemetry(localBody);
|
|
1298
|
+
|
|
1299
|
+
// local_only: no data leaves the machine
|
|
1300
|
+
if (captureDepth === 'local_only') return;
|
|
1301
|
+
|
|
1288
1302
|
if (sendFull && opts) {
|
|
1289
1303
|
body.capture_depth = captureDepth;
|
|
1290
1304
|
if (opts.command) body.command = opts.command;
|
|
@@ -1294,8 +1308,6 @@ export function dispatchCapture(
|
|
|
1294
1308
|
if (opts.recentUserMessages) body.recent_user_messages = opts.recentUserMessages;
|
|
1295
1309
|
}
|
|
1296
1310
|
|
|
1297
|
-
appendLocalTelemetry(body);
|
|
1298
|
-
|
|
1299
1311
|
fetch(GATEWAY_URL + '/api/v1/hook/capture', {
|
|
1300
1312
|
method: 'POST',
|
|
1301
1313
|
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + jwt },
|
|
@@ -1878,6 +1890,25 @@ async function main() {
|
|
|
1878
1890
|
const proposed = reconstructContent(toolName, toolInput, filePath, cwd);
|
|
1879
1891
|
if (!proposed) { outputEmpty(); return; }
|
|
1880
1892
|
|
|
1893
|
+
// Change-anchored window: for Edit/MultiEdit send context around the diff,
|
|
1894
|
+
// for Write send first 4000 chars (new files have patterns at the top).
|
|
1895
|
+
let cweContent: string;
|
|
1896
|
+
if (toolName === 'Edit' || toolName === 'MultiEdit') {
|
|
1897
|
+
const newStr = toolName === 'Edit'
|
|
1898
|
+
? (toolInput.new_string || '')
|
|
1899
|
+
: (Array.isArray(toolInput.edits) ? toolInput.edits.map((e: any) => e?.new_string || '').join('\\n') : '');
|
|
1900
|
+
const changeIdx = proposed.indexOf(newStr);
|
|
1901
|
+
if (changeIdx >= 0 && proposed.length > 6000) {
|
|
1902
|
+
const start = Math.max(0, changeIdx - 2000);
|
|
1903
|
+
const end = Math.min(proposed.length, changeIdx + newStr.length + 2000);
|
|
1904
|
+
cweContent = proposed.slice(start, end);
|
|
1905
|
+
} else {
|
|
1906
|
+
cweContent = proposed.slice(0, 6000);
|
|
1907
|
+
}
|
|
1908
|
+
} else {
|
|
1909
|
+
cweContent = proposed.slice(0, 4000);
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1881
1912
|
const config = await loadConfig(jwt);
|
|
1882
1913
|
const rt = await cweRoute(config);
|
|
1883
1914
|
|
|
@@ -1915,7 +1946,7 @@ async function main() {
|
|
|
1915
1946
|
const graderPrompt = [
|
|
1916
1947
|
'File: ' + filePath,
|
|
1917
1948
|
'Content:',
|
|
1918
|
-
|
|
1949
|
+
cweContent,
|
|
1919
1950
|
'',
|
|
1920
1951
|
'CWE rules to check against:',
|
|
1921
1952
|
JSON.stringify(cweRules),
|
|
@@ -2620,7 +2651,7 @@ main();
|
|
|
2620
2651
|
`;
|
|
2621
2652
|
BASH_FOLLOWUP_TS = `#!/usr/bin/env bun
|
|
2622
2653
|
import {
|
|
2623
|
-
loadJwt, readStdin, hashCommand, consentGrant, consentHasActive, consentConsume,
|
|
2654
|
+
loadJwt, loadConfig, readStdin, hashCommand, consentGrant, consentHasActive, consentConsume,
|
|
2624
2655
|
outputEmpty, appendLocalTelemetry, GATEWAY_URL,
|
|
2625
2656
|
} from './_synkro-common.ts';
|
|
2626
2657
|
|
|
@@ -2664,12 +2695,15 @@ async function main() {
|
|
|
2664
2695
|
|
|
2665
2696
|
appendLocalTelemetry(body);
|
|
2666
2697
|
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2698
|
+
const config = await loadConfig(jwt);
|
|
2699
|
+
if (config.captureDepth !== 'local_only') {
|
|
2700
|
+
fetch(GATEWAY_URL + '/api/v1/hook/capture', {
|
|
2701
|
+
method: 'POST',
|
|
2702
|
+
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + jwt },
|
|
2703
|
+
body: JSON.stringify(body),
|
|
2704
|
+
signal: AbortSignal.timeout(3000),
|
|
2705
|
+
}).catch(() => {});
|
|
2706
|
+
}
|
|
2673
2707
|
|
|
2674
2708
|
outputEmpty();
|
|
2675
2709
|
} catch {
|
|
@@ -5167,7 +5201,7 @@ function writeConfigEnv(opts) {
|
|
|
5167
5201
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
5168
5202
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
5169
5203
|
`SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
|
|
5170
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.4.
|
|
5204
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.4.62")}`
|
|
5171
5205
|
];
|
|
5172
5206
|
if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
|
|
5173
5207
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|