@node9/proxy 1.21.1 → 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.
- package/dist/cli.js +40 -3
- package/dist/cli.mjs +40 -3
- package/dist/dashboard.mjs +48 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -16834,6 +16834,35 @@ function isTestEntry(entry, testTs) {
|
|
|
16834
16834
|
}
|
|
16835
16835
|
return false;
|
|
16836
16836
|
}
|
|
16837
|
+
var SUPERSEDE_WINDOW_MS = 6e4;
|
|
16838
|
+
function buildSupersededSet(entries) {
|
|
16839
|
+
const superseded = /* @__PURE__ */ new Set();
|
|
16840
|
+
for (let i = 0; i < entries.length; i++) {
|
|
16841
|
+
const e = entries[i];
|
|
16842
|
+
if (e.decision !== "deny") continue;
|
|
16843
|
+
if (e.checkedBy !== "smart-rule-block-override") continue;
|
|
16844
|
+
if (!e.argsHash || !e.sessionId) continue;
|
|
16845
|
+
const eTs = Date.parse(e.ts);
|
|
16846
|
+
if (Number.isNaN(eTs)) continue;
|
|
16847
|
+
for (let j = i + 1; j < entries.length; j++) {
|
|
16848
|
+
const next = entries[j];
|
|
16849
|
+
const nextTs = Date.parse(next.ts);
|
|
16850
|
+
if (Number.isNaN(nextTs)) continue;
|
|
16851
|
+
if (nextTs - eTs > SUPERSEDE_WINDOW_MS) break;
|
|
16852
|
+
if (next.argsHash !== e.argsHash) continue;
|
|
16853
|
+
if (next.sessionId !== e.sessionId) continue;
|
|
16854
|
+
if (next.tool !== e.tool) continue;
|
|
16855
|
+
if (next.decision === "allow" && next.checkedBy === "daemon") {
|
|
16856
|
+
superseded.add(`${e.ts}|${e.argsHash}`);
|
|
16857
|
+
break;
|
|
16858
|
+
}
|
|
16859
|
+
}
|
|
16860
|
+
}
|
|
16861
|
+
return superseded;
|
|
16862
|
+
}
|
|
16863
|
+
function supersedeKey(e) {
|
|
16864
|
+
return `${e.ts}|${e.argsHash ?? ""}`;
|
|
16865
|
+
}
|
|
16837
16866
|
function getDateRange(period, now) {
|
|
16838
16867
|
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
16839
16868
|
const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
|
@@ -17285,6 +17314,7 @@ function aggregateReportFromAudit(period, opts = {}) {
|
|
|
17285
17314
|
}
|
|
17286
17315
|
return true;
|
|
17287
17316
|
});
|
|
17317
|
+
const superseded = buildSupersededSet(entries);
|
|
17288
17318
|
let userApproved = 0;
|
|
17289
17319
|
let userDenied = 0;
|
|
17290
17320
|
let timedOut = 0;
|
|
@@ -17302,6 +17332,7 @@ function aggregateReportFromAudit(period, opts = {}) {
|
|
|
17302
17332
|
const dailyMap = /* @__PURE__ */ new Map();
|
|
17303
17333
|
const hourMap = /* @__PURE__ */ new Map();
|
|
17304
17334
|
for (const e of entries) {
|
|
17335
|
+
if (superseded.has(supersedeKey(e))) continue;
|
|
17305
17336
|
const allow = isAllow(e.decision);
|
|
17306
17337
|
const dateKey = e.ts.slice(0, 10);
|
|
17307
17338
|
const userInteracted = e.source === "daemon";
|
|
@@ -17312,6 +17343,7 @@ function aggregateReportFromAudit(period, opts = {}) {
|
|
|
17312
17343
|
if (e.checkedBy === "timeout") timedOut++;
|
|
17313
17344
|
else if (e.checkedBy === "observe-mode-dlp-would-block") observeDlp++;
|
|
17314
17345
|
else if (isDlp(e.checkedBy)) dlpBlocked++;
|
|
17346
|
+
else if (e.checkedBy === "local-decision") userDenied++;
|
|
17315
17347
|
else if (e.checkedBy !== "loop-detected") hardBlocked++;
|
|
17316
17348
|
}
|
|
17317
17349
|
if (e.checkedBy === "loop-detected") loopHits++;
|
|
@@ -17319,8 +17351,11 @@ function aggregateReportFromAudit(period, opts = {}) {
|
|
|
17319
17351
|
t.calls++;
|
|
17320
17352
|
if (!allow) t.blocked++;
|
|
17321
17353
|
toolMap.set(e.tool, t);
|
|
17322
|
-
if (!allow
|
|
17323
|
-
|
|
17354
|
+
if (!allow) {
|
|
17355
|
+
const key = e.checkedBy ?? (e.source === "daemon" ? "local-decision" : null);
|
|
17356
|
+
if (key) {
|
|
17357
|
+
blockMap.set(key, (blockMap.get(key) ?? 0) + 1);
|
|
17358
|
+
}
|
|
17324
17359
|
}
|
|
17325
17360
|
if (!allow && e.ruleName) {
|
|
17326
17361
|
ruleMap.set(e.ruleName, (ruleMap.get(e.ruleName) ?? 0) + 1);
|
|
@@ -17349,7 +17384,9 @@ function aggregateReportFromAudit(period, opts = {}) {
|
|
|
17349
17384
|
start,
|
|
17350
17385
|
end,
|
|
17351
17386
|
excludedTests,
|
|
17352
|
-
|
|
17387
|
+
// Subtract superseded rows so the headline event count agrees with
|
|
17388
|
+
// the bucket counters (which skip them in the loop above).
|
|
17389
|
+
total: entries.length - superseded.size,
|
|
17353
17390
|
userApproved,
|
|
17354
17391
|
userDenied,
|
|
17355
17392
|
timedOut,
|
package/dist/cli.mjs
CHANGED
|
@@ -16807,6 +16807,35 @@ function isTestEntry(entry, testTs) {
|
|
|
16807
16807
|
}
|
|
16808
16808
|
return false;
|
|
16809
16809
|
}
|
|
16810
|
+
var SUPERSEDE_WINDOW_MS = 6e4;
|
|
16811
|
+
function buildSupersededSet(entries) {
|
|
16812
|
+
const superseded = /* @__PURE__ */ new Set();
|
|
16813
|
+
for (let i = 0; i < entries.length; i++) {
|
|
16814
|
+
const e = entries[i];
|
|
16815
|
+
if (e.decision !== "deny") continue;
|
|
16816
|
+
if (e.checkedBy !== "smart-rule-block-override") continue;
|
|
16817
|
+
if (!e.argsHash || !e.sessionId) continue;
|
|
16818
|
+
const eTs = Date.parse(e.ts);
|
|
16819
|
+
if (Number.isNaN(eTs)) continue;
|
|
16820
|
+
for (let j = i + 1; j < entries.length; j++) {
|
|
16821
|
+
const next = entries[j];
|
|
16822
|
+
const nextTs = Date.parse(next.ts);
|
|
16823
|
+
if (Number.isNaN(nextTs)) continue;
|
|
16824
|
+
if (nextTs - eTs > SUPERSEDE_WINDOW_MS) break;
|
|
16825
|
+
if (next.argsHash !== e.argsHash) continue;
|
|
16826
|
+
if (next.sessionId !== e.sessionId) continue;
|
|
16827
|
+
if (next.tool !== e.tool) continue;
|
|
16828
|
+
if (next.decision === "allow" && next.checkedBy === "daemon") {
|
|
16829
|
+
superseded.add(`${e.ts}|${e.argsHash}`);
|
|
16830
|
+
break;
|
|
16831
|
+
}
|
|
16832
|
+
}
|
|
16833
|
+
}
|
|
16834
|
+
return superseded;
|
|
16835
|
+
}
|
|
16836
|
+
function supersedeKey(e) {
|
|
16837
|
+
return `${e.ts}|${e.argsHash ?? ""}`;
|
|
16838
|
+
}
|
|
16810
16839
|
function getDateRange(period, now) {
|
|
16811
16840
|
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
16812
16841
|
const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
|
@@ -17258,6 +17287,7 @@ function aggregateReportFromAudit(period, opts = {}) {
|
|
|
17258
17287
|
}
|
|
17259
17288
|
return true;
|
|
17260
17289
|
});
|
|
17290
|
+
const superseded = buildSupersededSet(entries);
|
|
17261
17291
|
let userApproved = 0;
|
|
17262
17292
|
let userDenied = 0;
|
|
17263
17293
|
let timedOut = 0;
|
|
@@ -17275,6 +17305,7 @@ function aggregateReportFromAudit(period, opts = {}) {
|
|
|
17275
17305
|
const dailyMap = /* @__PURE__ */ new Map();
|
|
17276
17306
|
const hourMap = /* @__PURE__ */ new Map();
|
|
17277
17307
|
for (const e of entries) {
|
|
17308
|
+
if (superseded.has(supersedeKey(e))) continue;
|
|
17278
17309
|
const allow = isAllow(e.decision);
|
|
17279
17310
|
const dateKey = e.ts.slice(0, 10);
|
|
17280
17311
|
const userInteracted = e.source === "daemon";
|
|
@@ -17285,6 +17316,7 @@ function aggregateReportFromAudit(period, opts = {}) {
|
|
|
17285
17316
|
if (e.checkedBy === "timeout") timedOut++;
|
|
17286
17317
|
else if (e.checkedBy === "observe-mode-dlp-would-block") observeDlp++;
|
|
17287
17318
|
else if (isDlp(e.checkedBy)) dlpBlocked++;
|
|
17319
|
+
else if (e.checkedBy === "local-decision") userDenied++;
|
|
17288
17320
|
else if (e.checkedBy !== "loop-detected") hardBlocked++;
|
|
17289
17321
|
}
|
|
17290
17322
|
if (e.checkedBy === "loop-detected") loopHits++;
|
|
@@ -17292,8 +17324,11 @@ function aggregateReportFromAudit(period, opts = {}) {
|
|
|
17292
17324
|
t.calls++;
|
|
17293
17325
|
if (!allow) t.blocked++;
|
|
17294
17326
|
toolMap.set(e.tool, t);
|
|
17295
|
-
if (!allow
|
|
17296
|
-
|
|
17327
|
+
if (!allow) {
|
|
17328
|
+
const key = e.checkedBy ?? (e.source === "daemon" ? "local-decision" : null);
|
|
17329
|
+
if (key) {
|
|
17330
|
+
blockMap.set(key, (blockMap.get(key) ?? 0) + 1);
|
|
17331
|
+
}
|
|
17297
17332
|
}
|
|
17298
17333
|
if (!allow && e.ruleName) {
|
|
17299
17334
|
ruleMap.set(e.ruleName, (ruleMap.get(e.ruleName) ?? 0) + 1);
|
|
@@ -17322,7 +17357,9 @@ function aggregateReportFromAudit(period, opts = {}) {
|
|
|
17322
17357
|
start,
|
|
17323
17358
|
end,
|
|
17324
17359
|
excludedTests,
|
|
17325
|
-
|
|
17360
|
+
// Subtract superseded rows so the headline event count agrees with
|
|
17361
|
+
// the bucket counters (which skip them in the loop above).
|
|
17362
|
+
total: entries.length - superseded.size,
|
|
17326
17363
|
userApproved,
|
|
17327
17364
|
userDenied,
|
|
17328
17365
|
timedOut,
|
package/dist/dashboard.mjs
CHANGED
|
@@ -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
|
|
3164
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
5596
|
-
|
|
5597
|
-
|
|
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 =
|
|
5666
|
+
COL_GUTTER = " ";
|
|
5629
5667
|
PROJECT_LABEL_W = 14;
|
|
5630
5668
|
}
|
|
5631
5669
|
});
|