@solongate/proxy 0.81.30 → 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 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, BLOCKS;
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 = BLOCKS2[Math.min(BLOCKS2.length - 1, Math.round(n / max * (BLOCKS2.length - 1)))];
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, BLOCKS2;
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
- BLOCKS2 = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
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
- const tsQ = useLoader(() => source === "cloud" ? api.stats.timeseries({ period: "24h" }) : Promise.resolve(null), [source]);
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 \xB7 ${statsQ.data?.registered_tools ?? "\xB7"} tools \xB7 24h ` }),
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 " }),
@@ -9221,9 +9204,11 @@ function AuditPanel({ active: active2, focused }) {
9221
9204
  ] }, k))
9222
9205
  ] }, group)) });
9223
9206
  return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
9207
+ copyBanner,
9224
9208
  /* @__PURE__ */ jsxs6(Text6, { bold: true, color: theme.accentBright, children: [
9225
- "AUDIT \u2014 all keys ",
9226
- /* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: "\xB7 press any key to close" })
9209
+ "AUDIT \u2014 all keys",
9210
+ " ",
9211
+ /* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: frozen ? "\xB7 screen frozen \u2014 space resumes, other keys are locked" : "\xB7 press any key to close \xB7 space = copy mode (works here too)" })
9227
9212
  ] }),
9228
9213
  /* @__PURE__ */ jsxs6(Box6, { marginTop: 1, children: [
9229
9214
  colOf(AUDIT_HELP.slice(0, 1)),
@@ -9918,13 +9903,13 @@ function truncate3(s, n) {
9918
9903
  if (s.length <= n) return s;
9919
9904
  return s.slice(0, Math.max(0, n - 1)) + "\u2026";
9920
9905
  }
9921
- function sparkline2(values) {
9906
+ function sparkline(values) {
9922
9907
  if (values.length === 0) return "";
9923
9908
  const max = Math.max(...values, 0);
9924
- if (max === 0) return BLOCKS3[0].repeat(values.length);
9925
- return values.map((v) => BLOCKS3[Math.min(BLOCKS3.length - 1, Math.round(v / max * (BLOCKS3.length - 1)))]).join("");
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("");
9926
9911
  }
9927
- var out, err, dim, bold, green, red, yellow, cyan, ANSI, width, BLOCKS3;
9912
+ var out, err, dim, bold, green, red, yellow, cyan, ANSI, width, BLOCKS2;
9928
9913
  var init_format = __esm({
9929
9914
  "src/commands/format.ts"() {
9930
9915
  "use strict";
@@ -9939,7 +9924,7 @@ var init_format = __esm({
9939
9924
  cyan = (s) => `${c.cyan}${s}${c.reset}`;
9940
9925
  ANSI = /\x1b\[[0-9;]*m/g;
9941
9926
  width = (s) => s.replace(ANSI, "").length;
9942
- BLOCKS3 = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
9927
+ BLOCKS2 = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
9943
9928
  }
9944
9929
  });
9945
9930
 
@@ -10215,7 +10200,7 @@ async function run2(argv) {
10215
10200
  err(` Rate limit mode: ${modeColor2(rl.mode)}`);
10216
10201
  err(` ${bold(String(rl.perMinute))} ${dim("/min")} ${bold(String(rl.perHour))} ${dim("/hour")} ${bold(String(rl.perDay))} ${dim("/day")}`);
10217
10202
  if (history.length) {
10218
- const spark = sparkline2(history.map((h) => h.minute));
10203
+ const spark = sparkline(history.map((h) => h.minute));
10219
10204
  err(` history ${cyan(spark)} ${dim(`(${history.length} changes, per-min)`)}`);
10220
10205
  }
10221
10206
  return 0;
@@ -10402,9 +10387,9 @@ async function run4(argv) {
10402
10387
  const pts = ts.timeseries;
10403
10388
  err("");
10404
10389
  err(` Timeseries ${dim(`(${ts.period}, per ${ts.granularity})`)}`);
10405
- err(` total ${cyan(sparkline2(pts.map((p) => p.total)))} ${dim(`max ${Math.max(0, ...pts.map((p) => p.total))}`)}`);
10406
- err(` allowed ${green(sparkline2(pts.map((p) => p.allowed)))}`);
10407
- err(` denied ${red(sparkline2(pts.map((p) => p.denied)))}`);
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)))}`);
10408
10393
  return 0;
10409
10394
  }
10410
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 BLOCKS2 = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
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 = BLOCKS2[Math.min(BLOCKS2.length - 1, Math.round(n / max * (BLOCKS2.length - 1)))];
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
- const tsQ = useLoader(() => source === "cloud" ? api.stats.timeseries({ period: "24h" }) : Promise.resolve(null), [source]);
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 \xB7 ${statsQ.data?.registered_tools ?? "\xB7"} tools \xB7 24h ` }),
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 " }),
@@ -2625,9 +2608,11 @@ function AuditPanel({ active: active2, focused }) {
2625
2608
  ] }, k))
2626
2609
  ] }, group)) });
2627
2610
  return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
2611
+ copyBanner,
2628
2612
  /* @__PURE__ */ jsxs6(Text6, { bold: true, color: theme.accentBright, children: [
2629
- "AUDIT \u2014 all keys ",
2630
- /* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: "\xB7 press any key to close" })
2613
+ "AUDIT \u2014 all keys",
2614
+ " ",
2615
+ /* @__PURE__ */ jsx6(Text6, { color: theme.dim, children: frozen ? "\xB7 screen frozen \u2014 space resumes, other keys are locked" : "\xB7 press any key to close \xB7 space = copy mode (works here too)" })
2631
2616
  ] }),
2632
2617
  /* @__PURE__ */ jsxs6(Box6, { marginTop: 1, children: [
2633
2618
  colOf(AUDIT_HELP.slice(0, 1)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.81.30",
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": {