@synkro-sh/cli 1.2.1 → 1.2.3

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
@@ -114,7 +114,7 @@ function installCCHooks(settingsPath, config) {
114
114
  {
115
115
  type: "command",
116
116
  command: config.bashJudgeScriptPath,
117
- timeout: 8
117
+ timeout: 15
118
118
  }
119
119
  ],
120
120
  [SYNKRO_MARKER]: true
@@ -479,7 +479,7 @@ if [ -z "$SYNKRO_INFERENCE_TIER" ]; then
479
479
  [ -n "$SYNKRO_INFERENCE_TIER" ] && printf '%s' "$SYNKRO_INFERENCE_TIER" > "$TIER_CACHE_FILE" 2>/dev/null || true
480
480
  fi
481
481
  fi
482
- SYNKRO_INFERENCE_TIER="\${SYNKRO_INFERENCE_TIER:-free}"
482
+ SYNKRO_INFERENCE_TIER="\${SYNKRO_INFERENCE_TIER:-fast}"
483
483
 
484
484
 
485
485
  if [ "$SYNKRO_INFERENCE_TIER" = "free" ] && command -v claude >/dev/null 2>&1; then
@@ -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:-fast}"
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 \\
@@ -1141,7 +1156,7 @@ if [ -z "$SYNKRO_INFERENCE_TIER" ]; then
1141
1156
  [ -n "$SYNKRO_INFERENCE_TIER" ] && printf '%s' "$SYNKRO_INFERENCE_TIER" > "$TIER_CACHE_FILE" 2>/dev/null || true
1142
1157
  fi
1143
1158
  fi
1144
- SYNKRO_INFERENCE_TIER="\${SYNKRO_INFERENCE_TIER:-free}"
1159
+ SYNKRO_INFERENCE_TIER="\${SYNKRO_INFERENCE_TIER:-fast}"
1145
1160
 
1146
1161
  if [ "$SYNKRO_INFERENCE_TIER" = "free" ] && command -v claude >/dev/null 2>&1; then
1147
1162
  # \u2500\u2500\u2500 FREE TIER: grade via the persistent claude daemon (mode=edit). \u2500\u2500\u2500
@@ -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.1")}`
2228
+ `SYNKRO_VERSION=${shellQuoteSingle("1.2.3")}`
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);