anon-identity
Version:
Decentralized identity framework with DIDs, Verifiable Credentials, and privacy-preserving selective disclosure
86 lines • 2.96 kB
TypeScript
import { AgentMessage, AgentMessageType, CommunicationChannel, CommunicationStats, MessageHandlerContext } from './types';
import { AgentIdentity } from '../types';
import { AgentIdentityManager } from '../agent-identity';
import { DelegationManager } from '../delegation-manager';
import { DelegationPolicyEngine } from '../delegation-policy-engine';
import { ActivityLogger } from '../activity/activity-logger';
export interface CommunicationManagerOptions {
enableEncryption?: boolean;
defaultMessageTTL?: number;
maxRetries?: number;
retryDelay?: number;
enableStats?: boolean;
}
export declare class CommunicationManager {
private agentIdentity;
private channels;
private messageHandlers;
private stats;
private options;
private pendingMessages;
constructor(agentIdentity: AgentIdentity, agentManager: AgentIdentityManager, delegationManager: DelegationManager, policyEngine: DelegationPolicyEngine, activityLogger: ActivityLogger, options?: CommunicationManagerOptions);
/**
* Adds a communication channel
*/
addChannel(channel: CommunicationChannel): void;
/**
* Removes a communication channel
*/
removeChannel(channelId: string): Promise<void>;
/**
* Connects all channels
*/
connectAll(): Promise<void>;
/**
* Disconnects all channels
*/
disconnectAll(): Promise<void>;
/**
* Sends a message through the best available channel
*/
sendMessage(message: AgentMessage, preferredChannelId?: string): Promise<void>;
/**
* Sends a delegation request to another agent
*/
requestDelegation(targetAgentDID: string, requestedScopes: string[], options?: {
serviceDID?: string;
duration?: number;
purpose?: string;
channelId?: string;
}): Promise<void>;
/**
* Queries another agent's status
*/
queryAgentStatus(targetAgentDID: string, options?: {
includeChain?: boolean;
includeScopes?: boolean;
includeMetrics?: boolean;
channelId?: string;
}): Promise<void>;
/**
* Pings another agent
*/
pingAgent(targetAgentDID: string, channelId?: string): Promise<void>;
/**
* Registers a custom message handler
*/
registerMessageHandler(type: AgentMessageType, handler: (message: AgentMessage, context: MessageHandlerContext) => Promise<AgentMessage | void>): void;
/**
* Gets communication statistics
*/
getStats(channelId?: string): CommunicationStats | Map<string, CommunicationStats>;
/**
* Gets list of connected channels
*/
getConnectedChannels(): string[];
/**
* Retries failed messages
*/
retryFailedMessages(): Promise<number>;
private handleIncomingMessage;
private selectChannel;
private sendThroughChannel;
private updateStats;
private initializeStats;
}
//# sourceMappingURL=communication-manager.d.ts.map