@solongate/proxy 0.81.46 → 0.81.47

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.
@@ -0,0 +1,12 @@
1
+ export interface Me {
2
+ user?: {
3
+ email?: string;
4
+ name?: string;
5
+ } | null;
6
+ project?: {
7
+ id?: string;
8
+ name?: string;
9
+ slug?: string;
10
+ } | null;
11
+ }
12
+ export declare function me(): Promise<Me>;
@@ -5,6 +5,7 @@
5
5
  export * from './client.js';
6
6
  export * from './types.js';
7
7
  export * from './device-login.js';
8
+ import * as auth from './auth.js';
8
9
  import * as policies from './policies.js';
9
10
  import * as settings from './settings.js';
10
11
  import * as stats from './stats.js';
@@ -13,6 +14,7 @@ import * as agents from './agents.js';
13
14
  import * as keys from './keys.js';
14
15
  import * as mcp from './mcp.js';
15
16
  export declare const api: {
17
+ auth: typeof auth;
16
18
  policies: typeof policies;
17
19
  settings: typeof settings;
18
20
  stats: typeof stats;
@@ -142,6 +142,15 @@ async function request(method, path, opts = {}) {
142
142
  // src/api-client/device-login.ts
143
143
  import { spawn } from "child_process";
144
144
 
145
+ // src/api-client/auth.ts
146
+ var auth_exports = {};
147
+ __export(auth_exports, {
148
+ me: () => me
149
+ });
150
+ function me() {
151
+ return request("GET", "/auth/me");
152
+ }
153
+
145
154
  // src/api-client/policies.ts
146
155
  var policies_exports = {};
147
156
  __export(policies_exports, {
@@ -364,7 +373,7 @@ function list4() {
364
373
  }
365
374
 
366
375
  // src/api-client/index.ts
367
- var api = { policies: policies_exports, settings: settings_exports, stats: stats_exports, audit: audit_exports, agents: agents_exports, keys: keys_exports, mcp: mcp_exports };
376
+ var api = { auth: auth_exports, policies: policies_exports, settings: settings_exports, stats: stats_exports, audit: audit_exports, agents: agents_exports, keys: keys_exports, mcp: mcp_exports };
368
377
 
369
378
  // src/cli-utils.ts
370
379
  var c = {
package/dist/index.js CHANGED
@@ -7157,6 +7157,21 @@ var init_device_login = __esm({
7157
7157
  }
7158
7158
  });
7159
7159
 
7160
+ // src/api-client/auth.ts
7161
+ var auth_exports = {};
7162
+ __export(auth_exports, {
7163
+ me: () => me
7164
+ });
7165
+ function me() {
7166
+ return request("GET", "/auth/me");
7167
+ }
7168
+ var init_auth = __esm({
7169
+ "src/api-client/auth.ts"() {
7170
+ "use strict";
7171
+ init_client();
7172
+ }
7173
+ });
7174
+
7160
7175
  // src/api-client/policies.ts
7161
7176
  var policies_exports = {};
7162
7177
  __export(policies_exports, {
@@ -7428,6 +7443,7 @@ var init_api_client = __esm({
7428
7443
  init_client();
7429
7444
  init_types();
7430
7445
  init_device_login();
7446
+ init_auth();
7431
7447
  init_policies();
7432
7448
  init_settings();
7433
7449
  init_stats();
@@ -7435,7 +7451,7 @@ var init_api_client = __esm({
7435
7451
  init_agents();
7436
7452
  init_keys();
7437
7453
  init_mcp();
7438
- api = { policies: policies_exports, settings: settings_exports, stats: stats_exports, audit: audit_exports, agents: agents_exports, keys: keys_exports, mcp: mcp_exports };
7454
+ api = { auth: auth_exports, policies: policies_exports, settings: settings_exports, stats: stats_exports, audit: audit_exports, agents: agents_exports, keys: keys_exports, mcp: mcp_exports };
7439
7455
  }
7440
7456
  });
7441
7457
 
@@ -10177,7 +10193,7 @@ function AccountsPanel({
10177
10193
  if (a) {
10178
10194
  setViewCredentials({ apiKey: a.apiKey, apiUrl: a.apiUrl });
10179
10195
  onView?.(a);
10180
- setMsg({ text: `viewing ${a.project || a.user || a.apiKey.slice(0, 8)}`, level: "ok" });
10196
+ setMsg({ text: `viewing ${a.project || a.user || "account \u2026" + a.apiKey.slice(-4)}`, level: "ok" });
10181
10197
  }
10182
10198
  } else if (input === "m") {
10183
10199
  const a = accounts[sel];
@@ -10226,7 +10242,7 @@ function AccountsPanel({
10226
10242
  const isActive = isActiveAccount(a.apiKey);
10227
10243
  return /* @__PURE__ */ jsxs8(Text8, { wrap: "truncate", backgroundColor: isSel ? "#333333" : void 0, bold: isSel, children: [
10228
10244
  /* @__PURE__ */ jsx8(Text8, { color: isSel ? theme.accentBright : theme.dim, children: isSel ? "\u25B8 " : " " }),
10229
- /* @__PURE__ */ jsx8(Text8, { color: theme.accent, children: truncate2(a.project || a.user || a.apiKey.slice(0, 12), 30).padEnd(31) }),
10245
+ /* @__PURE__ */ jsx8(Text8, { color: theme.accent, children: truncate2(a.project || a.user || "account \u2026" + a.apiKey.slice(-4), 30).padEnd(31) }),
10230
10246
  isView ? /* @__PURE__ */ jsx8(Text8, { color: theme.ok, children: "\u25CF viewing " }) : /* @__PURE__ */ jsx8(Text8, { color: theme.dim, children: " " }),
10231
10247
  isActive ? /* @__PURE__ */ jsx8(Text8, { color: theme.warn, children: "ACTIVE " }) : /* @__PURE__ */ jsx8(Text8, { color: theme.dim, children: " " }),
10232
10248
  /* @__PURE__ */ jsx8(Text8, { color: theme.dim, children: a.user && a.project ? truncate2(a.user, 24) : "" })
@@ -10248,7 +10264,7 @@ var init_Accounts = __esm({
10248
10264
 
10249
10265
  // src/tui/App.tsx
10250
10266
  import { Box as Box9, Text as Text9, useApp, useInput as useInput8 } from "ink";
10251
- import { useState as useState9 } from "react";
10267
+ import { useEffect as useEffect7, useState as useState9 } from "react";
10252
10268
  import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
10253
10269
  function LiveHint() {
10254
10270
  return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
@@ -10285,7 +10301,22 @@ function App() {
10285
10301
  const [help, setHelp] = useState9(false);
10286
10302
  const acctIdx = Math.max(0, accounts.findIndex((a) => a.apiKey === viewKey));
10287
10303
  const cur = accounts[acctIdx];
10288
- const acctLabel = cur ? cur.project || cur.user || cur.apiKey.slice(0, 8) : "not logged in";
10304
+ const acctLabel = cur ? cur.project || cur.user || `account \u2026${cur.apiKey.slice(-4)}` : "not logged in";
10305
+ useEffect7(() => {
10306
+ if (!cur || cur.project || cur.user) return;
10307
+ let alive = true;
10308
+ api.auth.me().then((r) => {
10309
+ const project = r.project?.name || void 0;
10310
+ const user = r.user?.name || r.user?.email || void 0;
10311
+ if (!alive || !project && !user) return;
10312
+ saveAccount({ ...cur, project, user });
10313
+ setAccounts(listAccounts());
10314
+ }).catch(() => {
10315
+ });
10316
+ return () => {
10317
+ alive = false;
10318
+ };
10319
+ }, [cur]);
10289
10320
  const viewAccount = (a) => {
10290
10321
  setViewCredentials({ apiKey: a.apiKey, apiUrl: a.apiUrl });
10291
10322
  setAccounts(listAccounts());
@@ -10379,6 +10410,7 @@ var init_App = __esm({
10379
10410
  init_Accounts();
10380
10411
  init_hooks();
10381
10412
  init_client();
10413
+ init_api_client();
10382
10414
  SECTIONS = [
10383
10415
  { label: "Live", Panel: LiveHint },
10384
10416
  { label: "Policies", Panel: PoliciesPanel },
package/dist/tui/index.js CHANGED
@@ -12,7 +12,7 @@ import { render } from "ink";
12
12
 
13
13
  // src/tui/App.tsx
14
14
  import { Box as Box9, Text as Text9, useApp, useInput as useInput8 } from "ink";
15
- import { useState as useState9 } from "react";
15
+ import { useEffect as useEffect7, useState as useState9 } from "react";
16
16
 
17
17
  // src/cli-utils.ts
18
18
  var c = {
@@ -471,6 +471,15 @@ async function pollDeviceLogin(apiUrl, deviceCode) {
471
471
  }
472
472
  }
473
473
 
474
+ // src/api-client/auth.ts
475
+ var auth_exports = {};
476
+ __export(auth_exports, {
477
+ me: () => me
478
+ });
479
+ function me() {
480
+ return request("GET", "/auth/me");
481
+ }
482
+
474
483
  // src/api-client/policies.ts
475
484
  var policies_exports = {};
476
485
  __export(policies_exports, {
@@ -693,7 +702,7 @@ function list4() {
693
702
  }
694
703
 
695
704
  // src/api-client/index.ts
696
- var api = { policies: policies_exports, settings: settings_exports, stats: stats_exports, audit: audit_exports, agents: agents_exports, keys: keys_exports, mcp: mcp_exports };
705
+ var api = { auth: auth_exports, policies: policies_exports, settings: settings_exports, stats: stats_exports, audit: audit_exports, agents: agents_exports, keys: keys_exports, mcp: mcp_exports };
697
706
 
698
707
  // src/tui/notify.ts
699
708
  import { spawn as spawn2 } from "child_process";
@@ -3355,7 +3364,7 @@ function AccountsPanel({
3355
3364
  if (a) {
3356
3365
  setViewCredentials({ apiKey: a.apiKey, apiUrl: a.apiUrl });
3357
3366
  onView?.(a);
3358
- setMsg({ text: `viewing ${a.project || a.user || a.apiKey.slice(0, 8)}`, level: "ok" });
3367
+ setMsg({ text: `viewing ${a.project || a.user || "account \u2026" + a.apiKey.slice(-4)}`, level: "ok" });
3359
3368
  }
3360
3369
  } else if (input === "m") {
3361
3370
  const a = accounts[sel];
@@ -3404,7 +3413,7 @@ function AccountsPanel({
3404
3413
  const isActive = isActiveAccount(a.apiKey);
3405
3414
  return /* @__PURE__ */ jsxs8(Text8, { wrap: "truncate", backgroundColor: isSel ? "#333333" : void 0, bold: isSel, children: [
3406
3415
  /* @__PURE__ */ jsx8(Text8, { color: isSel ? theme.accentBright : theme.dim, children: isSel ? "\u25B8 " : " " }),
3407
- /* @__PURE__ */ jsx8(Text8, { color: theme.accent, children: truncate(a.project || a.user || a.apiKey.slice(0, 12), 30).padEnd(31) }),
3416
+ /* @__PURE__ */ jsx8(Text8, { color: theme.accent, children: truncate(a.project || a.user || "account \u2026" + a.apiKey.slice(-4), 30).padEnd(31) }),
3408
3417
  isView ? /* @__PURE__ */ jsx8(Text8, { color: theme.ok, children: "\u25CF viewing " }) : /* @__PURE__ */ jsx8(Text8, { color: theme.dim, children: " " }),
3409
3418
  isActive ? /* @__PURE__ */ jsx8(Text8, { color: theme.warn, children: "ACTIVE " }) : /* @__PURE__ */ jsx8(Text8, { color: theme.dim, children: " " }),
3410
3419
  /* @__PURE__ */ jsx8(Text8, { color: theme.dim, children: a.user && a.project ? truncate(a.user, 24) : "" })
@@ -3462,7 +3471,22 @@ function App() {
3462
3471
  const [help, setHelp] = useState9(false);
3463
3472
  const acctIdx = Math.max(0, accounts.findIndex((a) => a.apiKey === viewKey));
3464
3473
  const cur = accounts[acctIdx];
3465
- const acctLabel = cur ? cur.project || cur.user || cur.apiKey.slice(0, 8) : "not logged in";
3474
+ const acctLabel = cur ? cur.project || cur.user || `account \u2026${cur.apiKey.slice(-4)}` : "not logged in";
3475
+ useEffect7(() => {
3476
+ if (!cur || cur.project || cur.user) return;
3477
+ let alive = true;
3478
+ api.auth.me().then((r) => {
3479
+ const project = r.project?.name || void 0;
3480
+ const user = r.user?.name || r.user?.email || void 0;
3481
+ if (!alive || !project && !user) return;
3482
+ saveAccount({ ...cur, project, user });
3483
+ setAccounts(listAccounts());
3484
+ }).catch(() => {
3485
+ });
3486
+ return () => {
3487
+ alive = false;
3488
+ };
3489
+ }, [cur]);
3466
3490
  const viewAccount = (a) => {
3467
3491
  setViewCredentials({ apiKey: a.apiKey, apiUrl: a.apiUrl });
3468
3492
  setAccounts(listAccounts());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.81.46",
3
+ "version": "0.81.47",
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": {