@solongate/proxy 0.81.88 → 0.81.89

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
@@ -9140,9 +9140,9 @@ function RateLimitPanel({ focused }) {
9140
9140
  const lim = draft.perMinute;
9141
9141
  const now = insightsQ.data ? insightsQ.data["activity"]?.minute?.slice(-1)[0]?.count ?? 0 : 0;
9142
9142
  const loadPct = lim > 0 ? Math.min(100, Math.round(now / lim * 100)) : 0;
9143
- const peakFlag = (peak) => lim > 0 ? peak > lim ? ` OVER ${lim}` : peak === lim ? ` at ${lim}` : ` / ${lim}` : "";
9143
+ const last24h = (insightsQ.data?.["activity"]?.hour ?? []).reduce((s, b) => s + b.count, 0);
9144
9144
  const hasLoad = lim > 0;
9145
- const fixed = 1 + 4 + (hasLoad ? 1 : 0) + 1 + 1 + 1 + 1 + (dirty || status ? 1 : 0) + 1;
9145
+ const fixed = 1 + 4 + (hasLoad ? 1 : 0) + 5 + 1 + 1 + 1 + 1 + (dirty || status ? 1 : 0) + 1;
9146
9146
  const burstBudget = Math.max(1, rows - fixed);
9147
9147
  const shown = anomalies2.slice(0, burstBudget);
9148
9148
  const bw = Math.max(10, cols - 30);
@@ -9156,35 +9156,40 @@ function RateLimitPanel({ focused }) {
9156
9156
  /* @__PURE__ */ jsx4(FieldRow, { label: "Per hour", active: focused && fi === 2, children: /* @__PURE__ */ jsx4(Text4, { bold: true, children: draft.perHour || "off" }) }),
9157
9157
  /* @__PURE__ */ jsx4(FieldRow, { label: "Per day", active: focused && fi === 3, children: /* @__PURE__ */ jsx4(Text4, { bold: true, children: draft.perDay || "off" }) }),
9158
9158
  hasLoad ? /* @__PURE__ */ jsxs4(Text4, { wrap: "truncate", children: [
9159
- /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: "load".padEnd(13) }),
9160
- /* @__PURE__ */ jsx4(Text4, { color: loadPct >= 100 ? theme.bad : loadPct >= 80 ? theme.warn : theme.ok, children: "\u2588".repeat(Math.min(20, Math.round(now / lim * 20))) }),
9161
- /* @__PURE__ */ jsx4(Text4, { color: "#233457", children: "\u2591".repeat(Math.max(0, 20 - Math.round(now / lim * 20))) }),
9159
+ /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: "load now".padEnd(13) }),
9160
+ /* @__PURE__ */ jsx4(Text4, { color: loadPct >= 100 ? theme.bad : loadPct >= 80 ? theme.warn : theme.ok, children: "\u2588".repeat(Math.min(18, Math.round(now / lim * 18))) }),
9161
+ /* @__PURE__ */ jsx4(Text4, { color: "#233457", children: "\u2591".repeat(Math.max(0, 18 - Math.round(now / lim * 18))) }),
9162
9162
  /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: ` ${now}/${lim} this minute (${loadPct}%)` })
9163
9163
  ] }) : null,
9164
- /* @__PURE__ */ jsxs4(Text4, { wrap: "truncate", children: [
9165
- /* @__PURE__ */ jsx4(Text4, { color: theme.accentBright, bold: true, children: "Busiest 7d " }),
9166
- /* @__PURE__ */ jsx4(Text4, { color: peaks.minute > lim && lim > 0 ? theme.bad : theme.dim, children: `min ${peaks.minute}${peakFlag(peaks.minute)}` }),
9167
- /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: ` \xB7 hr ${peaks.hour} \xB7 day ${peaks.day}` })
9168
- ] }),
9169
9164
  /* @__PURE__ */ jsxs4(Text4, { color: theme.accentBright, bold: true, wrap: "truncate", children: [
9170
- `Recent bursts 7d${anomalies2.length ? ` (${anomalies2.length})` : ""}`,
9171
- /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: " over the per-minute limit \xB7 Bypassed = detect (not blocked)" })
9165
+ "Busiest 7d",
9166
+ /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: " most calls in one window vs your limit" })
9167
+ ] }),
9168
+ /* @__PURE__ */ jsx4(BusiestRow, { label: "minute", peak: peaks.minute, limit: draft.perMinute }),
9169
+ /* @__PURE__ */ jsx4(BusiestRow, { label: "hour", peak: peaks.hour, limit: draft.perHour }),
9170
+ /* @__PURE__ */ jsx4(BusiestRow, { label: "day", peak: peaks.day, limit: draft.perDay }),
9171
+ /* @__PURE__ */ jsx4(Text4, { color: theme.dim, wrap: "truncate", children: `activity`.padEnd(11) + ` last 24h \xB7 ${last24h} calls \xB7 busiest hour ${peaks.hour}/hr` }),
9172
+ /* @__PURE__ */ jsxs4(Box4, { marginTop: 1, flexDirection: "column", children: [
9173
+ /* @__PURE__ */ jsxs4(Text4, { color: theme.accentBright, bold: true, wrap: "truncate", children: [
9174
+ `Recent bursts 7d${anomalies2.length ? ` (${anomalies2.length})` : ""}`,
9175
+ /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: " over the per-minute limit \xB7 Bypassed = detect (not blocked)" })
9176
+ ] }),
9177
+ anomalies2.length === 0 ? /* @__PURE__ */ jsxs4(Text4, { color: theme.dim, children: [
9178
+ " ",
9179
+ insightsQ.loading ? "loading\u2026" : "no bursts in the last 7 days"
9180
+ ] }) : /* @__PURE__ */ jsx4(
9181
+ Table,
9182
+ {
9183
+ columns: [{ header: "WHEN", width: 13 }, { header: "RESULT", width: 9 }, { header: "CALLS", width: 7 }, { header: "AGENT", width: Math.max(8, bw - 29) }],
9184
+ rows: shown.map((a) => [
9185
+ { value: when(new Date(a.minute).getTime()), dim: true },
9186
+ { value: a.blocked ? "Blocked" : "Bypassed", color: a.blocked ? theme.bad : theme.warn },
9187
+ { value: `${a.count}/${a.limit}`, color: theme.warn },
9188
+ { value: truncate2(a.agent, Math.max(8, bw - 29)), dim: true }
9189
+ ])
9190
+ }
9191
+ )
9172
9192
  ] }),
9173
- anomalies2.length === 0 ? /* @__PURE__ */ jsxs4(Text4, { color: theme.dim, children: [
9174
- " ",
9175
- insightsQ.loading ? "loading\u2026" : "no bursts in the last 7 days"
9176
- ] }) : /* @__PURE__ */ jsx4(
9177
- Table,
9178
- {
9179
- columns: [{ header: "WHEN", width: 13 }, { header: "RESULT", width: 9 }, { header: "CALLS", width: 7 }, { header: "AGENT", width: Math.max(8, bw - 29) }],
9180
- rows: shown.map((a) => [
9181
- { value: when(new Date(a.minute).getTime()), dim: true },
9182
- { value: a.blocked ? "Blocked" : "Bypassed", color: a.blocked ? theme.bad : theme.warn },
9183
- { value: `${a.count}/${a.limit}`, color: theme.warn },
9184
- { value: truncate2(a.agent, Math.max(8, bw - 29)), dim: true }
9185
- ])
9186
- }
9187
- ),
9188
9193
  /* @__PURE__ */ jsxs4(Text4, { wrap: "truncate", children: [
9189
9194
  /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: "limit now " }),
9190
9195
  /* @__PURE__ */ jsx4(Text4, { children: lim > 0 ? `${lim}/min` : "no per-minute limit" }),
@@ -9195,6 +9200,15 @@ function RateLimitPanel({ focused }) {
9195
9200
  ] });
9196
9201
  })() : null });
9197
9202
  }
9203
+ function BusiestRow({ label, peak, limit }) {
9204
+ const ctx = limit > 0 ? peak > limit ? `over ${limit}` : peak === limit ? `at limit ${limit}` : `limit ${limit}` : "no limit set";
9205
+ const hot = limit > 0 && peak > limit;
9206
+ return /* @__PURE__ */ jsxs4(Text4, { wrap: "truncate", children: [
9207
+ /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: (" " + label).padEnd(11) }),
9208
+ /* @__PURE__ */ jsx4(Text4, { color: hot ? theme.bad : void 0, bold: hot, children: String(peak).padStart(4) + " calls" }),
9209
+ /* @__PURE__ */ jsx4(Text4, { color: hot ? theme.bad : theme.dim, children: " \xB7 " + ctx })
9210
+ ] });
9211
+ }
9198
9212
  function FieldRow({ label, active: active2, children }) {
9199
9213
  return /* @__PURE__ */ jsxs4(Text4, { wrap: "truncate", children: [
9200
9214
  /* @__PURE__ */ jsx4(Text4, { color: active2 ? theme.accentBright : void 0, children: (active2 ? "\u25B8 " : " ") + label.padEnd(11) }),
package/dist/tui/index.js CHANGED
@@ -2233,9 +2233,9 @@ function RateLimitPanel({ focused }) {
2233
2233
  const lim = draft.perMinute;
2234
2234
  const now = insightsQ.data ? insightsQ.data["activity"]?.minute?.slice(-1)[0]?.count ?? 0 : 0;
2235
2235
  const loadPct = lim > 0 ? Math.min(100, Math.round(now / lim * 100)) : 0;
2236
- const peakFlag = (peak) => lim > 0 ? peak > lim ? ` OVER ${lim}` : peak === lim ? ` at ${lim}` : ` / ${lim}` : "";
2236
+ const last24h = (insightsQ.data?.["activity"]?.hour ?? []).reduce((s, b) => s + b.count, 0);
2237
2237
  const hasLoad = lim > 0;
2238
- const fixed = 1 + 4 + (hasLoad ? 1 : 0) + 1 + 1 + 1 + 1 + (dirty || status ? 1 : 0) + 1;
2238
+ const fixed = 1 + 4 + (hasLoad ? 1 : 0) + 5 + 1 + 1 + 1 + 1 + (dirty || status ? 1 : 0) + 1;
2239
2239
  const burstBudget = Math.max(1, rows - fixed);
2240
2240
  const shown = anomalies2.slice(0, burstBudget);
2241
2241
  const bw = Math.max(10, cols - 30);
@@ -2249,35 +2249,40 @@ function RateLimitPanel({ focused }) {
2249
2249
  /* @__PURE__ */ jsx4(FieldRow, { label: "Per hour", active: focused && fi === 2, children: /* @__PURE__ */ jsx4(Text4, { bold: true, children: draft.perHour || "off" }) }),
2250
2250
  /* @__PURE__ */ jsx4(FieldRow, { label: "Per day", active: focused && fi === 3, children: /* @__PURE__ */ jsx4(Text4, { bold: true, children: draft.perDay || "off" }) }),
2251
2251
  hasLoad ? /* @__PURE__ */ jsxs4(Text4, { wrap: "truncate", children: [
2252
- /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: "load".padEnd(13) }),
2253
- /* @__PURE__ */ jsx4(Text4, { color: loadPct >= 100 ? theme.bad : loadPct >= 80 ? theme.warn : theme.ok, children: "\u2588".repeat(Math.min(20, Math.round(now / lim * 20))) }),
2254
- /* @__PURE__ */ jsx4(Text4, { color: "#233457", children: "\u2591".repeat(Math.max(0, 20 - Math.round(now / lim * 20))) }),
2252
+ /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: "load now".padEnd(13) }),
2253
+ /* @__PURE__ */ jsx4(Text4, { color: loadPct >= 100 ? theme.bad : loadPct >= 80 ? theme.warn : theme.ok, children: "\u2588".repeat(Math.min(18, Math.round(now / lim * 18))) }),
2254
+ /* @__PURE__ */ jsx4(Text4, { color: "#233457", children: "\u2591".repeat(Math.max(0, 18 - Math.round(now / lim * 18))) }),
2255
2255
  /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: ` ${now}/${lim} this minute (${loadPct}%)` })
2256
2256
  ] }) : null,
2257
- /* @__PURE__ */ jsxs4(Text4, { wrap: "truncate", children: [
2258
- /* @__PURE__ */ jsx4(Text4, { color: theme.accentBright, bold: true, children: "Busiest 7d " }),
2259
- /* @__PURE__ */ jsx4(Text4, { color: peaks.minute > lim && lim > 0 ? theme.bad : theme.dim, children: `min ${peaks.minute}${peakFlag(peaks.minute)}` }),
2260
- /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: ` \xB7 hr ${peaks.hour} \xB7 day ${peaks.day}` })
2261
- ] }),
2262
2257
  /* @__PURE__ */ jsxs4(Text4, { color: theme.accentBright, bold: true, wrap: "truncate", children: [
2263
- `Recent bursts 7d${anomalies2.length ? ` (${anomalies2.length})` : ""}`,
2264
- /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: " over the per-minute limit \xB7 Bypassed = detect (not blocked)" })
2258
+ "Busiest 7d",
2259
+ /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: " most calls in one window vs your limit" })
2260
+ ] }),
2261
+ /* @__PURE__ */ jsx4(BusiestRow, { label: "minute", peak: peaks.minute, limit: draft.perMinute }),
2262
+ /* @__PURE__ */ jsx4(BusiestRow, { label: "hour", peak: peaks.hour, limit: draft.perHour }),
2263
+ /* @__PURE__ */ jsx4(BusiestRow, { label: "day", peak: peaks.day, limit: draft.perDay }),
2264
+ /* @__PURE__ */ jsx4(Text4, { color: theme.dim, wrap: "truncate", children: `activity`.padEnd(11) + ` last 24h \xB7 ${last24h} calls \xB7 busiest hour ${peaks.hour}/hr` }),
2265
+ /* @__PURE__ */ jsxs4(Box4, { marginTop: 1, flexDirection: "column", children: [
2266
+ /* @__PURE__ */ jsxs4(Text4, { color: theme.accentBright, bold: true, wrap: "truncate", children: [
2267
+ `Recent bursts 7d${anomalies2.length ? ` (${anomalies2.length})` : ""}`,
2268
+ /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: " over the per-minute limit \xB7 Bypassed = detect (not blocked)" })
2269
+ ] }),
2270
+ anomalies2.length === 0 ? /* @__PURE__ */ jsxs4(Text4, { color: theme.dim, children: [
2271
+ " ",
2272
+ insightsQ.loading ? "loading\u2026" : "no bursts in the last 7 days"
2273
+ ] }) : /* @__PURE__ */ jsx4(
2274
+ Table,
2275
+ {
2276
+ columns: [{ header: "WHEN", width: 13 }, { header: "RESULT", width: 9 }, { header: "CALLS", width: 7 }, { header: "AGENT", width: Math.max(8, bw - 29) }],
2277
+ rows: shown.map((a) => [
2278
+ { value: when(new Date(a.minute).getTime()), dim: true },
2279
+ { value: a.blocked ? "Blocked" : "Bypassed", color: a.blocked ? theme.bad : theme.warn },
2280
+ { value: `${a.count}/${a.limit}`, color: theme.warn },
2281
+ { value: truncate(a.agent, Math.max(8, bw - 29)), dim: true }
2282
+ ])
2283
+ }
2284
+ )
2265
2285
  ] }),
2266
- anomalies2.length === 0 ? /* @__PURE__ */ jsxs4(Text4, { color: theme.dim, children: [
2267
- " ",
2268
- insightsQ.loading ? "loading\u2026" : "no bursts in the last 7 days"
2269
- ] }) : /* @__PURE__ */ jsx4(
2270
- Table,
2271
- {
2272
- columns: [{ header: "WHEN", width: 13 }, { header: "RESULT", width: 9 }, { header: "CALLS", width: 7 }, { header: "AGENT", width: Math.max(8, bw - 29) }],
2273
- rows: shown.map((a) => [
2274
- { value: when(new Date(a.minute).getTime()), dim: true },
2275
- { value: a.blocked ? "Blocked" : "Bypassed", color: a.blocked ? theme.bad : theme.warn },
2276
- { value: `${a.count}/${a.limit}`, color: theme.warn },
2277
- { value: truncate(a.agent, Math.max(8, bw - 29)), dim: true }
2278
- ])
2279
- }
2280
- ),
2281
2286
  /* @__PURE__ */ jsxs4(Text4, { wrap: "truncate", children: [
2282
2287
  /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: "limit now " }),
2283
2288
  /* @__PURE__ */ jsx4(Text4, { children: lim > 0 ? `${lim}/min` : "no per-minute limit" }),
@@ -2288,6 +2293,15 @@ function RateLimitPanel({ focused }) {
2288
2293
  ] });
2289
2294
  })() : null });
2290
2295
  }
2296
+ function BusiestRow({ label, peak, limit }) {
2297
+ const ctx = limit > 0 ? peak > limit ? `over ${limit}` : peak === limit ? `at limit ${limit}` : `limit ${limit}` : "no limit set";
2298
+ const hot = limit > 0 && peak > limit;
2299
+ return /* @__PURE__ */ jsxs4(Text4, { wrap: "truncate", children: [
2300
+ /* @__PURE__ */ jsx4(Text4, { color: theme.dim, children: (" " + label).padEnd(11) }),
2301
+ /* @__PURE__ */ jsx4(Text4, { color: hot ? theme.bad : void 0, bold: hot, children: String(peak).padStart(4) + " calls" }),
2302
+ /* @__PURE__ */ jsx4(Text4, { color: hot ? theme.bad : theme.dim, children: " \xB7 " + ctx })
2303
+ ] });
2304
+ }
2291
2305
  function FieldRow({ label, active: active2, children }) {
2292
2306
  return /* @__PURE__ */ jsxs4(Text4, { wrap: "truncate", children: [
2293
2307
  /* @__PURE__ */ jsx4(Text4, { color: active2 ? theme.accentBright : void 0, children: (active2 ? "\u25B8 " : " ") + label.padEnd(11) }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.81.88",
3
+ "version": "0.81.89",
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": {