@solongate/proxy 0.81.67 → 0.81.69

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.
@@ -67,6 +67,7 @@ export declare function updateAlert(id: string, patch: {
67
67
  windowSeconds?: number;
68
68
  emails?: string[];
69
69
  telegram?: string[];
70
+ enabled?: boolean;
70
71
  }): Promise<{
71
72
  rule: AlertRule;
72
73
  }>;
package/dist/index.js CHANGED
@@ -6600,10 +6600,16 @@ function newerThan(b, a) {
6600
6600
  }
6601
6601
  async function fetchLatest() {
6602
6602
  try {
6603
- const res = await fetch(`https://registry.npmjs.org/${PKG}/latest`, { signal: AbortSignal.timeout(2e3) });
6603
+ const res = await fetch(`https://registry.npmjs.org/${PKG}`, {
6604
+ headers: { accept: "application/vnd.npm.install-v1+json" },
6605
+ signal: AbortSignal.timeout(3e3)
6606
+ });
6604
6607
  if (!res.ok) return null;
6605
6608
  const j = await res.json();
6606
- return typeof j.version === "string" ? j.version : null;
6609
+ const latest = j["dist-tags"]?.latest;
6610
+ if (typeof latest !== "string") return null;
6611
+ if (!j.versions || !(latest in j.versions)) return null;
6612
+ return latest;
6607
6613
  } catch {
6608
6614
  return null;
6609
6615
  }
@@ -10202,6 +10208,7 @@ function SettingsPanel({
10202
10208
  signal: rule?.signal ?? "any",
10203
10209
  threshold: rule?.threshold ?? THRESH_MIN,
10204
10210
  windowSeconds: rule?.windowSeconds ?? 300,
10211
+ enabled: rule?.enabled ?? true,
10205
10212
  field: rule ? 1 : 0
10206
10213
  // new rule starts on the target; existing on signal
10207
10214
  });
@@ -10229,7 +10236,7 @@ function SettingsPanel({
10229
10236
  return;
10230
10237
  }
10231
10238
  const channels = editor.channel === "email" ? { emails: [t.value], telegram: [] } : { telegram: [t.value], emails: [] };
10232
- const body = { signal: editor.signal, threshold: editor.threshold, windowSeconds: editor.windowSeconds, ...channels };
10239
+ const body = { signal: editor.signal, threshold: editor.threshold, windowSeconds: editor.windowSeconds, enabled: editor.enabled, ...channels };
10233
10240
  const id = editor.id;
10234
10241
  setEditor(null);
10235
10242
  if (id) run12("alert updated", () => api.settings.updateAlert(id, body), alertQ.reload);
@@ -10317,13 +10324,15 @@ function SettingsPanel({
10317
10324
  saveEditor();
10318
10325
  return;
10319
10326
  }
10320
- if (key.upArrow) setEditor({ ...editor, field: (editor.field + EDITOR_FIELDS - 1) % EDITOR_FIELDS });
10321
- else if (key.downArrow) setEditor({ ...editor, field: (editor.field + 1) % EDITOR_FIELDS });
10327
+ const nFields = editorFieldCount(editor);
10328
+ if (key.upArrow) setEditor({ ...editor, field: (editor.field + nFields - 1) % nFields });
10329
+ else if (key.downArrow) setEditor({ ...editor, field: (editor.field + 1) % nFields });
10322
10330
  else if (key.leftArrow || key.rightArrow) {
10323
10331
  const d = key.rightArrow ? 1 : -1;
10324
10332
  if (editor.field === 1) setEditor({ ...editor, signal: SIGNALS2[(SIGNALS2.indexOf(editor.signal) + d + SIGNALS2.length) % SIGNALS2.length] });
10325
10333
  else if (editor.field === 2) setEditor({ ...editor, threshold: Math.max(THRESH_MIN, Math.min(THRESH_MAX, editor.threshold + d * 5)) });
10326
10334
  else if (editor.field === 3) setEditor({ ...editor, windowSeconds: WINDOWS[Math.max(0, Math.min(WINDOWS.length - 1, nearestWindowIdx(editor.windowSeconds) + d))] });
10335
+ else if (editor.field === 4) setEditor({ ...editor, enabled: !editor.enabled });
10327
10336
  }
10328
10337
  return;
10329
10338
  }
@@ -10435,9 +10444,10 @@ function SettingsPanel({
10435
10444
  fieldRow(0, "target", editor.target ? /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: truncate2(editor.target, cols - 16) }) : /* @__PURE__ */ jsx7(Text7, { color: theme.dim, children: "empty \u2014 press e" }), "press e to edit"),
10436
10445
  fieldRow(1, "signal", /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: SIGNAL_LABEL[editor.signal] }), "\u2190\u2192 change"),
10437
10446
  fieldRow(2, "threshold", /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: `\u2265 ${editor.threshold}` }), "\u2190\u2192 \xB15"),
10438
- fieldRow(3, "window", /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: winLabel(editor.windowSeconds) }), "\u2190\u2192 change")
10447
+ fieldRow(3, "window", /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: winLabel(editor.windowSeconds) }), "\u2190\u2192 change"),
10448
+ editor.id ? fieldRow(4, "status", editor.enabled ? /* @__PURE__ */ jsx7(Text7, { color: theme.ok, children: "on" }) : /* @__PURE__ */ jsx7(Text7, { color: theme.dim, children: "off" }), "\u2190\u2192 turn on/off") : null
10439
10449
  ] }),
10440
- /* @__PURE__ */ jsx7(Box7, { marginTop: 1, children: /* @__PURE__ */ jsxs7(Text7, { color: theme.dim, children: [
10450
+ /* @__PURE__ */ jsx7(Box7, { marginTop: 1, children: editor.id && !editor.enabled ? /* @__PURE__ */ jsx7(Text7, { color: theme.warn, children: "disabled \u2014 this alert will NOT fire until you set status back to on" }) : /* @__PURE__ */ jsxs7(Text7, { color: theme.dim, children: [
10441
10451
  "fires when ",
10442
10452
  /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: SIGNAL_LABEL[editor.signal] }),
10443
10453
  " reach ",
@@ -10548,7 +10558,7 @@ function SettingsPanel({
10548
10558
  PROTECTION: "guard hook version + self-protection toggle",
10549
10559
  "LOCAL LOGS": "mirror every decision to a file + dashboard link",
10550
10560
  WEBHOOKS: `POST events to a URL (${webhooks.length}) \xB7 t tests`,
10551
- ALERTS: `one email + one telegram (${alerts.length}) \xB7 enter edits`
10561
+ ALERTS: `one email + one telegram (${alerts.length}) \xB7 enter edits \xB7 m on/off`
10552
10562
  };
10553
10563
  const lineEls = [];
10554
10564
  const lineKey = [];
@@ -10600,7 +10610,7 @@ function SettingsPanel({
10600
10610
  /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", height: budget, overflow: "hidden", children: win })
10601
10611
  ] }) });
10602
10612
  }
10603
- var EVENTS, SPIN2, SIGNALS2, SIGNAL_LABEL, WINDOWS, winLabel, THRESH_MIN, THRESH_MAX, nearestWindowIdx, EDITOR_FIELDS, acctLabel, alertChannel;
10613
+ var EVENTS, SPIN2, SIGNALS2, SIGNAL_LABEL, WINDOWS, winLabel, THRESH_MIN, THRESH_MAX, nearestWindowIdx, editorFieldCount, acctLabel, alertChannel;
10604
10614
  var init_Settings = __esm({
10605
10615
  "src/tui/panels/Settings.tsx"() {
10606
10616
  "use strict";
@@ -10624,7 +10634,7 @@ var init_Settings = __esm({
10624
10634
  for (let i = 1; i < WINDOWS.length; i++) if (Math.abs(WINDOWS[i] - s) < Math.abs(WINDOWS[best] - s)) best = i;
10625
10635
  return best;
10626
10636
  };
10627
- EDITOR_FIELDS = 4;
10637
+ editorFieldCount = (e) => e.id ? 5 : 4;
10628
10638
  acctLabel = (a) => a.email || a.user || "account \u2026" + a.apiKey.slice(-4);
10629
10639
  alertChannel = (r) => r.emails && r.emails.length ? "email" : r.telegram && r.telegram.length ? "telegram" : null;
10630
10640
  }
package/dist/tui/index.js CHANGED
@@ -3204,7 +3204,7 @@ var nearestWindowIdx = (s) => {
3204
3204
  for (let i = 1; i < WINDOWS.length; i++) if (Math.abs(WINDOWS[i] - s) < Math.abs(WINDOWS[best] - s)) best = i;
3205
3205
  return best;
3206
3206
  };
3207
- var EDITOR_FIELDS = 4;
3207
+ var editorFieldCount = (e) => e.id ? 5 : 4;
3208
3208
  var acctLabel = (a) => a.email || a.user || "account \u2026" + a.apiKey.slice(-4);
3209
3209
  var alertChannel = (r) => r.emails && r.emails.length ? "email" : r.telegram && r.telegram.length ? "telegram" : null;
3210
3210
  function SettingsPanel({
@@ -3329,6 +3329,7 @@ function SettingsPanel({
3329
3329
  signal: rule?.signal ?? "any",
3330
3330
  threshold: rule?.threshold ?? THRESH_MIN,
3331
3331
  windowSeconds: rule?.windowSeconds ?? 300,
3332
+ enabled: rule?.enabled ?? true,
3332
3333
  field: rule ? 1 : 0
3333
3334
  // new rule starts on the target; existing on signal
3334
3335
  });
@@ -3356,7 +3357,7 @@ function SettingsPanel({
3356
3357
  return;
3357
3358
  }
3358
3359
  const channels = editor.channel === "email" ? { emails: [t.value], telegram: [] } : { telegram: [t.value], emails: [] };
3359
- const body = { signal: editor.signal, threshold: editor.threshold, windowSeconds: editor.windowSeconds, ...channels };
3360
+ const body = { signal: editor.signal, threshold: editor.threshold, windowSeconds: editor.windowSeconds, enabled: editor.enabled, ...channels };
3360
3361
  const id = editor.id;
3361
3362
  setEditor(null);
3362
3363
  if (id) run("alert updated", () => api.settings.updateAlert(id, body), alertQ.reload);
@@ -3444,13 +3445,15 @@ function SettingsPanel({
3444
3445
  saveEditor();
3445
3446
  return;
3446
3447
  }
3447
- if (key.upArrow) setEditor({ ...editor, field: (editor.field + EDITOR_FIELDS - 1) % EDITOR_FIELDS });
3448
- else if (key.downArrow) setEditor({ ...editor, field: (editor.field + 1) % EDITOR_FIELDS });
3448
+ const nFields = editorFieldCount(editor);
3449
+ if (key.upArrow) setEditor({ ...editor, field: (editor.field + nFields - 1) % nFields });
3450
+ else if (key.downArrow) setEditor({ ...editor, field: (editor.field + 1) % nFields });
3449
3451
  else if (key.leftArrow || key.rightArrow) {
3450
3452
  const d = key.rightArrow ? 1 : -1;
3451
3453
  if (editor.field === 1) setEditor({ ...editor, signal: SIGNALS2[(SIGNALS2.indexOf(editor.signal) + d + SIGNALS2.length) % SIGNALS2.length] });
3452
3454
  else if (editor.field === 2) setEditor({ ...editor, threshold: Math.max(THRESH_MIN, Math.min(THRESH_MAX, editor.threshold + d * 5)) });
3453
3455
  else if (editor.field === 3) setEditor({ ...editor, windowSeconds: WINDOWS[Math.max(0, Math.min(WINDOWS.length - 1, nearestWindowIdx(editor.windowSeconds) + d))] });
3456
+ else if (editor.field === 4) setEditor({ ...editor, enabled: !editor.enabled });
3454
3457
  }
3455
3458
  return;
3456
3459
  }
@@ -3562,9 +3565,10 @@ function SettingsPanel({
3562
3565
  fieldRow(0, "target", editor.target ? /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: truncate(editor.target, cols - 16) }) : /* @__PURE__ */ jsx7(Text7, { color: theme.dim, children: "empty \u2014 press e" }), "press e to edit"),
3563
3566
  fieldRow(1, "signal", /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: SIGNAL_LABEL[editor.signal] }), "\u2190\u2192 change"),
3564
3567
  fieldRow(2, "threshold", /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: `\u2265 ${editor.threshold}` }), "\u2190\u2192 \xB15"),
3565
- fieldRow(3, "window", /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: winLabel(editor.windowSeconds) }), "\u2190\u2192 change")
3568
+ fieldRow(3, "window", /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: winLabel(editor.windowSeconds) }), "\u2190\u2192 change"),
3569
+ editor.id ? fieldRow(4, "status", editor.enabled ? /* @__PURE__ */ jsx7(Text7, { color: theme.ok, children: "on" }) : /* @__PURE__ */ jsx7(Text7, { color: theme.dim, children: "off" }), "\u2190\u2192 turn on/off") : null
3566
3570
  ] }),
3567
- /* @__PURE__ */ jsx7(Box7, { marginTop: 1, children: /* @__PURE__ */ jsxs7(Text7, { color: theme.dim, children: [
3571
+ /* @__PURE__ */ jsx7(Box7, { marginTop: 1, children: editor.id && !editor.enabled ? /* @__PURE__ */ jsx7(Text7, { color: theme.warn, children: "disabled \u2014 this alert will NOT fire until you set status back to on" }) : /* @__PURE__ */ jsxs7(Text7, { color: theme.dim, children: [
3568
3572
  "fires when ",
3569
3573
  /* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: SIGNAL_LABEL[editor.signal] }),
3570
3574
  " reach ",
@@ -3675,7 +3679,7 @@ function SettingsPanel({
3675
3679
  PROTECTION: "guard hook version + self-protection toggle",
3676
3680
  "LOCAL LOGS": "mirror every decision to a file + dashboard link",
3677
3681
  WEBHOOKS: `POST events to a URL (${webhooks.length}) \xB7 t tests`,
3678
- ALERTS: `one email + one telegram (${alerts.length}) \xB7 enter edits`
3682
+ ALERTS: `one email + one telegram (${alerts.length}) \xB7 enter edits \xB7 m on/off`
3679
3683
  };
3680
3684
  const lineEls = [];
3681
3685
  const lineKey = [];
@@ -3773,10 +3777,16 @@ function newerThan(b, a) {
3773
3777
  }
3774
3778
  async function fetchLatest() {
3775
3779
  try {
3776
- const res = await fetch(`https://registry.npmjs.org/${PKG}/latest`, { signal: AbortSignal.timeout(2e3) });
3780
+ const res = await fetch(`https://registry.npmjs.org/${PKG}`, {
3781
+ headers: { accept: "application/vnd.npm.install-v1+json" },
3782
+ signal: AbortSignal.timeout(3e3)
3783
+ });
3777
3784
  if (!res.ok) return null;
3778
3785
  const j = await res.json();
3779
- return typeof j.version === "string" ? j.version : null;
3786
+ const latest = j["dist-tags"]?.latest;
3787
+ if (typeof latest !== "string") return null;
3788
+ if (!j.versions || !(latest in j.versions)) return null;
3789
+ return latest;
3780
3790
  } catch {
3781
3791
  return null;
3782
3792
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.81.67",
3
+ "version": "0.81.69",
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": {