@securecode-ai/mcp 0.5.5 → 0.5.6
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/api/types.d.ts +7 -0
- package/dist/approval/auditLog.d.ts +1 -1
- package/dist/approval/auditLog.js +11 -3
- package/dist/approval/auditLog.js.map +1 -1
- package/dist/approval/broker.d.ts +7 -2
- package/dist/approval/broker.js +239 -110
- package/dist/approval/broker.js.map +1 -1
- package/dist/approval/policy.d.ts +10 -0
- package/dist/approval/policy.js +104 -0
- package/dist/approval/policy.js.map +1 -0
- package/dist/approval/types.d.ts +11 -2
- package/dist/approval/types.js +10 -1
- package/dist/approval/types.js.map +1 -1
- package/dist/attack/agentScanExecutor.d.ts +35 -1
- package/dist/attack/agentScanExecutor.js +405 -76
- package/dist/attack/agentScanExecutor.js.map +1 -1
- package/dist/attack/agentScanLoop.d.ts +20 -0
- package/dist/attack/agentScanLoop.js +1264 -60
- package/dist/attack/agentScanLoop.js.map +1 -1
- package/dist/attack/agentScanProtocol.d.ts +382 -6
- package/dist/attack/agentScanProtocol.js +110 -4
- package/dist/attack/agentScanProtocol.js.map +1 -1
- package/dist/attack/agentTrace.d.ts +73 -0
- package/dist/attack/agentTrace.js +228 -0
- package/dist/attack/agentTrace.js.map +1 -0
- package/dist/attack/architectureScoutExecutor.d.ts +18 -0
- package/dist/attack/architectureScoutExecutor.js +211 -0
- package/dist/attack/architectureScoutExecutor.js.map +1 -0
- package/dist/attack/architectureScoutLoop.d.ts +36 -0
- package/dist/attack/architectureScoutLoop.js +403 -0
- package/dist/attack/architectureScoutLoop.js.map +1 -0
- package/dist/attack/architectureScoutProtocol.d.ts +209 -0
- package/dist/attack/architectureScoutProtocol.js +47 -0
- package/dist/attack/architectureScoutProtocol.js.map +1 -0
- package/dist/attack/candidateStore.d.ts +95 -0
- package/dist/attack/candidateStore.js +231 -0
- package/dist/attack/candidateStore.js.map +1 -0
- package/dist/attack/evidenceLedger.d.ts +67 -0
- package/dist/attack/evidenceLedger.js +192 -0
- package/dist/attack/evidenceLedger.js.map +1 -0
- package/dist/attack/finishGate.d.ts +62 -0
- package/dist/attack/finishGate.js +209 -0
- package/dist/attack/finishGate.js.map +1 -0
- package/dist/attack/fixCodeMerge.d.ts +27 -0
- package/dist/attack/fixCodeMerge.js +42 -0
- package/dist/attack/fixCodeMerge.js.map +1 -0
- package/dist/attack/fixVerifyLoop.d.ts +55 -0
- package/dist/attack/fixVerifyLoop.js +187 -0
- package/dist/attack/fixVerifyLoop.js.map +1 -0
- package/dist/attack/investigationProfiles.d.ts +36 -0
- package/dist/attack/investigationProfiles.js +144 -0
- package/dist/attack/investigationProfiles.js.map +1 -0
- package/dist/attack/investigationState.d.ts +227 -0
- package/dist/attack/investigationState.js +666 -0
- package/dist/attack/investigationState.js.map +1 -0
- package/dist/attack/mutationOperators.d.ts +22 -0
- package/dist/attack/mutationOperators.js +170 -0
- package/dist/attack/mutationOperators.js.map +1 -0
- package/dist/attack/mutationTest.d.ts +33 -0
- package/dist/attack/mutationTest.js +110 -0
- package/dist/attack/mutationTest.js.map +1 -0
- package/dist/attack/proofGate.d.ts +20 -0
- package/dist/attack/proofGate.js +104 -0
- package/dist/attack/proofGate.js.map +1 -0
- package/dist/attack/proofTypes.d.ts +57 -0
- package/dist/attack/proofTypes.js +32 -0
- package/dist/attack/proofTypes.js.map +1 -0
- package/dist/attack/protocolValidator.d.ts +50 -0
- package/dist/attack/protocolValidator.js +427 -0
- package/dist/attack/protocolValidator.js.map +1 -0
- package/dist/attack/qualityMetrics.d.ts +133 -0
- package/dist/attack/qualityMetrics.js +226 -0
- package/dist/attack/qualityMetrics.js.map +1 -0
- package/dist/attack/scanScheduler.d.ts +52 -0
- package/dist/attack/scanScheduler.js +265 -0
- package/dist/attack/scanScheduler.js.map +1 -0
- package/dist/attack/scanState.d.ts +58 -0
- package/dist/attack/scanState.js +102 -0
- package/dist/attack/scanState.js.map +1 -0
- package/dist/attack/searchIntent.d.ts +16 -0
- package/dist/attack/searchIntent.js +57 -0
- package/dist/attack/searchIntent.js.map +1 -0
- package/dist/attack/verifyLoop.d.ts +43 -0
- package/dist/attack/verifyLoop.js +314 -14
- package/dist/attack/verifyLoop.js.map +1 -1
- package/dist/attack/workItem.d.ts +57 -0
- package/dist/attack/workItem.js +225 -0
- package/dist/attack/workItem.js.map +1 -0
- package/dist/audit/findingReviewQueue.d.ts +109 -0
- package/dist/audit/findingReviewQueue.js +335 -0
- package/dist/audit/findingReviewQueue.js.map +1 -0
- package/dist/audit/scanAuditLog.d.ts +160 -0
- package/dist/audit/scanAuditLog.js +404 -0
- package/dist/audit/scanAuditLog.js.map +1 -0
- package/dist/dependency/dependencyChecker.js +35 -9
- package/dist/dependency/dependencyChecker.js.map +1 -1
- package/dist/dependency/exploitPriority.d.ts +33 -0
- package/dist/dependency/exploitPriority.js +78 -0
- package/dist/dependency/exploitPriority.js.map +1 -0
- package/dist/dependency/finding.d.ts +16 -0
- package/dist/dependency/osvClient.js +2 -0
- package/dist/dependency/osvClient.js.map +1 -1
- package/dist/dependency/types.d.ts +12 -1
- package/dist/mcp/server.js +13 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts +1 -0
- package/dist/mcp/tools.js +127 -6
- package/dist/mcp/tools.js.map +1 -1
- package/dist/project-map/agentMemory.d.ts +83 -1
- package/dist/project-map/agentMemory.js +197 -7
- package/dist/project-map/agentMemory.js.map +1 -1
- package/dist/project-map/architectureContext.d.ts +202 -0
- package/dist/project-map/architectureContext.js +421 -0
- package/dist/project-map/architectureContext.js.map +1 -0
- package/dist/project-map/blastRadius.d.ts +54 -0
- package/dist/project-map/blastRadius.js +196 -0
- package/dist/project-map/blastRadius.js.map +1 -0
- package/dist/project-map/callGraphExtractor.d.ts +13 -0
- package/dist/project-map/callGraphExtractor.js +222 -0
- package/dist/project-map/callGraphExtractor.js.map +1 -0
- package/dist/project-map/capabilityRegistry.d.ts +46 -0
- package/dist/project-map/capabilityRegistry.js +91 -0
- package/dist/project-map/capabilityRegistry.js.map +1 -0
- package/dist/project-map/findTests.d.ts +29 -0
- package/dist/project-map/findTests.js +236 -0
- package/dist/project-map/findTests.js.map +1 -0
- package/dist/project-map/handlerInventory.d.ts +112 -0
- package/dist/project-map/handlerInventory.js +184 -0
- package/dist/project-map/handlerInventory.js.map +1 -0
- package/dist/project-map/implementationResolver.d.ts +43 -0
- package/dist/project-map/implementationResolver.js +217 -0
- package/dist/project-map/implementationResolver.js.map +1 -0
- package/dist/project-map/mapContext.d.ts +6 -1
- package/dist/project-map/mapContext.js +1 -0
- package/dist/project-map/mapContext.js.map +1 -1
- package/dist/project-map/scanCache.d.ts +57 -3
- package/dist/project-map/scanCache.js +61 -2
- package/dist/project-map/scanCache.js.map +1 -1
- package/dist/project-map/symbolIndex.d.ts +39 -0
- package/dist/project-map/symbolIndex.js +385 -0
- package/dist/project-map/symbolIndex.js.map +1 -0
- package/dist/tooling/agentEvalScoring.d.ts +77 -0
- package/dist/tooling/agentEvalScoring.js +140 -0
- package/dist/tooling/agentEvalScoring.js.map +1 -0
- package/dist/tooling/agentRegression.d.ts +53 -0
- package/dist/tooling/agentRegression.js +99 -0
- package/dist/tooling/agentRegression.js.map +1 -0
- package/dist/tools/agentScan.d.ts +69 -0
- package/dist/tools/agentScan.js +702 -43
- package/dist/tools/agentScan.js.map +1 -1
- package/dist/tools/findingReviewTools.d.ts +22 -0
- package/dist/tools/findingReviewTools.js +121 -0
- package/dist/tools/findingReviewTools.js.map +1 -0
- package/dist/tools/fix.js +1 -1
- package/dist/tools/fix.js.map +1 -1
- package/dist/tools/map.js +191 -1
- package/dist/tools/map.js.map +1 -1
- package/dist/tools/runTests.d.ts +2 -0
- package/dist/tools/runTests.js +29 -0
- package/dist/tools/runTests.js.map +1 -0
- package/dist/utils/effectMock.d.ts +1 -0
- package/dist/utils/effectMock.js +162 -0
- package/dist/utils/effectMock.js.map +1 -0
- package/dist/utils/gitContext.d.ts +26 -0
- package/dist/utils/gitContext.js +317 -0
- package/dist/utils/gitContext.js.map +1 -0
- package/dist/utils/localTestRunner.d.ts +57 -2
- package/dist/utils/localTestRunner.js +122 -115
- package/dist/utils/localTestRunner.js.map +1 -1
- package/dist/utils/securityConfig.d.ts +17 -0
- package/dist/utils/securityConfig.js +192 -0
- package/dist/utils/securityConfig.js.map +1 -0
- package/dist/utils/testCommandPolicy.d.ts +36 -0
- package/dist/utils/testCommandPolicy.js +252 -0
- package/dist/utils/testCommandPolicy.js.map +1 -0
- package/dist/utils/testRunner.d.ts +56 -0
- package/dist/utils/testRunner.js +246 -0
- package/dist/utils/testRunner.js.map +1 -0
- package/dist/utils/testSafety.d.ts +40 -2
- package/dist/utils/testSafety.js +205 -26
- package/dist/utils/testSafety.js.map +1 -1
- package/dist/utils/verificationSandbox.d.ts +113 -0
- package/dist/utils/verificationSandbox.js +656 -0
- package/dist/utils/verificationSandbox.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured investigation state — tracks what the agent has already
|
|
3
|
+
* investigated so it doesn't waste steps re-reading the same code and
|
|
4
|
+
* can see which required checks remain incomplete.
|
|
5
|
+
*
|
|
6
|
+
* The Synara scan exposed two problems this module addresses:
|
|
7
|
+
*
|
|
8
|
+
* 1. The agent read `http.ts` 12 times with different line ranges, many
|
|
9
|
+
* overlapping. The exact-range dedup blocked identical ranges but
|
|
10
|
+
* not overlapping ones. This module tracks merged coverage so a read
|
|
11
|
+
* that substantially overlaps an already-read range is caught.
|
|
12
|
+
*
|
|
13
|
+
* 2. The agent called `finish` without completing the required
|
|
14
|
+
* investigation protocol (configuration inspection, threat-model
|
|
15
|
+
* establishment, cross-file ownership tracing). The checklist makes
|
|
16
|
+
* the missing steps visible to the agent AND to the controller.
|
|
17
|
+
*/
|
|
18
|
+
export interface LineRange {
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
}
|
|
22
|
+
export type InvestigationTaskStatus = 'pending' | 'investigated' | 'verified' | 'refuted' | 'unproven' | 'blocked';
|
|
23
|
+
export interface InvestigationTask {
|
|
24
|
+
id: string;
|
|
25
|
+
targetFiles: string[];
|
|
26
|
+
claim: string;
|
|
27
|
+
requiredTools: string[];
|
|
28
|
+
requiredEvidence: string[];
|
|
29
|
+
status: InvestigationTaskStatus;
|
|
30
|
+
entryFiles?: string[];
|
|
31
|
+
relatedFiles?: string[];
|
|
32
|
+
sourceSymbols?: string[];
|
|
33
|
+
sinkSymbols?: string[];
|
|
34
|
+
requiredProofDimensions?: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface FileCoverage {
|
|
37
|
+
filePath: string;
|
|
38
|
+
ranges: LineRange[];
|
|
39
|
+
totalLines?: number;
|
|
40
|
+
readCount: number;
|
|
41
|
+
blockedReadCount: number;
|
|
42
|
+
}
|
|
43
|
+
export type FlowVerificationStatus = 'confirmed' | 'refuted' | 'inconclusive' | 'blocked';
|
|
44
|
+
export interface FlowVerification {
|
|
45
|
+
filePath: string;
|
|
46
|
+
tool: string;
|
|
47
|
+
status: FlowVerificationStatus;
|
|
48
|
+
flowCount: number;
|
|
49
|
+
reason: string;
|
|
50
|
+
timestamp: number;
|
|
51
|
+
riskId?: string;
|
|
52
|
+
candidateId?: string;
|
|
53
|
+
source?: {
|
|
54
|
+
filePath: string;
|
|
55
|
+
symbol?: string;
|
|
56
|
+
line?: number;
|
|
57
|
+
};
|
|
58
|
+
sink?: {
|
|
59
|
+
filePath: string;
|
|
60
|
+
symbol?: string;
|
|
61
|
+
line?: number;
|
|
62
|
+
};
|
|
63
|
+
hops?: Array<{
|
|
64
|
+
filePath: string;
|
|
65
|
+
symbol?: string;
|
|
66
|
+
line?: number;
|
|
67
|
+
description?: string;
|
|
68
|
+
}>;
|
|
69
|
+
truncated?: boolean;
|
|
70
|
+
error?: string;
|
|
71
|
+
}
|
|
72
|
+
export type ReadValueClassification = 'new-coverage' | 'partial-new-coverage' | 'duplicate' | 'high-overlap' | 'invalid' | 'function-map';
|
|
73
|
+
export interface ReadValueResult {
|
|
74
|
+
classification: ReadValueClassification;
|
|
75
|
+
overlapFraction: number;
|
|
76
|
+
newLines: number;
|
|
77
|
+
coverageAfter: LineRange[];
|
|
78
|
+
nextUnreadRange: LineRange | null;
|
|
79
|
+
}
|
|
80
|
+
export type InvestigationStep = 'initial-read' | 'route-discovery' | 'policy-check' | 'auth-symbol-search' | 'cross-file-flow' | 'config-inspection' | 'ownership-analysis' | 'tests-found' | 'architecture-risks-addressed' | 'all-handlers-reviewed' | 'candidates-verified';
|
|
81
|
+
export interface InvestigationChecklist {
|
|
82
|
+
completed: Set<InvestigationStep>;
|
|
83
|
+
required: Set<InvestigationStep>;
|
|
84
|
+
requiredForFindingType: Map<string, Set<InvestigationStep>>;
|
|
85
|
+
}
|
|
86
|
+
export declare class InvestigationState {
|
|
87
|
+
private fileCoverages;
|
|
88
|
+
private checklist;
|
|
89
|
+
private toolsUsed;
|
|
90
|
+
private filesRead;
|
|
91
|
+
private symbolsSearched;
|
|
92
|
+
private rootCauses;
|
|
93
|
+
private duplicateReadKeys;
|
|
94
|
+
private tasks;
|
|
95
|
+
private flowVerifications;
|
|
96
|
+
constructor();
|
|
97
|
+
static normalizePath(p: string): string;
|
|
98
|
+
static parseRange(startLine?: number, endLine?: number, totalLines?: number): LineRange;
|
|
99
|
+
static rangesOverlap(a: LineRange, b: LineRange): boolean;
|
|
100
|
+
static mergeRanges(ranges: LineRange[]): LineRange[];
|
|
101
|
+
static overlapFraction(a: LineRange, b: LineRange): number;
|
|
102
|
+
/**
|
|
103
|
+
* Check if a read would be blocked (duplicate or overlapping) WITHOUT
|
|
104
|
+
* recording it. This lets the loop decide before committing coverage.
|
|
105
|
+
*/
|
|
106
|
+
checkRead(filePath: string, startLine?: number, endLine?: number, totalLines?: number): {
|
|
107
|
+
isExactDuplicate: boolean;
|
|
108
|
+
overlapping: boolean;
|
|
109
|
+
overlapFraction: number;
|
|
110
|
+
coverageAfter: LineRange[];
|
|
111
|
+
};
|
|
112
|
+
classifyRead(filePath: string, startLine?: number, endLine?: number, totalLines?: number): ReadValueResult;
|
|
113
|
+
/**
|
|
114
|
+
* Record a blocked read attempt — increments the blocked counter
|
|
115
|
+
* without merging ranges or counting it as a successful read.
|
|
116
|
+
*/
|
|
117
|
+
recordBlockedRead(filePath: string): void;
|
|
118
|
+
recordRead(filePath: string, startLine?: number, endLine?: number, totalLines?: number): {
|
|
119
|
+
overlapping: boolean;
|
|
120
|
+
overlapFraction: number;
|
|
121
|
+
coverageAfter: LineRange[];
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Record a read using the ACTUAL delivered range (not the requested range).
|
|
125
|
+
*
|
|
126
|
+
* Use this when the executor returns structured metadata telling you
|
|
127
|
+
* exactly which lines were delivered. A large-file read that returns a
|
|
128
|
+
* function map (truncated=true, actualStart=0, actualEnd=0) does NOT
|
|
129
|
+
* record any content coverage — the agent must still read specific
|
|
130
|
+
* line ranges.
|
|
131
|
+
*/
|
|
132
|
+
recordActualRead(filePath: string, actualStart: number, actualEnd: number, totalLines: number, truncated: boolean): {
|
|
133
|
+
overlapping: boolean;
|
|
134
|
+
overlapFraction: number;
|
|
135
|
+
coverageAfter: LineRange[];
|
|
136
|
+
};
|
|
137
|
+
getCoverage(filePath: string): FileCoverage | undefined;
|
|
138
|
+
isCovered(filePath: string, startLine?: number, endLine?: number): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Return the gaps in coverage for a file — the line ranges that have NOT
|
|
141
|
+
* been read yet. Returns [] if the file is fully covered or not tracked.
|
|
142
|
+
*/
|
|
143
|
+
getUncoveredRanges(filePath: string): LineRange[];
|
|
144
|
+
/**
|
|
145
|
+
* Return the next unread chunk for a file, using a chunk-size policy
|
|
146
|
+
* based on file size:
|
|
147
|
+
* < 300 lines full-file read (chunk = totalLines)
|
|
148
|
+
* 300-1,000 lines 250-line chunks
|
|
149
|
+
* 1,000-5,000 300-line chunks
|
|
150
|
+
* > 5,000 lines 400-line chunks
|
|
151
|
+
*
|
|
152
|
+
* Returns null if the file is fully covered or not tracked.
|
|
153
|
+
*/
|
|
154
|
+
getNextUnreadRange(filePath: string, chunkSize?: number): LineRange | null;
|
|
155
|
+
getPrioritizedUnreadRange(filePath: string, fileContent: string, chunkSize?: number, candidateLocations?: LineRange[], functionBoundaries?: {
|
|
156
|
+
name: string;
|
|
157
|
+
startLine: number;
|
|
158
|
+
endLine: number;
|
|
159
|
+
}[]): LineRange | null;
|
|
160
|
+
private snapToFunctionBoundary;
|
|
161
|
+
/**
|
|
162
|
+
* Return coverage percentage for a file (0-100). Returns 0 if the file
|
|
163
|
+
* is not tracked or has no totalLines.
|
|
164
|
+
*/
|
|
165
|
+
getCoveragePercent(filePath: string): number;
|
|
166
|
+
static chunkSizeForLines(totalLines: number): number;
|
|
167
|
+
recordToolUse(toolType: string): void;
|
|
168
|
+
recordFlowVerification(filePath: string, tool: string, status: FlowVerificationStatus, flowCount: number, reason: string, structured?: {
|
|
169
|
+
riskId?: string;
|
|
170
|
+
candidateId?: string;
|
|
171
|
+
source?: {
|
|
172
|
+
filePath: string;
|
|
173
|
+
symbol?: string;
|
|
174
|
+
line?: number;
|
|
175
|
+
};
|
|
176
|
+
sink?: {
|
|
177
|
+
filePath: string;
|
|
178
|
+
symbol?: string;
|
|
179
|
+
line?: number;
|
|
180
|
+
};
|
|
181
|
+
hops?: Array<{
|
|
182
|
+
filePath: string;
|
|
183
|
+
symbol?: string;
|
|
184
|
+
line?: number;
|
|
185
|
+
description?: string;
|
|
186
|
+
}>;
|
|
187
|
+
truncated?: boolean;
|
|
188
|
+
error?: string;
|
|
189
|
+
}): void;
|
|
190
|
+
getFlowVerifications(): FlowVerification[];
|
|
191
|
+
hasClassifiedFlow(): boolean;
|
|
192
|
+
hasResolvedFlow(riskId?: string): boolean;
|
|
193
|
+
recordSymbolSearch(symbol: string): void;
|
|
194
|
+
markStepComplete(step: InvestigationStep): void;
|
|
195
|
+
markAllHandlersReviewed(): void;
|
|
196
|
+
markCandidatesVerified(): void;
|
|
197
|
+
markArchitectureRisksAddressed(): void;
|
|
198
|
+
/**
|
|
199
|
+
* Replace the required checklist with a specific set of steps.
|
|
200
|
+
* Used by target-specific investigation profiles.
|
|
201
|
+
*/
|
|
202
|
+
setRequiredSteps(steps: InvestigationStep[]): void;
|
|
203
|
+
addInvestigationTasks(tasks: InvestigationTask[]): void;
|
|
204
|
+
updateTaskStatus(taskId: string, status: InvestigationTaskStatus): void;
|
|
205
|
+
getPendingTasks(): InvestigationTask[];
|
|
206
|
+
getUnresolvedTasks(): InvestigationTask[];
|
|
207
|
+
getAllTasks(): InvestigationTask[];
|
|
208
|
+
getIncompleteSteps(): InvestigationStep[];
|
|
209
|
+
getCompletedSteps(): InvestigationStep[];
|
|
210
|
+
getToolsUsed(): string[];
|
|
211
|
+
getFilesRead(): string[];
|
|
212
|
+
getReadCount(filePath: string): number;
|
|
213
|
+
getCoverageSummary(filePath: string): {
|
|
214
|
+
totalLines: number;
|
|
215
|
+
coveredLines: number;
|
|
216
|
+
coveragePercentage: number;
|
|
217
|
+
uncoveredRangeCount: number;
|
|
218
|
+
largestUncoveredRange: LineRange | null;
|
|
219
|
+
readCount: number;
|
|
220
|
+
blockedReadCount: number;
|
|
221
|
+
};
|
|
222
|
+
registerRootCause(rootCauseId: string, description: string): void;
|
|
223
|
+
getRootCauses(): Map<string, string>;
|
|
224
|
+
getRecommendedRecoveryAction(): string | null;
|
|
225
|
+
formatChecklistForPrompt(): string;
|
|
226
|
+
private stepDescription;
|
|
227
|
+
}
|