@synkro-sh/cli 1.3.46 → 1.3.48

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
@@ -592,7 +592,7 @@ SYNKRO_CAPTURE_DEPTH=""
592
592
  if find "$TIER_CACHE_FILE" -mmin -60 2>/dev/null | grep -q .; then
593
593
  SYNKRO_INFERENCE_TIER=$(cat "$TIER_CACHE_FILE" 2>/dev/null)
594
594
  fi
595
- if [ -z "$SYNKRO_INFERENCE_TIER" ]; then
595
+ if [ -z "$SYNKRO_INFERENCE_TIER" ] || [ -z "$SYNKRO_CAPTURE_DEPTH" ]; then
596
596
  ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null || echo "")
597
597
  if [ -n "$ME_RESP" ]; then
598
598
  SYNKRO_INFERENCE_TIER=$(echo "$ME_RESP" | jq -r '.tier // empty' 2>/dev/null)
@@ -787,8 +787,8 @@ case "$SEVERITY" in
787
787
  ;;
788
788
  esac
789
789
 
790
- # Fire-and-forget anonymized telemetry for local_only mode
791
- if [ "$SYNKRO_CAPTURE_DEPTH" = "local_only" ] && [ -n "$VERDICT_KIND" ]; then
790
+ # Fire-and-forget telemetry for locally-judged checks
791
+ if [ "$USE_LOCAL" = "true" ] && [ -n "$VERDICT_KIND" ]; then
792
792
  (
793
793
  MECH_CAT=""
794
794
  BIZ_CAT=""
@@ -810,7 +810,7 @@ if [ "$SYNKRO_CAPTURE_DEPTH" = "local_only" ] && [ -n "$VERDICT_KIND" ]; then
810
810
  BIZ_CAT=$(echo "$CLASS_RESP" | grep -oE '<business>[^<]+</business>' | sed 's/<[^>]*>//g')
811
811
  fi
812
812
  fi
813
- ANON_BODY=$(jq -n \\
813
+ TEL_BODY=$(jq -n \\
814
814
  --arg event_id "$(uuidgen 2>/dev/null || echo "evt_$(date +%s)_$$")" \\
815
815
  --arg timestamp "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \\
816
816
  --arg hook_type "bash" \\
@@ -824,6 +824,10 @@ if [ "$SYNKRO_CAPTURE_DEPTH" = "local_only" ] && [ -n "$VERDICT_KIND" ]; then
824
824
  --arg session_id "$SESSION_ID" \\
825
825
  --arg mech_cat "$MECH_CAT" \\
826
826
  --arg biz_cat "$BIZ_CAT" \\
827
+ --arg capture_depth "$SYNKRO_CAPTURE_DEPTH" \\
828
+ --arg command "$COMMAND" \\
829
+ --arg reasoning "$REASONING" \\
830
+ --arg alternative "$ALTERNATIVE" \\
827
831
  '{
828
832
  event_id: $event_id,
829
833
  timestamp: $timestamp,
@@ -833,15 +837,17 @@ if [ "$SYNKRO_CAPTURE_DEPTH" = "local_only" ] && [ -n "$VERDICT_KIND" ]; then
833
837
  risk_level: $risk_level,
834
838
  category: $category,
835
839
  model: $model,
836
- tool_name: $tool_name
840
+ tool_name: $tool_name,
841
+ capture_depth: $capture_depth
837
842
  } + (if $repo != "" then {repo: $repo} else {} end)
838
843
  + (if $session_id != "" then {session_id: $session_id} else {} end)
839
844
  + (if $mech_cat != "" then {mechanism_category: $mech_cat} else {} end)
840
- + (if $biz_cat != "" then {business_category: $biz_cat} else {} end)')
845
+ + (if $biz_cat != "" then {business_category: $biz_cat} else {} end)
846
+ + (if $capture_depth != "local_only" then {command: $command, reasoning: $reasoning} + (if $alternative != "" then {alternative: $alternative} else {} end) else {} end)')
841
847
  curl -sS -X POST "\${GATEWAY_URL}/api/v1/events/local-verdict" \\
842
848
  -H "Content-Type: application/json" \\
843
849
  -H "Authorization: Bearer $JWT" \\
844
- -d "$ANON_BODY" \\
850
+ -d "$TEL_BODY" \\
845
851
  --max-time 2 >/dev/null 2>&1
846
852
  ) &
847
853
  fi
@@ -1088,7 +1094,7 @@ SYNKRO_CAPTURE_DEPTH=""
1088
1094
  if find "$TIER_CACHE_FILE" -mmin -60 2>/dev/null | grep -q .; then
1089
1095
  SYNKRO_INFERENCE_TIER=$(cat "$TIER_CACHE_FILE" 2>/dev/null)
1090
1096
  fi
1091
- if [ -z "$SYNKRO_INFERENCE_TIER" ]; then
1097
+ if [ -z "$SYNKRO_INFERENCE_TIER" ] || [ -z "$SYNKRO_CAPTURE_DEPTH" ]; then
1092
1098
  ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null || echo "")
1093
1099
  if [ -n "$ME_RESP" ]; then
1094
1100
  SYNKRO_INFERENCE_TIER=$(echo "$ME_RESP" | jq -r '.tier // empty' 2>/dev/null)
@@ -1521,7 +1527,7 @@ if find "$TIER_CACHE_FILE" -mmin -60 2>/dev/null | grep -q .; then
1521
1527
  SYNKRO_INFERENCE_TIER=$(cat "$TIER_CACHE_FILE" 2>/dev/null || true)
1522
1528
  SYNKRO_CAPTURE_DEPTH=$(cat "$CD_CACHE_FILE" 2>/dev/null || true)
1523
1529
  fi
1524
- if [ -z "$SYNKRO_INFERENCE_TIER" ]; then
1530
+ if [ -z "$SYNKRO_INFERENCE_TIER" ] || [ -z "$SYNKRO_CAPTURE_DEPTH" ]; then
1525
1531
  ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null || echo "")
1526
1532
  if [ -n "$ME_RESP" ]; then
1527
1533
  SYNKRO_INFERENCE_TIER=$(echo "$ME_RESP" | jq -r '.tier // empty' 2>/dev/null || true)
@@ -3854,7 +3860,7 @@ function writeConfigEnv(opts) {
3854
3860
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
3855
3861
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
3856
3862
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
3857
- `SYNKRO_VERSION=${shellQuoteSingle("1.3.46")}`
3863
+ `SYNKRO_VERSION=${shellQuoteSingle("1.3.48")}`
3858
3864
  ];
3859
3865
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
3860
3866
  if (safeOrgId) lines.push(`SYNKRO_ORG_ID=${shellQuoteSingle(safeOrgId)}`);