@theihtisham/agent-shadow-brain 3.0.0 → 4.0.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.
- package/README.md +443 -602
- package/dist/brain/adversarial-defense.d.ts +57 -0
- package/dist/brain/adversarial-defense.d.ts.map +1 -0
- package/dist/brain/adversarial-defense.js +303 -0
- package/dist/brain/adversarial-defense.js.map +1 -0
- package/dist/brain/cognitive-load.d.ts +27 -0
- package/dist/brain/cognitive-load.d.ts.map +1 -0
- package/dist/brain/cognitive-load.js +304 -0
- package/dist/brain/cognitive-load.js.map +1 -0
- package/dist/brain/cross-agent-protocol.d.ts +48 -0
- package/dist/brain/cross-agent-protocol.d.ts.map +1 -0
- package/dist/brain/cross-agent-protocol.js +306 -0
- package/dist/brain/cross-agent-protocol.js.map +1 -0
- package/dist/brain/influence-map.d.ts +31 -0
- package/dist/brain/influence-map.d.ts.map +1 -0
- package/dist/brain/influence-map.js +375 -0
- package/dist/brain/influence-map.js.map +1 -0
- package/dist/brain/knowledge-graph.d.ts +56 -0
- package/dist/brain/knowledge-graph.d.ts.map +1 -0
- package/dist/brain/knowledge-graph.js +427 -0
- package/dist/brain/knowledge-graph.js.map +1 -0
- package/dist/brain/learning-engine.d.ts +11 -0
- package/dist/brain/learning-engine.d.ts.map +1 -1
- package/dist/brain/learning-engine.js +44 -1
- package/dist/brain/learning-engine.js.map +1 -1
- package/dist/brain/neural-mesh.d.ts +9 -1
- package/dist/brain/neural-mesh.d.ts.map +1 -1
- package/dist/brain/neural-mesh.js +75 -16
- package/dist/brain/neural-mesh.js.map +1 -1
- package/dist/brain/orchestrator.d.ts +24 -2
- package/dist/brain/orchestrator.d.ts.map +1 -1
- package/dist/brain/orchestrator.js +208 -4
- package/dist/brain/orchestrator.js.map +1 -1
- package/dist/brain/pattern-memory.d.ts +8 -3
- package/dist/brain/pattern-memory.d.ts.map +1 -1
- package/dist/brain/pattern-memory.js +71 -3
- package/dist/brain/pattern-memory.js.map +1 -1
- package/dist/brain/predictive-engine.d.ts +45 -0
- package/dist/brain/predictive-engine.d.ts.map +1 -0
- package/dist/brain/predictive-engine.js +238 -0
- package/dist/brain/predictive-engine.js.map +1 -0
- package/dist/brain/security-audit.d.ts +20 -0
- package/dist/brain/security-audit.d.ts.map +1 -0
- package/dist/brain/security-audit.js +340 -0
- package/dist/brain/security-audit.js.map +1 -0
- package/dist/brain/self-evolution.d.ts +53 -0
- package/dist/brain/self-evolution.d.ts.map +1 -0
- package/dist/brain/self-evolution.js +278 -0
- package/dist/brain/self-evolution.js.map +1 -0
- package/dist/brain/sssp-router.d.ts +58 -0
- package/dist/brain/sssp-router.d.ts.map +1 -0
- package/dist/brain/sssp-router.js +295 -0
- package/dist/brain/sssp-router.js.map +1 -0
- package/dist/brain/swarm-intelligence.d.ts +48 -0
- package/dist/brain/swarm-intelligence.d.ts.map +1 -0
- package/dist/brain/swarm-intelligence.js +215 -0
- package/dist/brain/swarm-intelligence.js.map +1 -0
- package/dist/brain/turbo-memory.d.ts +56 -0
- package/dist/brain/turbo-memory.d.ts.map +1 -0
- package/dist/brain/turbo-memory.js +388 -0
- package/dist/brain/turbo-memory.js.map +1 -0
- package/dist/cli.js +339 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +272 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/dashboard.d.ts.map +1 -1
- package/dist/ui/dashboard.js +20 -3
- package/dist/ui/dashboard.js.map +1 -1
- package/package.json +16 -7
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { BrainInsight, HallucinationFlag, EnsembleVote, AdversarialLog, ThreatVector } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Adversarial Defense — the immune system of the brain.
|
|
4
|
+
*
|
|
5
|
+
* Hallucination Detection:
|
|
6
|
+
* Cross-reference LLM claims against actual file content.
|
|
7
|
+
* "function X exists in file Y" → verify with file reads.
|
|
8
|
+
* Contradiction detection: compare against stored knowledge.
|
|
9
|
+
*
|
|
10
|
+
* Ensemble Verification:
|
|
11
|
+
* Critical insights → send to 2+ models → majority vote.
|
|
12
|
+
* Split verdict → flag for human review.
|
|
13
|
+
*
|
|
14
|
+
* Injection Detection:
|
|
15
|
+
* Scan for prompt injection patterns in agent inputs.
|
|
16
|
+
* Block and log ThreatVector when detected.
|
|
17
|
+
* Rate limit: max 3 injections per session before alert.
|
|
18
|
+
*/
|
|
19
|
+
export declare class AdversarialDefense {
|
|
20
|
+
private log;
|
|
21
|
+
private injectionCount;
|
|
22
|
+
private readonly MAX_INJECTIONS_PER_SESSION;
|
|
23
|
+
private static readonly INJECTION_PATTERNS;
|
|
24
|
+
constructor();
|
|
25
|
+
/**
|
|
26
|
+
* Verify an insight against actual project state.
|
|
27
|
+
* Cross-references claims with file content.
|
|
28
|
+
*/
|
|
29
|
+
verifyInsight(insight: BrainInsight, projectDir: string): Promise<HallucinationFlag>;
|
|
30
|
+
/**
|
|
31
|
+
* Send a question to multiple models and collect votes.
|
|
32
|
+
* Majority consensus required for acceptance.
|
|
33
|
+
*/
|
|
34
|
+
ensembleVerify(question: string, modelAnswers: Array<{
|
|
35
|
+
model: string;
|
|
36
|
+
answer: string;
|
|
37
|
+
confidence: number;
|
|
38
|
+
}>): EnsembleVote;
|
|
39
|
+
/**
|
|
40
|
+
* Scan input for prompt injection patterns.
|
|
41
|
+
* Returns ThreatVector if detected, null otherwise.
|
|
42
|
+
*/
|
|
43
|
+
scanForInjection(input: string): ThreatVector | null;
|
|
44
|
+
/** Block and log a detected threat */
|
|
45
|
+
blockAndLog(threat: ThreatVector): void;
|
|
46
|
+
/** Get defense statistics */
|
|
47
|
+
getDefenseStats(): AdversarialLog;
|
|
48
|
+
/** Get injection count for current session */
|
|
49
|
+
getSessionInjectionCount(): number;
|
|
50
|
+
/** Simple text similarity based on shared words */
|
|
51
|
+
private textSimilarity;
|
|
52
|
+
/** Attempt to decode common encoding schemes */
|
|
53
|
+
private decodeCommonEncodings;
|
|
54
|
+
private saveToDisk;
|
|
55
|
+
private loadFromDisk;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=adversarial-defense.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adversarial-defense.d.ts","sourceRoot":"","sources":["../../src/brain/adversarial-defense.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAC5E,MAAM,aAAa,CAAC;AAKrB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,GAAG,CAOT;IACF,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAK;IAGhD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAaxC;;IAQF;;;OAGG;IACG,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAwF1F;;;OAGG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,YAAY;IA6D1H;;;OAGG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAkCpD,sCAAsC;IACtC,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAWvC,6BAA6B;IAC7B,eAAe,IAAI,cAAc;IAIjC,8CAA8C;IAC9C,wBAAwB,IAAI,MAAM;IAMlC,mDAAmD;IACnD,OAAO,CAAC,cAAc;IAQtB,gDAAgD;IAChD,OAAO,CAAC,qBAAqB;YAoBf,UAAU;IAYxB,OAAO,CAAC,YAAY;CAQrB"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
// src/brain/adversarial-defense.ts — Hallucination & Threat Guard
|
|
2
|
+
// Detects hallucinations, contradictions, and prompt injection in LLM outputs.
|
|
3
|
+
// Ensemble verification for critical insights.
|
|
4
|
+
// v4.0.0 — Hyper-Intelligence Edition
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
const DEFENSE_DIR = path.join(process.env.HOME || process.env.USERPROFILE || '~', '.shadow-brain', 'defense');
|
|
8
|
+
const LOG_FILE = 'adversarial-log.json';
|
|
9
|
+
/**
|
|
10
|
+
* Adversarial Defense — the immune system of the brain.
|
|
11
|
+
*
|
|
12
|
+
* Hallucination Detection:
|
|
13
|
+
* Cross-reference LLM claims against actual file content.
|
|
14
|
+
* "function X exists in file Y" → verify with file reads.
|
|
15
|
+
* Contradiction detection: compare against stored knowledge.
|
|
16
|
+
*
|
|
17
|
+
* Ensemble Verification:
|
|
18
|
+
* Critical insights → send to 2+ models → majority vote.
|
|
19
|
+
* Split verdict → flag for human review.
|
|
20
|
+
*
|
|
21
|
+
* Injection Detection:
|
|
22
|
+
* Scan for prompt injection patterns in agent inputs.
|
|
23
|
+
* Block and log ThreatVector when detected.
|
|
24
|
+
* Rate limit: max 3 injections per session before alert.
|
|
25
|
+
*/
|
|
26
|
+
export class AdversarialDefense {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.log = {
|
|
29
|
+
timestamp: new Date(),
|
|
30
|
+
flagged: 0,
|
|
31
|
+
blocked: 0,
|
|
32
|
+
accuracy: 1.0,
|
|
33
|
+
totalChecked: 0,
|
|
34
|
+
falsePositives: 0,
|
|
35
|
+
};
|
|
36
|
+
this.injectionCount = 0;
|
|
37
|
+
this.MAX_INJECTIONS_PER_SESSION = 3;
|
|
38
|
+
this.loadFromDisk();
|
|
39
|
+
}
|
|
40
|
+
// ── Hallucination Detection ─────────────────────────────────────────────────
|
|
41
|
+
/**
|
|
42
|
+
* Verify an insight against actual project state.
|
|
43
|
+
* Cross-references claims with file content.
|
|
44
|
+
*/
|
|
45
|
+
async verifyInsight(insight, projectDir) {
|
|
46
|
+
this.log.totalChecked++;
|
|
47
|
+
const contradictions = [];
|
|
48
|
+
const evidence = [];
|
|
49
|
+
let verifiedCount = 0;
|
|
50
|
+
let totalClaims = 0;
|
|
51
|
+
// Check file references in the insight
|
|
52
|
+
if (insight.files && insight.files.length > 0) {
|
|
53
|
+
for (const fileRef of insight.files) {
|
|
54
|
+
totalClaims++;
|
|
55
|
+
const fullPath = path.join(projectDir, fileRef);
|
|
56
|
+
if (fs.existsSync(fullPath)) {
|
|
57
|
+
verifiedCount++;
|
|
58
|
+
evidence.push(`File exists: ${fileRef}`);
|
|
59
|
+
// If insight mentions specific content, verify it
|
|
60
|
+
if (insight.content) {
|
|
61
|
+
try {
|
|
62
|
+
const fileContent = fs.readFileSync(fullPath, 'utf-8').toLowerCase();
|
|
63
|
+
const contentLower = insight.content.toLowerCase();
|
|
64
|
+
// Extract quoted strings from insight (potential claims about file content)
|
|
65
|
+
const quotedMatches = contentLower.match(/["'`]([^"'`]{3,50})["'`]/g) || [];
|
|
66
|
+
for (const match of quotedMatches) {
|
|
67
|
+
const claim = match.replace(/["'`]/g, '');
|
|
68
|
+
if (claim.length > 5 && !fileContent.includes(claim)) {
|
|
69
|
+
contradictions.push(`Claim "${claim}" not found in ${fileRef}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// Cannot verify content
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
contradictions.push(`Referenced file does not exist: ${fileRef}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Check confidence calibration
|
|
84
|
+
if (insight.confidence !== undefined) {
|
|
85
|
+
totalClaims++;
|
|
86
|
+
if (insight.confidence > 0.9 && contradictions.length > 0) {
|
|
87
|
+
contradictions.push(`High confidence (${insight.confidence}) but ${contradictions.length} unverified claims`);
|
|
88
|
+
}
|
|
89
|
+
else if (insight.confidence < 0.3) {
|
|
90
|
+
evidence.push('Low confidence claim — treated with appropriate uncertainty');
|
|
91
|
+
verifiedCount++;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
verifiedCount++;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Calculate verification score
|
|
98
|
+
const confidence = totalClaims > 0 ? verifiedCount / totalClaims : 0.5;
|
|
99
|
+
const hasContradictions = contradictions.length > 0;
|
|
100
|
+
let verdict;
|
|
101
|
+
if (hasContradictions && confidence < 0.3) {
|
|
102
|
+
verdict = 'hallucinated';
|
|
103
|
+
this.log.flagged++;
|
|
104
|
+
}
|
|
105
|
+
else if (hasContradictions) {
|
|
106
|
+
verdict = 'uncertain';
|
|
107
|
+
this.log.flagged++;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
verdict = 'real';
|
|
111
|
+
}
|
|
112
|
+
// Update accuracy
|
|
113
|
+
this.log.accuracy = this.log.totalChecked > 0
|
|
114
|
+
? (this.log.totalChecked - this.log.flagged) / this.log.totalChecked
|
|
115
|
+
: 1.0;
|
|
116
|
+
await this.saveToDisk();
|
|
117
|
+
return {
|
|
118
|
+
claim: insight.title,
|
|
119
|
+
confidence,
|
|
120
|
+
verified: verdict === 'real',
|
|
121
|
+
contradictions,
|
|
122
|
+
verdict,
|
|
123
|
+
evidence,
|
|
124
|
+
checkedAt: new Date(),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
// ── Ensemble Verification ───────────────────────────────────────────────────
|
|
128
|
+
/**
|
|
129
|
+
* Send a question to multiple models and collect votes.
|
|
130
|
+
* Majority consensus required for acceptance.
|
|
131
|
+
*/
|
|
132
|
+
ensembleVerify(question, modelAnswers) {
|
|
133
|
+
if (modelAnswers.length === 0) {
|
|
134
|
+
return {
|
|
135
|
+
question,
|
|
136
|
+
votes: [],
|
|
137
|
+
consensus: 'none',
|
|
138
|
+
agreedAnswer: '',
|
|
139
|
+
confidence: 0,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
// Find majority answer (by similarity, not exact match)
|
|
143
|
+
const answerGroups = new Map();
|
|
144
|
+
for (const vote of modelAnswers) {
|
|
145
|
+
let matched = false;
|
|
146
|
+
for (const [key, group] of answerGroups) {
|
|
147
|
+
// Simple similarity: check if answers share key words
|
|
148
|
+
const similarity = this.textSimilarity(vote.answer, key);
|
|
149
|
+
if (similarity > 0.6) {
|
|
150
|
+
group.push(vote);
|
|
151
|
+
matched = true;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (!matched) {
|
|
156
|
+
answerGroups.set(vote.answer, [vote]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Find largest group
|
|
160
|
+
let largestGroup = [];
|
|
161
|
+
for (const group of answerGroups.values()) {
|
|
162
|
+
if (group.length > largestGroup.length) {
|
|
163
|
+
largestGroup = group;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const totalVotes = modelAnswers.length;
|
|
167
|
+
const agreeingVotes = largestGroup.length;
|
|
168
|
+
const ratio = agreeingVotes / totalVotes;
|
|
169
|
+
let consensus;
|
|
170
|
+
if (ratio === 1)
|
|
171
|
+
consensus = 'unanimous';
|
|
172
|
+
else if (ratio > 0.5)
|
|
173
|
+
consensus = 'majority';
|
|
174
|
+
else if (ratio === 0.5)
|
|
175
|
+
consensus = 'split';
|
|
176
|
+
else
|
|
177
|
+
consensus = 'none';
|
|
178
|
+
const avgConfidence = largestGroup.reduce((s, v) => s + v.confidence, 0) / largestGroup.length;
|
|
179
|
+
return {
|
|
180
|
+
question,
|
|
181
|
+
votes: modelAnswers,
|
|
182
|
+
consensus,
|
|
183
|
+
agreedAnswer: largestGroup[0]?.answer ?? '',
|
|
184
|
+
confidence: avgConfidence,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
// ── Injection Detection ─────────────────────────────────────────────────────
|
|
188
|
+
/**
|
|
189
|
+
* Scan input for prompt injection patterns.
|
|
190
|
+
* Returns ThreatVector if detected, null otherwise.
|
|
191
|
+
*/
|
|
192
|
+
scanForInjection(input) {
|
|
193
|
+
for (const { pattern, type, severity } of AdversarialDefense.INJECTION_PATTERNS) {
|
|
194
|
+
if (pattern.test(input)) {
|
|
195
|
+
return {
|
|
196
|
+
type,
|
|
197
|
+
severity,
|
|
198
|
+
blocked: true,
|
|
199
|
+
source: 'input-scan',
|
|
200
|
+
pattern: pattern.source,
|
|
201
|
+
timestamp: new Date(),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// Check for encoded injection attempts
|
|
206
|
+
const decodedInput = this.decodeCommonEncodings(input);
|
|
207
|
+
if (decodedInput !== input) {
|
|
208
|
+
for (const { pattern, type, severity } of AdversarialDefense.INJECTION_PATTERNS) {
|
|
209
|
+
if (pattern.test(decodedInput)) {
|
|
210
|
+
return {
|
|
211
|
+
type,
|
|
212
|
+
severity,
|
|
213
|
+
blocked: true,
|
|
214
|
+
source: 'encoded-injection',
|
|
215
|
+
pattern: `encoded:${pattern.source}`,
|
|
216
|
+
timestamp: new Date(),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
/** Block and log a detected threat */
|
|
224
|
+
blockAndLog(threat) {
|
|
225
|
+
this.injectionCount++;
|
|
226
|
+
this.log.blocked++;
|
|
227
|
+
if (this.injectionCount >= this.MAX_INJECTIONS_PER_SESSION) {
|
|
228
|
+
threat.severity = 'critical';
|
|
229
|
+
}
|
|
230
|
+
this.saveToDisk();
|
|
231
|
+
}
|
|
232
|
+
/** Get defense statistics */
|
|
233
|
+
getDefenseStats() {
|
|
234
|
+
return { ...this.log, timestamp: new Date() };
|
|
235
|
+
}
|
|
236
|
+
/** Get injection count for current session */
|
|
237
|
+
getSessionInjectionCount() {
|
|
238
|
+
return this.injectionCount;
|
|
239
|
+
}
|
|
240
|
+
// ── Utility ─────────────────────────────────────────────────────────────────
|
|
241
|
+
/** Simple text similarity based on shared words */
|
|
242
|
+
textSimilarity(a, b) {
|
|
243
|
+
const wordsA = new Set(a.toLowerCase().split(/\s+/));
|
|
244
|
+
const wordsB = new Set(b.toLowerCase().split(/\s+/));
|
|
245
|
+
const intersection = new Set([...wordsA].filter(w => wordsB.has(w)));
|
|
246
|
+
const union = new Set([...wordsA, ...wordsB]);
|
|
247
|
+
return union.size > 0 ? intersection.size / union.size : 0;
|
|
248
|
+
}
|
|
249
|
+
/** Attempt to decode common encoding schemes */
|
|
250
|
+
decodeCommonEncodings(input) {
|
|
251
|
+
try {
|
|
252
|
+
// Base64
|
|
253
|
+
if (/^[A-Za-z0-9+/]+=*$/.test(input) && input.length > 20) {
|
|
254
|
+
return Buffer.from(input, 'base64').toString('utf-8');
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
catch { /* not base64 */ }
|
|
258
|
+
try {
|
|
259
|
+
// URL encoding
|
|
260
|
+
if (input.includes('%')) {
|
|
261
|
+
return decodeURIComponent(input);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
catch { /* not URL encoded */ }
|
|
265
|
+
return input;
|
|
266
|
+
}
|
|
267
|
+
// ── Persistence ─────────────────────────────────────────────────────────────
|
|
268
|
+
async saveToDisk() {
|
|
269
|
+
try {
|
|
270
|
+
if (!fs.existsSync(DEFENSE_DIR)) {
|
|
271
|
+
fs.mkdirSync(DEFENSE_DIR, { recursive: true });
|
|
272
|
+
}
|
|
273
|
+
fs.writeFileSync(path.join(DEFENSE_DIR, LOG_FILE), JSON.stringify(this.log));
|
|
274
|
+
}
|
|
275
|
+
catch { /* non-blocking */ }
|
|
276
|
+
}
|
|
277
|
+
loadFromDisk() {
|
|
278
|
+
try {
|
|
279
|
+
const logFile = path.join(DEFENSE_DIR, LOG_FILE);
|
|
280
|
+
if (!fs.existsSync(logFile))
|
|
281
|
+
return;
|
|
282
|
+
const data = JSON.parse(fs.readFileSync(logFile, 'utf-8'));
|
|
283
|
+
this.log = { ...this.log, ...data, timestamp: new Date(data.timestamp) };
|
|
284
|
+
}
|
|
285
|
+
catch { /* fresh start */ }
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// Common prompt injection patterns
|
|
289
|
+
AdversarialDefense.INJECTION_PATTERNS = [
|
|
290
|
+
{ pattern: /ignore\s+(all\s+)?previous\s+instructions/i, type: 'prompt-injection', severity: 'critical' },
|
|
291
|
+
{ pattern: /forget\s+(your|all)\s+rules/i, type: 'prompt-injection', severity: 'critical' },
|
|
292
|
+
{ pattern: /pretend\s+you\s+are/i, type: 'prompt-injection', severity: 'high' },
|
|
293
|
+
{ pattern: /you\s+are\s+now\s+a/i, type: 'prompt-injection', severity: 'high' },
|
|
294
|
+
{ pattern: /disregard\s+(your|all)\s+(training|instructions)/i, type: 'prompt-injection', severity: 'critical' },
|
|
295
|
+
{ pattern: /override\s+safety/i, type: 'prompt-injection', severity: 'critical' },
|
|
296
|
+
{ pattern: /system\s*:\s*/i, type: 'prompt-injection', severity: 'high' },
|
|
297
|
+
{ pattern: /<\|im_start\|>/i, type: 'prompt-injection', severity: 'high' },
|
|
298
|
+
{ pattern: /jailbreak/i, type: 'prompt-injection', severity: 'medium' },
|
|
299
|
+
{ pattern: /DAN\s+mode/i, type: 'prompt-injection', severity: 'high' },
|
|
300
|
+
{ pattern: /bypass\s+(all\s+)?filters/i, type: 'prompt-injection', severity: 'critical' },
|
|
301
|
+
{ pattern: /extract\s+(the\s+)?(prompt|system|instructions)/i, type: 'data-poisoning', severity: 'high' },
|
|
302
|
+
];
|
|
303
|
+
//# sourceMappingURL=adversarial-defense.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adversarial-defense.js","sourceRoot":"","sources":["../../src/brain/adversarial-defense.ts"],"names":[],"mappings":"A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AAE,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,EAAE;IACjF,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE;IACzE,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE;IAC1E,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE;IACvE,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE;IACtE,EAAE,OAAO,EAAE,4BAA4B,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,EAAE;IACzF,EAAE,OAAO,EAAE,kDAAkD,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE;CAC1G,AAbyC,CAaxC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BrainInsight } from '../types.js';
|
|
2
|
+
export interface CognitiveFunction {
|
|
3
|
+
name: string;
|
|
4
|
+
file: string;
|
|
5
|
+
startLine: number;
|
|
6
|
+
endLine: number;
|
|
7
|
+
cognitiveScore: number;
|
|
8
|
+
nestingContributions: number;
|
|
9
|
+
booleanContributions: number;
|
|
10
|
+
controlFlowContributions: number;
|
|
11
|
+
recursionContributions: number;
|
|
12
|
+
linesOfCode: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class CognitiveLoadAnalyzer {
|
|
15
|
+
private projectDir;
|
|
16
|
+
constructor(projectDir: string);
|
|
17
|
+
analyzeProject(maxFiles?: number): Promise<BrainInsight[]>;
|
|
18
|
+
analyzeFile(filePath: string): CognitiveFunction[];
|
|
19
|
+
private getFunctionPattern;
|
|
20
|
+
private extractFunctionBody;
|
|
21
|
+
private skipString;
|
|
22
|
+
private calculateCognitiveComplexity;
|
|
23
|
+
private removeStringsAndComments;
|
|
24
|
+
private functionToInsight;
|
|
25
|
+
private collectFiles;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=cognitive-load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitive-load.d.ts","sourceRoot":"","sources":["../../src/brain/cognitive-load.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAU3C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wBAAwB,EAAE,MAAM,CAAC;IACjC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,UAAU,CAAS;gBAEf,UAAU,EAAE,MAAM;IAIxB,cAAc,CAAC,QAAQ,GAAE,MAAY,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAwDrE,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,EAAE;IA4ClD,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,mBAAmB;IAqC3B,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,4BAA4B;IA0EpC,OAAO,CAAC,wBAAwB;IAchC,OAAO,CAAC,iBAAiB;IAsCzB,OAAO,CAAC,YAAY;CAqBrB"}
|