@solongate/proxy 0.59.4 → 0.60.0

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.
Files changed (40) hide show
  1. package/dist/api-client/agents.d.ts +10 -0
  2. package/dist/api-client/audit.d.ts +22 -0
  3. package/dist/api-client/client.d.ts +39 -0
  4. package/dist/api-client/index.d.ts +18 -0
  5. package/dist/api-client/policies.d.ts +82 -0
  6. package/dist/api-client/settings.d.ts +22 -0
  7. package/dist/api-client/stats.d.ts +9 -0
  8. package/dist/api-client/types.d.ts +224 -0
  9. package/dist/audit/index.js +0 -1
  10. package/dist/commands/agents.d.ts +4 -0
  11. package/dist/commands/args.d.ts +15 -0
  12. package/dist/commands/audit.d.ts +1 -0
  13. package/dist/commands/dlp.d.ts +1 -0
  14. package/dist/commands/format.d.ts +22 -0
  15. package/dist/commands/index.d.ts +7 -0
  16. package/dist/commands/index.js +938 -0
  17. package/dist/commands/policy.d.ts +1 -0
  18. package/dist/commands/ratelimit.d.ts +1 -0
  19. package/dist/commands/stats.d.ts +1 -0
  20. package/dist/index.js +2059 -348
  21. package/dist/inject.js +4 -4
  22. package/dist/lib.js +3 -31
  23. package/dist/proxy.d.ts +0 -7
  24. package/dist/pull-push.js +2 -1
  25. package/dist/tui/App.d.ts +1 -0
  26. package/dist/tui/components.d.ts +40 -0
  27. package/dist/tui/hooks.d.ts +13 -0
  28. package/dist/tui/index.d.ts +1 -0
  29. package/dist/tui/index.js +881 -0
  30. package/dist/tui/panels/Agents.d.ts +3 -0
  31. package/dist/tui/panels/Audit.d.ts +4 -0
  32. package/dist/tui/panels/Dlp.d.ts +4 -0
  33. package/dist/tui/panels/Policies.d.ts +4 -0
  34. package/dist/tui/panels/RateLimit.d.ts +4 -0
  35. package/dist/tui/panels/Stats.d.ts +3 -0
  36. package/dist/tui/theme.d.ts +16 -0
  37. package/hooks/audit.mjs +23 -4
  38. package/hooks/guard.bundled.mjs +46 -35
  39. package/hooks/guard.mjs +16 -2
  40. package/package.json +7 -2
package/dist/inject.js CHANGED
@@ -137,8 +137,8 @@ function findTsEntryFile() {
137
137
  "server.ts",
138
138
  "main.ts"
139
139
  ];
140
- for (const c3 of candidates) {
141
- const full = resolve(c3);
140
+ for (const c2 of candidates) {
141
+ const full = resolve(c2);
142
142
  if (existsSync(full)) {
143
143
  try {
144
144
  const content = readFileSync(full, "utf-8");
@@ -149,8 +149,8 @@ function findTsEntryFile() {
149
149
  }
150
150
  }
151
151
  }
152
- for (const c3 of candidates) {
153
- if (existsSync(resolve(c3))) return resolve(c3);
152
+ for (const c2 of candidates) {
153
+ if (existsSync(resolve(c2))) return resolve(c2);
154
154
  }
155
155
  return null;
156
156
  }
package/dist/lib.js CHANGED
@@ -8991,7 +8991,7 @@ import {
8991
8991
  } from "@modelcontextprotocol/sdk/types.js";
8992
8992
  import { createServer as createHttpServer } from "http";
8993
8993
  import { resolve as resolve2, join as join3 } from "path";
8994
- import { mkdirSync as mkdirSync3, appendFileSync } from "fs";
8994
+ import { mkdirSync as mkdirSync2, appendFileSync } from "fs";
8995
8995
 
8996
8996
  // src/config.ts
8997
8997
  import { readFileSync as readFileSync2, existsSync } from "fs";
@@ -9030,6 +9030,7 @@ async function fetchCloudPolicy(apiKey, apiUrl, policyId) {
9030
9030
  return {
9031
9031
  id: String(data.id ?? "cloud"),
9032
9032
  name: String(data.name ?? "Cloud Policy"),
9033
+ description: String(data.description ?? ""),
9033
9034
  version: Number(data._version ?? 1),
9034
9035
  rules: data.rules ?? [],
9035
9036
  createdAt: String(data._created_at ?? ""),
@@ -9364,8 +9365,6 @@ var SolonGateProxy = class {
9364
9365
  /** Agent identity for trust map — resolved from CLI flag, HTTP headers, or MCP clientInfo */
9365
9366
  agentId = null;
9366
9367
  agentName = null;
9367
- /** Per-session agent info for HTTP mode (keyed by session ID) */
9368
- httpAgentInfo = /* @__PURE__ */ new Map();
9369
9368
  /** Per-request sub-agent info from HTTP headers (transient, overwritten per request) */
9370
9369
  httpSubAgent = null;
9371
9370
  constructor(config) {
@@ -9571,7 +9570,7 @@ var SolonGateProxy = class {
9571
9570
  pid: process.pid
9572
9571
  };
9573
9572
  const debugDir = resolve2(".solongate");
9574
- mkdirSync3(debugDir, { recursive: true });
9573
+ mkdirSync2(debugDir, { recursive: true });
9575
9574
  appendFileSync(join3(debugDir, ".debug-proxy"), JSON.stringify(debugInfo) + "\n");
9576
9575
  } catch {
9577
9576
  }
@@ -9847,33 +9846,6 @@ ${msg.content.text}`;
9847
9846
  /**
9848
9847
  * Extract protected filenames from policy DENY rules (filenameConstraints.denied).
9849
9848
  */
9850
- extractProtectedFiles() {
9851
- const files = /* @__PURE__ */ new Set();
9852
- for (const rule of this.config.policy.rules) {
9853
- if (rule.effect === "DENY" && rule.enabled !== false) {
9854
- const denied = rule.filenameConstraints?.denied;
9855
- if (denied) {
9856
- for (const f of denied) files.add(f);
9857
- }
9858
- }
9859
- }
9860
- return [...files];
9861
- }
9862
- /**
9863
- * Extract protected paths from policy DENY rules (pathConstraints.denied).
9864
- */
9865
- extractProtectedPaths() {
9866
- const paths = /* @__PURE__ */ new Set();
9867
- for (const rule of this.config.policy.rules) {
9868
- if (rule.effect === "DENY" && rule.enabled !== false) {
9869
- const denied = rule.pathConstraints?.denied;
9870
- if (denied) {
9871
- for (const p of denied) paths.add(p);
9872
- }
9873
- }
9874
- }
9875
- return [...paths];
9876
- }
9877
9849
  startPolicySync() {
9878
9850
  const apiKey = this.config.apiKey;
9879
9851
  if (!apiKey) return;
package/dist/proxy.d.ts CHANGED
@@ -24,8 +24,6 @@ export declare class SolonGateProxy {
24
24
  /** Agent identity for trust map — resolved from CLI flag, HTTP headers, or MCP clientInfo */
25
25
  private agentId;
26
26
  private agentName;
27
- /** Per-session agent info for HTTP mode (keyed by session ID) */
28
- private httpAgentInfo;
29
27
  /** Per-request sub-agent info from HTTP headers (transient, overwritten per request) */
30
28
  private httpSubAgent;
31
29
  constructor(config: ProxyConfig);
@@ -74,11 +72,6 @@ export declare class SolonGateProxy {
74
72
  /**
75
73
  * Extract protected filenames from policy DENY rules (filenameConstraints.denied).
76
74
  */
77
- private extractProtectedFiles;
78
- /**
79
- * Extract protected paths from policy DENY rules (pathConstraints.denied).
80
- */
81
- private extractProtectedPaths;
82
75
  private startPolicySync;
83
76
  /**
84
77
  * Start serving downstream.
package/dist/pull-push.js CHANGED
@@ -40,6 +40,7 @@ async function fetchCloudPolicy(apiKey, apiUrl, policyId) {
40
40
  return {
41
41
  id: String(data.id ?? "cloud"),
42
42
  name: String(data.name ?? "Cloud Policy"),
43
+ description: String(data.description ?? ""),
43
44
  version: Number(data._version ?? 1),
44
45
  rules: data.rules ?? [],
45
46
  createdAt: String(data._created_at ?? ""),
@@ -161,7 +162,7 @@ async function list(apiKey, policyId) {
161
162
  )
162
163
  );
163
164
  for (const { policy, rules } of fullPolicies) {
164
- printPolicySummary(policy, rules);
165
+ printPolicySummary(policy, [...rules]);
165
166
  }
166
167
  log(dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
167
168
  log("");
@@ -0,0 +1 @@
1
+ export declare function App(): JSX.Element;
@@ -0,0 +1,40 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function Panel({ title, subtitle, children }: {
3
+ title: string;
4
+ subtitle?: string;
5
+ children: ReactNode;
6
+ }): JSX.Element;
7
+ /** Wraps panel content with loading / error / empty handling. */
8
+ export declare function DataView({ loading, error, empty, emptyText, children, }: {
9
+ loading: boolean;
10
+ error: string | null;
11
+ empty?: boolean;
12
+ emptyText?: string;
13
+ children: ReactNode;
14
+ }): JSX.Element;
15
+ export interface Column {
16
+ header: string;
17
+ width: number;
18
+ }
19
+ export interface Cell {
20
+ value: string;
21
+ color?: string;
22
+ dim?: boolean;
23
+ bold?: boolean;
24
+ }
25
+ /** Fixed-width aligned table. Cells are padded/truncated to their column width. */
26
+ export declare function Table({ columns, rows }: {
27
+ columns: Column[];
28
+ rows: Cell[][];
29
+ }): JSX.Element;
30
+ /** A labeled horizontal bar (unicode blocks) scaled to `max`. */
31
+ export declare function Bar({ label, value, max, width, color }: {
32
+ label: string;
33
+ value: number;
34
+ max: number;
35
+ width?: number;
36
+ color?: string;
37
+ }): JSX.Element;
38
+ export declare function KeyHints({ hints }: {
39
+ hints: [string, string][];
40
+ }): JSX.Element;
@@ -0,0 +1,13 @@
1
+ export interface LoaderState<T> {
2
+ data: T | null;
3
+ error: string | null;
4
+ loading: boolean;
5
+ reload: () => void;
6
+ }
7
+ /**
8
+ * Load async data once (and on demand via reload()). Safe against unmount —
9
+ * a resolve after the component is gone is ignored.
10
+ */
11
+ export declare function useLoader<T>(fn: () => Promise<T>, deps?: unknown[]): LoaderState<T>;
12
+ /** Fire `reload` on a fixed interval (ms). Cleans up on unmount. */
13
+ export declare function usePoll(reload: () => void, intervalMs: number, enabled?: boolean): void;
@@ -0,0 +1 @@
1
+ export declare function launchTui(): Promise<void>;