@synkro-sh/cli 1.3.44 → 1.3.46
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 +24 -29
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -1
package/dist/bootstrap.js
CHANGED
|
@@ -584,14 +584,13 @@ ensure_fresh_jwt() {
|
|
|
584
584
|
|
|
585
585
|
ensure_fresh_jwt
|
|
586
586
|
|
|
587
|
-
# Resolve tier
|
|
587
|
+
# Resolve tier (cached 60 min) + capture_depth (cached 2 min) via /cli/me.
|
|
588
588
|
TIER_CACHE_FILE="$HOME/.synkro/.tier-cache-\${SYNKRO_USER_ID:-default}"
|
|
589
589
|
CD_CACHE_FILE="\${TIER_CACHE_FILE}.cd"
|
|
590
590
|
SYNKRO_INFERENCE_TIER=""
|
|
591
591
|
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
|
-
SYNKRO_CAPTURE_DEPTH=$(cat "$CD_CACHE_FILE" 2>/dev/null)
|
|
595
594
|
fi
|
|
596
595
|
if [ -z "$SYNKRO_INFERENCE_TIER" ]; then
|
|
597
596
|
ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null || echo "")
|
|
@@ -617,18 +616,16 @@ if [ "$USE_LOCAL" = "true" ]; then
|
|
|
617
616
|
# The daemon fetches the primer (Synkro IP) directly from the server at
|
|
618
617
|
# startup and holds it in memory \u2014 never written to disk.
|
|
619
618
|
|
|
620
|
-
# Fetch org guardrail rules. In local_only mode use GET (no command leaks);
|
|
621
|
-
# in other modes use POST with content for embedding-based top_k matching.
|
|
622
619
|
RULES_CACHE="$HOME/.synkro/.rules-cache-bash"
|
|
623
620
|
ORG_RULES="[]"
|
|
624
621
|
if [ "$SYNKRO_CAPTURE_DEPTH" = "local_only" ]; then
|
|
625
|
-
|
|
622
|
+
ORG_RULES=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/pr-rules" \\
|
|
623
|
+
-H "Authorization: Bearer $JWT" --max-time 3 2>/dev/null \\
|
|
624
|
+
| jq -c '[.rules[]? | {rule_id, text, severity, category}]' 2>/dev/null || echo "[]")
|
|
625
|
+
if [ -n "$ORG_RULES" ] && [ "$ORG_RULES" != "null" ] && [ "$ORG_RULES" != "[]" ]; then
|
|
626
|
+
printf '%s' "$ORG_RULES" > "$RULES_CACHE" 2>/dev/null || true
|
|
627
|
+
elif [ -f "$RULES_CACHE" ]; then
|
|
626
628
|
ORG_RULES=$(cat "$RULES_CACHE" 2>/dev/null || echo "[]")
|
|
627
|
-
else
|
|
628
|
-
ORG_RULES=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/pr-rules" \\
|
|
629
|
-
-H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null \\
|
|
630
|
-
| jq -c '[.rules[]? | {rule_id, text, severity, category}]' 2>/dev/null || echo "[]")
|
|
631
|
-
[ -n "$ORG_RULES" ] && [ "$ORG_RULES" != "null" ] && printf '%s' "$ORG_RULES" > "$RULES_CACHE" 2>/dev/null || true
|
|
632
629
|
fi
|
|
633
630
|
else
|
|
634
631
|
ORG_RULES=$(printf '%s' "$COMMAND" | head -c 4000 \\
|
|
@@ -1083,14 +1080,13 @@ ensure_fresh_jwt() {
|
|
|
1083
1080
|
ensure_fresh_jwt
|
|
1084
1081
|
|
|
1085
1082
|
|
|
1086
|
-
# Resolve tier
|
|
1083
|
+
# Resolve tier (cached 60 min) + capture_depth (cached 2 min) via /cli/me.
|
|
1087
1084
|
TIER_CACHE_FILE="$HOME/.synkro/.tier-cache-\${SYNKRO_USER_ID:-default}"
|
|
1088
1085
|
CD_CACHE_FILE="\${TIER_CACHE_FILE}.cd"
|
|
1089
1086
|
SYNKRO_INFERENCE_TIER=""
|
|
1090
1087
|
SYNKRO_CAPTURE_DEPTH=""
|
|
1091
1088
|
if find "$TIER_CACHE_FILE" -mmin -60 2>/dev/null | grep -q .; then
|
|
1092
1089
|
SYNKRO_INFERENCE_TIER=$(cat "$TIER_CACHE_FILE" 2>/dev/null)
|
|
1093
|
-
SYNKRO_CAPTURE_DEPTH=$(cat "$CD_CACHE_FILE" 2>/dev/null)
|
|
1094
1090
|
fi
|
|
1095
1091
|
if [ -z "$SYNKRO_INFERENCE_TIER" ]; then
|
|
1096
1092
|
ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null || echo "")
|
|
@@ -1118,13 +1114,13 @@ if [ "$USE_LOCAL" = "true" ]; then
|
|
|
1118
1114
|
RULES_CACHE="$HOME/.synkro/.rules-cache-edit"
|
|
1119
1115
|
ORG_RULES="[]"
|
|
1120
1116
|
if [ "$SYNKRO_CAPTURE_DEPTH" = "local_only" ]; then
|
|
1121
|
-
|
|
1117
|
+
ORG_RULES=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/pr-rules" \\
|
|
1118
|
+
-H "Authorization: Bearer $JWT" --max-time 3 2>/dev/null \\
|
|
1119
|
+
| jq -c '[.rules[]? | {rule_id, text, severity, category, mode}]' 2>/dev/null || echo "[]")
|
|
1120
|
+
if [ -n "$ORG_RULES" ] && [ "$ORG_RULES" != "null" ] && [ "$ORG_RULES" != "[]" ]; then
|
|
1121
|
+
printf '%s' "$ORG_RULES" > "$RULES_CACHE" 2>/dev/null || true
|
|
1122
|
+
elif [ -f "$RULES_CACHE" ]; then
|
|
1122
1123
|
ORG_RULES=$(cat "$RULES_CACHE" 2>/dev/null || echo "[]")
|
|
1123
|
-
else
|
|
1124
|
-
ORG_RULES=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/pr-rules" \\
|
|
1125
|
-
-H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null \\
|
|
1126
|
-
| jq -c '[.rules[]? | {rule_id, text, severity, category, mode}]' 2>/dev/null || echo "[]")
|
|
1127
|
-
[ -n "$ORG_RULES" ] && [ "$ORG_RULES" != "null" ] && printf '%s' "$ORG_RULES" > "$RULES_CACHE" 2>/dev/null || true
|
|
1128
1124
|
fi
|
|
1129
1125
|
else
|
|
1130
1126
|
ORG_RULES=$(printf '%s' "$PROPOSED" | head -c 8000 \\
|
|
@@ -1547,16 +1543,15 @@ fi
|
|
|
1547
1543
|
if [ "$USE_LOCAL" = "true" ]; then
|
|
1548
1544
|
# \u2500\u2500\u2500 LOCAL GRADING: grade via the persistent claude daemon (mode=edit). \u2500\u2500\u2500
|
|
1549
1545
|
|
|
1550
|
-
# In local_only: GET all rules (no content sent), cache 1h. Otherwise POST with content.
|
|
1551
1546
|
RULES_CACHE="$HOME/.synkro/.rules-cache-edit-capture"
|
|
1552
1547
|
if [ "$SYNKRO_CAPTURE_DEPTH" = "local_only" ]; then
|
|
1553
|
-
|
|
1548
|
+
ORG_RULES=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/pr-rules" \\
|
|
1549
|
+
-H "Authorization: Bearer $JWT" --max-time 3 2>/dev/null \\
|
|
1550
|
+
| jq -c '[.rules[]? | {rule_id, text, severity, category}]' 2>/dev/null || echo "[]")
|
|
1551
|
+
if [ -n "$ORG_RULES" ] && [ "$ORG_RULES" != "null" ] && [ "$ORG_RULES" != "[]" ]; then
|
|
1552
|
+
printf '%s' "$ORG_RULES" > "$RULES_CACHE" 2>/dev/null || true
|
|
1553
|
+
elif [ -f "$RULES_CACHE" ]; then
|
|
1554
1554
|
ORG_RULES=$(cat "$RULES_CACHE" 2>/dev/null || echo "[]")
|
|
1555
|
-
else
|
|
1556
|
-
ORG_RULES=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/pr-rules" \\
|
|
1557
|
-
-H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null \\
|
|
1558
|
-
| jq -c '[.rules[]? | {rule_id, text, severity, category}]' 2>/dev/null || echo "[]")
|
|
1559
|
-
[ -n "$ORG_RULES" ] && [ "$ORG_RULES" != "null" ] && printf '%s' "$ORG_RULES" > "$RULES_CACHE" 2>/dev/null || true
|
|
1560
1555
|
fi
|
|
1561
1556
|
else
|
|
1562
1557
|
ORG_RULES=$(printf '%s' "$FILE_CONTENT" | head -c 8000 \\
|
|
@@ -2193,7 +2188,7 @@ def log(msg):
|
|
|
2193
2188
|
pass
|
|
2194
2189
|
|
|
2195
2190
|
|
|
2196
|
-
STALL_TIMEOUT_SEC = int(os.environ.get("SYNKRO_DAEMON_STALL_TIMEOUT", "
|
|
2191
|
+
STALL_TIMEOUT_SEC = int(os.environ.get("SYNKRO_DAEMON_STALL_TIMEOUT", "15"))
|
|
2197
2192
|
|
|
2198
2193
|
def _read_response(proc, timeout=45, stop_event=None):
|
|
2199
2194
|
"""Read stream-json from proc.stdout until a 'result' message arrives.
|
|
@@ -2353,7 +2348,7 @@ class WarmGrader:
|
|
|
2353
2348
|
self._kill_proc(proc)
|
|
2354
2349
|
proc = None
|
|
2355
2350
|
|
|
2356
|
-
wall_limit = int(os.environ.get("SYNKRO_DAEMON_WALL_TIMEOUT", "
|
|
2351
|
+
wall_limit = int(os.environ.get("SYNKRO_DAEMON_WALL_TIMEOUT", "20"))
|
|
2357
2352
|
race_timeout = min(GRADE_TIMEOUT_SEC, wall_limit)
|
|
2358
2353
|
|
|
2359
2354
|
# Race a warm and a fresh cold process. Whichever returns a non-empty
|
|
@@ -2367,7 +2362,7 @@ class WarmGrader:
|
|
|
2367
2362
|
|
|
2368
2363
|
def grade_worker(p, label):
|
|
2369
2364
|
try:
|
|
2370
|
-
_send_msg(p, prompt)
|
|
2365
|
+
_send_msg(p, prompt, close_stdin=True)
|
|
2371
2366
|
r = _read_response(p, timeout=race_timeout, stop_event=stop_event)
|
|
2372
2367
|
if r:
|
|
2373
2368
|
result_q.put((label, r))
|
|
@@ -3859,7 +3854,7 @@ function writeConfigEnv(opts) {
|
|
|
3859
3854
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
3860
3855
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
3861
3856
|
`SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
|
|
3862
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.3.
|
|
3857
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.3.46")}`
|
|
3863
3858
|
];
|
|
3864
3859
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
3865
3860
|
if (safeOrgId) lines.push(`SYNKRO_ORG_ID=${shellQuoteSingle(safeOrgId)}`);
|