@solongate/proxy 0.82.15 → 0.82.16

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.
@@ -114,6 +114,17 @@ function clearGuardUpdateCheck() {
114
114
  function readHook(filename) {
115
115
  return readFileSync(join(HOOKS_DIR, filename), "utf-8");
116
116
  }
117
+ function firstAccountCredential() {
118
+ try {
119
+ const raw = JSON.parse(readFileSync(join(homedir(), ".solongate", "accounts.json"), "utf-8"));
120
+ if (Array.isArray(raw)) {
121
+ const acc = raw.find((a) => a && typeof a.apiKey === "string" && a.apiKey);
122
+ if (acc) return { apiKey: acc.apiKey, apiUrl: typeof acc.apiUrl === "string" ? acc.apiUrl : void 0 };
123
+ }
124
+ } catch {
125
+ }
126
+ return {};
127
+ }
117
128
  function readGuard() {
118
129
  const bundled = join(HOOKS_DIR, "guard.bundled.mjs");
119
130
  return existsSync(bundled) ? readFileSync(bundled, "utf-8") : readHook("guard.mjs");
@@ -193,6 +204,13 @@ function installGlobalQuiet() {
193
204
  if (cfg && typeof cfg.apiUrl === "string") apiUrl = cfg.apiUrl;
194
205
  } catch {
195
206
  }
207
+ if (!apiKey) {
208
+ const acc = firstAccountCredential();
209
+ if (acc.apiKey) {
210
+ apiKey = acc.apiKey;
211
+ if (acc.apiUrl) apiUrl = acc.apiUrl;
212
+ }
213
+ }
196
214
  if (!apiKey) return { ok: false, message: "no login on this device \u2014 add an account first (Accounts \u2192 + add)" };
197
215
  mkdirSync(p.hooksDir, { recursive: true });
198
216
  mkdirSync(p.claudeDir, { recursive: true });
@@ -361,6 +379,10 @@ async function runGlobalInstall(opts = {}) {
361
379
  } catch {
362
380
  }
363
381
  }
382
+ if (!apiKey || apiKey === "sg_live_your_key_here") {
383
+ const acc = firstAccountCredential();
384
+ if (acc.apiKey) apiKey = acc.apiKey;
385
+ }
364
386
  if (!apiKey || apiKey === "sg_live_your_key_here") {
365
387
  apiKey = await ask(" Enter your SolonGate API key (sg_live_\u2026 from https://dashboard.solongate.com): ");
366
388
  }
package/dist/index.js CHANGED
@@ -10245,6 +10245,17 @@ function globalPaths() {
10245
10245
  function readHook(filename) {
10246
10246
  return readFileSync9(join11(HOOKS_DIR, filename), "utf-8");
10247
10247
  }
10248
+ function firstAccountCredential() {
10249
+ try {
10250
+ const raw = JSON.parse(readFileSync9(join11(homedir9(), ".solongate", "accounts.json"), "utf-8"));
10251
+ if (Array.isArray(raw)) {
10252
+ const acc = raw.find((a) => a && typeof a.apiKey === "string" && a.apiKey);
10253
+ if (acc) return { apiKey: acc.apiKey, apiUrl: typeof acc.apiUrl === "string" ? acc.apiUrl : void 0 };
10254
+ }
10255
+ } catch {
10256
+ }
10257
+ return {};
10258
+ }
10248
10259
  function readGuard() {
10249
10260
  const bundled = join11(HOOKS_DIR, "guard.bundled.mjs");
10250
10261
  return existsSync4(bundled) ? readFileSync9(bundled, "utf-8") : readHook("guard.mjs");
@@ -10295,6 +10306,13 @@ function installGlobalQuiet() {
10295
10306
  if (cfg && typeof cfg.apiUrl === "string") apiUrl = cfg.apiUrl;
10296
10307
  } catch {
10297
10308
  }
10309
+ if (!apiKey) {
10310
+ const acc = firstAccountCredential();
10311
+ if (acc.apiKey) {
10312
+ apiKey = acc.apiKey;
10313
+ if (acc.apiUrl) apiUrl = acc.apiUrl;
10314
+ }
10315
+ }
10298
10316
  if (!apiKey) return { ok: false, message: "no login on this device \u2014 add an account first (Accounts \u2192 + add)" };
10299
10317
  mkdirSync8(p.hooksDir, { recursive: true });
10300
10318
  mkdirSync8(p.claudeDir, { recursive: true });
package/dist/tui/index.js CHANGED
@@ -3303,6 +3303,17 @@ function globalPaths() {
3303
3303
  function readHook(filename) {
3304
3304
  return readFileSync4(join6(HOOKS_DIR, filename), "utf-8");
3305
3305
  }
3306
+ function firstAccountCredential() {
3307
+ try {
3308
+ const raw = JSON.parse(readFileSync4(join6(homedir6(), ".solongate", "accounts.json"), "utf-8"));
3309
+ if (Array.isArray(raw)) {
3310
+ const acc = raw.find((a) => a && typeof a.apiKey === "string" && a.apiKey);
3311
+ if (acc) return { apiKey: acc.apiKey, apiUrl: typeof acc.apiUrl === "string" ? acc.apiUrl : void 0 };
3312
+ }
3313
+ } catch {
3314
+ }
3315
+ return {};
3316
+ }
3306
3317
  function readGuard() {
3307
3318
  const bundled = join6(HOOKS_DIR, "guard.bundled.mjs");
3308
3319
  return existsSync2(bundled) ? readFileSync4(bundled, "utf-8") : readHook("guard.mjs");
@@ -3354,6 +3365,13 @@ function installGlobalQuiet() {
3354
3365
  if (cfg && typeof cfg.apiUrl === "string") apiUrl = cfg.apiUrl;
3355
3366
  } catch {
3356
3367
  }
3368
+ if (!apiKey) {
3369
+ const acc = firstAccountCredential();
3370
+ if (acc.apiKey) {
3371
+ apiKey = acc.apiKey;
3372
+ if (acc.apiUrl) apiUrl = acc.apiUrl;
3373
+ }
3374
+ }
3357
3375
  if (!apiKey) return { ok: false, message: "no login on this device \u2014 add an account first (Accounts \u2192 + add)" };
3358
3376
  mkdirSync4(p.hooksDir, { recursive: true });
3359
3377
  mkdirSync4(p.claudeDir, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.82.15",
3
+ "version": "0.82.16",
4
4
  "description": "AI tool security proxy: protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. No code changes required.",
5
5
  "type": "module",
6
6
  "bin": {