🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
Checkpoint: File edits
rUv0467a3860932
diff --git a/v3/@claude-flow/aidefence/src/domain/entities/threat.ts b/v3/@claude-flow/aidefence/src/domain/entities/threat.tsnew file mode 100644index 0000000000..93c331d471--- /dev/null+++ b/v3/@claude-flow/aidefence/src/domain/entities/threat.ts@@ -0,0 +1,81 @@+/**+ * Threat Domain Entity+ *+ * Represents a detected security threat from AI manipulation attempts.+ */++export type ThreatSeverity = 'low' | 'medium' | 'high' | 'critical';++export type ThreatType =+ | 'prompt_injection'+ | 'jailbreak'+ | 'pii_exposure'+ | 'instruction_override'+ | 'role_switching'+ | 'context_manipulation'+ | 'encoding_attack'+ | 'unknown';++export interface Threat {+ readonly id: string;+ readonly type: ThreatType;+ readonly severity: ThreatSeverity;+ readonly confidence: number;+ readonly pattern: string;+ readonly description: string;+ readonly location?: {+ start: number;+ end: number;+ };+ readonly detectedAt: Date;+}++export interface ThreatDetectionResult {+ readonly safe: boolean;+ readonly threats: Threat[];+ readonly detectionTimeMs: number;+ readonly piiFound: boolean;+ readonly inputHash: string;+}++export interface BehavioralAnalysisResult {+ readonly agentId: string;+ readonly anomalyScore: number;+ readonly attractorType: 'point' | 'cycle' | 'torus' | 'strange';+ readonly lyapunovExponent: number;+ readonly analysisTimeMs: number;+ readonly windowSize: string;+ readonly actionCount: number;+}++export interface PolicyVerificationResult {+ readonly agentId: string;+ readonly policy: string;+ readonly valid: boolean;+ readonly violations: string[];+ readonly proofStatus: 'valid' | 'invalid' | 'timeout';+ readonly verificationTimeMs: number;+}++/**+ * Factory function to create a Threat entity+ */+export function createThreat(params: {+ type: ThreatType;+ severity: ThreatSeverity;+ confidence: number;+ pattern: string;+ description: string;+ location?: { start: number; end: number };+}): Threat {+ return {+ id: `threat-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,+ type: params.type,+ severity: params.severity,+ confidence: params.confidence,+ pattern: params.pattern,+ description: params.description,+ location: params.location,+ detectedAt: new Date(),+ };+}