@synkro-sh/cli 1.2.1 → 1.2.2
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 +17 -5
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -1
package/dist/bootstrap.js
CHANGED
|
@@ -114,7 +114,7 @@ function installCCHooks(settingsPath, config) {
|
|
|
114
114
|
{
|
|
115
115
|
type: "command",
|
|
116
116
|
command: config.bashJudgeScriptPath,
|
|
117
|
-
timeout:
|
|
117
|
+
timeout: 15
|
|
118
118
|
}
|
|
119
119
|
],
|
|
120
120
|
[SYNKRO_MARKER]: true
|
|
@@ -854,6 +854,21 @@ refresh_jwt() {
|
|
|
854
854
|
}
|
|
855
855
|
|
|
856
856
|
|
|
857
|
+
# Resolve tier (cached 60 min) \u2014 server is canonical via /cli/me; fallback free.
|
|
858
|
+
TIER_CACHE_FILE="$HOME/.synkro/.tier-cache-\${SYNKRO_USER_ID:-default}"
|
|
859
|
+
SYNKRO_INFERENCE_TIER=""
|
|
860
|
+
if find "$TIER_CACHE_FILE" -mmin -60 2>/dev/null | grep -q .; then
|
|
861
|
+
SYNKRO_INFERENCE_TIER=$(cat "$TIER_CACHE_FILE" 2>/dev/null)
|
|
862
|
+
fi
|
|
863
|
+
if [ -z "$SYNKRO_INFERENCE_TIER" ]; then
|
|
864
|
+
ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null || echo "")
|
|
865
|
+
if [ -n "$ME_RESP" ]; then
|
|
866
|
+
SYNKRO_INFERENCE_TIER=$(echo "$ME_RESP" | jq -r '.tier // empty' 2>/dev/null)
|
|
867
|
+
[ -n "$SYNKRO_INFERENCE_TIER" ] && printf '%s' "$SYNKRO_INFERENCE_TIER" > "$TIER_CACHE_FILE" 2>/dev/null || true
|
|
868
|
+
fi
|
|
869
|
+
fi
|
|
870
|
+
SYNKRO_INFERENCE_TIER="\${SYNKRO_INFERENCE_TIER:-free}"
|
|
871
|
+
|
|
857
872
|
if [ "$SYNKRO_INFERENCE_TIER" = "free" ] && command -v claude >/dev/null 2>&1; then
|
|
858
873
|
# \u2500\u2500\u2500 FREE TIER: grade via the persistent claude daemon (Python helper).
|
|
859
874
|
ORG_RULES=$(printf '%s' "$PROPOSED" | head -c 8000 \\
|
|
@@ -2203,8 +2218,6 @@ function writeConfigEnv(opts) {
|
|
|
2203
2218
|
const safeOrgId = sanitizeConfigValue(opts.orgId);
|
|
2204
2219
|
const safeEmail = sanitizeConfigValue(opts.email);
|
|
2205
2220
|
const safeTier = sanitizeConfigValue(opts.tier ?? "pro", 32);
|
|
2206
|
-
const tierEnv = process.env.SYNKRO_INFERENCE_TIER;
|
|
2207
|
-
const safeInferenceTier = tierEnv === "fast" ? "fast" : "free";
|
|
2208
2221
|
const lines = [
|
|
2209
2222
|
"# Synkro CLI config (managed by synkro install)",
|
|
2210
2223
|
"# JWT auth \u2014 the hook scripts read SYNKRO_CREDENTIALS_PATH at runtime",
|
|
@@ -2212,12 +2225,11 @@ function writeConfigEnv(opts) {
|
|
|
2212
2225
|
`SYNKRO_GATEWAY_URL=${shellQuoteSingle(safeGateway)}`,
|
|
2213
2226
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
2214
2227
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
2215
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.2.
|
|
2228
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.2.2")}`
|
|
2216
2229
|
];
|
|
2217
2230
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
2218
2231
|
if (safeOrgId) lines.push(`SYNKRO_ORG_ID=${shellQuoteSingle(safeOrgId)}`);
|
|
2219
2232
|
if (safeEmail) lines.push(`SYNKRO_EMAIL=${shellQuoteSingle(safeEmail)}`);
|
|
2220
|
-
lines.push(`SYNKRO_INFERENCE_TIER=${shellQuoteSingle(safeInferenceTier)}`);
|
|
2221
2233
|
lines.push("");
|
|
2222
2234
|
writeFileSync4(CONFIG_PATH, lines.join("\n"), "utf-8");
|
|
2223
2235
|
chmodSync(CONFIG_PATH, 384);
|