@bryan-thompson/inspector-assessment-client 1.34.2 → 1.35.1

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 (34) hide show
  1. package/dist/assets/{OAuthCallback-CBcYNwyM.js → OAuthCallback-DC1cIXHT.js} +1 -1
  2. package/dist/assets/{OAuthDebugCallback-B0zFGlM8.js → OAuthDebugCallback-C3gqJjgQ.js} +1 -1
  3. package/dist/assets/{index-Djm_oTDV.js → index-Dn2w887x.js} +5 -4
  4. package/dist/index.html +1 -1
  5. package/lib/lib/assessment/resultTypes.d.ts +42 -0
  6. package/lib/lib/assessment/resultTypes.d.ts.map +1 -1
  7. package/lib/lib/assessment/sharedSchemas.d.ts +13 -0
  8. package/lib/lib/assessment/sharedSchemas.d.ts.map +1 -1
  9. package/lib/lib/assessment/sharedSchemas.js +9 -0
  10. package/lib/lib/assessment/summarizer/AssessmentSummarizer.d.ts +112 -0
  11. package/lib/lib/assessment/summarizer/AssessmentSummarizer.d.ts.map +1 -0
  12. package/lib/lib/assessment/summarizer/AssessmentSummarizer.js +452 -0
  13. package/lib/lib/assessment/summarizer/index.d.ts +19 -0
  14. package/lib/lib/assessment/summarizer/index.d.ts.map +1 -0
  15. package/lib/lib/assessment/summarizer/index.js +19 -0
  16. package/lib/lib/assessment/summarizer/stageBEnrichmentBuilder.d.ts +36 -0
  17. package/lib/lib/assessment/summarizer/stageBEnrichmentBuilder.d.ts.map +1 -0
  18. package/lib/lib/assessment/summarizer/stageBEnrichmentBuilder.js +282 -0
  19. package/lib/lib/assessment/summarizer/stageBTypes.d.ts +154 -0
  20. package/lib/lib/assessment/summarizer/stageBTypes.d.ts.map +1 -0
  21. package/lib/lib/assessment/summarizer/stageBTypes.js +24 -0
  22. package/lib/lib/assessment/summarizer/tokenEstimator.d.ts +103 -0
  23. package/lib/lib/assessment/summarizer/tokenEstimator.d.ts.map +1 -0
  24. package/lib/lib/assessment/summarizer/tokenEstimator.js +225 -0
  25. package/lib/lib/assessment/summarizer/types.d.ts +187 -0
  26. package/lib/lib/assessment/summarizer/types.d.ts.map +1 -0
  27. package/lib/lib/assessment/summarizer/types.js +20 -0
  28. package/lib/lib/moduleScoring.d.ts +2 -1
  29. package/lib/lib/moduleScoring.d.ts.map +1 -1
  30. package/lib/lib/moduleScoring.js +2 -1
  31. package/lib/services/assessment/modules/securityTests/TestValidityAnalyzer.d.ts +28 -0
  32. package/lib/services/assessment/modules/securityTests/TestValidityAnalyzer.d.ts.map +1 -1
  33. package/lib/services/assessment/modules/securityTests/TestValidityAnalyzer.js +180 -0
  34. package/package.json +1 -1
@@ -0,0 +1,225 @@
1
+ /**
2
+ * Token Estimation Utilities
3
+ *
4
+ * Provides token counting and threshold detection for tiered output strategy.
5
+ * Uses industry-standard approximation of ~4 characters per token.
6
+ *
7
+ * Issue #136: Tiered output strategy for large assessments
8
+ *
9
+ * @module assessment/summarizer/tokenEstimator
10
+ */
11
+ import { DEFAULT_SUMMARIZER_CONFIG } from "./types.js";
12
+ // ============================================================================
13
+ // Constants
14
+ // ============================================================================
15
+ /**
16
+ * Average characters per token for modern LLMs (GPT, Claude).
17
+ * This is an approximation; actual tokenization varies by model and content.
18
+ */
19
+ const CHARS_PER_TOKEN = 4;
20
+ /**
21
+ * Buffer factor to account for JSON formatting overhead.
22
+ * Pretty-printed JSON adds whitespace that increases character count.
23
+ */
24
+ const JSON_FORMAT_BUFFER = 1.1;
25
+ // ============================================================================
26
+ // Token Estimation Functions
27
+ // ============================================================================
28
+ /**
29
+ * Estimate the number of tokens for any content.
30
+ *
31
+ * Uses the industry-standard approximation of ~4 characters per token.
32
+ * For JSON content, applies a buffer for formatting overhead.
33
+ *
34
+ * @param content - Content to estimate (string, object, or array)
35
+ * @returns Estimated token count
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * // String content
40
+ * estimateTokens("Hello world"); // ~3 tokens
41
+ *
42
+ * // Object content (will be JSON stringified)
43
+ * estimateTokens({ name: "test", value: 123 }); // ~10 tokens
44
+ *
45
+ * // Large assessment results
46
+ * estimateTokens(assessmentResults); // ~50,000+ tokens
47
+ * ```
48
+ */
49
+ export function estimateTokens(content) {
50
+ let charCount;
51
+ if (typeof content === "string") {
52
+ charCount = content.length;
53
+ }
54
+ else if (content === null || content === undefined) {
55
+ return 0;
56
+ }
57
+ else {
58
+ // JSON stringify for objects/arrays
59
+ try {
60
+ const json = JSON.stringify(content, null, 2);
61
+ charCount = Math.ceil(json.length * JSON_FORMAT_BUFFER);
62
+ }
63
+ catch {
64
+ // Fallback for circular references or other stringify issues
65
+ return 0;
66
+ }
67
+ }
68
+ return Math.ceil(charCount / CHARS_PER_TOKEN);
69
+ }
70
+ /**
71
+ * Estimate tokens for a JSON file that would be written.
72
+ * Accounts for pretty-printing with indent=2.
73
+ *
74
+ * @param content - Content that would be JSON.stringify'd
75
+ * @returns Estimated token count
76
+ */
77
+ export function estimateJsonFileTokens(content) {
78
+ if (content === null || content === undefined) {
79
+ return 0;
80
+ }
81
+ try {
82
+ const json = JSON.stringify(content, null, 2);
83
+ return Math.ceil(json.length / CHARS_PER_TOKEN);
84
+ }
85
+ catch {
86
+ return 0;
87
+ }
88
+ }
89
+ /**
90
+ * Determine if assessment results should automatically use tiered output.
91
+ *
92
+ * Returns true when estimated token count exceeds the threshold,
93
+ * indicating the full output would not fit in typical LLM context windows.
94
+ *
95
+ * @param results - Full assessment results
96
+ * @param threshold - Token threshold (default: 100,000)
97
+ * @returns true if results should be tiered
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * const results = await runAssessment(server);
102
+ *
103
+ * if (shouldAutoTier(results)) {
104
+ * // Use tiered output
105
+ * saveTieredResults(serverName, results, options);
106
+ * } else {
107
+ * // Use standard full output
108
+ * saveResults(serverName, results, options);
109
+ * }
110
+ * ```
111
+ */
112
+ export function shouldAutoTier(results, threshold = DEFAULT_SUMMARIZER_CONFIG.autoTierThreshold) {
113
+ const estimated = estimateTokens(results);
114
+ return estimated > threshold;
115
+ }
116
+ /**
117
+ * Get a human-readable token estimate with size category.
118
+ *
119
+ * @param tokenCount - Number of tokens
120
+ * @returns Object with formatted token count and size category
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * formatTokenEstimate(5000);
125
+ * // { tokens: "5,000", category: "small", fitsContext: true }
126
+ *
127
+ * formatTokenEstimate(500000);
128
+ * // { tokens: "500,000", category: "very-large", fitsContext: false }
129
+ * ```
130
+ */
131
+ export function formatTokenEstimate(tokenCount) {
132
+ const formatted = tokenCount.toLocaleString();
133
+ let category;
134
+ let fitsContext;
135
+ let recommendation;
136
+ if (tokenCount <= 10_000) {
137
+ category = "small";
138
+ fitsContext = true;
139
+ recommendation = "Full output recommended";
140
+ }
141
+ else if (tokenCount <= 50_000) {
142
+ category = "medium";
143
+ fitsContext = true;
144
+ recommendation = "Full output should fit most contexts";
145
+ }
146
+ else if (tokenCount <= 100_000) {
147
+ category = "large";
148
+ fitsContext = true;
149
+ recommendation = "Consider tiered output for smaller context windows";
150
+ }
151
+ else if (tokenCount <= 200_000) {
152
+ category = "very-large";
153
+ fitsContext = false;
154
+ recommendation = "Tiered output recommended";
155
+ }
156
+ else {
157
+ category = "oversized";
158
+ fitsContext = false;
159
+ recommendation = "Tiered output required";
160
+ }
161
+ return { tokens: formatted, category, fitsContext, recommendation };
162
+ }
163
+ /**
164
+ * Estimate tokens for each major section of assessment results.
165
+ * Useful for understanding which modules contribute most to output size.
166
+ *
167
+ * @param results - Assessment results to analyze
168
+ * @returns Map of section name to estimated token count
169
+ */
170
+ export function estimateSectionTokens(results) {
171
+ const sections = {};
172
+ // Core assessment sections
173
+ const sectionKeys = [
174
+ "functionality",
175
+ "security",
176
+ "errorHandling",
177
+ "aupCompliance",
178
+ "toolAnnotations",
179
+ "temporal",
180
+ "resources",
181
+ "prompts",
182
+ "crossCapability",
183
+ "protocolCompliance",
184
+ "developerExperience",
185
+ "prohibitedLibraries",
186
+ "manifestValidation",
187
+ "authentication",
188
+ "portability",
189
+ "externalAPIScanner",
190
+ ];
191
+ for (const key of sectionKeys) {
192
+ const section = results[key];
193
+ if (section !== undefined) {
194
+ sections[key] = estimateTokens(section);
195
+ }
196
+ }
197
+ // Metadata and summary
198
+ sections["metadata"] = estimateTokens({
199
+ serverName: results.serverName,
200
+ overallStatus: results.overallStatus,
201
+ summary: results.summary,
202
+ recommendations: results.recommendations,
203
+ totalTestsRun: results.totalTestsRun,
204
+ executionTime: results.executionTime,
205
+ });
206
+ // Calculate total
207
+ sections["_total"] = Object.entries(sections)
208
+ .filter(([key]) => !key.startsWith("_"))
209
+ .reduce((sum, [, tokens]) => sum + tokens, 0);
210
+ return sections;
211
+ }
212
+ /**
213
+ * Get the top N largest sections by token count.
214
+ *
215
+ * @param results - Assessment results
216
+ * @param topN - Number of sections to return (default: 5)
217
+ * @returns Array of [sectionName, tokenCount] sorted by size descending
218
+ */
219
+ export function getTopSections(results, topN = 5) {
220
+ const sections = estimateSectionTokens(results);
221
+ return Object.entries(sections)
222
+ .filter(([key]) => !key.startsWith("_"))
223
+ .sort((a, b) => b[1] - a[1])
224
+ .slice(0, topN);
225
+ }
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Tiered Output Types
3
+ *
4
+ * Type definitions for the tiered output strategy that generates
5
+ * LLM-consumable summaries from large assessment results.
6
+ *
7
+ * Issue #136: Tiered output strategy for large assessments
8
+ *
9
+ * @module assessment/summarizer/types
10
+ */
11
+ import type { AssessmentStatus } from "../coreTypes.js";
12
+ import type { ToolSummaryStageBEnrichment } from "./stageBTypes.js";
13
+ /**
14
+ * Output format for assessment results.
15
+ * - "full": Complete JSON output (default, existing behavior)
16
+ * - "tiered": Directory structure with executive summary, tool summaries, and per-tool details
17
+ * - "summary-only": Only executive summary and tool summaries (no per-tool detail files)
18
+ */
19
+ export type OutputFormat = "full" | "tiered" | "summary-only";
20
+ /**
21
+ * Risk level categorization for tools based on security assessment results.
22
+ */
23
+ export type ToolRiskLevel = "HIGH" | "MEDIUM" | "LOW" | "SAFE";
24
+ /**
25
+ * Executive Summary - Tier 1 output.
26
+ * Always generated, always fits in LLM context window.
27
+ * Provides high-level overview for quick assessment understanding.
28
+ */
29
+ export interface ExecutiveSummary {
30
+ /** Server name from assessment */
31
+ serverName: string;
32
+ /** Overall assessment status (PASS/FAIL/NEED_MORE_INFO) */
33
+ overallStatus: AssessmentStatus;
34
+ /** Calculated overall score (0-100) */
35
+ overallScore: number;
36
+ /** Total number of tools discovered */
37
+ toolCount: number;
38
+ /** Total number of tests executed */
39
+ testCount: number;
40
+ /** Total execution time in milliseconds */
41
+ executionTime: number;
42
+ /**
43
+ * Per-module status and score summary.
44
+ * Key is module name (e.g., "security", "functionality")
45
+ */
46
+ modulesSummary: Record<string, {
47
+ status: AssessmentStatus;
48
+ score: number;
49
+ }>;
50
+ /** Critical findings aggregated from all modules */
51
+ criticalFindings: {
52
+ /** Number of security vulnerabilities detected */
53
+ securityVulnerabilities: number;
54
+ /** Number of AUP violations detected */
55
+ aupViolations: number;
56
+ /** Number of broken/non-functional tools */
57
+ brokenTools: number;
58
+ /** Number of tools missing required annotations */
59
+ missingAnnotations: number;
60
+ };
61
+ /**
62
+ * Distribution of tools by risk level.
63
+ * Helps quickly understand overall risk profile.
64
+ */
65
+ toolRiskDistribution: {
66
+ high: number;
67
+ medium: number;
68
+ low: number;
69
+ safe: number;
70
+ };
71
+ /** Top recommendations aggregated from all modules */
72
+ recommendations: string[];
73
+ /** Estimated token count for this summary */
74
+ estimatedTokens: number;
75
+ /** ISO timestamp when summary was generated */
76
+ generatedAt: string;
77
+ }
78
+ /**
79
+ * Tool Summary - Tier 2 output.
80
+ * Per-tool digest without individual test results.
81
+ * Enables focused analysis on specific tools without full detail.
82
+ */
83
+ export interface ToolSummary {
84
+ /** Tool name from MCP server */
85
+ toolName: string;
86
+ /** Calculated risk level based on security findings */
87
+ riskLevel: ToolRiskLevel;
88
+ /** Number of vulnerabilities found for this tool */
89
+ vulnerabilityCount: number;
90
+ /**
91
+ * Top vulnerability patterns detected.
92
+ * Limited to top 5 for token efficiency.
93
+ */
94
+ topPatterns: string[];
95
+ /** Total number of tests run on this tool */
96
+ testCount: number;
97
+ /** Percentage of tests that passed (0-100) */
98
+ passRate: number;
99
+ /** Tool-specific recommendations */
100
+ recommendations: string[];
101
+ /** Estimated token count for this summary */
102
+ estimatedTokens: number;
103
+ /** Whether the tool has proper annotations */
104
+ hasAnnotations: boolean;
105
+ /** Annotation alignment status if available */
106
+ annotationStatus?: "ALIGNED" | "MISALIGNED" | "MISSING";
107
+ /** Stage B enrichment for Claude semantic analysis (Issue #137) */
108
+ stageBEnrichment?: ToolSummaryStageBEnrichment;
109
+ }
110
+ /**
111
+ * Collection of tool summaries with aggregate metadata.
112
+ */
113
+ export interface ToolSummariesCollection {
114
+ /** Individual tool summaries */
115
+ tools: ToolSummary[];
116
+ /** Total number of tools */
117
+ totalTools: number;
118
+ /** Aggregate statistics */
119
+ aggregate: {
120
+ /** Total vulnerabilities across all tools */
121
+ totalVulnerabilities: number;
122
+ /** Average pass rate across all tools */
123
+ averagePassRate: number;
124
+ /** Tools with misaligned annotations */
125
+ misalignedAnnotations: number;
126
+ };
127
+ /** Estimated total tokens for all summaries */
128
+ estimatedTokens: number;
129
+ /** ISO timestamp */
130
+ generatedAt: string;
131
+ }
132
+ /**
133
+ * Reference to a per-tool detail file (Tier 3).
134
+ * Full test results stored in separate files for deep-dive analysis.
135
+ */
136
+ export interface ToolDetailReference {
137
+ /** Tool name */
138
+ toolName: string;
139
+ /** Relative path to detail file (e.g., "tools/my_tool.json") */
140
+ relativePath: string;
141
+ /** Absolute path to detail file */
142
+ absolutePath: string;
143
+ /** File size in bytes */
144
+ fileSizeBytes: number;
145
+ /** Estimated token count for full detail */
146
+ estimatedTokens: number;
147
+ }
148
+ /**
149
+ * Complete tiered output structure.
150
+ * Contains all tiers with paths to generated files.
151
+ */
152
+ export interface TieredOutput {
153
+ /** Tier 1: Executive summary */
154
+ executiveSummary: ExecutiveSummary;
155
+ /** Tier 2: Tool summaries */
156
+ toolSummaries: ToolSummariesCollection;
157
+ /** Tier 3: References to per-tool detail files */
158
+ toolDetailRefs: ToolDetailReference[];
159
+ /** Output directory path */
160
+ outputDir: string;
161
+ /** File paths for each tier */
162
+ paths: {
163
+ executiveSummary: string;
164
+ toolSummaries: string;
165
+ toolDetailsDir: string;
166
+ };
167
+ }
168
+ /**
169
+ * Configuration options for the summarizer.
170
+ */
171
+ export interface SummarizerConfig {
172
+ /** Maximum number of recommendations to include in executive summary */
173
+ maxRecommendations?: number;
174
+ /** Maximum number of top patterns per tool in tool summaries */
175
+ maxPatternsPerTool?: number;
176
+ /** Token threshold for auto-tiering (default: 100,000) */
177
+ autoTierThreshold?: number;
178
+ /** Whether to include tool detail files (Tier 3) */
179
+ includeToolDetails?: boolean;
180
+ /** Enable Stage B enrichment for Claude semantic analysis (Issue #137) */
181
+ stageBVerbose?: boolean;
182
+ }
183
+ /**
184
+ * Default summarizer configuration values.
185
+ */
186
+ export declare const DEFAULT_SUMMARIZER_CONFIG: Required<SummarizerConfig>;
187
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/assessment/summarizer/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAMjE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,cAAc,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAM/D;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IAEnB,2DAA2D;IAC3D,aAAa,EAAE,gBAAgB,CAAC;IAEhC,uCAAuC;IAC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CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAMD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,oDAAoD;IACpD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,0EAA0E;IAC1E,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,gBAAgB,CAMhE,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Tiered Output Types
3
+ *
4
+ * Type definitions for the tiered output strategy that generates
5
+ * LLM-consumable summaries from large assessment results.
6
+ *
7
+ * Issue #136: Tiered output strategy for large assessments
8
+ *
9
+ * @module assessment/summarizer/types
10
+ */
11
+ /**
12
+ * Default summarizer configuration values.
13
+ */
14
+ export const DEFAULT_SUMMARIZER_CONFIG = {
15
+ maxRecommendations: 10,
16
+ maxPatternsPerTool: 5,
17
+ autoTierThreshold: 100_000,
18
+ includeToolDetails: true,
19
+ stageBVerbose: false,
20
+ };
@@ -36,6 +36,7 @@ export declare const INSPECTOR_VERSION: string;
36
36
  * Version History:
37
37
  * - v1: Initial schema
38
38
  * - v2: Added TestValidityWarningEvent (Issue #134)
39
+ * - v3: Added Stage B enrichment for Claude semantic analysis (Issue #137)
39
40
  */
40
- export declare const SCHEMA_VERSION = 2;
41
+ export declare const SCHEMA_VERSION = 3;
41
42
  //# sourceMappingURL=moduleScoring.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"moduleScoring.d.ts","sourceRoot":"","sources":["../../src/lib/moduleScoring.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAkCnE;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAsB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC"}
1
+ {"version":3,"file":"moduleScoring.d.ts","sourceRoot":"","sources":["../../src/lib/moduleScoring.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAkCnE;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAsB,CAAC;AAErD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC"}
@@ -73,5 +73,6 @@ export const INSPECTOR_VERSION = packageJson.version;
73
73
  * Version History:
74
74
  * - v1: Initial schema
75
75
  * - v2: Added TestValidityWarningEvent (Issue #134)
76
+ * - v3: Added Stage B enrichment for Claude semantic analysis (Issue #137)
76
77
  */
77
- export const SCHEMA_VERSION = 2;
78
+ export const SCHEMA_VERSION = 3;
@@ -20,6 +20,10 @@ export interface TestValidityConfig {
20
20
  minimumTestsForAnalysis: number;
21
21
  /** Maximum response length to compare (default: 1000) */
22
22
  maxResponseCompareLength: number;
23
+ /** Maximum sample payload-response pairs (default: 10) */
24
+ maxSamplePairs: number;
25
+ /** Maximum response distribution entries (default: 5) */
26
+ maxDistributionEntries: number;
23
27
  }
24
28
  /**
25
29
  * Result of test validity analysis
@@ -86,5 +90,29 @@ export declare class TestValidityAnalyzer {
86
90
  * Generate human-readable explanation
87
91
  */
88
92
  private generateExplanation;
93
+ /**
94
+ * Calculate Shannon entropy for response diversity (0=uniform, 1=max diversity)
95
+ */
96
+ private calculateEntropy;
97
+ /**
98
+ * Build response distribution sorted by frequency
99
+ */
100
+ private buildResponseDistribution;
101
+ /**
102
+ * Extract attack category from test name
103
+ */
104
+ private extractAttackCategory;
105
+ /**
106
+ * Analyze attack pattern correlation by category
107
+ */
108
+ private analyzeAttackPatterns;
109
+ /**
110
+ * Collect sample payload-response pairs with category diversity
111
+ */
112
+ private collectSamplePairs;
113
+ /**
114
+ * Collect response metadata statistics
115
+ */
116
+ private collectResponseMetadata;
89
117
  }
90
118
  //# sourceMappingURL=TestValidityAnalyzer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TestValidityAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/TestValidityAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,uBAAuB,EAAE,MAAM,CAAC;IAChC,8DAA8D;IAC9D,gCAAgC,EAAE,MAAM,CAAC;IACzC,wDAAwD;IACxD,uBAAuB,EAAE,MAAM,CAAC;IAChC,yDAAyD;IACzD,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,aAAa,EAAE,OAAO,CAAC;IACvB,6CAA6C;IAC7C,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;IAC9C,wCAAwC;IACxC,qBAAqB,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACjD,mCAAmC;IACnC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,mCAAmC;IACnC,cAAc,CAAC,EAAE,GAAG,CAClB,MAAM,EACN;QACE,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CACF,CAAC;CACH;AASD;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAqB;gBAEvB,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAIhD;;;;;OAKG;IACH,OAAO,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,kBAAkB;IAyE9D;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAgCzB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAehC;;OAEG;IACH,OAAO,CAAC,cAAc;IActB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA2C7B;;OAEG;IACH,OAAO,CAAC,cAAc;IA4CtB;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAoB5B"}
1
+ {"version":3,"file":"TestValidityAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/TestValidityAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,uBAAuB,EAAE,MAAM,CAAC;IAChC,8DAA8D;IAC9D,gCAAgC,EAAE,MAAM,CAAC;IACzC,wDAAwD;IACxD,uBAAuB,EAAE,MAAM,CAAC;IAChC,yDAAyD;IACzD,wBAAwB,EAAE,MAAM,CAAC;IAEjC,0DAA0D;IAC1D,cAAc,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,aAAa,EAAE,OAAO,CAA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