UNPKG

anon-identity

Version:

Decentralized identity framework with DIDs, Verifiable Credentials, and privacy-preserving selective disclosure

141 lines 5.04 kB
/** * MCP-Enabled Communication Manager * * Extends the existing CommunicationManager to leverage MCP for all LLM interactions */ import { CommunicationManager, CommunicationManagerOptions } from '../../agent/communication/communication-manager'; import { AgentMessage, MessageEnvelope } from '../../agent/communication/types'; import { AgentIdentity } from '../../agent/types'; import { AgentIdentityManager } from '../../agent/agent-identity'; import { DelegationManager } from '../../agent/delegation-manager'; import { DelegationPolicyEngine } from '../../agent/delegation-policy-engine'; import { ActivityLogger } from '../../agent/activity/activity-logger'; import { MCPClient } from '../client'; import { AuthManager } from '../security/auth-manager'; import { RateLimiterManager } from '../security/rate-limiter'; import { CredentialManager } from '../security/credential-manager'; import { RequestPriority, AgentCapabilityProfile } from '../types'; /** * MCP-enabled communication manager options */ export interface MCPCommunicationManagerOptions extends CommunicationManagerOptions { mcpClient: MCPClient; llmIntegration?: { enableNaturalLanguage?: boolean; enablePolicyEvaluation?: boolean; enableAgentMatching?: boolean; enableStreaming?: boolean; defaultProvider?: string; defaultModel?: string; }; contextSettings?: { maxTokensPerContext?: number; compressionStrategy?: 'summary' | 'sliding-window' | 'importance'; shareContextBetweenAgents?: boolean; }; } /** * MCP-Enabled Communication Manager */ export declare class MCPEnabledCommunicationManager extends CommunicationManager { private mcpOptions; private llmManager; private delegationEngine; private delegationIntegration; private agentMatcher; private providerSelector?; private streamManager; private contextManager; private messageRouter; private mcpAuditLogger; private conversationContexts; protected mcpAgentIdentity: AgentIdentity; constructor(agentIdentity: AgentIdentity, agentManager: AgentIdentityManager, delegationManager: DelegationManager, policyEngine: DelegationPolicyEngine, activityLogger: ActivityLogger, mcpOptions: MCPCommunicationManagerOptions, authManager: AuthManager, rateLimiter: RateLimiterManager, credentialManager: CredentialManager); /** * Process a natural language message */ processNaturalLanguageMessage(message: string, targetAgent?: string, options?: { streaming?: boolean; priority?: RequestPriority; onChunk?: (chunk: string) => void; }): Promise<MessageEnvelope>; /** * Evaluate delegation request using LLM */ evaluateDelegationWithLLM(requestingAgent: string, targetAgent: string, requestedScopes: string[], purpose: string, duration?: number): Promise<{ decision: 'approve' | 'deny' | 'approve_with_modifications' | 'request_more_info'; confidence: number; reasoning: string; suggestedScopes?: string[]; warnings: string[]; riskLevel: 'low' | 'medium' | 'high' | 'critical'; }>; /** * Find matching agents for a task */ findAgentsForTask(taskDescription: string, requiredCapabilities: string[], options?: { maxResults?: number; minTrustLevel?: number; urgency?: 'low' | 'medium' | 'high' | 'critical'; }): Promise<Array<{ agent: AgentCapabilityProfile; score: number; confidence: number; reasoning: string; }>>; /** * Send message with intelligent routing */ sendMessageWithRouting(message: AgentMessage, targetAgent: string, options?: { priority?: RequestPriority; preferredProvider?: string; requireConfirmation?: boolean; }): Promise<MessageEnvelope>; /** * Get or create conversation context */ private getOrCreateContext; /** * Build natural language prompt */ private buildNaturalLanguagePrompt; /** * Parse natural language response */ private parseNaturalLanguageResponse; /** * Build decision context for delegation */ private buildDecisionContext; /** * Log LLM activity */ private logLLMActivity; /** * Get LLM usage statistics */ getLLMUsageStatistics(): Promise<{ totalRequests: number; totalTokens: number; totalCost: number; averageLatency: number; providerBreakdown: Record<string, { requests: number; tokens: number; cost: number; }>; }>; /** * Share context between agents */ shareContextWithAgent(targetAgentDID: string, options?: { shareHistory?: boolean; shareSummary?: boolean; }): Promise<void>; /** * Cleanup resources */ cleanup(): Promise<void>; } export default MCPEnabledCommunicationManager; //# sourceMappingURL=mcp-communication-manager.d.ts.map