@solongate/proxy 0.30.0 → 0.30.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/index.js CHANGED
@@ -1,5 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
3
9
  var __esm = (fn, res) => function __init() {
4
10
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
5
11
  };
@@ -6012,6 +6018,17 @@ var SolonGateProxy = class {
6012
6018
  log2("WARNING:", w);
6013
6019
  }
6014
6020
  }
6021
+ /** Normalize well-known MCP client names to display-friendly agent identities */
6022
+ normalizeAgentName(raw) {
6023
+ const lower = raw.toLowerCase();
6024
+ if (lower.includes("cursor")) return { id: "cursor", name: "Cursor" };
6025
+ if (lower.includes("claude-code") || lower === "claude code") return { id: "claude-code", name: "Claude Code" };
6026
+ if (lower.includes("claude")) return { id: "claude-desktop", name: "Claude Desktop" };
6027
+ if (lower.includes("gemini")) return { id: "gemini-cli", name: "Gemini CLI" };
6028
+ if (lower.includes("antigravity")) return { id: "antigravity", name: "Antigravity" };
6029
+ if (lower.includes("perplexity")) return { id: "perplexity", name: "Perplexity" };
6030
+ return { id: raw.toLowerCase().replace(/\s+/g, "-"), name: raw };
6031
+ }
6015
6032
  /** Extract sub-agent identity from MCP _meta field */
6016
6033
  extractSubAgent(request) {
6017
6034
  const meta = request?.params?._meta;
@@ -6208,10 +6225,25 @@ var SolonGateProxy = class {
6208
6225
  this.server.oninitialized = () => {
6209
6226
  if (this.server) {
6210
6227
  const clientVersion = this.server.getClientVersion();
6228
+ log2(`MCP clientInfo raw: ${JSON.stringify(clientVersion)}`);
6229
+ try {
6230
+ const fs = __require("fs");
6231
+ const path = __require("path");
6232
+ const debugDir = path.resolve(".solongate");
6233
+ fs.mkdirSync(debugDir, { recursive: true });
6234
+ fs.writeFileSync(path.join(debugDir, ".debug-clientinfo"), JSON.stringify({
6235
+ clientVersion,
6236
+ agentIdBefore: this.agentId,
6237
+ agentNameBefore: this.agentName,
6238
+ ts: Date.now()
6239
+ }, null, 2));
6240
+ } catch {
6241
+ }
6211
6242
  if (clientVersion?.name) {
6212
- this.agentId = clientVersion.name;
6213
- this.agentName = clientVersion.name;
6214
- log2(`Agent identified from MCP clientInfo: ${this.agentName}`);
6243
+ const normalized = this.normalizeAgentName(clientVersion.name);
6244
+ this.agentId = normalized.id;
6245
+ this.agentName = normalized.name;
6246
+ log2(`Agent identified from MCP clientInfo: ${this.agentName} (raw: ${clientVersion.name})`);
6215
6247
  }
6216
6248
  }
6217
6249
  };
package/dist/lib.js CHANGED
@@ -1,3 +1,10 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
1
8
  // ../core/dist/index.js
2
9
  import { z } from "zod";
3
10
  var __defProp = Object.defineProperty;
@@ -4252,6 +4259,17 @@ var SolonGateProxy = class {
4252
4259
  log2("WARNING:", w);
4253
4260
  }
4254
4261
  }
4262
+ /** Normalize well-known MCP client names to display-friendly agent identities */
4263
+ normalizeAgentName(raw) {
4264
+ const lower = raw.toLowerCase();
4265
+ if (lower.includes("cursor")) return { id: "cursor", name: "Cursor" };
4266
+ if (lower.includes("claude-code") || lower === "claude code") return { id: "claude-code", name: "Claude Code" };
4267
+ if (lower.includes("claude")) return { id: "claude-desktop", name: "Claude Desktop" };
4268
+ if (lower.includes("gemini")) return { id: "gemini-cli", name: "Gemini CLI" };
4269
+ if (lower.includes("antigravity")) return { id: "antigravity", name: "Antigravity" };
4270
+ if (lower.includes("perplexity")) return { id: "perplexity", name: "Perplexity" };
4271
+ return { id: raw.toLowerCase().replace(/\s+/g, "-"), name: raw };
4272
+ }
4255
4273
  /** Extract sub-agent identity from MCP _meta field */
4256
4274
  extractSubAgent(request) {
4257
4275
  const meta = request?.params?._meta;
@@ -4448,10 +4466,25 @@ var SolonGateProxy = class {
4448
4466
  this.server.oninitialized = () => {
4449
4467
  if (this.server) {
4450
4468
  const clientVersion = this.server.getClientVersion();
4469
+ log2(`MCP clientInfo raw: ${JSON.stringify(clientVersion)}`);
4470
+ try {
4471
+ const fs = __require("fs");
4472
+ const path = __require("path");
4473
+ const debugDir = path.resolve(".solongate");
4474
+ fs.mkdirSync(debugDir, { recursive: true });
4475
+ fs.writeFileSync(path.join(debugDir, ".debug-clientinfo"), JSON.stringify({
4476
+ clientVersion,
4477
+ agentIdBefore: this.agentId,
4478
+ agentNameBefore: this.agentName,
4479
+ ts: Date.now()
4480
+ }, null, 2));
4481
+ } catch {
4482
+ }
4451
4483
  if (clientVersion?.name) {
4452
- this.agentId = clientVersion.name;
4453
- this.agentName = clientVersion.name;
4454
- log2(`Agent identified from MCP clientInfo: ${this.agentName}`);
4484
+ const normalized = this.normalizeAgentName(clientVersion.name);
4485
+ this.agentId = normalized.id;
4486
+ this.agentName = normalized.name;
4487
+ log2(`Agent identified from MCP clientInfo: ${this.agentName} (raw: ${clientVersion.name})`);
4455
4488
  }
4456
4489
  }
4457
4490
  };
package/hooks/audit.mjs CHANGED
@@ -38,6 +38,9 @@ process.stdin.on('end', async () => {
38
38
  try {
39
39
  const data = JSON.parse(input);
40
40
 
41
+ // Debug: dump raw stdin to file for agent detection troubleshooting
42
+ try { writeFileSync(resolve('.solongate', '.debug-stdin'), JSON.stringify(data, null, 2)); } catch {}
43
+
41
44
  // Auto-detect agent from stdin data (overrides CLI args if detected)
42
45
  if (data.cursor_version) {
43
46
  AGENT_ID = 'cursor';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.30.0",
3
+ "version": "0.30.2",
4
4
  "description": "AI tool security proxy — protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. Zero code changes required.",
5
5
  "type": "module",
6
6
  "bin": {