@solongate/proxy 0.25.3 → 0.25.5

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/index.js CHANGED
@@ -79,6 +79,27 @@ async function sendAuditLog(apiKey, apiUrl, entry) {
79
79
  `);
80
80
  }
81
81
  }
82
+ async function fetchAiJudgeConfig(apiKey, apiUrl) {
83
+ try {
84
+ const res = await fetch(`${apiUrl}/api/v1/project-config/ai-judge`, {
85
+ headers: {
86
+ "Authorization": `Bearer ${apiKey}`,
87
+ "X-API-Key": apiKey
88
+ },
89
+ signal: AbortSignal.timeout(5e3)
90
+ });
91
+ if (!res.ok) return null;
92
+ const data = await res.json();
93
+ return {
94
+ enabled: Boolean(data.enabled),
95
+ model: String(data.model ?? "llama-3.1-8b-instant"),
96
+ endpoint: String(data.endpoint ?? "https://api.groq.com/openai"),
97
+ timeoutMs: Number(data.timeoutMs ?? 5e3)
98
+ };
99
+ } catch {
100
+ return null;
101
+ }
102
+ }
82
103
  function ensureCatchAllAllow(policy) {
83
104
  const hasCatchAllAllow = policy.rules.some(
84
105
  (r) => r.effect === "ALLOW" && r.toolPattern === "*" && r.enabled !== false
@@ -399,7 +420,7 @@ function isAlreadyProtected(server) {
399
420
  if (server.command === "@solongate/proxy") return true;
400
421
  for (const arg of args) {
401
422
  if (arg === "-y" || arg === "--yes") continue;
402
- if (arg === "@solongate/proxy" || arg === "solongate-proxy") return true;
423
+ if (arg === "@solongate/proxy" || arg === "@solongate/proxy@latest" || arg === "solongate-proxy") return true;
403
424
  if (/[/\\]packages[/\\]proxy[/\\]dist[/\\]index\.js$/.test(arg)) return true;
404
425
  break;
405
426
  }
@@ -408,7 +429,7 @@ function isAlreadyProtected(server) {
408
429
  function wrapServer(server, policy) {
409
430
  const env = { ...server.env ?? {} };
410
431
  env.SOLONGATE_API_KEY = "${SOLONGATE_API_KEY}";
411
- const proxyArgs = ["-y", "@solongate/proxy"];
432
+ const proxyArgs = ["-y", "@solongate/proxy@latest"];
412
433
  if (policy) {
413
434
  proxyArgs.push("--policy", policy);
414
435
  }
@@ -6419,6 +6440,40 @@ var SolonGateProxy = class {
6419
6440
  this.registerToolsToCloud();
6420
6441
  this.registerServerToCloud();
6421
6442
  this.startPolicySync();
6443
+ if (this.config.apiKey && !this.config.apiKey.startsWith("sg_test_")) {
6444
+ try {
6445
+ const cloudJudge = await fetchAiJudgeConfig(this.config.apiKey, apiUrl);
6446
+ if (cloudJudge) {
6447
+ if (this.config.aiJudge?.enabled) {
6448
+ log2("AI Judge: CLI flags override cloud config.");
6449
+ } else if (cloudJudge.enabled) {
6450
+ let groqKey;
6451
+ const dotenvPath = (await import("path")).resolve(".env");
6452
+ const { existsSync: existsSync7, readFileSync: readFileSync6 } = await import("fs");
6453
+ if (existsSync7(dotenvPath)) {
6454
+ const content = readFileSync6(dotenvPath, "utf-8");
6455
+ const match = content.match(/^GROQ_API_KEY=(.+)/m);
6456
+ if (match) groqKey = match[1].trim();
6457
+ }
6458
+ if (!groqKey) groqKey = process.env.GROQ_API_KEY;
6459
+ if (groqKey) {
6460
+ this.config.aiJudge = {
6461
+ enabled: true,
6462
+ model: cloudJudge.model,
6463
+ endpoint: cloudJudge.endpoint,
6464
+ apiKey: groqKey,
6465
+ timeoutMs: cloudJudge.timeoutMs
6466
+ };
6467
+ log2(`AI Judge enabled via dashboard (model: ${cloudJudge.model}).`);
6468
+ } else {
6469
+ log2("AI Judge enabled in dashboard but GROQ_API_KEY not found in .env \u2014 skipping.");
6470
+ }
6471
+ }
6472
+ }
6473
+ } catch (err) {
6474
+ log2(`AI Judge cloud config fetch failed: ${err instanceof Error ? err.message : String(err)}`);
6475
+ }
6476
+ }
6422
6477
  if (this.config.aiJudge?.enabled) {
6423
6478
  const protectedFiles = this.extractProtectedFiles();
6424
6479
  const protectedPaths = this.extractProtectedPaths();
package/dist/init.js CHANGED
@@ -60,7 +60,7 @@ function isAlreadyProtected(server) {
60
60
  if (server.command === "@solongate/proxy") return true;
61
61
  for (const arg of args) {
62
62
  if (arg === "-y" || arg === "--yes") continue;
63
- if (arg === "@solongate/proxy" || arg === "solongate-proxy") return true;
63
+ if (arg === "@solongate/proxy" || arg === "@solongate/proxy@latest" || arg === "solongate-proxy") return true;
64
64
  if (/[/\\]packages[/\\]proxy[/\\]dist[/\\]index\.js$/.test(arg)) return true;
65
65
  break;
66
66
  }
@@ -69,7 +69,7 @@ function isAlreadyProtected(server) {
69
69
  function wrapServer(server, policy) {
70
70
  const env = { ...server.env ?? {} };
71
71
  env.SOLONGATE_API_KEY = "${SOLONGATE_API_KEY}";
72
- const proxyArgs = ["-y", "@solongate/proxy"];
72
+ const proxyArgs = ["-y", "@solongate/proxy@latest"];
73
73
  if (policy) {
74
74
  proxyArgs.push("--policy", policy);
75
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.25.3",
3
+ "version": "0.25.5",
4
4
  "description": "MCP security proxy — protect any MCP server with customizable policies, path/command constraints, rate limiting, and audit logging. Zero code changes required.",
5
5
  "type": "module",
6
6
  "bin": {