@solongate/proxy 0.81.31 → 0.81.32
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 +15 -32
- package/dist/tui/index.js +4 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6742,14 +6742,6 @@ function modeColor(m) {
|
|
|
6742
6742
|
if (m === "detect" || m === "idle") return theme.warn;
|
|
6743
6743
|
return theme.dim;
|
|
6744
6744
|
}
|
|
6745
|
-
function sparkline(values, width2) {
|
|
6746
|
-
let v = values;
|
|
6747
|
-
if (width2 && v.length > width2) v = v.slice(v.length - width2);
|
|
6748
|
-
if (v.length === 0) return "";
|
|
6749
|
-
const max = Math.max(...v, 0);
|
|
6750
|
-
if (max === 0) return BLOCKS[0].repeat(v.length);
|
|
6751
|
-
return v.map((n) => BLOCKS[Math.min(BLOCKS.length - 1, Math.round(n / max * (BLOCKS.length - 1)))]).join("");
|
|
6752
|
-
}
|
|
6753
6745
|
function prettyJson(s) {
|
|
6754
6746
|
try {
|
|
6755
6747
|
return JSON.stringify(JSON.parse(s), null, 2);
|
|
@@ -6782,7 +6774,7 @@ function ago(ts) {
|
|
|
6782
6774
|
if (s < 86400) return `${Math.floor(s / 3600)}h`;
|
|
6783
6775
|
return `${Math.floor(s / 86400)}d`;
|
|
6784
6776
|
}
|
|
6785
|
-
var accent, theme
|
|
6777
|
+
var accent, theme;
|
|
6786
6778
|
var init_theme = __esm({
|
|
6787
6779
|
"src/tui/theme.ts"() {
|
|
6788
6780
|
"use strict";
|
|
@@ -6796,7 +6788,6 @@ var init_theme = __esm({
|
|
|
6796
6788
|
bad: "red",
|
|
6797
6789
|
dim: "gray"
|
|
6798
6790
|
};
|
|
6799
|
-
BLOCKS = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
|
|
6800
6791
|
}
|
|
6801
6792
|
});
|
|
6802
6793
|
|
|
@@ -8538,7 +8529,7 @@ function ColoredSpark({ values, limit, width: width2 = 60 }) {
|
|
|
8538
8529
|
const v = values.length > width2 ? values.slice(values.length - width2) : values;
|
|
8539
8530
|
const max = Math.max(1, ...v);
|
|
8540
8531
|
return /* @__PURE__ */ jsx4(Text4, { children: v.map((n, i) => {
|
|
8541
|
-
const ch =
|
|
8532
|
+
const ch = BLOCKS[Math.min(BLOCKS.length - 1, Math.round(n / max * (BLOCKS.length - 1)))];
|
|
8542
8533
|
const over = limit > 0 && n > limit;
|
|
8543
8534
|
return /* @__PURE__ */ jsx4(Text4, { color: over ? theme.bad : theme.accent, children: ch }, i);
|
|
8544
8535
|
}) });
|
|
@@ -8670,7 +8661,7 @@ function FieldRow({ label, active: active2, children }) {
|
|
|
8670
8661
|
children
|
|
8671
8662
|
] });
|
|
8672
8663
|
}
|
|
8673
|
-
var MODES, FIELDS2,
|
|
8664
|
+
var MODES, FIELDS2, BLOCKS;
|
|
8674
8665
|
var init_RateLimit = __esm({
|
|
8675
8666
|
"src/tui/panels/RateLimit.tsx"() {
|
|
8676
8667
|
"use strict";
|
|
@@ -8680,7 +8671,7 @@ var init_RateLimit = __esm({
|
|
|
8680
8671
|
init_theme();
|
|
8681
8672
|
MODES = ["off", "detect", "block"];
|
|
8682
8673
|
FIELDS2 = ["mode", "perMinute", "perHour", "perDay"];
|
|
8683
|
-
|
|
8674
|
+
BLOCKS = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
|
|
8684
8675
|
}
|
|
8685
8676
|
});
|
|
8686
8677
|
|
|
@@ -8923,11 +8914,7 @@ function AuditPanel({ active: active2, focused }) {
|
|
|
8923
8914
|
const [frozen, setFrozen] = useState6(false);
|
|
8924
8915
|
const toTop = () => setSel(0);
|
|
8925
8916
|
const statsQ = useLoader(() => source === "cloud" ? api.stats.get() : Promise.resolve(null), [source]);
|
|
8926
|
-
|
|
8927
|
-
usePoll(() => {
|
|
8928
|
-
statsQ.reloadQuiet();
|
|
8929
|
-
tsQ.reloadQuiet();
|
|
8930
|
-
}, 15e3, active2 && source === "cloud" && !frozen);
|
|
8917
|
+
usePoll(statsQ.reloadQuiet, 15e3, active2 && source === "cloud" && !frozen);
|
|
8931
8918
|
const query = {
|
|
8932
8919
|
filter: DECISIONS[di],
|
|
8933
8920
|
signal: SIGNALS[gi],
|
|
@@ -9171,7 +9158,6 @@ function AuditPanel({ active: active2, focused }) {
|
|
|
9171
9158
|
},
|
|
9172
9159
|
{ isActive: focused && !editing }
|
|
9173
9160
|
);
|
|
9174
|
-
const points = tsQ.data?.timeseries ?? [];
|
|
9175
9161
|
const localAll = localQ.data ?? [];
|
|
9176
9162
|
const strip = source === "cloud" ? /* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
9177
9163
|
/* @__PURE__ */ jsx6(Text6, { bold: true, children: statsQ.data ? statsQ.data.total_calls : "\xB7\xB7\xB7\xB7" }),
|
|
@@ -9185,10 +9171,7 @@ function AuditPanel({ active: active2, focused }) {
|
|
|
9185
9171
|
statsQ.data?.denied ?? "\xB7\xB7",
|
|
9186
9172
|
" deny"
|
|
9187
9173
|
] }),
|
|
9188
|
-
/* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: ` \xB7 ${statsQ.data?.active_policies ?? "\xB7"} policies
|
|
9189
|
-
/* @__PURE__ */ jsx6(Text6, { color: theme.accent, children: sparkline(points.map((p) => p.total), 24) }),
|
|
9190
|
-
/* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: " deny " }),
|
|
9191
|
-
/* @__PURE__ */ jsx6(Text6, { color: theme.bad, children: sparkline(points.map((p) => p.denied), 24) })
|
|
9174
|
+
/* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: ` \xB7 ${statsQ.data?.active_policies ?? "\xB7"} policies` })
|
|
9192
9175
|
] }) : /* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
9193
9176
|
/* @__PURE__ */ jsx6(Text6, { bold: true, children: localAll.length }),
|
|
9194
9177
|
/* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: " calls in local file \xB7 " }),
|
|
@@ -9920,13 +9903,13 @@ function truncate3(s, n) {
|
|
|
9920
9903
|
if (s.length <= n) return s;
|
|
9921
9904
|
return s.slice(0, Math.max(0, n - 1)) + "\u2026";
|
|
9922
9905
|
}
|
|
9923
|
-
function
|
|
9906
|
+
function sparkline(values) {
|
|
9924
9907
|
if (values.length === 0) return "";
|
|
9925
9908
|
const max = Math.max(...values, 0);
|
|
9926
|
-
if (max === 0) return
|
|
9927
|
-
return values.map((v) =>
|
|
9909
|
+
if (max === 0) return BLOCKS2[0].repeat(values.length);
|
|
9910
|
+
return values.map((v) => BLOCKS2[Math.min(BLOCKS2.length - 1, Math.round(v / max * (BLOCKS2.length - 1)))]).join("");
|
|
9928
9911
|
}
|
|
9929
|
-
var out, err, dim, bold, green, red, yellow, cyan, ANSI, width,
|
|
9912
|
+
var out, err, dim, bold, green, red, yellow, cyan, ANSI, width, BLOCKS2;
|
|
9930
9913
|
var init_format = __esm({
|
|
9931
9914
|
"src/commands/format.ts"() {
|
|
9932
9915
|
"use strict";
|
|
@@ -9941,7 +9924,7 @@ var init_format = __esm({
|
|
|
9941
9924
|
cyan = (s) => `${c.cyan}${s}${c.reset}`;
|
|
9942
9925
|
ANSI = /\x1b\[[0-9;]*m/g;
|
|
9943
9926
|
width = (s) => s.replace(ANSI, "").length;
|
|
9944
|
-
|
|
9927
|
+
BLOCKS2 = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
|
|
9945
9928
|
}
|
|
9946
9929
|
});
|
|
9947
9930
|
|
|
@@ -10217,7 +10200,7 @@ async function run2(argv) {
|
|
|
10217
10200
|
err(` Rate limit mode: ${modeColor2(rl.mode)}`);
|
|
10218
10201
|
err(` ${bold(String(rl.perMinute))} ${dim("/min")} ${bold(String(rl.perHour))} ${dim("/hour")} ${bold(String(rl.perDay))} ${dim("/day")}`);
|
|
10219
10202
|
if (history.length) {
|
|
10220
|
-
const spark =
|
|
10203
|
+
const spark = sparkline(history.map((h) => h.minute));
|
|
10221
10204
|
err(` history ${cyan(spark)} ${dim(`(${history.length} changes, per-min)`)}`);
|
|
10222
10205
|
}
|
|
10223
10206
|
return 0;
|
|
@@ -10404,9 +10387,9 @@ async function run4(argv) {
|
|
|
10404
10387
|
const pts = ts.timeseries;
|
|
10405
10388
|
err("");
|
|
10406
10389
|
err(` Timeseries ${dim(`(${ts.period}, per ${ts.granularity})`)}`);
|
|
10407
|
-
err(` total ${cyan(
|
|
10408
|
-
err(` allowed ${green(
|
|
10409
|
-
err(` denied ${red(
|
|
10390
|
+
err(` total ${cyan(sparkline(pts.map((p) => p.total)))} ${dim(`max ${Math.max(0, ...pts.map((p) => p.total))}`)}`);
|
|
10391
|
+
err(` allowed ${green(sparkline(pts.map((p) => p.allowed)))}`);
|
|
10392
|
+
err(` denied ${red(sparkline(pts.map((p) => p.denied)))}`);
|
|
10410
10393
|
return 0;
|
|
10411
10394
|
}
|
|
10412
10395
|
case "drift": {
|
package/dist/tui/index.js
CHANGED
|
@@ -87,15 +87,6 @@ function modeColor(m) {
|
|
|
87
87
|
if (m === "detect" || m === "idle") return theme.warn;
|
|
88
88
|
return theme.dim;
|
|
89
89
|
}
|
|
90
|
-
var BLOCKS = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
|
|
91
|
-
function sparkline(values, width) {
|
|
92
|
-
let v = values;
|
|
93
|
-
if (width && v.length > width) v = v.slice(v.length - width);
|
|
94
|
-
if (v.length === 0) return "";
|
|
95
|
-
const max = Math.max(...v, 0);
|
|
96
|
-
if (max === 0) return BLOCKS[0].repeat(v.length);
|
|
97
|
-
return v.map((n) => BLOCKS[Math.min(BLOCKS.length - 1, Math.round(n / max * (BLOCKS.length - 1)))]).join("");
|
|
98
|
-
}
|
|
99
90
|
function prettyJson(s) {
|
|
100
91
|
try {
|
|
101
92
|
return JSON.stringify(JSON.parse(s), null, 2);
|
|
@@ -1893,12 +1884,12 @@ import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
|
1893
1884
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1894
1885
|
var MODES = ["off", "detect", "block"];
|
|
1895
1886
|
var FIELDS2 = ["mode", "perMinute", "perHour", "perDay"];
|
|
1896
|
-
var
|
|
1887
|
+
var BLOCKS = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
|
|
1897
1888
|
function ColoredSpark({ values, limit, width = 60 }) {
|
|
1898
1889
|
const v = values.length > width ? values.slice(values.length - width) : values;
|
|
1899
1890
|
const max = Math.max(1, ...v);
|
|
1900
1891
|
return /* @__PURE__ */ jsx4(Text4, { children: v.map((n, i) => {
|
|
1901
|
-
const ch =
|
|
1892
|
+
const ch = BLOCKS[Math.min(BLOCKS.length - 1, Math.round(n / max * (BLOCKS.length - 1)))];
|
|
1902
1893
|
const over = limit > 0 && n > limit;
|
|
1903
1894
|
return /* @__PURE__ */ jsx4(Text4, { color: over ? theme.bad : theme.accent, children: ch }, i);
|
|
1904
1895
|
}) });
|
|
@@ -2327,11 +2318,7 @@ function AuditPanel({ active: active2, focused }) {
|
|
|
2327
2318
|
const [frozen, setFrozen] = useState6(false);
|
|
2328
2319
|
const toTop = () => setSel(0);
|
|
2329
2320
|
const statsQ = useLoader(() => source === "cloud" ? api.stats.get() : Promise.resolve(null), [source]);
|
|
2330
|
-
|
|
2331
|
-
usePoll(() => {
|
|
2332
|
-
statsQ.reloadQuiet();
|
|
2333
|
-
tsQ.reloadQuiet();
|
|
2334
|
-
}, 15e3, active2 && source === "cloud" && !frozen);
|
|
2321
|
+
usePoll(statsQ.reloadQuiet, 15e3, active2 && source === "cloud" && !frozen);
|
|
2335
2322
|
const query = {
|
|
2336
2323
|
filter: DECISIONS[di],
|
|
2337
2324
|
signal: SIGNALS[gi],
|
|
@@ -2575,7 +2562,6 @@ function AuditPanel({ active: active2, focused }) {
|
|
|
2575
2562
|
},
|
|
2576
2563
|
{ isActive: focused && !editing }
|
|
2577
2564
|
);
|
|
2578
|
-
const points = tsQ.data?.timeseries ?? [];
|
|
2579
2565
|
const localAll = localQ.data ?? [];
|
|
2580
2566
|
const strip = source === "cloud" ? /* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
2581
2567
|
/* @__PURE__ */ jsx6(Text6, { bold: true, children: statsQ.data ? statsQ.data.total_calls : "\xB7\xB7\xB7\xB7" }),
|
|
@@ -2589,10 +2575,7 @@ function AuditPanel({ active: active2, focused }) {
|
|
|
2589
2575
|
statsQ.data?.denied ?? "\xB7\xB7",
|
|
2590
2576
|
" deny"
|
|
2591
2577
|
] }),
|
|
2592
|
-
/* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: ` \xB7 ${statsQ.data?.active_policies ?? "\xB7"} policies
|
|
2593
|
-
/* @__PURE__ */ jsx6(Text6, { color: theme.accent, children: sparkline(points.map((p) => p.total), 24) }),
|
|
2594
|
-
/* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: " deny " }),
|
|
2595
|
-
/* @__PURE__ */ jsx6(Text6, { color: theme.bad, children: sparkline(points.map((p) => p.denied), 24) })
|
|
2578
|
+
/* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: ` \xB7 ${statsQ.data?.active_policies ?? "\xB7"} policies` })
|
|
2596
2579
|
] }) : /* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
2597
2580
|
/* @__PURE__ */ jsx6(Text6, { bold: true, children: localAll.length }),
|
|
2598
2581
|
/* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: " calls in local file \xB7 " }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.32",
|
|
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": {
|