vaspera 2.5.0 → 2.8.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 (67) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/dist/agents/adversary/config.d.ts +92 -0
  3. package/dist/agents/adversary/config.d.ts.map +1 -0
  4. package/dist/agents/adversary/config.js +361 -0
  5. package/dist/agents/adversary/config.js.map +1 -0
  6. package/dist/agents/adversary/index.d.ts +34 -0
  7. package/dist/agents/adversary/index.d.ts.map +1 -0
  8. package/dist/agents/adversary/index.js +756 -0
  9. package/dist/agents/adversary/index.js.map +1 -0
  10. package/dist/agents/adversary/types.d.ts +351 -0
  11. package/dist/agents/adversary/types.d.ts.map +1 -0
  12. package/dist/agents/adversary/types.js +12 -0
  13. package/dist/agents/adversary/types.js.map +1 -0
  14. package/dist/agents/agent-integrity.test.d.ts +5 -0
  15. package/dist/agents/agent-integrity.test.d.ts.map +1 -0
  16. package/dist/agents/agent-integrity.test.js +364 -0
  17. package/dist/agents/agent-integrity.test.js.map +1 -0
  18. package/dist/agents/agent-privacy.test.d.ts +5 -0
  19. package/dist/agents/agent-privacy.test.d.ts.map +1 -0
  20. package/dist/agents/agent-privacy.test.js +373 -0
  21. package/dist/agents/agent-privacy.test.js.map +1 -0
  22. package/dist/agents/index.d.ts +1 -0
  23. package/dist/agents/index.d.ts.map +1 -1
  24. package/dist/agents/index.js +2 -0
  25. package/dist/agents/index.js.map +1 -1
  26. package/dist/certification/consensus.test.js +2 -0
  27. package/dist/certification/consensus.test.js.map +1 -1
  28. package/dist/certification/store.d.ts.map +1 -1
  29. package/dist/certification/store.js +4 -0
  30. package/dist/certification/store.js.map +1 -1
  31. package/dist/certification/types.d.ts +2 -2
  32. package/dist/certification/types.d.ts.map +1 -1
  33. package/dist/certification/types.js +2 -0
  34. package/dist/certification/types.js.map +1 -1
  35. package/dist/compliance/mapper.d.ts.map +1 -1
  36. package/dist/compliance/mapper.js +2 -2
  37. package/dist/compliance/mapper.js.map +1 -1
  38. package/dist/compliance/nist-800-53.d.ts +34 -0
  39. package/dist/compliance/nist-800-53.d.ts.map +1 -0
  40. package/dist/compliance/nist-800-53.js +664 -0
  41. package/dist/compliance/nist-800-53.js.map +1 -0
  42. package/dist/config/flags.test.d.ts +5 -0
  43. package/dist/config/flags.test.d.ts.map +1 -0
  44. package/dist/config/flags.test.js +489 -0
  45. package/dist/config/flags.test.js.map +1 -0
  46. package/dist/enterprise/policy/opa.test.js +4 -1
  47. package/dist/enterprise/policy/opa.test.js.map +1 -1
  48. package/dist/http-server.js +2 -1
  49. package/dist/http-server.js.map +1 -1
  50. package/dist/index.js.map +1 -1
  51. package/dist/observability/otel.test.d.ts +5 -0
  52. package/dist/observability/otel.test.d.ts.map +1 -0
  53. package/dist/observability/otel.test.js +269 -0
  54. package/dist/observability/otel.test.js.map +1 -0
  55. package/dist/plugins/loader.test.d.ts +5 -0
  56. package/dist/plugins/loader.test.d.ts.map +1 -0
  57. package/dist/plugins/loader.test.js +337 -0
  58. package/dist/plugins/loader.test.js.map +1 -0
  59. package/dist/sbom/provenance.test.js +2 -2
  60. package/dist/sbom/provenance.test.js.map +1 -1
  61. package/dist/scanners/agent/manifest-audit.d.ts.map +1 -1
  62. package/dist/scanners/agent/manifest-audit.js +30 -18
  63. package/dist/scanners/agent/manifest-audit.js.map +1 -1
  64. package/dist/scanners/dependencies.d.ts.map +1 -1
  65. package/dist/scanners/dependencies.js +1 -2
  66. package/dist/scanners/dependencies.js.map +1 -1
  67. package/package.json +12 -3
package/CHANGELOG.md CHANGED
@@ -5,6 +5,68 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.8.0] - 2026-04-29
9
+
10
+ ### Added
11
+
12
+ #### Agent Batch Submit Tool
13
+ - New `agent_batch_submit` tool for submitting findings from subagent JSON output
14
+ - Solves MCP permission issues when certification agents run as subagents
15
+ - Accepts array of findings and optional summary in one call
16
+ - Updated certification command docs to recommend batch submit
17
+
18
+ ### Fixed
19
+
20
+ #### CI/CD Improvements
21
+ - Lazy Stripe initialization to allow builds without `STRIPE_SECRET_KEY`
22
+ - Fixed TypeScript test timeout for CI environments
23
+ - Synced package-lock.json for CI compatibility
24
+
25
+ ## [2.7.0] - 2026-04-26
26
+
27
+ ### Added
28
+
29
+ #### Plan Enforcement
30
+ - New plan-limits system for free/pro/enterprise tiers
31
+ - Certification monthly limits enforced at API level
32
+ - Agent count limits based on subscription plan
33
+ - Compliance framework access gating (SOC2 free, HIPAA/NIST pro+)
34
+ - 403 responses with `PLAN_LIMIT_EXCEEDED` code and upgrade prompts
35
+
36
+ #### Plan Limits
37
+
38
+ | Limit | Free | Pro | Enterprise |
39
+ |-------|------|-----|------------|
40
+ | Certifications/month | 3 | 50 | Unlimited |
41
+ | Projects | 2 | 20 | Unlimited |
42
+ | Agents | 3 | 7 | All |
43
+ | Frameworks | SOC2 | SOC2, HIPAA, NIST | All |
44
+ | Red team | ❌ | ❌ | ✓ |
45
+
46
+ ## [2.6.0] - 2026-04-26
47
+
48
+ ### Added
49
+
50
+ #### Test Coverage
51
+ - 147 new tests across 5 test files
52
+ - `agent-integrity.test.ts` - Consensus analysis and outlier detection
53
+ - `agent-privacy.test.ts` - PII detection with Luhn validation
54
+ - `otel.test.ts` - OpenTelemetry metrics and tracing
55
+ - `loader.test.ts` - Plugin registry and sandboxed execution
56
+ - `flags.test.ts` - Feature flags and config loading
57
+
58
+ #### Feature Flags System
59
+ - New `.vaspera/config.yaml` configuration format
60
+ - Per-agent weights and model selection
61
+ - Per-scanner timeouts and custom rules
62
+ - Feature toggles for multiModel, costTracking, autofix, etc.
63
+
64
+ #### Plugin System
65
+ - Scanner plugin architecture with manifest schema
66
+ - Local plugins from `.vaspera/plugins/`
67
+ - npm plugins from `vaspera-scanner-*` packages
68
+ - Sandboxed execution in child processes
69
+
8
70
  ## [2.5.0] - 2026-04-24
9
71
 
10
72
  ### Added
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Adversary Agent - Configuration
3
+ *
4
+ * Default configurations and model settings for the adversary agent.
5
+ *
6
+ * @module agents/adversary/config
7
+ */
8
+ import type { AdversaryConfig, AdversaryModel, AggressivenessLevel, AttackFocusArea } from "./types.js";
9
+ /**
10
+ * Default configuration for passive analysis
11
+ */
12
+ export declare const PASSIVE_CONFIG: Partial<AdversaryConfig>;
13
+ /**
14
+ * Default configuration for active analysis
15
+ */
16
+ export declare const ACTIVE_CONFIG: Partial<AdversaryConfig>;
17
+ /**
18
+ * Default configuration for aggressive analysis
19
+ */
20
+ export declare const AGGRESSIVE_CONFIG: Partial<AdversaryConfig>;
21
+ /**
22
+ * All attack focus areas
23
+ */
24
+ export declare const ALL_FOCUS_AREAS: AttackFocusArea[];
25
+ /**
26
+ * Web-focused attack areas
27
+ */
28
+ export declare const WEB_FOCUS_AREAS: AttackFocusArea[];
29
+ /**
30
+ * LLM/AI-focused attack areas
31
+ */
32
+ export declare const LLM_FOCUS_AREAS: AttackFocusArea[];
33
+ /**
34
+ * Infrastructure-focused attack areas
35
+ */
36
+ export declare const INFRA_FOCUS_AREAS: AttackFocusArea[];
37
+ /**
38
+ * Model pricing per million tokens (as of 2026)
39
+ */
40
+ export declare const MODEL_PRICING: Record<AdversaryModel, {
41
+ input: number;
42
+ output: number;
43
+ }>;
44
+ /**
45
+ * Model capabilities
46
+ */
47
+ export declare const MODEL_CAPABILITIES: Record<AdversaryModel, {
48
+ contextWindow: number;
49
+ maxOutputTokens: number;
50
+ bestFor: string[];
51
+ }>;
52
+ /**
53
+ * Get model for plan tier
54
+ */
55
+ export declare function getModelForTier(tier: "free" | "pro" | "enterprise"): AdversaryModel | null;
56
+ /**
57
+ * Default include patterns for analysis
58
+ */
59
+ export declare const DEFAULT_INCLUDE_PATTERNS: string[];
60
+ /**
61
+ * Default exclude patterns
62
+ */
63
+ export declare const DEFAULT_EXCLUDE_PATTERNS: string[];
64
+ /**
65
+ * Security-relevant file patterns (prioritized)
66
+ */
67
+ export declare const SECURITY_RELEVANT_PATTERNS: string[];
68
+ /**
69
+ * MITRE ATT&CK technique mappings for focus areas
70
+ */
71
+ export declare const FOCUS_AREA_MITRE_MAPPING: Record<AttackFocusArea, string[]>;
72
+ /**
73
+ * Common CWE mappings for focus areas
74
+ */
75
+ export declare const FOCUS_AREA_CWE_MAPPING: Record<AttackFocusArea, string[]>;
76
+ /**
77
+ * Create default adversary configuration
78
+ */
79
+ export declare function createDefaultConfig(model: AdversaryModel, aggressiveness?: AggressivenessLevel): AdversaryConfig;
80
+ /**
81
+ * Create focused adversary configuration
82
+ */
83
+ export declare function createFocusedConfig(model: AdversaryModel, focusAreas: AttackFocusArea[], aggressiveness?: AggressivenessLevel): AdversaryConfig;
84
+ /**
85
+ * Estimate token usage for analysis
86
+ */
87
+ export declare function estimateTokenUsage(filesCount: number, avgFileSize: number, config: AdversaryConfig): {
88
+ estimatedInputTokens: number;
89
+ estimatedOutputTokens: number;
90
+ estimatedCost: number;
91
+ };
92
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/agents/adversary/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,eAAe,EAChB,MAAM,YAAY,CAAC;AAMpB;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,eAAe,CAMnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,eAAe,CAMlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,eAAe,CAMtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,eAAe,EAU5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,e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;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,eAAe,GACtB;IACD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;CACvB,CA2BA"}
@@ -0,0 +1,361 @@
1
+ /**
2
+ * Adversary Agent - Configuration
3
+ *
4
+ * Default configurations and model settings for the adversary agent.
5
+ *
6
+ * @module agents/adversary/config
7
+ */
8
+ // ============================================================================
9
+ // Default Configurations
10
+ // ============================================================================
11
+ /**
12
+ * Default configuration for passive analysis
13
+ */
14
+ export const PASSIVE_CONFIG = {
15
+ aggressiveness: "passive",
16
+ generatePoC: false,
17
+ maxAnalysisTime: 60000, // 1 minute
18
+ maxFiles: 50,
19
+ enableChaining: true,
20
+ };
21
+ /**
22
+ * Default configuration for active analysis
23
+ */
24
+ export const ACTIVE_CONFIG = {
25
+ aggressiveness: "active",
26
+ generatePoC: true,
27
+ maxAnalysisTime: 300000, // 5 minutes
28
+ maxFiles: 100,
29
+ enableChaining: true,
30
+ };
31
+ /**
32
+ * Default configuration for aggressive analysis
33
+ */
34
+ export const AGGRESSIVE_CONFIG = {
35
+ aggressiveness: "aggressive",
36
+ generatePoC: true,
37
+ maxAnalysisTime: 600000, // 10 minutes
38
+ maxFiles: 200,
39
+ enableChaining: true,
40
+ };
41
+ /**
42
+ * All attack focus areas
43
+ */
44
+ export const ALL_FOCUS_AREAS = [
45
+ "web-app",
46
+ "api",
47
+ "auth",
48
+ "injection",
49
+ "llm",
50
+ "infra",
51
+ "crypto",
52
+ "data-flow",
53
+ "supply-chain",
54
+ ];
55
+ /**
56
+ * Web-focused attack areas
57
+ */
58
+ export const WEB_FOCUS_AREAS = [
59
+ "web-app",
60
+ "api",
61
+ "auth",
62
+ "injection",
63
+ ];
64
+ /**
65
+ * LLM/AI-focused attack areas
66
+ */
67
+ export const LLM_FOCUS_AREAS = [
68
+ "llm",
69
+ "data-flow",
70
+ "supply-chain",
71
+ ];
72
+ /**
73
+ * Infrastructure-focused attack areas
74
+ */
75
+ export const INFRA_FOCUS_AREAS = [
76
+ "infra",
77
+ "crypto",
78
+ "supply-chain",
79
+ ];
80
+ // ============================================================================
81
+ // Model Configuration
82
+ // ============================================================================
83
+ /**
84
+ * Model pricing per million tokens (as of 2026)
85
+ */
86
+ export const MODEL_PRICING = {
87
+ "claude-sonnet-4": { input: 3.0, output: 15.0 },
88
+ "claude-opus-4": { input: 15.0, output: 75.0 },
89
+ };
90
+ /**
91
+ * Model capabilities
92
+ */
93
+ export const MODEL_CAPABILITIES = {
94
+ "claude-sonnet-4": {
95
+ contextWindow: 200000,
96
+ maxOutputTokens: 64000,
97
+ bestFor: ["Fast analysis", "Pattern detection", "Code review"],
98
+ },
99
+ "claude-opus-4": {
100
+ contextWindow: 200000,
101
+ maxOutputTokens: 64000,
102
+ bestFor: ["Deep reasoning", "Novel vulnerability discovery", "Complex chains"],
103
+ },
104
+ };
105
+ /**
106
+ * Get model for plan tier
107
+ */
108
+ export function getModelForTier(tier) {
109
+ switch (tier) {
110
+ case "free":
111
+ return null; // Adversary not available on free
112
+ case "pro":
113
+ return "claude-sonnet-4";
114
+ case "enterprise":
115
+ return "claude-opus-4";
116
+ }
117
+ }
118
+ // ============================================================================
119
+ // File Patterns
120
+ // ============================================================================
121
+ /**
122
+ * Default include patterns for analysis
123
+ */
124
+ export const DEFAULT_INCLUDE_PATTERNS = [
125
+ "**/*.ts",
126
+ "**/*.tsx",
127
+ "**/*.js",
128
+ "**/*.jsx",
129
+ "**/*.py",
130
+ "**/*.go",
131
+ "**/*.rs",
132
+ "**/*.java",
133
+ "**/*.rb",
134
+ "**/*.php",
135
+ "**/*.cs",
136
+ ];
137
+ /**
138
+ * Default exclude patterns
139
+ */
140
+ export const DEFAULT_EXCLUDE_PATTERNS = [
141
+ "**/node_modules/**",
142
+ "**/dist/**",
143
+ "**/build/**",
144
+ "**/.git/**",
145
+ "**/vendor/**",
146
+ "**/venv/**",
147
+ "**/__pycache__/**",
148
+ "**/coverage/**",
149
+ "**/*.test.*",
150
+ "**/*.spec.*",
151
+ "**/test/**",
152
+ "**/tests/**",
153
+ "**/__tests__/**",
154
+ "**/fixtures/**",
155
+ ];
156
+ /**
157
+ * Security-relevant file patterns (prioritized)
158
+ */
159
+ export const SECURITY_RELEVANT_PATTERNS = [
160
+ "**/auth/**",
161
+ "**/authentication/**",
162
+ "**/authorization/**",
163
+ "**/login/**",
164
+ "**/session/**",
165
+ "**/jwt/**",
166
+ "**/oauth/**",
167
+ "**/api/**",
168
+ "**/routes/**",
169
+ "**/handlers/**",
170
+ "**/controllers/**",
171
+ "**/middleware/**",
172
+ "**/crypto/**",
173
+ "**/encryption/**",
174
+ "**/db/**",
175
+ "**/database/**",
176
+ "**/sql/**",
177
+ "**/graphql/**",
178
+ "**/upload/**",
179
+ "**/download/**",
180
+ "**/file/**",
181
+ "**/admin/**",
182
+ "**/config/**",
183
+ "**/secrets/**",
184
+ "**/*password*",
185
+ "**/*credential*",
186
+ "**/*token*",
187
+ "**/*key*",
188
+ ];
189
+ // ============================================================================
190
+ // MITRE ATT&CK Mappings
191
+ // ============================================================================
192
+ /**
193
+ * MITRE ATT&CK technique mappings for focus areas
194
+ */
195
+ export const FOCUS_AREA_MITRE_MAPPING = {
196
+ "web-app": [
197
+ "T1189", // Drive-by Compromise
198
+ "T1190", // Exploit Public-Facing Application
199
+ "T1059", // Command and Scripting Interpreter
200
+ ],
201
+ "api": [
202
+ "T1190", // Exploit Public-Facing Application
203
+ "T1106", // Native API
204
+ "T1071", // Application Layer Protocol
205
+ ],
206
+ "auth": [
207
+ "T1078", // Valid Accounts
208
+ "T1110", // Brute Force
209
+ "T1539", // Steal Web Session Cookie
210
+ "T1556", // Modify Authentication Process
211
+ ],
212
+ "injection": [
213
+ "T1059", // Command and Scripting Interpreter
214
+ "T1203", // Exploitation for Client Execution
215
+ "T1505", // Server Software Component
216
+ ],
217
+ "llm": [
218
+ "AML.T0043", // Craft Adversarial Data (ATLAS)
219
+ "AML.T0048", // LLM Prompt Injection (ATLAS)
220
+ "AML.T0051", // LLM Jailbreak (ATLAS)
221
+ ],
222
+ "infra": [
223
+ "T1610", // Deploy Container
224
+ "T1525", // Implant Internal Image
225
+ "T1611", // Escape to Host
226
+ ],
227
+ "crypto": [
228
+ "T1552", // Unsecured Credentials
229
+ "T1557", // Adversary-in-the-Middle
230
+ "T1600", // Weaken Encryption
231
+ ],
232
+ "data-flow": [
233
+ "T1020", // Automated Exfiltration
234
+ "T1041", // Exfiltration Over C2 Channel
235
+ "T1567", // Exfiltration Over Web Service
236
+ ],
237
+ "supply-chain": [
238
+ "T1195", // Supply Chain Compromise
239
+ "T1199", // Trusted Relationship
240
+ "T1505", // Server Software Component
241
+ ],
242
+ };
243
+ // ============================================================================
244
+ // CWE Mappings
245
+ // ============================================================================
246
+ /**
247
+ * Common CWE mappings for focus areas
248
+ */
249
+ export const FOCUS_AREA_CWE_MAPPING = {
250
+ "web-app": [
251
+ "CWE-79", // XSS
252
+ "CWE-352", // CSRF
253
+ "CWE-1021", // Clickjacking
254
+ "CWE-942", // CORS Misconfiguration
255
+ ],
256
+ "api": [
257
+ "CWE-284", // Improper Access Control
258
+ "CWE-770", // Resource Allocation Without Limits
259
+ "CWE-200", // Exposure of Sensitive Information
260
+ "CWE-639", // IDOR
261
+ ],
262
+ "auth": [
263
+ "CWE-287", // Improper Authentication
264
+ "CWE-384", // Session Fixation
265
+ "CWE-798", // Hard-coded Credentials
266
+ "CWE-307", // Brute Force
267
+ ],
268
+ "injection": [
269
+ "CWE-89", // SQL Injection
270
+ "CWE-78", // OS Command Injection
271
+ "CWE-611", // XXE
272
+ "CWE-94", // Code Injection
273
+ "CWE-1336", // SSTI
274
+ ],
275
+ "llm": [
276
+ "CWE-1421", // Prompt Injection (proposed)
277
+ "CWE-200", // Sensitive Information Exposure
278
+ "CWE-284", // Improper Access Control
279
+ ],
280
+ "infra": [
281
+ "CWE-250", // Execution with Unnecessary Privileges
282
+ "CWE-269", // Improper Privilege Management
283
+ "CWE-668", // Exposure of Resource to Wrong Sphere
284
+ ],
285
+ "crypto": [
286
+ "CWE-327", // Use of Broken Crypto Algorithm
287
+ "CWE-326", // Inadequate Encryption Strength
288
+ "CWE-320", // Key Management Errors
289
+ "CWE-338", // Use of Weak PRNG
290
+ ],
291
+ "data-flow": [
292
+ "CWE-200", // Exposure of Sensitive Information
293
+ "CWE-532", // Log Injection
294
+ "CWE-209", // Generation of Error Message Containing Sensitive Info
295
+ ],
296
+ "supply-chain": [
297
+ "CWE-1104", // Use of Unmaintained Third-Party Components
298
+ "CWE-494", // Download of Code Without Integrity Check
299
+ "CWE-829", // Inclusion of Functionality from Untrusted Control Sphere
300
+ ],
301
+ };
302
+ // ============================================================================
303
+ // Factory Functions
304
+ // ============================================================================
305
+ /**
306
+ * Create default adversary configuration
307
+ */
308
+ export function createDefaultConfig(model, aggressiveness = "active") {
309
+ const baseConfig = aggressiveness === "passive"
310
+ ? PASSIVE_CONFIG
311
+ : aggressiveness === "active"
312
+ ? ACTIVE_CONFIG
313
+ : AGGRESSIVE_CONFIG;
314
+ return {
315
+ model,
316
+ aggressiveness,
317
+ focusAreas: ALL_FOCUS_AREAS,
318
+ maxAnalysisTime: baseConfig.maxAnalysisTime,
319
+ generatePoC: baseConfig.generatePoC,
320
+ maxFiles: baseConfig.maxFiles,
321
+ enableChaining: baseConfig.enableChaining,
322
+ includePatterns: DEFAULT_INCLUDE_PATTERNS,
323
+ excludePatterns: DEFAULT_EXCLUDE_PATTERNS,
324
+ };
325
+ }
326
+ /**
327
+ * Create focused adversary configuration
328
+ */
329
+ export function createFocusedConfig(model, focusAreas, aggressiveness = "active") {
330
+ const config = createDefaultConfig(model, aggressiveness);
331
+ config.focusAreas = focusAreas;
332
+ return config;
333
+ }
334
+ /**
335
+ * Estimate token usage for analysis
336
+ */
337
+ export function estimateTokenUsage(filesCount, avgFileSize, config) {
338
+ // Rough estimates based on typical analysis
339
+ const tokensPerKB = 250;
340
+ const avgFileSizeKB = avgFileSize / 1024;
341
+ // Input: code context + prompts
342
+ const codeTokens = filesCount * avgFileSizeKB * tokensPerKB;
343
+ const promptOverhead = filesCount * 500; // ~500 tokens per file for prompts
344
+ const estimatedInputTokens = Math.round(codeTokens + promptOverhead);
345
+ // Output: findings, reasoning, PoCs
346
+ const findingsPerFile = config.aggressiveness === "aggressive" ? 3 :
347
+ config.aggressiveness === "active" ? 2 : 1;
348
+ const tokensPerFinding = config.generatePoC ? 1000 : 500;
349
+ const estimatedOutputTokens = Math.round(filesCount * findingsPerFile * tokensPerFinding);
350
+ // Calculate cost
351
+ const pricing = MODEL_PRICING[config.model];
352
+ const inputCost = (estimatedInputTokens / 1_000_000) * pricing.input;
353
+ const outputCost = (estimatedOutputTokens / 1_000_000) * pricing.output;
354
+ const estimatedCost = inputCost + outputCost;
355
+ return {
356
+ estimatedInputTokens,
357
+ estimatedOutputTokens,
358
+ estimatedCost: Math.round(estimatedCost * 100) / 100,
359
+ };
360
+ }
361
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/agents/adversary/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAA6B;IACtD,cAAc,EAAE,SAAS;IACzB,WAAW,EAAE,KAAK;IAClB,eAAe,EAAE,KAAK,EAAE,WAAW;IACnC,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA6B;IACrD,cAAc,EAAE,QAAQ;IACxB,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,MAAM,EAAE,YAAY;IACrC,QAAQ,EAAE,GAAG;IACb,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF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,GAAG,gBAAgB,CAAC,CAAC;IAE1F,iBAAiB;IACjB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,CAAC,oBAAoB,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;IACrE,MAAM,UAAU,GAAG,CAAC,qBAAqB,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IACxE,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC;IAE7C,OAAO;QACL,oBAAoB;QACpB,qBAAqB;QACrB,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,GAAG,CAAC,GAAG,GAAG;KACrD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Adversary Agent - Main Orchestrator
3
+ *
4
+ * The Adversary agent is a mythos-class ethical hacker that uses real
5
+ * Claude API reasoning to find vulnerabilities that pattern-based scanners
6
+ * miss. It coordinates four analysis phases:
7
+ *
8
+ * 1. Reconnaissance - Technology stack detection, framework identification
9
+ * 2. Attack Surface - Entry points, trust boundaries, data flows
10
+ * 3. Exploitation - LLM-powered vulnerability discovery with PoCs
11
+ * 4. Chaining - Multi-vulnerability attack path discovery
12
+ *
13
+ * @module agents/adversary
14
+ */
15
+ import type { Finding } from "../../certification/types.js";
16
+ import type { AdversaryConfig, AdversaryResult } from "./types.js";
17
+ export * from "./types.js";
18
+ export * from "./config.js";
19
+ /**
20
+ * Run full adversary analysis
21
+ */
22
+ export declare function runAdversaryAnalysis(projectPath: string, config: AdversaryConfig): Promise<AdversaryResult>;
23
+ /**
24
+ * Convert adversary findings to certification findings
25
+ */
26
+ export declare function adversaryToFindings(result: AdversaryResult): Finding[];
27
+ /**
28
+ * Estimate cost for adversary analysis
29
+ */
30
+ export declare function estimateAdversaryCost(filesCount: number, config: AdversaryConfig): {
31
+ estimatedCost: number;
32
+ estimatedTokens: number;
33
+ };
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/adversary/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAWhB,MAAM,YAAY,CAAC;AAYpB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAqrB5B;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,eAAe,CAAC,CA+F1B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CAsBtE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,GACtB;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAmBpD"}