@node9/proxy 1.21.0 → 1.21.2

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.
@@ -2645,6 +2645,34 @@ function isTestEntry(entry, testTs) {
2645
2645
  }
2646
2646
  return false;
2647
2647
  }
2648
+ function buildSupersededSet(entries) {
2649
+ const superseded = /* @__PURE__ */ new Set();
2650
+ for (let i = 0; i < entries.length; i++) {
2651
+ const e = entries[i];
2652
+ if (e.decision !== "deny") continue;
2653
+ if (e.checkedBy !== "smart-rule-block-override") continue;
2654
+ if (!e.argsHash || !e.sessionId) continue;
2655
+ const eTs = Date.parse(e.ts);
2656
+ if (Number.isNaN(eTs)) continue;
2657
+ for (let j = i + 1; j < entries.length; j++) {
2658
+ const next = entries[j];
2659
+ const nextTs = Date.parse(next.ts);
2660
+ if (Number.isNaN(nextTs)) continue;
2661
+ if (nextTs - eTs > SUPERSEDE_WINDOW_MS) break;
2662
+ if (next.argsHash !== e.argsHash) continue;
2663
+ if (next.sessionId !== e.sessionId) continue;
2664
+ if (next.tool !== e.tool) continue;
2665
+ if (next.decision === "allow" && next.checkedBy === "daemon") {
2666
+ superseded.add(`${e.ts}|${e.argsHash}`);
2667
+ break;
2668
+ }
2669
+ }
2670
+ }
2671
+ return superseded;
2672
+ }
2673
+ function supersedeKey(e) {
2674
+ return `${e.ts}|${e.argsHash ?? ""}`;
2675
+ }
2648
2676
  function getReportDateRange(period, now = /* @__PURE__ */ new Date()) {
2649
2677
  return getDateRange(period, now);
2650
2678
  }
@@ -3126,6 +3154,7 @@ function aggregateReportFromAudit(period, opts = {}) {
3126
3154
  }
3127
3155
  return true;
3128
3156
  });
3157
+ const superseded = buildSupersededSet(entries);
3129
3158
  let userApproved = 0;
3130
3159
  let userDenied = 0;
3131
3160
  let timedOut = 0;
@@ -3143,6 +3172,7 @@ function aggregateReportFromAudit(period, opts = {}) {
3143
3172
  const dailyMap = /* @__PURE__ */ new Map();
3144
3173
  const hourMap = /* @__PURE__ */ new Map();
3145
3174
  for (const e of entries) {
3175
+ if (superseded.has(supersedeKey(e))) continue;
3146
3176
  const allow = isAllow(e.decision);
3147
3177
  const dateKey = e.ts.slice(0, 10);
3148
3178
  const userInteracted = e.source === "daemon";
@@ -3153,6 +3183,7 @@ function aggregateReportFromAudit(period, opts = {}) {
3153
3183
  if (e.checkedBy === "timeout") timedOut++;
3154
3184
  else if (e.checkedBy === "observe-mode-dlp-would-block") observeDlp++;
3155
3185
  else if (isDlp(e.checkedBy)) dlpBlocked++;
3186
+ else if (e.checkedBy === "local-decision") userDenied++;
3156
3187
  else if (e.checkedBy !== "loop-detected") hardBlocked++;
3157
3188
  }
3158
3189
  if (e.checkedBy === "loop-detected") loopHits++;
@@ -3160,8 +3191,11 @@ function aggregateReportFromAudit(period, opts = {}) {
3160
3191
  t.calls++;
3161
3192
  if (!allow) t.blocked++;
3162
3193
  toolMap.set(e.tool, t);
3163
- if (!allow && e.checkedBy) {
3164
- blockMap.set(e.checkedBy, (blockMap.get(e.checkedBy) ?? 0) + 1);
3194
+ if (!allow) {
3195
+ const key = e.checkedBy ?? (e.source === "daemon" ? "local-decision" : null);
3196
+ if (key) {
3197
+ blockMap.set(key, (blockMap.get(key) ?? 0) + 1);
3198
+ }
3165
3199
  }
3166
3200
  if (!allow && e.ruleName) {
3167
3201
  ruleMap.set(e.ruleName, (ruleMap.get(e.ruleName) ?? 0) + 1);
@@ -3190,7 +3224,9 @@ function aggregateReportFromAudit(period, opts = {}) {
3190
3224
  start,
3191
3225
  end,
3192
3226
  excludedTests,
3193
- total: entries.length,
3227
+ // Subtract superseded rows so the headline event count agrees with
3228
+ // the bucket counters (which skip them in the loop above).
3229
+ total: entries.length - superseded.size,
3194
3230
  userApproved,
3195
3231
  userDenied,
3196
3232
  timedOut,
@@ -3225,13 +3261,14 @@ function aggregateReportFromAudit(period, opts = {}) {
3225
3261
  };
3226
3262
  return { data, hasAuditFile, responseDlpEntries };
3227
3263
  }
3228
- var TEST_COMMAND_RE, CLAUDE_PRICING, GEMINI_FALLBACK_MODELS;
3264
+ var TEST_COMMAND_RE, SUPERSEDE_WINDOW_MS, CLAUDE_PRICING, GEMINI_FALLBACK_MODELS;
3229
3265
  var init_report_audit = __esm({
3230
3266
  "src/cli/aggregate/report-audit.ts"() {
3231
3267
  "use strict";
3232
3268
  init_costSync();
3233
3269
  init_litellm();
3234
3270
  TEST_COMMAND_RE = /(?:^|\s)(npm\s+(?:run\s+)?test|npx\s+(?:vitest|jest|mocha)|yarn\s+(?:run\s+)?test|pnpm\s+(?:run\s+)?test|vitest|jest|mocha|pytest|py\.test|cargo\s+test|go\s+test|bundle\s+exec\s+rspec|rspec|phpunit|dotnet\s+test)\b/i;
3271
+ SUPERSEDE_WINDOW_MS = 6e4;
3235
3272
  CLAUDE_PRICING = {
3236
3273
  "claude-opus-4-6": { i: 5e-6, o: 25e-6, cw: 625e-8, cr: 5e-7 },
3237
3274
  "claude-opus-4-5": { i: 5e-6, o: 25e-6, cw: 625e-8, cr: 5e-7 },
@@ -5588,14 +5625,15 @@ function TopToolsProjects({ audit }) {
5588
5625
  /* @__PURE__ */ jsx4(Text4, { bold: true, children: "TOP TOOLS / PROJECTS" }),
5589
5626
  audit === null ? /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "loading\u2026" }) : tools.length === 0 && projects.length === 0 ? /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "\u2014" }) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
5590
5627
  /* @__PURE__ */ jsxs4(Box4, { children: [
5591
- /* @__PURE__ */ jsx4(Box4, { width: TOOL_LABEL_W + TOOL_COUNT_W + COL_GUTTER, children: /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "TOOLS" }) }),
5628
+ /* @__PURE__ */ jsx4(Box4, { width: TOOL_LABEL_W, children: /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "TOOLS" }) }),
5629
+ /* @__PURE__ */ jsx4(Box4, { width: TOOL_COUNT_W }),
5630
+ /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: COL_GUTTER }),
5592
5631
  /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "PROJECTS" })
5593
5632
  ] }),
5594
5633
  rows.map((r, i) => /* @__PURE__ */ jsxs4(Box4, { height: 1, children: [
5595
- /* @__PURE__ */ jsx4(Box4, { width: TOOL_LABEL_W + TOOL_COUNT_W + COL_GUTTER, children: r.tool ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
5596
- /* @__PURE__ */ jsx4(Box4, { width: TOOL_LABEL_W, children: /* @__PURE__ */ jsx4(Text4, { children: fit(r.tool[0], TOOL_LABEL_W) }) }),
5597
- /* @__PURE__ */ jsx4(Box4, { width: TOOL_COUNT_W, justifyContent: "flex-end", children: /* @__PURE__ */ jsx4(Text4, { bold: true, children: num(r.tool[1].calls) }) })
5598
- ] }) : null }),
5634
+ /* @__PURE__ */ jsx4(Box4, { width: TOOL_LABEL_W, children: /* @__PURE__ */ jsx4(Text4, { children: r.tool ? fit(r.tool[0], TOOL_LABEL_W) : "" }) }),
5635
+ /* @__PURE__ */ jsx4(Box4, { width: TOOL_COUNT_W, justifyContent: "flex-end", children: /* @__PURE__ */ jsx4(Text4, { bold: true, children: r.tool ? num(r.tool[1].calls) : "" }) }),
5636
+ /* @__PURE__ */ jsx4(Text4, { children: COL_GUTTER }),
5599
5637
  r.project ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
5600
5638
  /* @__PURE__ */ jsx4(Box4, { width: PROJECT_LABEL_W, children: /* @__PURE__ */ jsx4(Text4, { children: fit(r.project.name, PROJECT_LABEL_W) }) }),
5601
5639
  /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: `${formatTokens(r.project.tokens)} ` }),
@@ -5625,7 +5663,7 @@ var init_TopToolsProjects = __esm({
5625
5663
  ROW_LIMIT = 4;
5626
5664
  TOOL_LABEL_W = 10;
5627
5665
  TOOL_COUNT_W = 6;
5628
- COL_GUTTER = 3;
5666
+ COL_GUTTER = " ";
5629
5667
  PROJECT_LABEL_W = 14;
5630
5668
  }
5631
5669
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node9/proxy",
3
- "version": "1.21.0",
3
+ "version": "1.21.2",
4
4
  "description": "The Sudo Command for AI Agents. Execution Security for Claude Code & MCP.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",