/** * Opacus DAC Manager * Manages Decentralized Agent Communication channels and data streams * * Features: * - DAC registry and configuration * - Membership management with roles * - Access control and permissions * - Channel subscriptions * - Usage tracking and billing */ import { DACConfig, DataChannel, OpacusFrame, AgentIdentity } from '../types'; import { OGChainClient } from '../chain/0g'; import { SecurityManager } from '../crypto/security'; /** * Member role in DAC */ export type MemberRole = 'owner' | 'operator' | 'reader' | 'writer' | 'admin'; /** * DAC member with role and permissions */ export interface DACMember { address: string; role: MemberRole; joinedAt: number; lastActive: number; permissions: string[]; } /** * Access control entry */ export interface AccessControl { resource: string; principal: string; actions: string[]; conditions?: { expiresAt?: number; maxUsage?: number; rateLimit?: number; }; } /** * Usage statistics for billing */ export interface UsageStats { channelId: string; subscriber: string; bytesReceived: number; messagesReceived: number; firstActivity: number; lastActivity: number; totalCost: bigint; } export declare class DACManager { private chainClient; private security; private dacs; private channels; private subscriptions; private members; private accessControl; private usageStats; constructor(chainClient: OGChainClient, security: SecurityManager); /** * Create new DAC */ createDAC(config: DACConfig): Promise; /** * Get DAC configuration */ getDAC(dacId: string): DACConfig | undefined; /** * Get all DACs */ getAllDACs(): DACConfig[]; /** * Add member to DAC */ addMember(dacId: string, member: DACMember): boolean; /** * Remove member from DAC */ removeMember(dacId: string, address: string): boolean; /** * Get member info */ getMember(dacId: string, address: string): DACMember | undefined; /** * Get all members of DAC */ getMembers(dacId: string): DACMember[]; /** * Get members by role */ getMembersByRole(dacId: string, role: MemberRole): DACMember[]; /** * Update member role */ updateMemberRole(dacId: string, address: string, newRole: MemberRole): boolean; /** * Check if member has permission */ hasPermission(dacId: string, address: string, permission: string): boolean; /** * Grant access to resource */ grantAccess(acl: AccessControl): void; /** * Revoke access to resource */ revokeAccess(resource: string, principal: string): boolean; /** * Check if principal can perform action on resource */ canAccess(resource: string, principal: string, action: string): boolean; /** * Subscribe to data channel */ subscribe(channelId: string, subscriberId: string): Promise; /** * Unsubscribe from channel */ unsubscribe(channelId: string, subscriberId: string): Promise; /** * Get channel subscribers */ getSubscribers(channelId: string): string[]; /** * Check if subscriber is subscribed to channel */ isSubscribed(channelId: string, subscriberId: string): boolean; /** * Broadcast to channel subscribers */ broadcastToChannel(channelId: string, identity: AgentIdentity, payload: any, sendFn: (frame: OpacusFrame, to: string) => Promise): Promise; /** * Record usage for billing */ private recordUsage; /** * Get usage statistics */ getUsageStats(channelId: string, subscriber: string): UsageStats | undefined; /** * Get all usage stats for channel */ getChannelUsageStats(channelId: string): UsageStats[]; /** * Calculate usage cost for a channel */ calculateCost(channelId: string, bytes: number, messages: number): bigint; /** * Get channel info */ getChannel(channelId: string): DataChannel | undefined; /** * Get all channels */ getAllChannels(): DataChannel[]; /** * Get channels for DAC */ getDACChannels(dacId: string): DataChannel[]; } //# sourceMappingURL=manager.d.ts.map