@elizaos/service-interfaces 1.6.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Shaw Walters and elizaOS Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ import{Service as x,ServiceType as B}from"@elizaos/core";class E extends x{static serviceType=B.BROWSER;capabilityDescription="Web browser automation and scraping capabilities"}import{Service as j,ServiceType as w}from"@elizaos/core";class H extends j{static serviceType=w.EMAIL;capabilityDescription="Email sending, receiving, and management capabilities"}import{Service as J}from"@elizaos/core";class N extends J{static serviceType="lp";capabilityDescription="Provides standardized access to DEX liquidity pools."}import{Service as O,ServiceType as Q}from"@elizaos/core";class W extends O{static serviceType=Q.MESSAGE;capabilityDescription="Message sending, receiving, and management capabilities"}import{Service as X,ServiceType as Z}from"@elizaos/core";class _ extends X{static serviceType=Z.PDF;capabilityDescription="PDF processing, extraction, and generation capabilities"}import{Service as $,ServiceType as C}from"@elizaos/core";class M extends ${static serviceType=C.POST;capabilityDescription="Social media posting and content management capabilities"}import{Service as Y,ServiceType as G}from"@elizaos/core";class K extends Y{static serviceType=G.TOKEN_DATA;capabilityDescription="Provides standardized access to token market data."}import{Service as V,ServiceType as F}from"@elizaos/core";class I extends V{static serviceType=F.TRANSCRIPTION;capabilityDescription="Audio transcription and speech processing capabilities"}import{Service as A,ServiceType as U}from"@elizaos/core";class k extends A{static serviceType=U.VIDEO;capabilityDescription="Video download, processing, and conversion capabilities"}import{Service as D,ServiceType as R}from"@elizaos/core";class q extends D{static serviceType=R.WALLET;capabilityDescription="Provides standardized access to wallet balances and portfolios."}import{Service as L,ServiceType as z}from"@elizaos/core";class b extends L{static serviceType=z.WEB_SEARCH;capabilityDescription="Web search and content discovery capabilities"}export{b as IWebSearchService,q as IWalletService,k as IVideoService,I as ITranscriptionService,K as ITokenDataService,M as IPostService,_ as IPdfService,W as IMessageService,N as ILpService,H as IEmailService,E as IBrowserService};
2
+
3
+ //# debugId=7B2F7142E1B53DB764756E2164756E21
4
+ //# sourceMappingURL=index.browser.js.map
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/interfaces/browser.ts", "../../src/interfaces/email.ts", "../../src/interfaces/lp.ts", "../../src/interfaces/message.ts", "../../src/interfaces/pdf.ts", "../../src/interfaces/post.ts", "../../src/interfaces/token.ts", "../../src/interfaces/transcription.ts", "../../src/interfaces/video.ts", "../../src/interfaces/wallet.ts", "../../src/interfaces/web-search.ts"],
4
+ "sourcesContent": [
5
+ "import { Service, ServiceType } from '@elizaos/core';\n\nexport interface BrowserNavigationOptions {\n timeout?: number;\n waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';\n viewport?: {\n width: number;\n height: number;\n };\n userAgent?: string;\n headers?: Record<string, string>;\n}\n\nexport interface ScreenshotOptions {\n fullPage?: boolean;\n clip?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n format?: 'png' | 'jpeg' | 'webp';\n quality?: number;\n omitBackground?: boolean;\n}\n\nexport interface ElementSelector {\n selector: string;\n text?: string;\n timeout?: number;\n}\n\nexport interface ExtractedContent {\n text: string;\n html: string;\n links: Array<{\n url: string;\n text: string;\n }>;\n images: Array<{\n src: string;\n alt?: string;\n }>;\n title?: string;\n metadata?: Record<string, string>;\n}\n\nexport interface ClickOptions {\n timeout?: number;\n force?: boolean;\n waitForNavigation?: boolean;\n}\n\nexport interface TypeOptions {\n delay?: number;\n timeout?: number;\n clear?: boolean;\n}\n\n/**\n * Interface for browser automation services\n */\nexport abstract class IBrowserService extends Service {\n static override readonly serviceType = ServiceType.BROWSER;\n\n public readonly capabilityDescription = 'Web browser automation and scraping capabilities';\n\n /**\n * Navigate to a URL\n * @param url - URL to navigate to\n * @param options - Navigation options\n * @returns Promise resolving when navigation completes\n */\n abstract navigate(url: string, options?: BrowserNavigationOptions): Promise<void>;\n\n /**\n * Take a screenshot of the current page\n * @param options - Screenshot options\n * @returns Promise resolving to screenshot buffer\n */\n abstract screenshot(options?: ScreenshotOptions): Promise<Buffer>;\n\n /**\n * Extract text and content from the current page\n * @param selector - Optional CSS selector to extract from specific element\n * @returns Promise resolving to extracted content\n */\n abstract extractContent(selector?: string): Promise<ExtractedContent>;\n\n /**\n * Click on an element\n * @param selector - CSS selector or element selector\n * @param options - Click options\n * @returns Promise resolving when click completes\n */\n abstract click(selector: string | ElementSelector, options?: ClickOptions): Promise<void>;\n\n /**\n * Type text into an input field\n * @param selector - CSS selector for input field\n * @param text - Text to type\n * @param options - Typing options\n * @returns Promise resolving when typing completes\n */\n abstract type(selector: string, text: string, options?: TypeOptions): Promise<void>;\n\n /**\n * Wait for an element to appear\n * @param selector - CSS selector or element selector\n * @returns Promise resolving when element is found\n */\n abstract waitForElement(selector: string | ElementSelector): Promise<void>;\n\n /**\n * Evaluate JavaScript in the browser context\n * @param script - JavaScript code to evaluate\n * @param args - Arguments to pass to the script\n * @returns Promise resolving to evaluation result\n */\n abstract evaluate<T = any>(script: string, ...args: any[]): Promise<T>;\n\n /**\n * Get the current page URL\n * @returns Promise resolving to current URL\n */\n abstract getCurrentUrl(): Promise<string>;\n\n /**\n * Go back in browser history\n * @returns Promise resolving when navigation completes\n */\n abstract goBack(): Promise<void>;\n\n /**\n * Go forward in browser history\n * @returns Promise resolving when navigation completes\n */\n abstract goForward(): Promise<void>;\n\n /**\n * Refresh the current page\n * @returns Promise resolving when refresh completes\n */\n abstract refresh(): Promise<void>;\n}\n",
6
+ "import { Service, ServiceType } from '@elizaos/core';\n\nexport interface EmailAddress {\n email: string;\n name?: string;\n}\n\nexport interface EmailAttachment {\n filename: string;\n content: Buffer | string;\n contentType?: string;\n contentDisposition?: 'attachment' | 'inline';\n cid?: string;\n}\n\nexport interface EmailMessage {\n from: EmailAddress;\n to: EmailAddress[];\n cc?: EmailAddress[];\n bcc?: EmailAddress[];\n subject: string;\n text?: string;\n html?: string;\n attachments?: EmailAttachment[];\n replyTo?: EmailAddress;\n date?: Date;\n messageId?: string;\n references?: string[];\n inReplyTo?: string;\n priority?: 'high' | 'normal' | 'low';\n}\n\nexport interface EmailSendOptions {\n retry?: number;\n timeout?: number;\n trackOpens?: boolean;\n trackClicks?: boolean;\n tags?: string[];\n}\n\nexport interface EmailSearchOptions {\n query?: string;\n from?: string;\n to?: string;\n subject?: string;\n folder?: string;\n since?: Date;\n before?: Date;\n limit?: number;\n offset?: number;\n unread?: boolean;\n flagged?: boolean;\n hasAttachments?: boolean;\n}\n\nexport interface EmailFolder {\n name: string;\n path: string;\n type: 'inbox' | 'sent' | 'drafts' | 'trash' | 'spam' | 'custom';\n messageCount?: number;\n unreadCount?: number;\n children?: EmailFolder[];\n}\n\nexport interface EmailAccount {\n email: string;\n name?: string;\n provider?: string;\n folders?: EmailFolder[];\n quotaUsed?: number;\n quotaLimit?: number;\n}\n\n/**\n * Interface for email services\n */\nexport abstract class IEmailService extends Service {\n static override readonly serviceType = ServiceType.EMAIL;\n\n public readonly capabilityDescription = 'Email sending, receiving, and management capabilities';\n\n /**\n * Send an email\n * @param message - Email message to send\n * @param options - Send options\n * @returns Promise resolving to message ID\n */\n abstract sendEmail(message: EmailMessage, options?: EmailSendOptions): Promise<string>;\n\n /**\n * Get emails from a folder\n * @param options - Search options\n * @returns Promise resolving to array of emails\n */\n abstract getEmails(options?: EmailSearchOptions): Promise<EmailMessage[]>;\n\n /**\n * Get a specific email by ID\n * @param messageId - Message ID\n * @returns Promise resolving to email message\n */\n abstract getEmail(messageId: string): Promise<EmailMessage>;\n\n /**\n * Delete an email\n * @param messageId - Message ID\n * @returns Promise resolving when deletion completes\n */\n abstract deleteEmail(messageId: string): Promise<void>;\n\n /**\n * Mark an email as read/unread\n * @param messageId - Message ID\n * @param read - True to mark as read, false for unread\n * @returns Promise resolving when operation completes\n */\n abstract markEmailAsRead(messageId: string, read: boolean): Promise<void>;\n\n /**\n * Flag/unflag an email\n * @param messageId - Message ID\n * @param flagged - True to flag, false to unflag\n * @returns Promise resolving when operation completes\n */\n abstract flagEmail(messageId: string, flagged: boolean): Promise<void>;\n\n /**\n * Move email to a different folder\n * @param messageId - Message ID\n * @param folderPath - Destination folder path\n * @returns Promise resolving when move completes\n */\n abstract moveEmail(messageId: string, folderPath: string): Promise<void>;\n\n /**\n * Get available folders\n * @returns Promise resolving to array of folders\n */\n abstract getFolders(): Promise<EmailFolder[]>;\n\n /**\n * Create a new folder\n * @param folderName - Name of the folder\n * @param parentPath - Optional parent folder path\n * @returns Promise resolving when folder is created\n */\n abstract createFolder(folderName: string, parentPath?: string): Promise<void>;\n\n /**\n * Get account information\n * @returns Promise resolving to account details\n */\n abstract getAccountInfo(): Promise<EmailAccount>;\n\n /**\n * Search emails\n * @param query - Search query\n * @param options - Search options\n * @returns Promise resolving to search results\n */\n abstract searchEmails(query: string, options?: EmailSearchOptions): Promise<EmailMessage[]>;\n}\n",
7
+ "import { Service, type Metadata } from '@elizaos/core';\nimport type { TokenBalance } from './token';\n\n/**\n * A standardized representation of a liquidity pool from any DEX.\n */\nexport type PoolInfo = {\n id: string; // Unique identifier for the pool (e.g., LP token mint or a DEX-specific ID).\n displayName?: string; // User-friendly name for the pool.\n dex: string; // Identifier for the DEX (e.g., \"orca\", \"raydium\").\n tokenA: {\n mint: string;\n symbol?: string;\n reserve?: string;\n decimals?: number;\n };\n tokenB: {\n mint: string;\n symbol?: string;\n reserve?: string;\n decimals?: number;\n };\n lpTokenMint?: string;\n apr?: number; // Annual Percentage Rate.\n apy?: number; // Annual Percentage Yield.\n tvl?: number; // Total Value Locked in USD.\n fee?: number; // Trading fee percentage.\n metadata?: Metadata; // For DEX-specific extra data.\n};\n\n/**\n * A standardized representation of a user's position in a liquidity pool.\n */\nexport type LpPositionDetails = {\n poolId: string;\n dex: string;\n lpTokenBalance: TokenBalance;\n underlyingTokens: TokenBalance[]; // Array of two token balances.\n valueUsd?: number;\n accruedFees?: TokenBalance[];\n rewards?: TokenBalance[];\n metadata?: Metadata; // For additional DEX-specific position data.\n};\n\n/**\n * A standardized result for blockchain transactions.\n */\nexport type TransactionResult = {\n success: boolean;\n transactionId?: string;\n error?: string;\n data?: any;\n};\n\n/**\n * Abstract interface for a Liquidity Pool Service.\n * DEX-specific plugins (e.g., for Orca, Raydium) must implement this service\n * to allow the LP Manager to interact with them in a standardized way.\n */\nexport abstract class ILpService extends Service {\n static override readonly serviceType = 'lp';\n\n public readonly capabilityDescription = 'Provides standardized access to DEX liquidity pools.';\n\n /**\n * Returns the name of the DEX this service interacts with.\n * @returns The name of the DEX (e.g., \"Orca\", \"Raydium\").\n */\n abstract getDexName(): string;\n\n /**\n * Fetches a list of available liquidity pools from the DEX.\n * @param tokenAMint - Optional: Filter pools by the mint address of the first token.\n * @param tokenBMint - Optional: Filter pools by the mint address of the second token.\n * @returns A promise that resolves to an array of standardized PoolInfo objects.\n */\n abstract getPools(tokenAMint?: string, tokenBMint?: string): Promise<PoolInfo[]>;\n\n /**\n * Adds liquidity to a specified pool.\n * @param params - The parameters for adding liquidity.\n * @returns A promise resolving to a transaction result, including the LP tokens received.\n */\n abstract addLiquidity(params: {\n userVault: any;\n poolId: string;\n tokenAAmountLamports: string;\n tokenBAmountLamports?: string;\n slippageBps: number;\n tickLowerIndex?: number; // For concentrated liquidity\n tickUpperIndex?: number; // For concentrated liquidity\n }): Promise<TransactionResult & { lpTokensReceived?: TokenBalance }>;\n\n /**\n * Removes liquidity from a specified pool.\n * @param params - The parameters for removing liquidity.\n * @returns A promise resolving to a transaction result, including the tokens received.\n */\n abstract removeLiquidity(params: {\n userVault: any;\n poolId: string;\n lpTokenAmountLamports: string;\n slippageBps: number;\n }): Promise<TransactionResult & { tokensReceived?: TokenBalance[] }>;\n\n /**\n * Fetches the details of a specific LP position for a user.\n * @param userAccountPublicKey - The user's wallet public key.\n * @param poolOrPositionIdentifier - The identifier for the pool or a specific position (e.g., position NFT mint).\n * @returns A promise resolving to the position details or null if not found.\n */\n abstract getLpPositionDetails(\n userAccountPublicKey: string,\n poolOrPositionIdentifier: string\n ): Promise<LpPositionDetails | null>;\n\n /**\n * Fetches the latest market data (e.g., APY, TVL) for a list of pools.\n * @param poolIds - An array of pool IDs to fetch data for.\n * @returns A promise resolving to a map of pool IDs to their partial market data.\n */\n abstract getMarketDataForPools(poolIds: string[]): Promise<Record<string, Partial<PoolInfo>>>;\n}\n",
8
+ "import { Service, ServiceType, type UUID } from '@elizaos/core';\n\nexport interface MessageParticipant {\n id: UUID;\n name: string;\n username?: string;\n avatar?: string;\n status?: 'online' | 'offline' | 'away' | 'busy';\n}\n\nexport interface MessageAttachment {\n id: UUID;\n filename: string;\n url: string;\n mimeType: string;\n size: number;\n width?: number;\n height?: number;\n duration?: number;\n thumbnail?: string;\n}\n\nexport interface MessageReaction {\n emoji: string;\n count: number;\n users: UUID[];\n hasReacted: boolean;\n}\n\nexport interface MessageReference {\n messageId: UUID;\n channelId: UUID;\n type: 'reply' | 'forward' | 'quote';\n}\n\nexport interface MessageContent {\n text?: string;\n html?: string;\n markdown?: string;\n attachments?: MessageAttachment[];\n reactions?: MessageReaction[];\n reference?: MessageReference;\n mentions?: UUID[];\n embeds?: Array<{\n title?: string;\n description?: string;\n url?: string;\n image?: string;\n fields?: Array<{\n name: string;\n value: string;\n inline?: boolean;\n }>;\n }>;\n}\n\nexport interface MessageInfo {\n id: UUID;\n channelId: UUID;\n senderId: UUID;\n content: MessageContent;\n timestamp: Date;\n edited?: Date;\n deleted?: Date;\n pinned?: boolean;\n thread?: {\n id: UUID;\n messageCount: number;\n participants: UUID[];\n lastMessageAt: Date;\n };\n}\n\nexport interface MessageSendOptions {\n replyTo?: UUID;\n ephemeral?: boolean;\n silent?: boolean;\n scheduled?: Date;\n thread?: UUID;\n nonce?: string;\n}\n\nexport interface MessageSearchOptions {\n query?: string;\n channelId?: UUID;\n senderId?: UUID;\n before?: Date;\n after?: Date;\n limit?: number;\n offset?: number;\n hasAttachments?: boolean;\n pinned?: boolean;\n mentions?: UUID;\n}\n\nexport interface MessageChannel {\n id: UUID;\n name: string;\n type: 'text' | 'voice' | 'dm' | 'group' | 'announcement' | 'thread';\n description?: string;\n participants?: MessageParticipant[];\n permissions?: {\n canSend: boolean;\n canRead: boolean;\n canDelete: boolean;\n canPin: boolean;\n canManage: boolean;\n };\n lastMessageAt?: Date;\n messageCount?: number;\n unreadCount?: number;\n}\n\n/**\n * Interface for messaging services\n */\nexport abstract class IMessageService extends Service {\n static override readonly serviceType = ServiceType.MESSAGE;\n\n public readonly capabilityDescription = 'Message sending, receiving, and management capabilities';\n\n /**\n * Send a message to a channel\n * @param channelId - Channel ID\n * @param content - Message content\n * @param options - Send options\n * @returns Promise resolving to message ID\n */\n abstract sendMessage(\n channelId: UUID,\n content: MessageContent,\n options?: MessageSendOptions\n ): Promise<UUID>;\n\n /**\n * Get messages from a channel\n * @param channelId - Channel ID\n * @param options - Search options\n * @returns Promise resolving to array of messages\n */\n abstract getMessages(channelId: UUID, options?: MessageSearchOptions): Promise<MessageInfo[]>;\n\n /**\n * Get a specific message by ID\n * @param messageId - Message ID\n * @returns Promise resolving to message\n */\n abstract getMessage(messageId: UUID): Promise<MessageInfo>;\n\n /**\n * Edit a message\n * @param messageId - Message ID\n * @param content - New message content\n * @returns Promise resolving when edit completes\n */\n abstract editMessage(messageId: UUID, content: MessageContent): Promise<void>;\n\n /**\n * Delete a message\n * @param messageId - Message ID\n * @returns Promise resolving when deletion completes\n */\n abstract deleteMessage(messageId: UUID): Promise<void>;\n\n /**\n * Add a reaction to a message\n * @param messageId - Message ID\n * @param emoji - Reaction emoji\n * @returns Promise resolving when reaction is added\n */\n abstract addReaction(messageId: UUID, emoji: string): Promise<void>;\n\n /**\n * Remove a reaction from a message\n * @param messageId - Message ID\n * @param emoji - Reaction emoji\n * @returns Promise resolving when reaction is removed\n */\n abstract removeReaction(messageId: UUID, emoji: string): Promise<void>;\n\n /**\n * Pin a message\n * @param messageId - Message ID\n * @returns Promise resolving when message is pinned\n */\n abstract pinMessage(messageId: UUID): Promise<void>;\n\n /**\n * Unpin a message\n * @param messageId - Message ID\n * @returns Promise resolving when message is unpinned\n */\n abstract unpinMessage(messageId: UUID): Promise<void>;\n\n /**\n * Get available channels\n * @returns Promise resolving to array of channels\n */\n abstract getChannels(): Promise<MessageChannel[]>;\n\n /**\n * Get channel information\n * @param channelId - Channel ID\n * @returns Promise resolving to channel info\n */\n abstract getChannel(channelId: UUID): Promise<MessageChannel>;\n\n /**\n * Create a new channel\n * @param name - Channel name\n * @param type - Channel type\n * @param options - Channel options\n * @returns Promise resolving to new channel ID\n */\n abstract createChannel(\n name: string,\n type: MessageChannel['type'],\n options?: {\n description?: string;\n participants?: UUID[];\n private?: boolean;\n }\n ): Promise<UUID>;\n\n /**\n * Search messages across channels\n * @param query - Search query\n * @param options - Search options\n * @returns Promise resolving to search results\n */\n abstract searchMessages(query: string, options?: MessageSearchOptions): Promise<MessageInfo[]>;\n}\n",
9
+ "import { Service, ServiceType } from '@elizaos/core';\n\nexport interface PdfExtractionResult {\n text: string;\n pageCount: number;\n metadata?: {\n title?: string;\n author?: string;\n createdAt?: Date;\n modifiedAt?: Date;\n };\n}\n\nexport interface PdfGenerationOptions {\n format?: 'A4' | 'A3' | 'Letter';\n orientation?: 'portrait' | 'landscape';\n margins?: {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n };\n header?: string;\n footer?: string;\n}\n\nexport interface PdfConversionOptions {\n quality?: 'high' | 'medium' | 'low';\n outputFormat?: 'pdf' | 'pdf/a';\n compression?: boolean;\n}\n\n/**\n * Interface for PDF processing services\n */\nexport abstract class IPdfService extends Service {\n static override readonly serviceType = ServiceType.PDF;\n\n public readonly capabilityDescription = 'PDF processing, extraction, and generation capabilities';\n\n /**\n * Extract text and metadata from a PDF file\n * @param pdfPath - Path to the PDF file or buffer\n * @returns Promise resolving to extracted text and metadata\n */\n abstract extractText(pdfPath: string | Buffer): Promise<PdfExtractionResult>;\n\n /**\n * Generate a PDF from HTML content\n * @param htmlContent - HTML content to convert to PDF\n * @param options - PDF generation options\n * @returns Promise resolving to PDF buffer\n */\n abstract generatePdf(htmlContent: string, options?: PdfGenerationOptions): Promise<Buffer>;\n\n /**\n * Convert a document to PDF format\n * @param filePath - Path to the document file\n * @param options - Conversion options\n * @returns Promise resolving to PDF buffer\n */\n abstract convertToPdf(filePath: string, options?: PdfConversionOptions): Promise<Buffer>;\n\n /**\n * Merge multiple PDF files into one\n * @param pdfPaths - Array of PDF file paths or buffers\n * @returns Promise resolving to merged PDF buffer\n */\n abstract mergePdfs(pdfPaths: (string | Buffer)[]): Promise<Buffer>;\n\n /**\n * Split a PDF into individual pages\n * @param pdfPath - Path to the PDF file or buffer\n * @returns Promise resolving to array of page buffers\n */\n abstract splitPdf(pdfPath: string | Buffer): Promise<Buffer[]>;\n}\n",
10
+ "import { Service, ServiceType, type UUID } from '@elizaos/core';\n\nexport interface PostMedia {\n id: UUID;\n url: string;\n type: 'image' | 'video' | 'audio' | 'document';\n mimeType: string;\n size: number;\n width?: number;\n height?: number;\n duration?: number;\n thumbnail?: string;\n description?: string;\n altText?: string;\n}\n\nexport interface PostLocation {\n name: string;\n address?: string;\n coordinates?: {\n latitude: number;\n longitude: number;\n };\n placeId?: string;\n}\n\nexport interface PostAuthor {\n id: UUID;\n username: string;\n displayName: string;\n avatar?: string;\n verified?: boolean;\n followerCount?: number;\n followingCount?: number;\n bio?: string;\n website?: string;\n}\n\nexport interface PostEngagement {\n likes: number;\n shares: number;\n comments: number;\n views?: number;\n hasLiked: boolean;\n hasShared: boolean;\n hasCommented: boolean;\n hasSaved: boolean;\n}\n\nexport interface PostContent {\n text?: string;\n html?: string;\n media?: PostMedia[];\n location?: PostLocation;\n tags?: string[];\n mentions?: UUID[];\n links?: Array<{\n url: string;\n title?: string;\n description?: string;\n image?: string;\n }>;\n poll?: {\n question: string;\n options: Array<{\n text: string;\n votes: number;\n }>;\n expiresAt?: Date;\n multipleChoice?: boolean;\n };\n}\n\nexport interface PostInfo {\n id: UUID;\n author: PostAuthor;\n content: PostContent;\n platform: string;\n platformId: string;\n url: string;\n createdAt: Date;\n editedAt?: Date;\n scheduledAt?: Date;\n engagement: PostEngagement;\n visibility: 'public' | 'private' | 'followers' | 'friends' | 'unlisted';\n replyTo?: UUID;\n thread?: {\n id: UUID;\n position: number;\n total: number;\n };\n crossPosted?: Array<{\n platform: string;\n platformId: string;\n url: string;\n }>;\n}\n\nexport interface PostCreateOptions {\n platforms?: string[];\n scheduledAt?: Date;\n visibility?: PostInfo['visibility'];\n replyTo?: UUID;\n thread?: boolean;\n location?: PostLocation;\n tags?: string[];\n mentions?: UUID[];\n enableComments?: boolean;\n enableSharing?: boolean;\n contentWarning?: string;\n sensitive?: boolean;\n}\n\nexport interface PostSearchOptions {\n query?: string;\n author?: UUID;\n platform?: string;\n tags?: string[];\n mentions?: UUID[];\n since?: Date;\n before?: Date;\n limit?: number;\n offset?: number;\n hasMedia?: boolean;\n hasLocation?: boolean;\n visibility?: PostInfo['visibility'];\n sortBy?: 'date' | 'engagement' | 'relevance';\n}\n\nexport interface PostAnalytics {\n postId: UUID;\n platform: string;\n impressions: number;\n reach: number;\n engagement: PostEngagement;\n clicks: number;\n shares: number;\n saves: number;\n demographics?: {\n age?: Record<string, number>;\n gender?: Record<string, number>;\n location?: Record<string, number>;\n };\n topPerformingHours?: Array<{\n hour: number;\n engagement: number;\n }>;\n}\n\n/**\n * Interface for social media posting services\n */\nexport abstract class IPostService extends Service {\n static override readonly serviceType = ServiceType.POST;\n\n public readonly capabilityDescription =\n 'Social media posting and content management capabilities';\n\n /**\n * Create and publish a new post\n * @param content - Post content\n * @param options - Publishing options\n * @returns Promise resolving to post ID\n */\n abstract createPost(content: PostContent, options?: PostCreateOptions): Promise<UUID>;\n\n /**\n * Get posts from timeline or specific user\n * @param options - Search options\n * @returns Promise resolving to array of posts\n */\n abstract getPosts(options?: PostSearchOptions): Promise<PostInfo[]>;\n\n /**\n * Get a specific post by ID\n * @param postId - Post ID\n * @returns Promise resolving to post info\n */\n abstract getPost(postId: UUID): Promise<PostInfo>;\n\n /**\n * Edit an existing post\n * @param postId - Post ID\n * @param content - New post content\n * @returns Promise resolving when edit completes\n */\n abstract editPost(postId: UUID, content: PostContent): Promise<void>;\n\n /**\n * Delete a post\n * @param postId - Post ID\n * @returns Promise resolving when deletion completes\n */\n abstract deletePost(postId: UUID): Promise<void>;\n\n /**\n * Like/unlike a post\n * @param postId - Post ID\n * @param like - True to like, false to unlike\n * @returns Promise resolving when operation completes\n */\n abstract likePost(postId: UUID, like: boolean): Promise<void>;\n\n /**\n * Share/repost a post\n * @param postId - Post ID\n * @param comment - Optional comment when sharing\n * @returns Promise resolving to share ID\n */\n abstract sharePost(postId: UUID, comment?: string): Promise<UUID>;\n\n /**\n * Save/unsave a post\n * @param postId - Post ID\n * @param save - True to save, false to unsave\n * @returns Promise resolving when operation completes\n */\n abstract savePost(postId: UUID, save: boolean): Promise<void>;\n\n /**\n * Comment on a post\n * @param postId - Post ID\n * @param content - Comment content\n * @returns Promise resolving to comment ID\n */\n abstract commentOnPost(postId: UUID, content: PostContent): Promise<UUID>;\n\n /**\n * Get comments for a post\n * @param postId - Post ID\n * @param options - Search options\n * @returns Promise resolving to array of comments\n */\n abstract getComments(postId: UUID, options?: PostSearchOptions): Promise<PostInfo[]>;\n\n /**\n * Schedule a post for later publishing\n * @param content - Post content\n * @param scheduledAt - When to publish\n * @param options - Publishing options\n * @returns Promise resolving to scheduled post ID\n */\n abstract schedulePost(\n content: PostContent,\n scheduledAt: Date,\n options?: PostCreateOptions\n ): Promise<UUID>;\n\n /**\n * Get analytics for a post\n * @param postId - Post ID\n * @returns Promise resolving to post analytics\n */\n abstract getPostAnalytics(postId: UUID): Promise<PostAnalytics>;\n\n /**\n * Get trending posts\n * @param options - Search options\n * @returns Promise resolving to trending posts\n */\n abstract getTrendingPosts(options?: PostSearchOptions): Promise<PostInfo[]>;\n\n /**\n * Search posts across platforms\n * @param query - Search query\n * @param options - Search options\n * @returns Promise resolving to search results\n */\n abstract searchPosts(query: string, options?: PostSearchOptions): Promise<PostInfo[]>;\n}\n",
11
+ "import { Service, ServiceType } from '@elizaos/core';\n\n/**\n * A standardized representation of a token holding.\n */\nexport interface TokenBalance {\n address: string; // Token mint address, or a native identifier like 'SOL' or 'ETH'\n balance: string; // Raw balance as a string to handle large numbers with precision\n decimals: number;\n uiAmount?: number; // User-friendly balance, adjusted for decimals\n name?: string;\n symbol?: string;\n logoURI?: string;\n}\n\n/**\n * Generic representation of token data that can be provided by various services.\n */\nexport interface TokenData {\n id: string; // Unique identifier (e.g., contract address or a composite ID)\n symbol: string;\n name: string;\n address: string; // Contract address\n chain: string; // e.g., 'solana', 'ethereum', 'base'\n sourceProvider: string; // e.g., 'birdeye', 'coinmarketcap'\n\n price?: number;\n priceChange24hPercent?: number;\n priceChange24hUSD?: number; // Absolute change\n\n volume24hUSD?: number;\n marketCapUSD?: number;\n\n liquidity?: number;\n holders?: number;\n\n logoURI?: string;\n decimals?: number;\n\n // Timestamps\n lastUpdatedAt?: Date; // When this specific data point was last updated from the source\n\n // Optional raw data from the provider\n raw?: any;\n}\n\n/**\n * Interface for a generic service that provides token data.\n */\nexport abstract class ITokenDataService extends Service {\n static override readonly serviceType = ServiceType.TOKEN_DATA;\n public readonly capabilityDescription =\n 'Provides standardized access to token market data.' as string;\n\n /**\n * Fetches detailed information for a single token.\n * @param address The token's contract address.\n * @param chain The blockchain the token resides on.\n * @returns A Promise resolving to TokenData or null if not found.\n */\n abstract getTokenDetails(address: string, chain: string): Promise<TokenData | null>;\n\n /**\n * Fetches a list of trending tokens.\n * @param chain Optional: Filter by a specific blockchain.\n * @param limit Optional: Number of tokens to return. Defaults to a service-specific value.\n * @param timePeriod Optional: Time period for trending data (e.g., '24h', '7d'). Defaults to service-specific.\n * @returns A Promise resolving to an array of TokenData.\n */\n abstract getTrendingTokens(\n chain?: string,\n limit?: number,\n timePeriod?: string\n ): Promise<TokenData[]>;\n\n /**\n * Searches for tokens based on a query string.\n * @param query The search query (e.g., symbol, name, address).\n * @param chain Optional: Filter by a specific blockchain.\n * @param limit Optional: Number of results to return.\n * @returns A Promise resolving to an array of TokenData.\n */\n abstract searchTokens(query: string, chain?: string, limit?: number): Promise<TokenData[]>;\n\n /**\n * Fetches data for multiple tokens by their addresses on a specific chain.\n * @param addresses Array of token contract addresses.\n * @param chain The blockchain the tokens reside on.\n * @returns A Promise resolving to an array of TokenData. May not include all requested if some are not found.\n */\n abstract getTokensByAddresses(addresses: string[], chain: string): Promise<TokenData[]>;\n\n // Future potential methods:\n // getHistoricalPriceData(address: string, chain: string, timeFrame: string): Promise<any[]>;\n // getTokenMarketChart(address: string, chain: string, days: number): Promise<any[]>;\n}\n",
12
+ "import { Service, ServiceType } from '@elizaos/core';\n\nexport interface TranscriptionOptions {\n language?: string;\n model?: string;\n temperature?: number;\n prompt?: string;\n response_format?: 'json' | 'text' | 'srt' | 'vtt' | 'verbose_json';\n timestamp_granularities?: ('word' | 'segment')[];\n word_timestamps?: boolean;\n segment_timestamps?: boolean;\n}\n\nexport interface TranscriptionResult {\n text: string;\n language?: string;\n duration?: number;\n segments?: TranscriptionSegment[];\n words?: TranscriptionWord[];\n confidence?: number;\n}\n\nexport interface TranscriptionSegment {\n id: number;\n text: string;\n start: number;\n end: number;\n confidence?: number;\n tokens?: number[];\n temperature?: number;\n avg_logprob?: number;\n compression_ratio?: number;\n no_speech_prob?: number;\n}\n\nexport interface TranscriptionWord {\n word: string;\n start: number;\n end: number;\n confidence?: number;\n}\n\nexport interface SpeechToTextOptions {\n language?: string;\n model?: string;\n continuous?: boolean;\n interimResults?: boolean;\n maxAlternatives?: number;\n}\n\nexport interface TextToSpeechOptions {\n voice?: string;\n model?: string;\n speed?: number;\n format?: 'mp3' | 'wav' | 'flac' | 'aac';\n response_format?: 'mp3' | 'opus' | 'aac' | 'flac';\n}\n\n/**\n * Interface for audio transcription and speech services\n */\nexport abstract class ITranscriptionService extends Service {\n static override readonly serviceType = ServiceType.TRANSCRIPTION;\n\n public readonly capabilityDescription = 'Audio transcription and speech processing capabilities';\n\n /**\n * Transcribe audio file to text\n * @param audioPath - Path to audio file or audio buffer\n * @param options - Transcription options\n * @returns Promise resolving to transcription result\n */\n abstract transcribeAudio(\n audioPath: string | Buffer,\n options?: TranscriptionOptions\n ): Promise<TranscriptionResult>;\n\n /**\n * Transcribe video file to text (extracts audio first)\n * @param videoPath - Path to video file or video buffer\n * @param options - Transcription options\n * @returns Promise resolving to transcription result\n */\n abstract transcribeVideo(\n videoPath: string | Buffer,\n options?: TranscriptionOptions\n ): Promise<TranscriptionResult>;\n\n /**\n * Real-time speech to text from audio stream\n * @param audioStream - Audio stream or buffer\n * @param options - Speech to text options\n * @returns Promise resolving to transcription result\n */\n abstract speechToText(\n audioStream: NodeJS.ReadableStream | Buffer,\n options?: SpeechToTextOptions\n ): Promise<TranscriptionResult>;\n\n /**\n * Convert text to speech\n * @param text - Text to convert to speech\n * @param options - Text to speech options\n * @returns Promise resolving to audio buffer\n */\n abstract textToSpeech(text: string, options?: TextToSpeechOptions): Promise<Buffer>;\n\n /**\n * Get supported languages for transcription\n * @returns Promise resolving to array of supported language codes\n */\n abstract getSupportedLanguages(): Promise<string[]>;\n\n /**\n * Get available voices for text to speech\n * @returns Promise resolving to array of available voices\n */\n abstract getAvailableVoices(): Promise<\n Array<{\n id: string;\n name: string;\n language: string;\n gender?: 'male' | 'female' | 'neutral';\n }>\n >;\n\n /**\n * Detect language of audio file\n * @param audioPath - Path to audio file or audio buffer\n * @returns Promise resolving to detected language code\n */\n abstract detectLanguage(audioPath: string | Buffer): Promise<string>;\n}\n",
13
+ "import { Service, ServiceType } from '@elizaos/core';\n\nexport interface VideoInfo {\n title?: string;\n duration?: number;\n url: string;\n thumbnail?: string;\n description?: string;\n uploader?: string;\n viewCount?: number;\n uploadDate?: Date;\n formats?: VideoFormat[];\n}\n\nexport interface VideoFormat {\n formatId: string;\n url: string;\n extension: string;\n quality: string;\n fileSize?: number;\n videoCodec?: string;\n audioCodec?: string;\n resolution?: string;\n fps?: number;\n bitrate?: number;\n}\n\nexport interface VideoDownloadOptions {\n format?: string;\n quality?: 'best' | 'worst' | 'bestvideo' | 'bestaudio' | string;\n outputPath?: string;\n audioOnly?: boolean;\n videoOnly?: boolean;\n subtitles?: boolean;\n embedSubs?: boolean;\n writeInfoJson?: boolean;\n}\n\nexport interface VideoProcessingOptions {\n startTime?: number;\n endTime?: number;\n outputFormat?: string;\n resolution?: string;\n bitrate?: string;\n framerate?: number;\n audioCodec?: string;\n videoCodec?: string;\n}\n\n/**\n * Interface for video processing and download services\n */\nexport abstract class IVideoService extends Service {\n static override readonly serviceType = ServiceType.VIDEO;\n\n public readonly capabilityDescription = 'Video download, processing, and conversion capabilities';\n\n /**\n * Get video information without downloading\n * @param url - Video URL\n * @returns Promise resolving to video information\n */\n abstract getVideoInfo(url: string): Promise<VideoInfo>;\n\n /**\n * Download a video from URL\n * @param url - Video URL\n * @param options - Download options\n * @returns Promise resolving to downloaded file path\n */\n abstract downloadVideo(url: string, options?: VideoDownloadOptions): Promise<string>;\n\n /**\n * Extract audio from video\n * @param videoPath - Path to video file or video URL\n * @param outputPath - Optional output path for audio file\n * @returns Promise resolving to audio file path\n */\n abstract extractAudio(videoPath: string, outputPath?: string): Promise<string>;\n\n /**\n * Generate thumbnail from video\n * @param videoPath - Path to video file or video URL\n * @param timestamp - Timestamp in seconds to capture thumbnail\n * @returns Promise resolving to thumbnail image path\n */\n abstract getThumbnail(videoPath: string, timestamp?: number): Promise<string>;\n\n /**\n * Convert video to different format\n * @param videoPath - Path to input video file\n * @param outputPath - Path for output video file\n * @param options - Processing options\n * @returns Promise resolving to converted video path\n */\n abstract convertVideo(\n videoPath: string,\n outputPath: string,\n options?: VideoProcessingOptions\n ): Promise<string>;\n\n /**\n * Get available formats for a video URL\n * @param url - Video URL\n * @returns Promise resolving to available formats\n */\n abstract getAvailableFormats(url: string): Promise<VideoFormat[]>;\n}\n",
14
+ "import { Service, ServiceType } from '@elizaos/core';\nimport type { TokenBalance } from './token';\n\n/**\n * Represents a single asset holding within a wallet, including its value.\n * This extends a generic TokenBalance with wallet-specific valuation.\n */\nexport interface WalletAsset extends TokenBalance {\n priceUsd?: number;\n valueUsd?: number;\n}\n\n/**\n * Represents the entire portfolio of assets in a wallet.\n */\nexport interface WalletPortfolio {\n totalValueUsd: number;\n assets: WalletAsset[];\n}\n\n/**\n * Abstract interface for a Wallet Service.\n * Plugins that provide wallet functionality (e.g., for Solana, EVM) should implement this service.\n * It provides a standardized way for other plugins to query the state of a wallet.\n */\nexport abstract class IWalletService extends Service {\n static override readonly serviceType = ServiceType.WALLET;\n\n public readonly capabilityDescription =\n 'Provides standardized access to wallet balances and portfolios.';\n\n /**\n * Retrieves the entire portfolio of assets held by the wallet.\n * @param owner - Optional: The specific wallet address/owner to query if the service manages multiple.\n * @returns A promise that resolves to the wallet's portfolio.\n */\n abstract getPortfolio(owner?: string): Promise<WalletPortfolio>;\n\n /**\n * Retrieves the balance of a specific asset in the wallet.\n * @param assetAddress - The mint address or native identifier of the asset.\n * @param owner - Optional: The specific wallet address/owner to query.\n * @returns A promise that resolves to the user-friendly (decimal-adjusted) balance of the asset held.\n */\n abstract getBalance(assetAddress: string, owner?: string): Promise<number>;\n\n /**\n * Transfers SOL from a specified keypair to a given public key.\n * This is a low-level function primarily for Solana-based wallet services.\n * @param from - The Keypair of the sender.\n * @param to - The PublicKey of the recipient.\n * @param lamports - The amount in lamports to transfer.\n * @returns A promise that resolves with the transaction signature.\n */\n abstract transferSol(from: any, to: any, lamports: number): Promise<string>;\n}\n",
15
+ "import { Service, ServiceType } from '@elizaos/core';\n\nexport interface SearchOptions {\n limit?: number;\n offset?: number;\n language?: string;\n region?: string;\n dateRange?: {\n start?: Date;\n end?: Date;\n };\n fileType?: string;\n site?: string;\n sortBy?: 'relevance' | 'date' | 'popularity';\n safeSearch?: 'strict' | 'moderate' | 'off';\n}\n\nexport interface SearchResult {\n title: string;\n url: string;\n description: string;\n displayUrl?: string;\n thumbnail?: string;\n publishedDate?: Date;\n source?: string;\n relevanceScore?: number;\n snippet?: string;\n}\n\nexport interface SearchResponse {\n query: string;\n results: SearchResult[];\n totalResults?: number;\n searchTime?: number;\n suggestions?: string[];\n nextPageToken?: string;\n relatedSearches?: string[];\n}\n\nexport interface NewsSearchOptions extends SearchOptions {\n category?:\n | 'general'\n | 'business'\n | 'entertainment'\n | 'health'\n | 'science'\n | 'sports'\n | 'technology';\n freshness?: 'day' | 'week' | 'month';\n}\n\nexport interface ImageSearchOptions extends SearchOptions {\n size?: 'small' | 'medium' | 'large' | 'wallpaper' | 'any';\n color?:\n | 'color'\n | 'monochrome'\n | 'red'\n | 'orange'\n | 'yellow'\n | 'green'\n | 'blue'\n | 'purple'\n | 'pink'\n | 'brown'\n | 'black'\n | 'gray'\n | 'white';\n type?: 'photo' | 'clipart' | 'line' | 'animated';\n layout?: 'square' | 'wide' | 'tall' | 'any';\n license?: 'any' | 'public' | 'share' | 'sharecommercially' | 'modify';\n}\n\nexport interface VideoSearchOptions extends SearchOptions {\n duration?: 'short' | 'medium' | 'long' | 'any';\n resolution?: 'high' | 'standard' | 'any';\n quality?: 'high' | 'standard' | 'any';\n}\n\n/**\n * Interface for web search services\n */\nexport abstract class IWebSearchService extends Service {\n static override readonly serviceType = ServiceType.WEB_SEARCH;\n\n public readonly capabilityDescription = 'Web search and content discovery capabilities';\n\n /**\n * Perform a general web search\n * @param query - Search query\n * @param options - Search options\n * @returns Promise resolving to search results\n */\n abstract search(query: string, options?: SearchOptions): Promise<SearchResponse>;\n\n /**\n * Search for news articles\n * @param query - Search query\n * @param options - News search options\n * @returns Promise resolving to news search results\n */\n abstract searchNews(query: string, options?: NewsSearchOptions): Promise<SearchResponse>;\n\n /**\n * Search for images\n * @param query - Search query\n * @param options - Image search options\n * @returns Promise resolving to image search results\n */\n abstract searchImages(query: string, options?: ImageSearchOptions): Promise<SearchResponse>;\n\n /**\n * Search for videos\n * @param query - Search query\n * @param options - Video search options\n * @returns Promise resolving to video search results\n */\n abstract searchVideos(query: string, options?: VideoSearchOptions): Promise<SearchResponse>;\n\n /**\n * Get search suggestions for a query\n * @param query - Partial search query\n * @returns Promise resolving to array of suggestions\n */\n abstract getSuggestions(query: string): Promise<string[]>;\n\n /**\n * Get trending searches\n * @param region - Optional region code\n * @returns Promise resolving to trending search queries\n */\n abstract getTrendingSearches(region?: string): Promise<string[]>;\n\n /**\n * Get detailed information about a specific URL\n * @param url - URL to analyze\n * @returns Promise resolving to page information\n */\n abstract getPageInfo(url: string): Promise<{\n title: string;\n description: string;\n content: string;\n metadata: Record<string, string>;\n images: string[];\n links: string[];\n }>;\n}\n"
16
+ ],
17
+ "mappings": "AAAA,kBAAS,iBAAS,sBA8DX,MAAe,UAAwB,CAAQ,OAC3B,aAAc,EAAY,QAEnC,sBAAwB,kDA+E1C,CChJA,kBAAS,iBAAS,sBA4EX,MAAe,UAAsB,CAAQ,OACzB,aAAc,EAAY,MAEnC,sBAAwB,uDAkF1C,CCjKA,kBAAS,sBA2DF,MAAe,UAAmB,CAAQ,OACtB,aAAc,KAEvB,sBAAwB,sDA4D1C,CC1HA,kBAAS,iBAAS,sBAoHX,MAAe,UAAwB,CAAQ,OAC3B,aAAc,EAAY,QAEnC,sBAAwB,yDAgH1C,CCvOA,kBAAS,iBAAS,sBAmCX,MAAe,UAAoB,CAAQ,OACvB,aAAc,EAAY,IAEnC,sBAAwB,yDAsC1C,CC5EA,kBAAS,iBAAS,sBAwJX,MAAe,UAAqB,CAAQ,OACxB,aAAc,EAAY,KAEnC,sBACd,0DAiHJ,CC7QA,kBAAS,iBAAS,sBAiDX,MAAe,UAA0B,CAAQ,OAC7B,aAAc,EAAY,WACnC,sBACd,oDA2CJ,CC/FA,kBAAS,iBAAS,sBA6DX,MAAe,UAA8B,CAAQ,OACjC,aAAc,EAAY,cAEnC,sBAAwB,wDAoE1C,CCpIA,kBAAS,iBAAS,sBAoDX,MAAe,UAAsB,CAAQ,OACzB,aAAc,EAAY,MAEnC,sBAAwB,yDAoD1C,CC3GA,kBAAS,iBAAS,sBAyBX,MAAe,UAAuB,CAAQ,OAC1B,aAAc,EAAY,OAEnC,sBACd,iEA0BJ,CCvDA,kBAAS,iBAAS,sBAiFX,MAAe,UAA0B,CAAQ,OAC7B,aAAc,EAAY,WAEnC,sBAAwB,+CA6D1C",
18
+ "debugId": "7B2F7142E1B53DB764756E2164756E21",
19
+ "names": []
20
+ }
@@ -0,0 +1,2 @@
1
+ // Type definitions for @elizaos/service-interfaces (Browser)
2
+ export * from '../index.browser';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Browser entry point for @elizaos/service-interfaces
3
+ *
4
+ * This package provides standardized service interface definitions for ElizaOS plugins.
5
+ * Service interfaces define contracts for plugin services without implementation details.
6
+ *
7
+ * Browser-optimized build with minimal dependencies.
8
+ */
9
+ export * from './index';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Main entry point for @elizaos/service-interfaces
3
+ *
4
+ * This package provides standardized service interface definitions for ElizaOS plugins.
5
+ * Service interfaces define contracts for plugin services without implementation details.
6
+ *
7
+ * Base service classes (Service, ServiceType, etc.) are imported from @elizaos/core.
8
+ */
9
+ export * from './interfaces';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ // Main entry point fallback for @elizaos/service-interfaces
2
+ export * from './node/index.node.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Node.js entry point for @elizaos/service-interfaces
3
+ *
4
+ * This package provides standardized service interface definitions for ElizaOS plugins.
5
+ * Service interfaces define contracts for plugin services without implementation details.
6
+ */
7
+ export * from './index';
@@ -0,0 +1,126 @@
1
+ import { Service } from '@elizaos/core';
2
+ export interface BrowserNavigationOptions {
3
+ timeout?: number;
4
+ waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
5
+ viewport?: {
6
+ width: number;
7
+ height: number;
8
+ };
9
+ userAgent?: string;
10
+ headers?: Record<string, string>;
11
+ }
12
+ export interface ScreenshotOptions {
13
+ fullPage?: boolean;
14
+ clip?: {
15
+ x: number;
16
+ y: number;
17
+ width: number;
18
+ height: number;
19
+ };
20
+ format?: 'png' | 'jpeg' | 'webp';
21
+ quality?: number;
22
+ omitBackground?: boolean;
23
+ }
24
+ export interface ElementSelector {
25
+ selector: string;
26
+ text?: string;
27
+ timeout?: number;
28
+ }
29
+ export interface ExtractedContent {
30
+ text: string;
31
+ html: string;
32
+ links: Array<{
33
+ url: string;
34
+ text: string;
35
+ }>;
36
+ images: Array<{
37
+ src: string;
38
+ alt?: string;
39
+ }>;
40
+ title?: string;
41
+ metadata?: Record<string, string>;
42
+ }
43
+ export interface ClickOptions {
44
+ timeout?: number;
45
+ force?: boolean;
46
+ waitForNavigation?: boolean;
47
+ }
48
+ export interface TypeOptions {
49
+ delay?: number;
50
+ timeout?: number;
51
+ clear?: boolean;
52
+ }
53
+ /**
54
+ * Interface for browser automation services
55
+ */
56
+ export declare abstract class IBrowserService extends Service {
57
+ static readonly serviceType: "browser";
58
+ readonly capabilityDescription = "Web browser automation and scraping capabilities";
59
+ /**
60
+ * Navigate to a URL
61
+ * @param url - URL to navigate to
62
+ * @param options - Navigation options
63
+ * @returns Promise resolving when navigation completes
64
+ */
65
+ abstract navigate(url: string, options?: BrowserNavigationOptions): Promise<void>;
66
+ /**
67
+ * Take a screenshot of the current page
68
+ * @param options - Screenshot options
69
+ * @returns Promise resolving to screenshot buffer
70
+ */
71
+ abstract screenshot(options?: ScreenshotOptions): Promise<Buffer>;
72
+ /**
73
+ * Extract text and content from the current page
74
+ * @param selector - Optional CSS selector to extract from specific element
75
+ * @returns Promise resolving to extracted content
76
+ */
77
+ abstract extractContent(selector?: string): Promise<ExtractedContent>;
78
+ /**
79
+ * Click on an element
80
+ * @param selector - CSS selector or element selector
81
+ * @param options - Click options
82
+ * @returns Promise resolving when click completes
83
+ */
84
+ abstract click(selector: string | ElementSelector, options?: ClickOptions): Promise<void>;
85
+ /**
86
+ * Type text into an input field
87
+ * @param selector - CSS selector for input field
88
+ * @param text - Text to type
89
+ * @param options - Typing options
90
+ * @returns Promise resolving when typing completes
91
+ */
92
+ abstract type(selector: string, text: string, options?: TypeOptions): Promise<void>;
93
+ /**
94
+ * Wait for an element to appear
95
+ * @param selector - CSS selector or element selector
96
+ * @returns Promise resolving when element is found
97
+ */
98
+ abstract waitForElement(selector: string | ElementSelector): Promise<void>;
99
+ /**
100
+ * Evaluate JavaScript in the browser context
101
+ * @param script - JavaScript code to evaluate
102
+ * @param args - Arguments to pass to the script
103
+ * @returns Promise resolving to evaluation result
104
+ */
105
+ abstract evaluate<T = any>(script: string, ...args: any[]): Promise<T>;
106
+ /**
107
+ * Get the current page URL
108
+ * @returns Promise resolving to current URL
109
+ */
110
+ abstract getCurrentUrl(): Promise<string>;
111
+ /**
112
+ * Go back in browser history
113
+ * @returns Promise resolving when navigation completes
114
+ */
115
+ abstract goBack(): Promise<void>;
116
+ /**
117
+ * Go forward in browser history
118
+ * @returns Promise resolving when navigation completes
119
+ */
120
+ abstract goForward(): Promise<void>;
121
+ /**
122
+ * Refresh the current page
123
+ * @returns Promise resolving when refresh completes
124
+ */
125
+ abstract refresh(): Promise<void>;
126
+ }
@@ -0,0 +1,142 @@
1
+ import { Service } from '@elizaos/core';
2
+ export interface EmailAddress {
3
+ email: string;
4
+ name?: string;
5
+ }
6
+ export interface EmailAttachment {
7
+ filename: string;
8
+ content: Buffer | string;
9
+ contentType?: string;
10
+ contentDisposition?: 'attachment' | 'inline';
11
+ cid?: string;
12
+ }
13
+ export interface EmailMessage {
14
+ from: EmailAddress;
15
+ to: EmailAddress[];
16
+ cc?: EmailAddress[];
17
+ bcc?: EmailAddress[];
18
+ subject: string;
19
+ text?: string;
20
+ html?: string;
21
+ attachments?: EmailAttachment[];
22
+ replyTo?: EmailAddress;
23
+ date?: Date;
24
+ messageId?: string;
25
+ references?: string[];
26
+ inReplyTo?: string;
27
+ priority?: 'high' | 'normal' | 'low';
28
+ }
29
+ export interface EmailSendOptions {
30
+ retry?: number;
31
+ timeout?: number;
32
+ trackOpens?: boolean;
33
+ trackClicks?: boolean;
34
+ tags?: string[];
35
+ }
36
+ export interface EmailSearchOptions {
37
+ query?: string;
38
+ from?: string;
39
+ to?: string;
40
+ subject?: string;
41
+ folder?: string;
42
+ since?: Date;
43
+ before?: Date;
44
+ limit?: number;
45
+ offset?: number;
46
+ unread?: boolean;
47
+ flagged?: boolean;
48
+ hasAttachments?: boolean;
49
+ }
50
+ export interface EmailFolder {
51
+ name: string;
52
+ path: string;
53
+ type: 'inbox' | 'sent' | 'drafts' | 'trash' | 'spam' | 'custom';
54
+ messageCount?: number;
55
+ unreadCount?: number;
56
+ children?: EmailFolder[];
57
+ }
58
+ export interface EmailAccount {
59
+ email: string;
60
+ name?: string;
61
+ provider?: string;
62
+ folders?: EmailFolder[];
63
+ quotaUsed?: number;
64
+ quotaLimit?: number;
65
+ }
66
+ /**
67
+ * Interface for email services
68
+ */
69
+ export declare abstract class IEmailService extends Service {
70
+ static readonly serviceType: "email";
71
+ readonly capabilityDescription = "Email sending, receiving, and management capabilities";
72
+ /**
73
+ * Send an email
74
+ * @param message - Email message to send
75
+ * @param options - Send options
76
+ * @returns Promise resolving to message ID
77
+ */
78
+ abstract sendEmail(message: EmailMessage, options?: EmailSendOptions): Promise<string>;
79
+ /**
80
+ * Get emails from a folder
81
+ * @param options - Search options
82
+ * @returns Promise resolving to array of emails
83
+ */
84
+ abstract getEmails(options?: EmailSearchOptions): Promise<EmailMessage[]>;
85
+ /**
86
+ * Get a specific email by ID
87
+ * @param messageId - Message ID
88
+ * @returns Promise resolving to email message
89
+ */
90
+ abstract getEmail(messageId: string): Promise<EmailMessage>;
91
+ /**
92
+ * Delete an email
93
+ * @param messageId - Message ID
94
+ * @returns Promise resolving when deletion completes
95
+ */
96
+ abstract deleteEmail(messageId: string): Promise<void>;
97
+ /**
98
+ * Mark an email as read/unread
99
+ * @param messageId - Message ID
100
+ * @param read - True to mark as read, false for unread
101
+ * @returns Promise resolving when operation completes
102
+ */
103
+ abstract markEmailAsRead(messageId: string, read: boolean): Promise<void>;
104
+ /**
105
+ * Flag/unflag an email
106
+ * @param messageId - Message ID
107
+ * @param flagged - True to flag, false to unflag
108
+ * @returns Promise resolving when operation completes
109
+ */
110
+ abstract flagEmail(messageId: string, flagged: boolean): Promise<void>;
111
+ /**
112
+ * Move email to a different folder
113
+ * @param messageId - Message ID
114
+ * @param folderPath - Destination folder path
115
+ * @returns Promise resolving when move completes
116
+ */
117
+ abstract moveEmail(messageId: string, folderPath: string): Promise<void>;
118
+ /**
119
+ * Get available folders
120
+ * @returns Promise resolving to array of folders
121
+ */
122
+ abstract getFolders(): Promise<EmailFolder[]>;
123
+ /**
124
+ * Create a new folder
125
+ * @param folderName - Name of the folder
126
+ * @param parentPath - Optional parent folder path
127
+ * @returns Promise resolving when folder is created
128
+ */
129
+ abstract createFolder(folderName: string, parentPath?: string): Promise<void>;
130
+ /**
131
+ * Get account information
132
+ * @returns Promise resolving to account details
133
+ */
134
+ abstract getAccountInfo(): Promise<EmailAccount>;
135
+ /**
136
+ * Search emails
137
+ * @param query - Search query
138
+ * @param options - Search options
139
+ * @returns Promise resolving to search results
140
+ */
141
+ abstract searchEmails(query: string, options?: EmailSearchOptions): Promise<EmailMessage[]>;
142
+ }
@@ -0,0 +1,11 @@
1
+ export * from './browser';
2
+ export * from './email';
3
+ export * from './lp';
4
+ export * from './message';
5
+ export * from './pdf';
6
+ export * from './post';
7
+ export * from './token';
8
+ export * from './transcription';
9
+ export * from './video';
10
+ export * from './wallet';
11
+ export * from './web-search';
@@ -0,0 +1,113 @@
1
+ import { Service, type Metadata } from '@elizaos/core';
2
+ import type { TokenBalance } from './token';
3
+ /**
4
+ * A standardized representation of a liquidity pool from any DEX.
5
+ */
6
+ export type PoolInfo = {
7
+ id: string;
8
+ displayName?: string;
9
+ dex: string;
10
+ tokenA: {
11
+ mint: string;
12
+ symbol?: string;
13
+ reserve?: string;
14
+ decimals?: number;
15
+ };
16
+ tokenB: {
17
+ mint: string;
18
+ symbol?: string;
19
+ reserve?: string;
20
+ decimals?: number;
21
+ };
22
+ lpTokenMint?: string;
23
+ apr?: number;
24
+ apy?: number;
25
+ tvl?: number;
26
+ fee?: number;
27
+ metadata?: Metadata;
28
+ };
29
+ /**
30
+ * A standardized representation of a user's position in a liquidity pool.
31
+ */
32
+ export type LpPositionDetails = {
33
+ poolId: string;
34
+ dex: string;
35
+ lpTokenBalance: TokenBalance;
36
+ underlyingTokens: TokenBalance[];
37
+ valueUsd?: number;
38
+ accruedFees?: TokenBalance[];
39
+ rewards?: TokenBalance[];
40
+ metadata?: Metadata;
41
+ };
42
+ /**
43
+ * A standardized result for blockchain transactions.
44
+ */
45
+ export type TransactionResult = {
46
+ success: boolean;
47
+ transactionId?: string;
48
+ error?: string;
49
+ data?: any;
50
+ };
51
+ /**
52
+ * Abstract interface for a Liquidity Pool Service.
53
+ * DEX-specific plugins (e.g., for Orca, Raydium) must implement this service
54
+ * to allow the LP Manager to interact with them in a standardized way.
55
+ */
56
+ export declare abstract class ILpService extends Service {
57
+ static readonly serviceType = "lp";
58
+ readonly capabilityDescription = "Provides standardized access to DEX liquidity pools.";
59
+ /**
60
+ * Returns the name of the DEX this service interacts with.
61
+ * @returns The name of the DEX (e.g., "Orca", "Raydium").
62
+ */
63
+ abstract getDexName(): string;
64
+ /**
65
+ * Fetches a list of available liquidity pools from the DEX.
66
+ * @param tokenAMint - Optional: Filter pools by the mint address of the first token.
67
+ * @param tokenBMint - Optional: Filter pools by the mint address of the second token.
68
+ * @returns A promise that resolves to an array of standardized PoolInfo objects.
69
+ */
70
+ abstract getPools(tokenAMint?: string, tokenBMint?: string): Promise<PoolInfo[]>;
71
+ /**
72
+ * Adds liquidity to a specified pool.
73
+ * @param params - The parameters for adding liquidity.
74
+ * @returns A promise resolving to a transaction result, including the LP tokens received.
75
+ */
76
+ abstract addLiquidity(params: {
77
+ userVault: any;
78
+ poolId: string;
79
+ tokenAAmountLamports: string;
80
+ tokenBAmountLamports?: string;
81
+ slippageBps: number;
82
+ tickLowerIndex?: number;
83
+ tickUpperIndex?: number;
84
+ }): Promise<TransactionResult & {
85
+ lpTokensReceived?: TokenBalance;
86
+ }>;
87
+ /**
88
+ * Removes liquidity from a specified pool.
89
+ * @param params - The parameters for removing liquidity.
90
+ * @returns A promise resolving to a transaction result, including the tokens received.
91
+ */
92
+ abstract removeLiquidity(params: {
93
+ userVault: any;
94
+ poolId: string;
95
+ lpTokenAmountLamports: string;
96
+ slippageBps: number;
97
+ }): Promise<TransactionResult & {
98
+ tokensReceived?: TokenBalance[];
99
+ }>;
100
+ /**
101
+ * Fetches the details of a specific LP position for a user.
102
+ * @param userAccountPublicKey - The user's wallet public key.
103
+ * @param poolOrPositionIdentifier - The identifier for the pool or a specific position (e.g., position NFT mint).
104
+ * @returns A promise resolving to the position details or null if not found.
105
+ */
106
+ abstract getLpPositionDetails(userAccountPublicKey: string, poolOrPositionIdentifier: string): Promise<LpPositionDetails | null>;
107
+ /**
108
+ * Fetches the latest market data (e.g., APY, TVL) for a list of pools.
109
+ * @param poolIds - An array of pool IDs to fetch data for.
110
+ * @returns A promise resolving to a map of pool IDs to their partial market data.
111
+ */
112
+ abstract getMarketDataForPools(poolIds: string[]): Promise<Record<string, Partial<PoolInfo>>>;
113
+ }