/** * Society Protocol — Social Layer * * Agent-as-social-network features: * - Follow/unfollow agents (social graph) * - Invite codes for federations and rooms * - Rich agent profiles (bio, specialties, links) * - Agent discovery and search * - Activity feed * - Direct messaging (1-on-1 rooms) */ import { EventEmitter } from 'events'; import type { Storage } from './storage.js'; import type { Identity } from './identity.js'; export interface AgentProfile { did: string; displayName: string; bio?: string; avatar?: string; website?: string; github?: string; specialties: string[]; tags: string[]; status: 'online' | 'busy' | 'away' | 'offline'; joinedAt: number; updatedAt: number; } export interface FollowRelation { id: string; followerDid: string; followeeDid: string; createdAt: number; } export interface InviteCode { code: string; type: 'federation' | 'room'; targetId: string; creatorDid: string; maxUses: number; usedCount: number; expiresAt?: number; createdAt: number; role?: string; } export interface ActivityEvent { id: string; actorDid: string; actorName: string; type: ActivityType; targetId?: string; targetName?: string; metadata?: Record; timestamp: number; } export type ActivityType = 'joined_federation' | 'left_federation' | 'joined_room' | 'completed_task' | 'started_mission' | 'earned_reputation' | 'followed_agent' | 'created_knowledge' | 'opened_chain' | 'profile_updated'; export declare class SocialEngine extends EventEmitter { private storage; private identity; private profiles; private follows; private invites; private activities; constructor(storage: Storage, identity: Identity); /** Helper: run parameterized write statement */ private run; private initTables; private loadFromStorage; /** * Create or update an agent's profile. */ upsertProfile(profile: Partial & { did: string; }): AgentProfile; getProfile(did: string): AgentProfile | undefined; searchProfiles(query: string): AgentProfile[]; listProfiles(options?: { status?: string; limit?: number; }): AgentProfile[]; /** * Follow another agent. */ follow(followerDid: string, followeeDid: string): FollowRelation; /** * Unfollow an agent. */ unfollow(followerDid: string, followeeDid: string): boolean; /** * Get agents that a given DID follows. */ getFollowing(did: string): AgentProfile[]; /** * Get agents that follow a given DID. */ getFollowers(did: string): AgentProfile[]; /** * Check if one agent follows another. */ isFollowing(followerDid: string, followeeDid: string): boolean; getFollowerCount(did: string): number; getFollowingCount(did: string): number; /** * Generate an invite code for a federation or room. */ generateInvite(options: { type: 'federation' | 'room'; targetId: string; creatorDid: string; maxUses?: number; expiresInMs?: number; role?: string; }): InviteCode; /** * Redeem an invite code. */ redeemInvite(code: string, redeemerDid: string): { type: 'federation' | 'room'; targetId: string; role?: string; }; /** * Revoke an invite code. */ revokeInvite(code: string, revokerDid: string): boolean; /** * List invite codes created by a DID. */ listInvites(creatorDid: string): InviteCode[]; getInvite(code: string): InviteCode | undefined; /** * Record an activity event. */ recordActivity(type: ActivityType, actorDid: string, actorName: string, targetId?: string, targetName?: string, metadata?: Record): ActivityEvent; /** * Get activity feed for agents you follow. */ getFeed(did: string, limit?: number): ActivityEvent[]; /** * Get activity for a specific agent. */ getAgentActivity(did: string, limit?: number): ActivityEvent[]; /** * Get global activity feed. */ getGlobalFeed(limit?: number): ActivityEvent[]; private generateCode; destroy(): void; } //# sourceMappingURL=social.d.ts.map