@node9/proxy 2.43.1 → 2.44.0
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 +1125 -1074
- package/dist/cli.mjs +1089 -1038
- package/dist/dashboard.mjs +443 -21
- package/dist/scan-ink.mjs +5 -1
- package/package.json +1 -1
package/dist/dashboard.mjs
CHANGED
|
@@ -18734,8 +18734,7 @@ function homeCredentialFiles(home) {
|
|
|
18734
18734
|
),
|
|
18735
18735
|
f([".docker", "config.json"], "Docker registry auth tokens", 10),
|
|
18736
18736
|
f([".netrc"], "FTP/HTTP credentials in plain text", 15),
|
|
18737
|
-
f([".npmrc"], "npm auth token: can publish packages as you", 10)
|
|
18738
|
-
f([".node9", "credentials.json"], "Node9 cloud API key", 10)
|
|
18737
|
+
f([".npmrc"], "npm auth token: can publish packages as you", 10)
|
|
18739
18738
|
];
|
|
18740
18739
|
}
|
|
18741
18740
|
var init_credential_files = __esm({
|
|
@@ -21485,6 +21484,68 @@ var init_cost_gemini = __esm({
|
|
|
21485
21484
|
});
|
|
21486
21485
|
|
|
21487
21486
|
// src/cost-copilot.ts
|
|
21487
|
+
function priceTokens(model, u) {
|
|
21488
|
+
const tuple = pricingFor(model);
|
|
21489
|
+
if (!tuple || !u) return 0;
|
|
21490
|
+
const [pin, pout, pcw, pcr] = tuple;
|
|
21491
|
+
return (u.inputTokens ?? 0) * pin + (u.outputTokens ?? 0) * pout + (u.cacheWriteTokens ?? 0) * pcw + (u.cacheReadTokens ?? 0) * pcr;
|
|
21492
|
+
}
|
|
21493
|
+
function parseCopilotSession(lines) {
|
|
21494
|
+
let sessionId = "";
|
|
21495
|
+
let cwd = "";
|
|
21496
|
+
let startDate = "";
|
|
21497
|
+
let shutdownDate = "";
|
|
21498
|
+
let modelMetrics = null;
|
|
21499
|
+
for (const raw of lines) {
|
|
21500
|
+
if (!raw.trim()) continue;
|
|
21501
|
+
let o;
|
|
21502
|
+
try {
|
|
21503
|
+
o = JSON.parse(raw);
|
|
21504
|
+
} catch {
|
|
21505
|
+
continue;
|
|
21506
|
+
}
|
|
21507
|
+
const d = o.data ?? {};
|
|
21508
|
+
if (o.type === "session.start") {
|
|
21509
|
+
if (typeof d["sessionId"] === "string") sessionId = d["sessionId"];
|
|
21510
|
+
if (typeof d["startTime"] === "string") startDate = d["startTime"];
|
|
21511
|
+
const ctx = d["context"] ?? {};
|
|
21512
|
+
if (typeof ctx["cwd"] === "string") cwd = ctx["cwd"];
|
|
21513
|
+
} else if (o.type === "session.shutdown") {
|
|
21514
|
+
if (d["modelMetrics"] && typeof d["modelMetrics"] === "object") {
|
|
21515
|
+
modelMetrics = d["modelMetrics"];
|
|
21516
|
+
}
|
|
21517
|
+
if (typeof o.timestamp === "string") shutdownDate = o.timestamp;
|
|
21518
|
+
}
|
|
21519
|
+
}
|
|
21520
|
+
if (!modelMetrics) return [];
|
|
21521
|
+
const date = (startDate || shutdownDate).slice(0, 10);
|
|
21522
|
+
if (!date) return [];
|
|
21523
|
+
const rows = [];
|
|
21524
|
+
for (const [rawModel, m] of Object.entries(modelMetrics)) {
|
|
21525
|
+
const u = m.usage ?? {};
|
|
21526
|
+
const inputTokens = u.inputTokens ?? 0;
|
|
21527
|
+
const outputTokens = u.outputTokens ?? 0;
|
|
21528
|
+
const cacheReadTokens = u.cacheReadTokens ?? 0;
|
|
21529
|
+
const cacheWriteTokens = u.cacheWriteTokens ?? 0;
|
|
21530
|
+
if (inputTokens === 0 && outputTokens === 0 && cacheReadTokens === 0 && cacheWriteTokens === 0) {
|
|
21531
|
+
continue;
|
|
21532
|
+
}
|
|
21533
|
+
const model = normalizeModel(rawModel);
|
|
21534
|
+
const costUSD = typeof m.requests?.cost === "number" && m.requests.cost > 0 ? m.requests.cost : priceTokens(rawModel, u);
|
|
21535
|
+
rows.push({
|
|
21536
|
+
date,
|
|
21537
|
+
model,
|
|
21538
|
+
workingDir: cwd,
|
|
21539
|
+
runId: sessionId,
|
|
21540
|
+
costUSD,
|
|
21541
|
+
inputTokens,
|
|
21542
|
+
outputTokens,
|
|
21543
|
+
cacheReadTokens,
|
|
21544
|
+
cacheWriteTokens
|
|
21545
|
+
});
|
|
21546
|
+
}
|
|
21547
|
+
return rows;
|
|
21548
|
+
}
|
|
21488
21549
|
var init_cost_copilot = __esm({
|
|
21489
21550
|
"src/cost-copilot.ts"() {
|
|
21490
21551
|
"use strict";
|
|
@@ -27669,6 +27730,16 @@ var init_scan_judge = __esm({
|
|
|
27669
27730
|
});
|
|
27670
27731
|
|
|
27671
27732
|
// src/utils/hook-payload.ts
|
|
27733
|
+
function canonicalToolInput(rawToolName, input) {
|
|
27734
|
+
if (rawToolName !== "run_command") return input;
|
|
27735
|
+
if (typeof input !== "object" || input === null || Array.isArray(input)) return input;
|
|
27736
|
+
const args = input;
|
|
27737
|
+
if (typeof args.CommandLine !== "string") return input;
|
|
27738
|
+
const { CommandLine, Cwd, ...rest } = args;
|
|
27739
|
+
const canonical = { ...rest, command: CommandLine };
|
|
27740
|
+
if (typeof Cwd === "string" && Cwd.length > 0) canonical.cwd = Cwd;
|
|
27741
|
+
return canonical;
|
|
27742
|
+
}
|
|
27672
27743
|
var init_hook_payload = __esm({
|
|
27673
27744
|
"src/utils/hook-payload.ts"() {
|
|
27674
27745
|
"use strict";
|
|
@@ -28731,6 +28802,360 @@ async function scanGeminiHistory(startDate, onProgress, onLine, opts = {}) {
|
|
|
28731
28802
|
result.policy = judge.policy(result.unknownInputs ?? {});
|
|
28732
28803
|
return result;
|
|
28733
28804
|
}
|
|
28805
|
+
function antigravityBrainDirs() {
|
|
28806
|
+
return ["antigravity-cli", "antigravity-ide"].map((surface) => path43.join(os30.homedir(), ".gemini", surface, "brain")).filter((p) => fs38.existsSync(p));
|
|
28807
|
+
}
|
|
28808
|
+
function antigravityTranscriptPath(convPath) {
|
|
28809
|
+
const logsDir = path43.join(convPath, ".system_generated", "logs");
|
|
28810
|
+
for (const name of ["transcript_full.jsonl", "transcript.jsonl"]) {
|
|
28811
|
+
const p = path43.join(logsDir, name);
|
|
28812
|
+
if (fs38.existsSync(p)) return p;
|
|
28813
|
+
}
|
|
28814
|
+
return null;
|
|
28815
|
+
}
|
|
28816
|
+
async function scanAntigravityHistory(startDate, onProgress, onLine, opts = {}) {
|
|
28817
|
+
const canaryVals = safeCanaryScanValues();
|
|
28818
|
+
const result = {
|
|
28819
|
+
filesScanned: 0,
|
|
28820
|
+
sessions: 0,
|
|
28821
|
+
totalToolCalls: 0,
|
|
28822
|
+
bashCalls: 0,
|
|
28823
|
+
findings: [],
|
|
28824
|
+
dlpFindings: [],
|
|
28825
|
+
canaryFindings: [],
|
|
28826
|
+
loopFindings: [],
|
|
28827
|
+
totalCostUSD: 0,
|
|
28828
|
+
// transcripts carry no token/model data
|
|
28829
|
+
firstDate: null,
|
|
28830
|
+
lastDate: null,
|
|
28831
|
+
sessionsWithEarlySecrets: 0,
|
|
28832
|
+
perSession: []
|
|
28833
|
+
};
|
|
28834
|
+
const dedup = emptyScanDedup();
|
|
28835
|
+
const brainDirs = antigravityBrainDirs();
|
|
28836
|
+
if (brainDirs.length === 0) return result;
|
|
28837
|
+
const judge = new HistoryJudge();
|
|
28838
|
+
const cache7 = openScanCache(judge, opts);
|
|
28839
|
+
for (const brainDir of brainDirs) {
|
|
28840
|
+
let convDirs;
|
|
28841
|
+
try {
|
|
28842
|
+
convDirs = fs38.readdirSync(brainDir);
|
|
28843
|
+
} catch {
|
|
28844
|
+
continue;
|
|
28845
|
+
}
|
|
28846
|
+
for (const conv of convDirs) {
|
|
28847
|
+
const convPath = path43.join(brainDir, conv);
|
|
28848
|
+
try {
|
|
28849
|
+
if (!fs38.statSync(convPath).isDirectory()) continue;
|
|
28850
|
+
} catch {
|
|
28851
|
+
continue;
|
|
28852
|
+
}
|
|
28853
|
+
const transcriptFile = antigravityTranscriptPath(convPath);
|
|
28854
|
+
if (!transcriptFile) continue;
|
|
28855
|
+
const stamp = fileStamp(transcriptFile);
|
|
28856
|
+
if (!fileMayHoldWindow(stamp, startDate)) continue;
|
|
28857
|
+
result.filesScanned++;
|
|
28858
|
+
onProgress?.(result.filesScanned);
|
|
28859
|
+
const cached = stamp ? cache7.get(transcriptFile, stamp, judge, judgeFromFor(startDate)) : null;
|
|
28860
|
+
if (cached) {
|
|
28861
|
+
mergeFileScan(result, cached, dedup, startDate);
|
|
28862
|
+
continue;
|
|
28863
|
+
}
|
|
28864
|
+
const fileResult = emptyScan();
|
|
28865
|
+
const fileDedup = emptyScanDedup();
|
|
28866
|
+
let raw;
|
|
28867
|
+
try {
|
|
28868
|
+
raw = fs38.readFileSync(transcriptFile, "utf-8");
|
|
28869
|
+
} catch {
|
|
28870
|
+
continue;
|
|
28871
|
+
}
|
|
28872
|
+
const sessionId = conv;
|
|
28873
|
+
let projLabel = conv.slice(0, 8);
|
|
28874
|
+
const sessionCalls = [];
|
|
28875
|
+
for (const line of raw.split("\n")) {
|
|
28876
|
+
if (!line.trim()) continue;
|
|
28877
|
+
onLine?.();
|
|
28878
|
+
let step;
|
|
28879
|
+
try {
|
|
28880
|
+
step = JSON.parse(line);
|
|
28881
|
+
} catch {
|
|
28882
|
+
continue;
|
|
28883
|
+
}
|
|
28884
|
+
const timestamp2 = step.created_at ?? "";
|
|
28885
|
+
if (beforeJudged(judgeFromFor(startDate), timestamp2 || void 0)) continue;
|
|
28886
|
+
const day = dayOf(fileResult, timestamp2 || void 0);
|
|
28887
|
+
if (fileResult.sessions === 0) fileResult.sessions = 1;
|
|
28888
|
+
if (step.type === "USER_INPUT") {
|
|
28889
|
+
const text = typeof step.content === "string" ? step.content : "";
|
|
28890
|
+
if (text) {
|
|
28891
|
+
const decoysHere5 = recordCanaries(
|
|
28892
|
+
{ text },
|
|
28893
|
+
"user-prompt",
|
|
28894
|
+
timestamp2,
|
|
28895
|
+
projLabel,
|
|
28896
|
+
sessionId,
|
|
28897
|
+
"antigravity",
|
|
28898
|
+
fileResult,
|
|
28899
|
+
fileDedup,
|
|
28900
|
+
canaryVals
|
|
28901
|
+
);
|
|
28902
|
+
const dlpMatch = scanArgs(scrubDecoys({ text }, decoysHere5));
|
|
28903
|
+
if (dlpMatch) {
|
|
28904
|
+
const k = dlpKey(dlpMatch.patternName, dlpMatch.redactedSample, projLabel, timestamp2);
|
|
28905
|
+
if (!fileDedup.dlpKeys.has(k)) {
|
|
28906
|
+
fileDedup.dlpKeys.add(k);
|
|
28907
|
+
fileResult.dlpFindings.push({
|
|
28908
|
+
patternName: dlpMatch.patternName,
|
|
28909
|
+
redactedSample: dlpMatch.redactedSample,
|
|
28910
|
+
toolName: "user-prompt",
|
|
28911
|
+
timestamp: timestamp2,
|
|
28912
|
+
project: projLabel,
|
|
28913
|
+
sessionId,
|
|
28914
|
+
agent: "antigravity"
|
|
28915
|
+
});
|
|
28916
|
+
}
|
|
28917
|
+
}
|
|
28918
|
+
}
|
|
28919
|
+
continue;
|
|
28920
|
+
}
|
|
28921
|
+
if (!Array.isArray(step.tool_calls) || step.tool_calls.length === 0) continue;
|
|
28922
|
+
if (timestamp2) {
|
|
28923
|
+
if (!fileResult.firstDate || timestamp2 < fileResult.firstDate)
|
|
28924
|
+
fileResult.firstDate = timestamp2;
|
|
28925
|
+
if (!fileResult.lastDate || timestamp2 > fileResult.lastDate)
|
|
28926
|
+
fileResult.lastDate = timestamp2;
|
|
28927
|
+
}
|
|
28928
|
+
for (const tc of step.tool_calls) {
|
|
28929
|
+
fileResult.totalToolCalls++;
|
|
28930
|
+
day.toolCalls++;
|
|
28931
|
+
const toolName = tc.name ?? "";
|
|
28932
|
+
countMcpCall(fileResult, toolName, day);
|
|
28933
|
+
const toolNameLower = toolName.toLowerCase();
|
|
28934
|
+
const input = canonicalToolInput(toolName, tc.args ?? {});
|
|
28935
|
+
sessionCalls.push({ toolName, input, timestamp: timestamp2 });
|
|
28936
|
+
const shellInput = resolveShellInput(toolNameLower, input, toolInspectionMap);
|
|
28937
|
+
const isShellTool = shellInput.kind === "shell";
|
|
28938
|
+
if (isShellTool) {
|
|
28939
|
+
fileResult.bashCalls++;
|
|
28940
|
+
day.bashCalls++;
|
|
28941
|
+
const cwd = String(input.cwd ?? "");
|
|
28942
|
+
if (cwd && projLabel === conv.slice(0, 8)) {
|
|
28943
|
+
projLabel = stripTerminalEscapes(cwd).replace(os30.homedir(), "~").slice(0, 40);
|
|
28944
|
+
}
|
|
28945
|
+
}
|
|
28946
|
+
const rawCmd = String(input.command ?? "").trimStart();
|
|
28947
|
+
if (/^node9\s+(scan|explain|report|tail|dlp|status|sessions|audit)\b/.test(rawCmd))
|
|
28948
|
+
continue;
|
|
28949
|
+
const decoysHere6 = recordCanaries(
|
|
28950
|
+
input,
|
|
28951
|
+
toolName,
|
|
28952
|
+
timestamp2,
|
|
28953
|
+
projLabel,
|
|
28954
|
+
sessionId,
|
|
28955
|
+
"antigravity",
|
|
28956
|
+
fileResult,
|
|
28957
|
+
fileDedup,
|
|
28958
|
+
canaryVals
|
|
28959
|
+
);
|
|
28960
|
+
const judged = await judge.judge(
|
|
28961
|
+
{
|
|
28962
|
+
agent: "antigravity",
|
|
28963
|
+
toolName,
|
|
28964
|
+
input,
|
|
28965
|
+
scrubbed: decoysHere6.length ? scrubDecoys(input, decoysHere6) : void 0,
|
|
28966
|
+
timestamp: timestamp2,
|
|
28967
|
+
sessionId,
|
|
28968
|
+
project: projLabel,
|
|
28969
|
+
cwd: typeof input.cwd === "string" && path43.isAbsolute(input.cwd) ? input.cwd : void 0
|
|
28970
|
+
},
|
|
28971
|
+
fileResult,
|
|
28972
|
+
fileDedup
|
|
28973
|
+
);
|
|
28974
|
+
addUnknown(day, judged.verdict.unknown);
|
|
28975
|
+
}
|
|
28976
|
+
}
|
|
28977
|
+
fileResult.loopFindings.push(
|
|
28978
|
+
...detectLoops(sessionCalls, projLabel, sessionId, "antigravity")
|
|
28979
|
+
);
|
|
28980
|
+
if (stamp)
|
|
28981
|
+
cache7.put(transcriptFile, stamp, "antigravity", fileResult, judge, judgeFromFor(startDate));
|
|
28982
|
+
mergeFileScan(result, fileResult, dedup, startDate);
|
|
28983
|
+
await yieldTick();
|
|
28984
|
+
}
|
|
28985
|
+
}
|
|
28986
|
+
cache7.close();
|
|
28987
|
+
result.policy = judge.policy(result.unknownInputs ?? {});
|
|
28988
|
+
return result;
|
|
28989
|
+
}
|
|
28990
|
+
async function scanCopilotHistory(startDate, onProgress, onLine, opts = {}) {
|
|
28991
|
+
const canaryVals = safeCanaryScanValues();
|
|
28992
|
+
const sessionDir = path43.join(os30.homedir(), ".copilot", "session-state");
|
|
28993
|
+
const result = {
|
|
28994
|
+
filesScanned: 0,
|
|
28995
|
+
sessions: 0,
|
|
28996
|
+
totalToolCalls: 0,
|
|
28997
|
+
bashCalls: 0,
|
|
28998
|
+
findings: [],
|
|
28999
|
+
dlpFindings: [],
|
|
29000
|
+
canaryFindings: [],
|
|
29001
|
+
loopFindings: [],
|
|
29002
|
+
totalCostUSD: 0,
|
|
29003
|
+
// event logs carry no token/cost rollup
|
|
29004
|
+
firstDate: null,
|
|
29005
|
+
lastDate: null,
|
|
29006
|
+
sessionsWithEarlySecrets: 0,
|
|
29007
|
+
perSession: []
|
|
29008
|
+
};
|
|
29009
|
+
const dedup = emptyScanDedup();
|
|
29010
|
+
if (!fs38.existsSync(sessionDir)) return result;
|
|
29011
|
+
let sessionIds;
|
|
29012
|
+
try {
|
|
29013
|
+
sessionIds = fs38.readdirSync(sessionDir);
|
|
29014
|
+
} catch {
|
|
29015
|
+
return result;
|
|
29016
|
+
}
|
|
29017
|
+
const judge = new HistoryJudge();
|
|
29018
|
+
const cache7 = openScanCache(judge, opts);
|
|
29019
|
+
for (const sessionId of sessionIds) {
|
|
29020
|
+
const eventsPath = path43.join(sessionDir, sessionId, "events.jsonl");
|
|
29021
|
+
if (!fs38.existsSync(eventsPath)) continue;
|
|
29022
|
+
const stamp = fileStamp(eventsPath);
|
|
29023
|
+
if (!fileMayHoldWindow(stamp, startDate)) continue;
|
|
29024
|
+
result.filesScanned++;
|
|
29025
|
+
onProgress?.(result.filesScanned);
|
|
29026
|
+
const cached = stamp ? cache7.get(eventsPath, stamp, judge, judgeFromFor(startDate)) : null;
|
|
29027
|
+
if (cached) {
|
|
29028
|
+
mergeFileScan(result, cached, dedup, startDate);
|
|
29029
|
+
continue;
|
|
29030
|
+
}
|
|
29031
|
+
const fileResult = emptyScan();
|
|
29032
|
+
const fileDedup = emptyScanDedup();
|
|
29033
|
+
let raw;
|
|
29034
|
+
try {
|
|
29035
|
+
raw = fs38.readFileSync(eventsPath, "utf-8");
|
|
29036
|
+
} catch {
|
|
29037
|
+
continue;
|
|
29038
|
+
}
|
|
29039
|
+
let projLabel = sessionId.slice(0, 8);
|
|
29040
|
+
let sessionCwd;
|
|
29041
|
+
const sessionCalls = [];
|
|
29042
|
+
for (const row of parseCopilotSession(raw.split("\n"))) {
|
|
29043
|
+
if (beforeJudged(judgeFromFor(startDate), row.date || void 0)) continue;
|
|
29044
|
+
fileResult.totalCostUSD += row.costUSD;
|
|
29045
|
+
dayOf(fileResult, row.date || void 0, false).costUSD += row.costUSD;
|
|
29046
|
+
}
|
|
29047
|
+
for (const line of raw.split("\n")) {
|
|
29048
|
+
if (!line.trim()) continue;
|
|
29049
|
+
onLine?.();
|
|
29050
|
+
let ev;
|
|
29051
|
+
try {
|
|
29052
|
+
ev = JSON.parse(line);
|
|
29053
|
+
} catch {
|
|
29054
|
+
continue;
|
|
29055
|
+
}
|
|
29056
|
+
const timestamp2 = ev.timestamp ?? "";
|
|
29057
|
+
if (ev.type === "session.start") {
|
|
29058
|
+
const cwd = ev.data?.context?.cwd;
|
|
29059
|
+
if (typeof cwd === "string" && cwd) {
|
|
29060
|
+
projLabel = stripTerminalEscapes(cwd).replace(os30.homedir(), "~").slice(0, 40);
|
|
29061
|
+
if (path43.isAbsolute(cwd)) sessionCwd = cwd;
|
|
29062
|
+
}
|
|
29063
|
+
continue;
|
|
29064
|
+
}
|
|
29065
|
+
if (beforeJudged(judgeFromFor(startDate), timestamp2 || void 0)) continue;
|
|
29066
|
+
const day = dayOf(fileResult, timestamp2 || void 0);
|
|
29067
|
+
if (fileResult.sessions === 0) fileResult.sessions = 1;
|
|
29068
|
+
if (ev.type === "user.message") {
|
|
29069
|
+
const text = ev.data?.content ?? ev.data?.text ?? "";
|
|
29070
|
+
if (typeof text === "string" && text) {
|
|
29071
|
+
const decoysHere7 = recordCanaries(
|
|
29072
|
+
{ text },
|
|
29073
|
+
"user-prompt",
|
|
29074
|
+
timestamp2,
|
|
29075
|
+
projLabel,
|
|
29076
|
+
sessionId,
|
|
29077
|
+
"copilot",
|
|
29078
|
+
fileResult,
|
|
29079
|
+
fileDedup,
|
|
29080
|
+
canaryVals
|
|
29081
|
+
);
|
|
29082
|
+
const dlpMatch = scanArgs(scrubDecoys({ text }, decoysHere7));
|
|
29083
|
+
if (dlpMatch) {
|
|
29084
|
+
const k = dlpKey(dlpMatch.patternName, dlpMatch.redactedSample, projLabel, timestamp2);
|
|
29085
|
+
if (!fileDedup.dlpKeys.has(k)) {
|
|
29086
|
+
fileDedup.dlpKeys.add(k);
|
|
29087
|
+
fileResult.dlpFindings.push({
|
|
29088
|
+
patternName: dlpMatch.patternName,
|
|
29089
|
+
redactedSample: dlpMatch.redactedSample,
|
|
29090
|
+
toolName: "user-prompt",
|
|
29091
|
+
timestamp: timestamp2,
|
|
29092
|
+
project: projLabel,
|
|
29093
|
+
sessionId,
|
|
29094
|
+
agent: "copilot"
|
|
29095
|
+
});
|
|
29096
|
+
}
|
|
29097
|
+
}
|
|
29098
|
+
}
|
|
29099
|
+
continue;
|
|
29100
|
+
}
|
|
29101
|
+
if (ev.type !== "tool.execution_start") continue;
|
|
29102
|
+
const toolName = ev.data?.toolName ?? "";
|
|
29103
|
+
const toolNameLower = toolName.toLowerCase();
|
|
29104
|
+
const input = ev.data?.arguments ?? {};
|
|
29105
|
+
fileResult.totalToolCalls++;
|
|
29106
|
+
day.toolCalls++;
|
|
29107
|
+
countMcpCall(fileResult, toolName, day);
|
|
29108
|
+
sessionCalls.push({ toolName, input, timestamp: timestamp2 });
|
|
29109
|
+
const shellInput = resolveShellInput(toolNameLower, input, toolInspectionMap);
|
|
29110
|
+
const isShellTool = shellInput.kind === "shell";
|
|
29111
|
+
if (isShellTool) {
|
|
29112
|
+
fileResult.bashCalls++;
|
|
29113
|
+
day.bashCalls++;
|
|
29114
|
+
}
|
|
29115
|
+
if (timestamp2) {
|
|
29116
|
+
if (!fileResult.firstDate || timestamp2 < fileResult.firstDate)
|
|
29117
|
+
fileResult.firstDate = timestamp2;
|
|
29118
|
+
if (!fileResult.lastDate || timestamp2 > fileResult.lastDate)
|
|
29119
|
+
fileResult.lastDate = timestamp2;
|
|
29120
|
+
}
|
|
29121
|
+
const rawCmd = String(input.command ?? "").trimStart();
|
|
29122
|
+
if (/^node9\s+(scan|explain|report|tail|dlp|status|sessions|audit)\b/.test(rawCmd)) continue;
|
|
29123
|
+
const decoysHere8 = recordCanaries(
|
|
29124
|
+
input,
|
|
29125
|
+
toolName,
|
|
29126
|
+
timestamp2,
|
|
29127
|
+
projLabel,
|
|
29128
|
+
sessionId,
|
|
29129
|
+
"copilot",
|
|
29130
|
+
fileResult,
|
|
29131
|
+
fileDedup,
|
|
29132
|
+
canaryVals
|
|
29133
|
+
);
|
|
29134
|
+
const judged = await judge.judge(
|
|
29135
|
+
{
|
|
29136
|
+
agent: "copilot",
|
|
29137
|
+
toolName,
|
|
29138
|
+
input,
|
|
29139
|
+
scrubbed: decoysHere8.length ? scrubDecoys(input, decoysHere8) : void 0,
|
|
29140
|
+
timestamp: timestamp2,
|
|
29141
|
+
sessionId,
|
|
29142
|
+
project: projLabel,
|
|
29143
|
+
cwd: sessionCwd
|
|
29144
|
+
},
|
|
29145
|
+
fileResult,
|
|
29146
|
+
fileDedup
|
|
29147
|
+
);
|
|
29148
|
+
addUnknown(day, judged.verdict.unknown);
|
|
29149
|
+
}
|
|
29150
|
+
fileResult.loopFindings.push(...detectLoops(sessionCalls, projLabel, sessionId, "copilot"));
|
|
29151
|
+
if (stamp) cache7.put(eventsPath, stamp, "copilot", fileResult, judge, judgeFromFor(startDate));
|
|
29152
|
+
mergeFileScan(result, fileResult, dedup, startDate);
|
|
29153
|
+
await yieldTick();
|
|
29154
|
+
}
|
|
29155
|
+
cache7.close();
|
|
29156
|
+
result.policy = judge.policy(result.unknownInputs ?? {});
|
|
29157
|
+
return result;
|
|
29158
|
+
}
|
|
28734
29159
|
async function scanCodexHistory(startDate, onProgress, onLine, opts = {}) {
|
|
28735
29160
|
const canaryVals = safeCanaryScanValues();
|
|
28736
29161
|
const result = {
|
|
@@ -29181,9 +29606,17 @@ function startScanWalk(onUpdate) {
|
|
|
29181
29606
|
if (cancelled) return;
|
|
29182
29607
|
const codex = await scanCodexHistory(lookbackStart);
|
|
29183
29608
|
if (cancelled) return;
|
|
29609
|
+
await yieldToEventLoop();
|
|
29610
|
+
if (cancelled) return;
|
|
29611
|
+
const copilot = await scanCopilotHistory(lookbackStart);
|
|
29612
|
+
if (cancelled) return;
|
|
29613
|
+
await yieldToEventLoop();
|
|
29614
|
+
if (cancelled) return;
|
|
29615
|
+
const antigravity = await scanAntigravityHistory(lookbackStart);
|
|
29616
|
+
if (cancelled) return;
|
|
29184
29617
|
onUpdate({
|
|
29185
29618
|
status: "ready",
|
|
29186
|
-
results: { claude, gemini, codex },
|
|
29619
|
+
results: { claude, gemini, codex, copilot, antigravity },
|
|
29187
29620
|
readyAt: Date.now()
|
|
29188
29621
|
});
|
|
29189
29622
|
} catch (err) {
|
|
@@ -30112,7 +30545,7 @@ var init_util = __esm({
|
|
|
30112
30545
|
BLOCK_REASON_LABELS = {
|
|
30113
30546
|
timeout: "Approval timeout",
|
|
30114
30547
|
"smart-rule-block": "Smart rule",
|
|
30115
|
-
"observe-mode-dlp-would-block": "DLP (
|
|
30548
|
+
"observe-mode-dlp-would-block": "DLP (audit)",
|
|
30116
30549
|
"persistent-deny": "Persistent deny",
|
|
30117
30550
|
"local-decision": "User denied",
|
|
30118
30551
|
"dlp-block": "DLP block",
|
|
@@ -30624,23 +31057,12 @@ function filterScanByPeriod(ready, period, now = /* @__PURE__ */ new Date()) {
|
|
|
30624
31057
|
if (Number.isNaN(t)) return false;
|
|
30625
31058
|
return t >= startMs && t <= endMs;
|
|
30626
31059
|
};
|
|
30627
|
-
const
|
|
30628
|
-
|
|
30629
|
-
|
|
30630
|
-
|
|
30631
|
-
|
|
30632
|
-
const
|
|
30633
|
-
...ready.results.claude.loopFindings,
|
|
30634
|
-
...ready.results.gemini.loopFindings,
|
|
30635
|
-
...ready.results.codex.loopFindings
|
|
30636
|
-
].filter((f) => inPeriod(f.timestamp));
|
|
30637
|
-
const allFindings = [
|
|
30638
|
-
...ready.results.claude.findings,
|
|
30639
|
-
...ready.results.gemini.findings,
|
|
30640
|
-
...ready.results.codex.findings
|
|
30641
|
-
].filter((f) => inPeriod(f.timestamp));
|
|
30642
|
-
const totalToolCalls = ready.results.claude.totalToolCalls + ready.results.gemini.totalToolCalls + ready.results.codex.totalToolCalls;
|
|
30643
|
-
const sessionsWithEarlySecrets = ready.results.claude.sessionsWithEarlySecrets + ready.results.gemini.sessionsWithEarlySecrets + ready.results.codex.sessionsWithEarlySecrets;
|
|
31060
|
+
const slots = Object.values(ready.results);
|
|
31061
|
+
const allLeaks = slots.flatMap((r) => r.dlpFindings).filter((f) => inPeriod(f.timestamp));
|
|
31062
|
+
const allLoops = slots.flatMap((r) => r.loopFindings).filter((f) => inPeriod(f.timestamp));
|
|
31063
|
+
const allFindings = slots.flatMap((r) => r.findings).filter((f) => inPeriod(f.timestamp));
|
|
31064
|
+
const totalToolCalls = slots.reduce((n, r) => n + r.totalToolCalls, 0);
|
|
31065
|
+
const sessionsWithEarlySecrets = slots.reduce((n, r) => n + r.sessionsWithEarlySecrets, 0);
|
|
30644
31066
|
return {
|
|
30645
31067
|
leaks: allLeaks,
|
|
30646
31068
|
loops: allLoops,
|
package/dist/scan-ink.mjs
CHANGED
|
@@ -2346,6 +2346,10 @@ var CHECK_TEXT = {
|
|
|
2346
2346
|
};
|
|
2347
2347
|
var LEVELS = ["audit", "soft", "standard", "strict", "block-all"];
|
|
2348
2348
|
var MODE_VALUES = ["observe", ...LEVELS];
|
|
2349
|
+
function levelOf(mode) {
|
|
2350
|
+
if (mode === "observe") return "audit";
|
|
2351
|
+
return LEVELS.includes(mode ?? "") ? mode : "standard";
|
|
2352
|
+
}
|
|
2349
2353
|
var STRICT = {
|
|
2350
2354
|
"commands.sql-ddl": "block",
|
|
2351
2355
|
// The agent disarming a check on its own work (node9Firewall#413 part 2).
|
|
@@ -7819,7 +7823,7 @@ function BlockedPanel({
|
|
|
7819
7823
|
const origins = rules.map((r) => originForRule(r.name, summary.sections, enabled));
|
|
7820
7824
|
const anyNeeds = origins.some((o) => o.startsWith("needs shield:"));
|
|
7821
7825
|
const recordOnly = summary.policy?.recordOnly === true;
|
|
7822
|
-
const footer = recordOnly ? `\u2192 ${summary.policy?.mode} mode: these were logged, not stopped \xB7 nothing here was enforced` : enabled.size === 0 ? "\u2192 install node9 + enable shields above" : anyNeeds ? "\u2192 \u2713 marks rules from enabled shields \xB7 enable the rest above" : "\u2192 \u2713 all these rules come from enabled shields";
|
|
7826
|
+
const footer = recordOnly ? `\u2192 ${levelOf(summary.policy?.mode)} mode: these were logged, not stopped \xB7 nothing here was enforced` : enabled.size === 0 ? "\u2192 install node9 + enable shields above" : anyNeeds ? "\u2192 \u2713 marks rules from enabled shields \xB7 enable the rest above" : "\u2192 \u2713 all these rules come from enabled shields";
|
|
7823
7827
|
return /* @__PURE__ */ jsxs7(Box7, { borderStyle: "round", borderColor: "red", paddingX: 1, flexDirection: "column", width, children: [
|
|
7824
7828
|
/* @__PURE__ */ jsxs7(Text7, { bold: true, color: "red", children: [
|
|
7825
7829
|
recordOnly ? "LOGGED ONLY (not enforced)" : "WOULD HAVE BLOCKED",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node9/proxy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.44.0",
|
|
4
4
|
"description": "Access control for AI agents. Set what Claude Code, Codex, Gemini, Cursor and any MCP server are allowed to do, review risky actions before they run, and keep every action on the record.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|