vaspera 2.13.0 → 2.14.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/__tests__/antagonist-integration.test.d.ts +6 -0
  3. package/dist/__tests__/antagonist-integration.test.d.ts.map +1 -0
  4. package/dist/__tests__/antagonist-integration.test.js +239 -0
  5. package/dist/__tests__/antagonist-integration.test.js.map +1 -0
  6. package/dist/agents/antagonist/challenger.d.ts +46 -0
  7. package/dist/agents/antagonist/challenger.d.ts.map +1 -0
  8. package/dist/agents/antagonist/challenger.js +257 -0
  9. package/dist/agents/antagonist/challenger.js.map +1 -0
  10. package/dist/agents/antagonist/index.d.ts +31 -0
  11. package/dist/agents/antagonist/index.d.ts.map +1 -0
  12. package/dist/agents/antagonist/index.js +175 -0
  13. package/dist/agents/antagonist/index.js.map +1 -0
  14. package/dist/agents/antagonist/prioritizer.d.ts +27 -0
  15. package/dist/agents/antagonist/prioritizer.d.ts.map +1 -0
  16. package/dist/agents/antagonist/prioritizer.js +181 -0
  17. package/dist/agents/antagonist/prioritizer.js.map +1 -0
  18. package/dist/agents/antagonist/prompts.d.ts +12 -0
  19. package/dist/agents/antagonist/prompts.d.ts.map +1 -0
  20. package/dist/agents/antagonist/prompts.js +155 -0
  21. package/dist/agents/antagonist/prompts.js.map +1 -0
  22. package/dist/agents/antagonist/synthesizer.d.ts +34 -0
  23. package/dist/agents/antagonist/synthesizer.d.ts.map +1 -0
  24. package/dist/agents/antagonist/synthesizer.js +451 -0
  25. package/dist/agents/antagonist/synthesizer.js.map +1 -0
  26. package/dist/agents/antagonist/types.d.ts +145 -0
  27. package/dist/agents/antagonist/types.d.ts.map +1 -0
  28. package/dist/agents/antagonist/types.js +63 -0
  29. package/dist/agents/antagonist/types.js.map +1 -0
  30. package/dist/agents/index.d.ts +1 -0
  31. package/dist/agents/index.d.ts.map +1 -1
  32. package/dist/agents/index.js +2 -0
  33. package/dist/agents/index.js.map +1 -1
  34. package/dist/certification/consensus.test.js +2 -0
  35. package/dist/certification/consensus.test.js.map +1 -1
  36. package/dist/certification/store.d.ts.map +1 -1
  37. package/dist/certification/store.js +6 -1
  38. package/dist/certification/store.js.map +1 -1
  39. package/dist/certification/types.d.ts +1 -1
  40. package/dist/certification/types.d.ts.map +1 -1
  41. package/dist/certification/types.js +2 -0
  42. package/dist/certification/types.js.map +1 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +164 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/sbom/provenance.test.js +2 -2
  47. package/dist/sbom/provenance.test.js.map +1 -1
  48. package/dist/sbom/signing.d.ts.map +1 -1
  49. package/dist/sbom/signing.js +5 -3
  50. package/dist/sbom/signing.js.map +1 -1
  51. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.14.0] - 2026-06-05
4
+
5
+ ### Added
6
+
7
+ #### Antagonist Agent
8
+ - New meta-analysis agent that runs after all other agents complete
9
+ - **Synthesis mode**: Chains findings into attack narratives mapped to MITRE ATT&CK kill chain
10
+ - **Challenger mode**: Internal critic that flags false positives, coverage gaps, and inconsistencies
11
+ - Prioritized remediation recommendations based on attack surface reduction
12
+ - New `antagonist_synthesize` tool - full analysis with narratives, challenges, and prioritization
13
+ - New `antagonist_challenge` tool - manually challenge specific findings
14
+
15
+ #### Attack Narrative Features
16
+ - Builds attack graphs from findings and exploit chains
17
+ - Maps vulnerabilities to 14 MITRE ATT&CK kill chain phases
18
+ - Identifies bottleneck findings that block multiple attack paths
19
+ - Generates human-readable attack stories with difficulty/likelihood ratings
20
+
21
+ #### Challenger Features
22
+ - Detects potential false positives (test files, low confidence, generic descriptions)
23
+ - Identifies untested attack vectors (17 categories tracked)
24
+ - Flags agents with zero findings as potentially incomplete
25
+ - Calculates coverage score across attack surface
26
+
27
+ ### Fixed
28
+ - Empty catch blocks in `store.ts` and `signing.ts` now log errors
29
+ - Antagonist agent integration test types corrected
30
+
31
+ ### Changed
32
+ - MCP tools increased from 108 to 110
33
+ - New agent type `antagonist` with weight 0.15 (informs but doesn't dominate consensus)
34
+ - Added to AGENT_VERIFICATION_MAP (verified by security, adversary, redteam)
35
+
3
36
  ## [2.13.0] - 2026-06-04
4
37
 
5
38
  ### Added
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Integration test for Antagonist Agent
3
+ * Tests the full pipeline on sample findings
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=antagonist-integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"antagonist-integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/antagonist-integration.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,239 @@
1
+ /**
2
+ * Integration test for Antagonist Agent
3
+ * Tests the full pipeline on sample findings
4
+ */
5
+ import { describe, it, expect } from "vitest";
6
+ import { synthesizeNarrativesDeterministic } from "../agents/antagonist/synthesizer.js";
7
+ import { runChallengerDeterministic } from "../agents/antagonist/challenger.js";
8
+ import { prioritizeRemediations } from "../agents/antagonist/prioritizer.js";
9
+ import { DEFAULT_ANTAGONIST_CONFIG } from "../agents/antagonist/types.js";
10
+ // Sample findings that represent real security issues
11
+ const sampleFindings = [
12
+ {
13
+ id: "find-001",
14
+ severity: "high",
15
+ category: "command-injection",
16
+ description: "Potential command injection via unsanitized user input",
17
+ evidence: "spawn(cmd, [userInput])",
18
+ confidence: 85,
19
+ verifications: [],
20
+ created_at: new Date().toISOString(),
21
+ file: "src/scanners/custom.ts",
22
+ line: 42,
23
+ },
24
+ {
25
+ id: "find-002",
26
+ severity: "medium",
27
+ category: "hardcoded-secret",
28
+ description: "Hardcoded API key detected",
29
+ evidence: "const API_KEY = 'sk-...'",
30
+ confidence: 90,
31
+ verifications: [],
32
+ created_at: new Date().toISOString(),
33
+ file: "src/config.ts",
34
+ line: 15,
35
+ },
36
+ {
37
+ id: "find-003",
38
+ severity: "high",
39
+ category: "auth-bypass",
40
+ description: "Missing authentication check on admin endpoint",
41
+ evidence: "No auth middleware on /admin route",
42
+ confidence: 75,
43
+ verifications: [],
44
+ created_at: new Date().toISOString(),
45
+ file: "src/routes/admin.ts",
46
+ line: 8,
47
+ },
48
+ {
49
+ id: "find-004",
50
+ severity: "critical",
51
+ category: "sql-injection",
52
+ description: "SQL injection vulnerability in query builder",
53
+ evidence: "db.query(`SELECT * FROM users WHERE id = ${userId}`)",
54
+ confidence: 95,
55
+ verifications: [],
56
+ created_at: new Date().toISOString(),
57
+ file: "src/db/queries.ts",
58
+ line: 22,
59
+ },
60
+ {
61
+ id: "find-005",
62
+ severity: "low",
63
+ category: "xss",
64
+ description: "Potential XSS in user-generated content",
65
+ evidence: "innerHTML = userContent",
66
+ confidence: 60,
67
+ verifications: [],
68
+ created_at: new Date().toISOString(),
69
+ file: "src/components/Comment.tsx",
70
+ line: 55,
71
+ },
72
+ ];
73
+ // Sample exploit chains (matching ExploitChain type)
74
+ const sampleChains = [
75
+ {
76
+ id: "chain-001",
77
+ name: "Auth Bypass to Data Exfil",
78
+ steps: [
79
+ {
80
+ findingId: "find-003",
81
+ finding: sampleFindings[2],
82
+ role: "entry",
83
+ enables: "find-004",
84
+ techniques: ["T1190"],
85
+ },
86
+ {
87
+ findingId: "find-004",
88
+ finding: sampleFindings[3],
89
+ role: "target",
90
+ prerequisite: "find-003",
91
+ techniques: ["T1213"],
92
+ },
93
+ ],
94
+ totalSeverity: "critical",
95
+ originalSeverities: ["high", "critical"],
96
+ confidence: 85,
97
+ attackScenario: "Attacker bypasses auth, then exfiltrates data via SQL injection",
98
+ mitreAttackIds: ["T1190", "T1213"],
99
+ impact: "Data breach - full database access",
100
+ difficulty: "easy",
101
+ },
102
+ ];
103
+ // Agent summaries
104
+ const agentSummaries = {
105
+ security: { completed: true, findingCount: 5 },
106
+ reliability: { completed: true, findingCount: 2 },
107
+ typesafety: { completed: true, findingCount: 1 },
108
+ performance: { completed: true, findingCount: 0 },
109
+ quality: { completed: true, findingCount: 3 },
110
+ redteam: { completed: true, findingCount: 1 },
111
+ "agent-redteam": { completed: false, findingCount: 0 },
112
+ "agent-privacy": { completed: false, findingCount: 0 },
113
+ "agent-integrity": { completed: false, findingCount: 0 },
114
+ adversary: { completed: false, findingCount: 0 },
115
+ antagonist: { completed: false, findingCount: 0 },
116
+ };
117
+ // Test config with all required fields
118
+ const testConfig = {
119
+ ...DEFAULT_ANTAGONIST_CONFIG,
120
+ maxNarratives: 5,
121
+ minConfidence: 50,
122
+ challengeThreshold: 50,
123
+ };
124
+ describe("Antagonist Integration", () => {
125
+ describe("synthesizeNarrativesDeterministic", () => {
126
+ it("generates attack narratives from findings", () => {
127
+ const narratives = synthesizeNarrativesDeterministic(sampleFindings, sampleChains, [], testConfig);
128
+ expect(narratives.length).toBeGreaterThan(0);
129
+ expect(narratives[0]).toHaveProperty("id");
130
+ expect(narratives[0]).toHaveProperty("name");
131
+ expect(narratives[0]).toHaveProperty("phases");
132
+ expect(narratives[0]).toHaveProperty("narrative");
133
+ expect(narratives[0]).toHaveProperty("findingIds");
134
+ expect(narratives[0]).toHaveProperty("recommendations");
135
+ });
136
+ it("includes MITRE ATT&CK techniques", () => {
137
+ const narratives = synthesizeNarrativesDeterministic(sampleFindings, sampleChains, [], testConfig);
138
+ const narrativeWithTechniques = narratives.find((n) => n.mitreTechniques.length > 0);
139
+ expect(narrativeWithTechniques).toBeDefined();
140
+ });
141
+ it("maps findings to kill chain phases", () => {
142
+ const narratives = synthesizeNarrativesDeterministic(sampleFindings, sampleChains, [], testConfig);
143
+ const narrative = narratives[0];
144
+ expect(narrative.phases.length).toBeGreaterThan(0);
145
+ expect(narrative.phases[0]).toHaveProperty("phase");
146
+ expect(narrative.phases[0]).toHaveProperty("description");
147
+ });
148
+ it("prioritizes critical findings in narratives", () => {
149
+ const narratives = synthesizeNarrativesDeterministic(sampleFindings, sampleChains, [], testConfig);
150
+ const hasCritical = narratives.some((n) => n.findingIds.includes("find-004"));
151
+ expect(hasCritical).toBe(true);
152
+ });
153
+ });
154
+ describe("runChallengerDeterministic", () => {
155
+ it("identifies coverage gaps", () => {
156
+ const result = runChallengerDeterministic(sampleFindings, agentSummaries, testConfig);
157
+ expect(result.assessments).toBeDefined();
158
+ expect(result.gapAnalysis).toBeDefined();
159
+ expect(result.gapAnalysis).toHaveProperty("untestedAttackVectors");
160
+ expect(result.gapAnalysis).toHaveProperty("missingControls");
161
+ expect(result.gapAnalysis).toHaveProperty("coverageScore");
162
+ });
163
+ it("flags potential false positives", () => {
164
+ const findingsWithTestFile = [
165
+ ...sampleFindings,
166
+ {
167
+ id: "find-test",
168
+ severity: "medium",
169
+ category: "sql-injection",
170
+ description: "SQL injection in test",
171
+ evidence: "test code",
172
+ confidence: 60,
173
+ verifications: [],
174
+ created_at: new Date().toISOString(),
175
+ file: "src/__tests__/db.test.ts",
176
+ line: 10,
177
+ },
178
+ ];
179
+ const result = runChallengerDeterministic(findingsWithTestFile, agentSummaries, testConfig);
180
+ const testChallenge = result.assessments.find((c) => c.targetFindingId === "find-test" && c.type === "false_positive_likely");
181
+ expect(testChallenge).toBeDefined();
182
+ expect(testChallenge?.challenge).toContain("false positive");
183
+ });
184
+ it("warns about agents with zero findings", () => {
185
+ const summariesWithZero = {
186
+ ...agentSummaries,
187
+ performance: { completed: true, findingCount: 0 },
188
+ };
189
+ const result = runChallengerDeterministic(sampleFindings, summariesWithZero, testConfig);
190
+ const zeroFindingChallenge = result.assessments.find((c) => c.type === "missed_check" && c.targetAgent === "performance");
191
+ expect(zeroFindingChallenge).toBeDefined();
192
+ });
193
+ });
194
+ describe("prioritizeRemediations", () => {
195
+ it("generates prioritized remediation list", () => {
196
+ const narratives = synthesizeNarrativesDeterministic(sampleFindings, sampleChains, [], testConfig);
197
+ const prioritized = prioritizeRemediations(sampleFindings, narratives);
198
+ expect(prioritized.length).toBeGreaterThan(0);
199
+ expect(prioritized[0]).toHaveProperty("order");
200
+ expect(prioritized[0]).toHaveProperty("findingId");
201
+ expect(prioritized[0]).toHaveProperty("reason");
202
+ expect(prioritized[0]).toHaveProperty("effort");
203
+ expect(prioritized[0]).toHaveProperty("impact");
204
+ });
205
+ it("prioritizes critical findings first", () => {
206
+ const narratives = synthesizeNarrativesDeterministic(sampleFindings, sampleChains, [], testConfig);
207
+ const prioritized = prioritizeRemediations(sampleFindings, narratives);
208
+ const criticalPosition = prioritized.findIndex((p) => p.findingId === "find-004");
209
+ expect(criticalPosition).toBeLessThan(3);
210
+ });
211
+ it("considers bottleneck findings (appear in multiple narratives)", () => {
212
+ const narratives = synthesizeNarrativesDeterministic(sampleFindings, sampleChains, [], testConfig);
213
+ const prioritized = prioritizeRemediations(sampleFindings, narratives);
214
+ const hasBlocksNarratives = prioritized.some((p) => p.blocksNarratives && p.blocksNarratives.length > 0);
215
+ expect(hasBlocksNarratives).toBe(true);
216
+ });
217
+ });
218
+ describe("Full pipeline", () => {
219
+ it("runs complete antagonist analysis", () => {
220
+ const narratives = synthesizeNarrativesDeterministic(sampleFindings, sampleChains, [], testConfig);
221
+ const challengerResult = runChallengerDeterministic(sampleFindings, agentSummaries, testConfig);
222
+ const prioritized = prioritizeRemediations(sampleFindings, narratives);
223
+ expect(narratives.length).toBeGreaterThan(0);
224
+ expect(challengerResult.assessments).toBeDefined();
225
+ expect(challengerResult.gapAnalysis).toBeDefined();
226
+ expect(prioritized.length).toBeGreaterThan(0);
227
+ console.log("\n=== Antagonist Analysis Summary ===");
228
+ console.log(`Attack Narratives: ${narratives.length}`);
229
+ console.log(`Challenger Assessments: ${challengerResult.assessments.length}`);
230
+ console.log(`Coverage Score: ${challengerResult.gapAnalysis.coverageScore}%`);
231
+ console.log(`Prioritized Remediations: ${prioritized.length}`);
232
+ console.log("\nTop 3 Remediation Priorities:");
233
+ prioritized.slice(0, 3).forEach((p, i) => {
234
+ console.log(` ${i + 1}. ${p.findingId}: ${p.reason}`);
235
+ });
236
+ });
237
+ });
238
+ });
239
+ //# sourceMappingURL=antagonist-integration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"antagonist-integration.test.js","sourceRoot":"","sources":["../../src/__tests__/antagonist-integration.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAI1E,sDAAsD;AACtD,MAAM,cAAc,GAAc;IAChC;QACE,EAAE,EAAE,UAAU;QACd,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,mBAAmB;QAC7B,WAAW,EAAE,wDAAwD;QACrE,QAAQ,EAAE,yBAAyB;QACnC,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,EAAE;QACjB,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,EAAE;KACT;IACD;QACE,EAAE,EAAE,UAAU;QACd,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,kBAAkB;QAC5B,WAAW,EAAE,4BAA4B;QACzC,QAAQ,EAAE,0BAA0B;QACpC,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,EAAE;QACjB,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,EAAE;KACT;IACD;QACE,EAAE,EAAE,UAAU;QACd,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,aAAa;QACvB,WAAW,EAAE,gDAAgD;QAC7D,QAAQ,EAAE,oCAAoC;QAC9C,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,EAA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AW,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;YAE9C,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;YACrD,OAAO,CAAC,GAAG,CAAC,sBAAsB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;YACvD,OAAO,CAAC,GAAG,CAAC,2BAA2B,gBAAgB,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9E,OAAO,CAAC,GAAG,CAAC,mBAAmB,gBAAgB,CAAC,WAAW,CAAC,aAAa,GAAG,CAAC,CAAC;YAC9E,OAAO,CAAC,GAAG,CAAC,6BAA6B,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;YAC/D,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;YAC/C,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;gBACvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Antagonist Challenger Module
3
+ *
4
+ * The internal critic that:
5
+ * 1. Checks for missing coverage (areas no agent scanned)
6
+ * 2. Identifies findings with low cross-verification
7
+ * 3. Flags potential false positives
8
+ * 4. Challenges assumptions
9
+ * 5. Detects inconsistent findings
10
+ *
11
+ * @module agents/antagonist/challenger
12
+ */
13
+ import type { AgentType, Finding } from "../../certification/types.js";
14
+ import type { ChallengerAssessment, GapAnalysis, AntagonistConfig } from "./types.js";
15
+ /**
16
+ * Run challenger analysis without LLM
17
+ */
18
+ export declare function runChallengerDeterministic(findings: Finding[], agentSummaries: Record<AgentType, {
19
+ completed: boolean;
20
+ findingCount: number;
21
+ }>, config: AntagonistConfig): {
22
+ assessments: ChallengerAssessment[];
23
+ gapAnalysis: GapAnalysis;
24
+ };
25
+ /**
26
+ * Run challenger analysis with LLM
27
+ */
28
+ export declare function runChallengerLlm(findings: Finding[], agentSummaries: Record<AgentType, {
29
+ completed: boolean;
30
+ findingCount: number;
31
+ }>, config: AntagonistConfig): Promise<{
32
+ assessments: ChallengerAssessment[];
33
+ tokensUsed: number;
34
+ }>;
35
+ /**
36
+ * Main challenger function - combines deterministic and LLM approaches
37
+ */
38
+ export declare function runChallenger(findings: Finding[], agentSummaries: Record<AgentType, {
39
+ completed: boolean;
40
+ findingCount: number;
41
+ }>, config: AntagonistConfig): Promise<{
42
+ assessments: ChallengerAssessment[];
43
+ gapAnalysis: GapAnalysis;
44
+ tokensUsed: number;
45
+ }>;
46
+ //# sourceMappingURL=challenger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"challenger.d.ts","sourceRoot":"","sources":["../../../src/agents/antagonist/challenger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAY,MAAM,8BAA8B,CAAC;AACjF,OAAO,KAAK,EACV,oBAAoB,EAEpB,WAAW,EAEX,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAmHpB;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,OAAO,EAAE,EACnB,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,EAC/E,MAAM,EAAE,gBAAgB,GACvB;IAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;IAAC,WAAW,EAAE,WAAW,CAAA;CAAE,CAuGnE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,OAAO,EAAE,EACnB,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,EAC/E,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC;IAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAqEtE;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,OAAO,EAAE,EACnB,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,EAC/E,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC;IACT,WAAW,EAAE,oBAAoB,EAAE,CAAC;IACpC,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CA0BD"}
@@ -0,0 +1,257 @@
1
+ /**
2
+ * Antagonist Challenger Module
3
+ *
4
+ * The internal critic that:
5
+ * 1. Checks for missing coverage (areas no agent scanned)
6
+ * 2. Identifies findings with low cross-verification
7
+ * 3. Flags potential false positives
8
+ * 4. Challenges assumptions
9
+ * 5. Detects inconsistent findings
10
+ *
11
+ * @module agents/antagonist/challenger
12
+ */
13
+ import Anthropic from "@anthropic-ai/sdk";
14
+ import { ATTACK_VECTORS, CATEGORY_TO_VECTOR } from "./types.js";
15
+ import { CHALLENGER_SYSTEM_PROMPT, buildChallengerPrompt } from "./prompts.js";
16
+ import { logger } from "../../logger.js";
17
+ /**
18
+ * Check which attack vectors are not covered by findings
19
+ */
20
+ function findUncoveredVectors(findings) {
21
+ const coveredVectors = new Set();
22
+ for (const finding of findings) {
23
+ const vector = CATEGORY_TO_VECTOR[finding.category];
24
+ if (vector) {
25
+ coveredVectors.add(vector);
26
+ }
27
+ }
28
+ return ATTACK_VECTORS.filter((v) => !coveredVectors.has(v));
29
+ }
30
+ /**
31
+ * Find findings with low cross-verification
32
+ */
33
+ function findUnverifiedFindings(findings) {
34
+ return findings.filter((f) => {
35
+ if (!f.verifications || f.verifications.length === 0) {
36
+ return f.severity === "critical" || f.severity === "high";
37
+ }
38
+ const confirmations = f.verifications.filter((v) => v.verdict === "confirmed").length;
39
+ const disputes = f.verifications.filter((v) => v.verdict === "disputed").length;
40
+ return disputes > confirmations;
41
+ });
42
+ }
43
+ /**
44
+ * Detect potential false positives based on patterns
45
+ */
46
+ function detectPotentialFalsePositives(findings) {
47
+ const suspects = [];
48
+ for (const finding of findings) {
49
+ const isSuspect = (finding.file?.includes("test") ||
50
+ finding.file?.includes("spec") ||
51
+ finding.file?.includes("mock")) &&
52
+ finding.severity !== "critical";
53
+ const isLowConfidence = finding.confidence < 70;
54
+ const isGenericDescription = finding.description.length < 50 ||
55
+ finding.description.includes("TODO") ||
56
+ finding.description.includes("FIXME");
57
+ if (isSuspect || isLowConfidence || isGenericDescription) {
58
+ suspects.push(finding);
59
+ }
60
+ }
61
+ return suspects;
62
+ }
63
+ /**
64
+ * Find inconsistent findings across agents
65
+ */
66
+ function findInconsistencies(findings) {
67
+ const inconsistencies = [];
68
+ const byFile = new Map();
69
+ for (const f of findings) {
70
+ if (!f.file)
71
+ continue;
72
+ const existing = byFile.get(f.file) || [];
73
+ existing.push(f);
74
+ byFile.set(f.file, existing);
75
+ }
76
+ for (const [file, fileFindings] of byFile) {
77
+ if (fileFindings.length < 2)
78
+ continue;
79
+ for (let i = 0; i < fileFindings.length; i++) {
80
+ for (let j = i + 1; j < fileFindings.length; j++) {
81
+ const f1 = fileFindings[i];
82
+ const f2 = fileFindings[j];
83
+ if (f1.category === f2.category &&
84
+ Math.abs((f1.line || 0) - (f2.line || 0)) < 5 &&
85
+ f1.severity !== f2.severity) {
86
+ inconsistencies.push({
87
+ finding1: f1,
88
+ finding2: f2,
89
+ reason: `Same category (${f1.category}) at similar location but different severities (${f1.severity} vs ${f2.severity})`,
90
+ });
91
+ }
92
+ }
93
+ }
94
+ }
95
+ return inconsistencies;
96
+ }
97
+ /**
98
+ * Run challenger analysis without LLM
99
+ */
100
+ export function runChallengerDeterministic(findings, agentSummaries, config) {
101
+ const assessments = [];
102
+ const uncoveredVectors = findUncoveredVectors(findings);
103
+ for (const vector of uncoveredVectors.slice(0, 5)) {
104
+ assessments.push({
105
+ id: `chal-gap-${vector}`,
106
+ type: "missed_check",
107
+ targetAgent: "security",
108
+ challenge: `Attack vector "${vector}" was not tested`,
109
+ evidence: `No findings in categories mapped to ${vector}`,
110
+ suggestedAction: `Add explicit checks for ${vector} vulnerabilities`,
111
+ severity: "medium",
112
+ confidence: 80,
113
+ });
114
+ }
115
+ const unverifiedFindings = findUnverifiedFindings(findings);
116
+ for (const finding of unverifiedFindings.slice(0, 5)) {
117
+ const disputes = finding.verifications?.filter((v) => v.verdict === "disputed") || [];
118
+ assessments.push({
119
+ id: `chal-unverified-${finding.id}`,
120
+ type: "insufficient_evidence",
121
+ targetAgent: finding.scanner_source || "security",
122
+ targetFindingId: finding.id,
123
+ challenge: `Finding has ${disputes.length} disputes and insufficient verification`,
124
+ evidence: disputes.map((d) => d.evidence).join("; ") || "No cross-verification",
125
+ suggestedAction: "Re-verify this finding with additional evidence",
126
+ severity: finding.severity,
127
+ confidence: 75,
128
+ });
129
+ }
130
+ const potentialFPs = detectPotentialFalsePositives(findings);
131
+ for (const finding of potentialFPs.slice(0, 5)) {
132
+ const reasons = [];
133
+ if (finding.file?.includes("test"))
134
+ reasons.push("in test file");
135
+ if (finding.confidence < 70)
136
+ reasons.push("low confidence");
137
+ if (finding.description.length < 50)
138
+ reasons.push("generic description");
139
+ assessments.push({
140
+ id: `chal-fp-${finding.id}`,
141
+ type: "false_positive_likely",
142
+ targetAgent: finding.scanner_source || "security",
143
+ targetFindingId: finding.id,
144
+ challenge: `Likely false positive: ${reasons.join(", ")}`,
145
+ evidence: `File: ${finding.file}, Confidence: ${finding.confidence}%`,
146
+ suggestedAction: "Review and potentially dismiss this finding",
147
+ severity: "low",
148
+ confidence: 65,
149
+ });
150
+ }
151
+ const inconsistencies = findInconsistencies(findings);
152
+ for (const { finding1, finding2, reason } of inconsistencies.slice(0, 3)) {
153
+ assessments.push({
154
+ id: `chal-inconsistent-${finding1.id}-${finding2.id}`,
155
+ type: "wrong_assumption",
156
+ targetAgent: finding1.scanner_source || "security",
157
+ targetFindingId: finding1.id,
158
+ challenge: `Inconsistent findings: ${reason}`,
159
+ evidence: `${finding1.id} vs ${finding2.id}`,
160
+ suggestedAction: "Reconcile these findings to determine correct severity",
161
+ severity: "medium",
162
+ confidence: 70,
163
+ });
164
+ }
165
+ const agentsWithNoFindings = Object.entries(agentSummaries)
166
+ .filter(([_, summary]) => summary.completed && summary.findingCount === 0)
167
+ .map(([agent]) => agent);
168
+ for (const agent of agentsWithNoFindings) {
169
+ assessments.push({
170
+ id: `chal-empty-${agent}`,
171
+ type: "missed_check",
172
+ targetAgent: agent,
173
+ challenge: `Agent "${agent}" completed but found no issues`,
174
+ evidence: "Zero findings submitted",
175
+ suggestedAction: "Verify agent ran correctly and coverage was adequate",
176
+ severity: "low",
177
+ confidence: 60,
178
+ });
179
+ }
180
+ const gapAnalysis = {
181
+ untestedAttackVectors: uncoveredVectors,
182
+ missingControls: uncoveredVectors.map((v) => `No ${v} testing`),
183
+ blindSpots: agentsWithNoFindings.map((a) => `${a} agent found nothing`),
184
+ recommendations: [
185
+ ...uncoveredVectors.slice(0, 3).map((v) => `Add ${v} security checks`),
186
+ ...agentsWithNoFindings.map((a) => `Verify ${a} agent coverage`),
187
+ ],
188
+ coverageScore: Math.round(((ATTACK_VECTORS.length - uncoveredVectors.length) / ATTACK_VECTORS.length) * 100),
189
+ };
190
+ return {
191
+ assessments: assessments.filter((a) => a.confidence >= config.challengeThreshold),
192
+ gapAnalysis,
193
+ };
194
+ }
195
+ /**
196
+ * Run challenger analysis with LLM
197
+ */
198
+ export async function runChallengerLlm(findings, agentSummaries, config) {
199
+ const client = new Anthropic();
200
+ const findingsStr = findings
201
+ .slice(0, 30)
202
+ .map((f) => `- ${f.id}: [${f.severity}] ${f.category} at ${f.file}:${f.line} - ${f.description} (confidence: ${f.confidence}%)`)
203
+ .join("\n");
204
+ const agentStr = Object.entries(agentSummaries)
205
+ .map(([agent, summary]) => `- ${agent}: ${summary.findingCount} findings`)
206
+ .join("\n");
207
+ const vectorsStr = ATTACK_VECTORS.join(", ");
208
+ const prompt = buildChallengerPrompt(findingsStr, agentStr, vectorsStr);
209
+ try {
210
+ const response = await client.messages.create({
211
+ model: config.llmModel || "claude-sonnet-4-20250514",
212
+ max_tokens: 2048,
213
+ system: CHALLENGER_SYSTEM_PROMPT,
214
+ messages: [{ role: "user", content: prompt }],
215
+ });
216
+ const content = response.content[0];
217
+ if (content.type !== "text") {
218
+ throw new Error("Unexpected response type");
219
+ }
220
+ const jsonMatch = content.text.match(/\{[\s\S]*\}/);
221
+ if (!jsonMatch) {
222
+ throw new Error("No JSON in response");
223
+ }
224
+ const parsed = JSON.parse(jsonMatch[0]);
225
+ const assessments = parsed.challenges.map((c, i) => ({
226
+ id: `chal-llm-${Date.now().toString(36)}-${i}`,
227
+ ...c,
228
+ }));
229
+ const tokensUsed = (response.usage?.input_tokens || 0) +
230
+ (response.usage?.output_tokens || 0);
231
+ return { assessments, tokensUsed };
232
+ }
233
+ catch (error) {
234
+ logger.warn("antagonist.llm_challenger_failed", {
235
+ error: error instanceof Error ? error.message : String(error),
236
+ });
237
+ return { assessments: [], tokensUsed: 0 };
238
+ }
239
+ }
240
+ /**
241
+ * Main challenger function - combines deterministic and LLM approaches
242
+ */
243
+ export async function runChallenger(findings, agentSummaries, config) {
244
+ const { assessments: deterministicAssessments, gapAnalysis } = runChallengerDeterministic(findings, agentSummaries, config);
245
+ if (!config.useLlm || findings.length < 5) {
246
+ return { assessments: deterministicAssessments, gapAnalysis, tokensUsed: 0 };
247
+ }
248
+ const { assessments: llmAssessments, tokensUsed } = await runChallengerLlm(findings, agentSummaries, config);
249
+ const existingIds = new Set(deterministicAssessments.map((a) => a.targetFindingId).filter(Boolean));
250
+ const uniqueLlmAssessments = llmAssessments.filter((a) => !a.targetFindingId || !existingIds.has(a.targetFindingId));
251
+ return {
252
+ assessments: [...deterministicAssessments, ...uniqueLlmAssessments],
253
+ gapAnalysis,
254
+ tokensUsed,
255
+ };
256
+ }
257
+ //# sourceMappingURL=challenger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"challenger.js","sourceRoot":"","sources":["../../../src/agents/antagonist/challenger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAS1C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC;;GAEG;AACH,SAAS,oBAAoB,CAAC,QAAmB;IAC/C,MAAM,cAAc,GAAG,IAAI,GAAG,EAAgB,CAAC;IAE/C,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACpD,IAAI,MAAM,EAAE,CAAC;YACX,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAS,sBAAsB,CAAC,QAAmB;IACjD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QAC3B,IAAI,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrD,OAAO,CAAC,CAAC,QAAQ,KAAK,UAA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