@elizaos/core 2.0.0-alpha.337 → 2.0.0-alpha.338

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.
@@ -446,7 +446,7 @@
446
446
  "import type { Metadata } from \"./primitives\";\nimport type { JsonValue } from \"./proto.js\";\nimport type { IAgentRuntime } from \"./runtime\";\n\n/**\n * Core service type registry that can be extended by plugins via module augmentation.\n * Plugins can extend this interface to add their own service types:\n *\n * @example\n * ```typescript\n * declare module '@elizaos/core' {\n * interface ServiceTypeRegistry {\n * MY_CUSTOM_SERVICE: 'my_custom_service';\n * }\n * }\n * ```\n */\nexport interface ServiceTypeRegistry {\n\tTRANSCRIPTION: \"transcription\";\n\tVIDEO: \"video\";\n\tBROWSER: \"browser\";\n\tPDF: \"pdf\";\n\tREMOTE_FILES: \"aws_s3\";\n\tWEB_SEARCH: \"web_search\";\n\tEMAIL: \"email\";\n\tTEE: \"tee\";\n\tTASK: \"task\";\n\tAPPROVAL: \"approval\";\n\tTOOL_POLICY: \"tool_policy\";\n\tWALLET: \"wallet\";\n\tLP_POOL: \"lp_pool\";\n\tTOKEN_DATA: \"token_data\";\n\tMESSAGE_SERVICE: \"message_service\";\n\tMESSAGE: \"message\";\n\tPOST: \"post\";\n\tHOOKS: \"hooks\";\n\tPAIRING: \"pairing\";\n\tAGENT_EVENT: \"agent_event\";\n\tOPTIMIZED_PROMPT: \"optimized_prompt\";\n\tUNKNOWN: \"unknown\";\n}\n\n/**\n * Type for service names that includes both core services and any plugin-registered services\n */\nexport type ServiceTypeName = ServiceTypeRegistry[keyof ServiceTypeRegistry];\n\n/**\n * Helper type to extract service type values from the registry\n */\nexport type ServiceTypeValue<K extends keyof ServiceTypeRegistry> =\n\tServiceTypeRegistry[K];\n\n/**\n * Helper type to check if a service type exists in the registry\n */\nexport type IsValidServiceType<T extends string> = T extends ServiceTypeName\n\t? true\n\t: false;\n\n/**\n * Type-safe service class definition\n */\nexport type TypedServiceClass<T extends ServiceTypeName> = {\n\tnew (runtime?: IAgentRuntime): Service;\n\tserviceType: T;\n\tstart(runtime: IAgentRuntime): Promise<Service>;\n};\n\n/**\n * Map of service type names to their implementation classes.\n * Plugins can extend this via module augmentation:\n * @example\n * ```typescript\n * declare module '@elizaos/core' {\n * interface ServiceClassMap {\n * MY_SERVICE: typeof MyService;\n * }\n * }\n * ```\n */\n// biome-ignore lint/complexity/noBannedTypes: Empty interface for module augmentation\nexport type ServiceClassMap = {};\n\n/**\n * Helper to infer service instance type from service type name\n */\nexport type ServiceInstance<T extends ServiceTypeName> =\n\tT extends keyof ServiceClassMap ? InstanceType<ServiceClassMap[T]> : Service;\n\n/**\n * Runtime service registry type\n */\nexport type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<\n\tT,\n\tService\n>;\n\n/**\n * Enumerates the recognized types of services that can be registered and used by the agent runtime.\n * Services provide specialized functionalities like audio transcription, video processing,\n * web browsing, PDF handling, file storage (e.g., AWS S3), web search, email integration,\n * secure execution via TEE (Trusted Execution Environment), and task management.\n * This constant is used in `AgentRuntime` for service registration and retrieval (e.g., `getService`).\n * Each service typically implements the `Service` abstract class or a more specific interface like `IVideoService`.\n */\nexport const ServiceType = {\n\tTRANSCRIPTION: \"transcription\",\n\tVIDEO: \"video\",\n\tBROWSER: \"browser\",\n\tPDF: \"pdf\",\n\tREMOTE_FILES: \"aws_s3\",\n\tWEB_SEARCH: \"web_search\",\n\tEMAIL: \"email\",\n\tTEE: \"tee\",\n\tTASK: \"task\",\n\tAPPROVAL: \"approval\",\n\tTOOL_POLICY: \"tool_policy\",\n\tWALLET: \"wallet\",\n\tLP_POOL: \"lp_pool\",\n\tTOKEN_DATA: \"token_data\",\n\tMESSAGE_SERVICE: \"message_service\",\n\tMESSAGE: \"message\",\n\tPOST: \"post\",\n\tHOOKS: \"hooks\",\n\tPAIRING: \"pairing\",\n\tAGENT_EVENT: \"agent_event\",\n\tVOICE_CACHE: \"voice_cache\",\n\tOPTIMIZED_PROMPT: \"optimized_prompt\",\n\tUNKNOWN: \"unknown\",\n} as const;\n\n/**\n * Client instance\n */\nexport abstract class Service {\n\t/** Runtime instance */\n\tprotected runtime!: IAgentRuntime;\n\n\tconstructor(runtime?: IAgentRuntime) {\n\t\tif (runtime) {\n\t\t\tthis.runtime = runtime;\n\t\t}\n\t}\n\n\tabstract stop(): Promise<void>;\n\n\t/** Service type */\n\tstatic serviceType: string;\n\n\t/** Service name */\n\tabstract capabilityDescription: string;\n\n\t/** Service configuration */\n\tconfig?: Metadata;\n\n\t/** Start service connection - subclasses must override this */\n\tstatic async start(_runtime: IAgentRuntime): Promise<Service> {\n\t\tthrow new Error(\"Service.start() must be implemented by subclass\");\n\t}\n\n\t/** Stop service connection - optional, subclasses may override this */\n\tstatic stopRuntime?(_runtime: IAgentRuntime): Promise<void>;\n\n\t/** Optional static method to register send handlers */\n\tstatic registerSendHandlers?(runtime: IAgentRuntime, service: Service): void;\n}\n\n/**\n * Generic service interface that provides better type checking for services\n * @template ConfigType The configuration type for this service\n * @template InputType The input type for processing\n * @template ResultType The result type returned by the service operations\n */\nexport interface TypedService<\n\tConfigType extends Metadata = Metadata,\n\tInputType = JsonValue,\n\tResultType = JsonValue,\n> extends Service {\n\t/**\n\t * The configuration for this service instance\n\t */\n\tconfig?: ConfigType;\n\n\t/**\n\t * Process an input with this service\n\t * @param input The input to process\n\t * @returns A promise resolving to the result\n\t */\n\tprocess(input: InputType): Promise<ResultType>;\n}\n\n/**\n * Generic factory function to create a typed service instance.\n * getService() is synchronous — no await needed.\n * @param runtime The agent runtime\n * @param serviceType The type of service to get\n * @returns The service instance or null if not available\n */\nexport function getTypedService<\n\tConfigType extends Metadata = Metadata,\n\tInputType = JsonValue,\n\tResultType = JsonValue,\n>(\n\truntime: IAgentRuntime,\n\tserviceType: ServiceTypeName,\n): TypedService<ConfigType, InputType, ResultType> | null {\n\treturn runtime.getService<TypedService<ConfigType, InputType, ResultType>>(\n\t\tserviceType,\n\t);\n}\n\n/**\n * Standardized service error type for consistent error handling\n */\nexport interface ServiceError {\n\tcode: string;\n\tmessage: string;\n\tdetails?: Record<string, JsonValue> | string | number | boolean | null;\n\tcause?: Error;\n}\n\n/**\n * Safely create a ServiceError from any caught error\n */\nexport function createServiceError(\n\terror: Error | string | JsonValue,\n\tcode = \"UNKNOWN_ERROR\",\n): ServiceError {\n\tif (error instanceof Error) {\n\t\treturn {\n\t\t\tcode,\n\t\t\tmessage: error.message,\n\t\t\tcause: error,\n\t\t};\n\t}\n\n\treturn {\n\t\tcode,\n\t\tmessage: String(error),\n\t};\n}\n",
447
447
  "/**\n * Service Interface Definitions for elizaOS\n *\n * This module provides standardized service interface definitions that plugins implement.\n * Data types are proto-generated; runtime classes remain TypeScript.\n */\n\nimport type { Content, UUID } from \"./primitives\";\nimport type {\n\tJsonValue,\n\tLpPositionDetails,\n\tPoolInfo,\n\tTokenBalance,\n\tTokenData,\n\tTransactionResult,\n\tWalletAsset,\n\tWalletPortfolio,\n} from \"./proto.js\";\nimport { Service, ServiceType } from \"./service\";\n\nexport type {\n\tLpPositionDetails,\n\tPoolInfo,\n\tTokenBalance,\n\tTokenData,\n\tTransactionResult,\n\tWalletAsset,\n\tWalletPortfolio,\n};\n\n// ============================================================================\n// Message Bus Service Interface\n// ============================================================================\n\nexport interface IMessageBusService extends Service {\n\tnotifyActionStart(\n\t\troomId: UUID,\n\t\tworldId: UUID,\n\t\tcontent: Content,\n\t\tmessageId?: UUID,\n\t): Promise<void>;\n\n\tnotifyActionUpdate(\n\t\troomId: UUID,\n\t\tworldId: UUID,\n\t\tcontent: Content,\n\t\tmessageId?: UUID,\n\t): Promise<void>;\n}\n\n// ============================================================================\n// Token & Wallet Interfaces\n// ============================================================================\n\nexport abstract class ITokenDataService extends Service {\n\tstatic override readonly serviceType = ServiceType.TOKEN_DATA;\n\tpublic readonly capabilityDescription =\n\t\t\"Provides standardized access to token market data.\" as string;\n\n\tabstract getTokenDetails(\n\t\taddress: string,\n\t\tchain: string,\n\t): Promise<TokenData | null>;\n\n\tabstract getTrendingTokens(\n\t\tchain?: string,\n\t\tlimit?: number,\n\t\ttimePeriod?: string,\n\t): Promise<TokenData[]>;\n\n\tabstract searchTokens(\n\t\tquery: string,\n\t\tchain?: string,\n\t\tlimit?: number,\n\t): Promise<TokenData[]>;\n\n\tabstract getTokensByAddresses(\n\t\taddresses: string[],\n\t\tchain: string,\n\t): Promise<TokenData[]>;\n}\n\nexport abstract class IWalletService extends Service {\n\tstatic override readonly serviceType = ServiceType.WALLET;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Provides standardized access to wallet balances and portfolios.\";\n\n\tabstract getPortfolio(owner?: string): Promise<WalletPortfolio>;\n\n\tabstract getBalance(assetAddress: string, owner?: string): Promise<number>;\n\n\tabstract transferSol(\n\t\tfrom: object,\n\t\tto: object,\n\t\tlamports: number,\n\t): Promise<string>;\n}\n\n// ============================================================================\n// Liquidity Pool Interfaces\n// ============================================================================\n\nexport abstract class ILpService extends Service {\n\tstatic override readonly serviceType = \"lp_pool\";\n\n\tpublic readonly capabilityDescription =\n\t\t\"Provides standardized access to DEX liquidity pools.\";\n\n\tabstract getDexName(): string;\n\n\tabstract getPools(\n\t\ttokenAMint?: string,\n\t\ttokenBMint?: string,\n\t): Promise<PoolInfo[]>;\n\n\tabstract addLiquidity(params: {\n\t\tuserVault: object;\n\t\tpoolId: string;\n\t\ttokenAAmountLamports: string;\n\t\ttokenBAmountLamports?: string;\n\t\tslippageBps: number;\n\t\ttickLowerIndex?: number;\n\t\ttickUpperIndex?: number;\n\t}): Promise<TransactionResult & { lpTokensReceived?: TokenBalance }>;\n\n\tabstract removeLiquidity(params: {\n\t\tuserVault: object;\n\t\tpoolId: string;\n\t\tlpTokenAmountLamports: string;\n\t\tslippageBps: number;\n\t}): Promise<TransactionResult & { tokensReceived?: TokenBalance[] }>;\n\n\tabstract getLpPositionDetails(\n\t\tuserAccountPublicKey: string,\n\t\tpoolOrPositionIdentifier: string,\n\t): Promise<LpPositionDetails | null>;\n\n\tabstract getMarketDataForPools(\n\t\tpoolIds: string[],\n\t): Promise<Record<string, Partial<PoolInfo>>>;\n}\n\n// ============================================================================\n// Transcription & Audio Interfaces\n// ============================================================================\n\nexport abstract class ITranscriptionService extends Service {\n\tstatic override readonly serviceType = ServiceType.TRANSCRIPTION;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Audio transcription and speech processing capabilities\";\n\n\tabstract transcribeAudio(\n\t\taudioPath: string | Buffer,\n\t\toptions?: TranscriptionOptions,\n\t): Promise<TranscriptionResult>;\n\n\tabstract transcribeVideo(\n\t\tvideoPath: string | Buffer,\n\t\toptions?: TranscriptionOptions,\n\t): Promise<TranscriptionResult>;\n\n\tabstract speechToText(\n\t\taudioStream: NodeJS.ReadableStream | Buffer,\n\t\toptions?: SpeechToTextOptions,\n\t): Promise<TranscriptionResult>;\n\n\tabstract textToSpeech(\n\t\ttext: string,\n\t\toptions?: TextToSpeechOptions,\n\t): Promise<Buffer>;\n\n\tabstract getSupportedLanguages(): Promise<string[]>;\n\n\tabstract getAvailableVoices(): Promise<\n\t\tArray<{\n\t\t\tid: string;\n\t\t\tname: string;\n\t\t\tlanguage: string;\n\t\t\tgender?: \"male\" | \"female\" | \"neutral\";\n\t\t}>\n\t>;\n\n\tabstract detectLanguage(audioPath: string | Buffer): Promise<string>;\n}\n\n// ============================================================================\n// Video Interfaces\n// ============================================================================\n\nexport abstract class IVideoService extends Service {\n\tstatic override readonly serviceType = ServiceType.VIDEO;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Video download, processing, and conversion capabilities\";\n\n\tabstract getVideoInfo(url: string): Promise<VideoInfo>;\n\n\tabstract downloadVideo(\n\t\turl: string,\n\t\toptions?: VideoDownloadOptions,\n\t): Promise<string>;\n\n\tabstract extractAudio(\n\t\tvideoPath: string,\n\t\toutputPath?: string,\n\t): Promise<string>;\n\n\tabstract getThumbnail(videoPath: string, timestamp?: number): Promise<string>;\n\n\tabstract convertVideo(\n\t\tvideoPath: string,\n\t\toutputPath: string,\n\t\toptions?: VideoProcessingOptions,\n\t): Promise<string>;\n\n\tabstract getAvailableFormats(url: string): Promise<VideoFormat[]>;\n}\n\n// ============================================================================\n// Browser Interfaces\n// ============================================================================\n\nexport abstract class IBrowserService extends Service {\n\tstatic override readonly serviceType = ServiceType.BROWSER;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Web browser automation and scraping capabilities\";\n\n\tabstract navigate(\n\t\turl: string,\n\t\toptions?: BrowserNavigationOptions,\n\t): Promise<void>;\n\n\tabstract screenshot(options?: ScreenshotOptions): Promise<Buffer>;\n\n\tabstract extractContent(selector?: string): Promise<ExtractedContent>;\n\n\tabstract click(\n\t\tselector: string | ElementSelector,\n\t\toptions?: ClickOptions,\n\t): Promise<void>;\n\n\tabstract type(\n\t\tselector: string,\n\t\ttext: string,\n\t\toptions?: TypeOptions,\n\t): Promise<void>;\n\n\tabstract waitForElement(selector: string | ElementSelector): Promise<void>;\n\n\tabstract evaluate<T = JsonValue>(\n\t\tscript: string,\n\t\t...args: JsonValue[]\n\t): Promise<T>;\n\n\tabstract getCurrentUrl(): Promise<string>;\n\n\tabstract goBack(): Promise<void>;\n\n\tabstract goForward(): Promise<void>;\n\n\tabstract refresh(): Promise<void>;\n}\n\n// ============================================================================\n// PDF Interfaces\n// ============================================================================\n\nexport abstract class IPdfService extends Service {\n\tstatic override readonly serviceType = ServiceType.PDF;\n\n\tpublic readonly capabilityDescription =\n\t\t\"PDF processing, extraction, and generation capabilities\";\n\n\tabstract extractText(pdfPath: string | Buffer): Promise<PdfExtractionResult>;\n\n\tabstract generatePdf(\n\t\thtmlContent: string,\n\t\toptions?: PdfGenerationOptions,\n\t): Promise<Buffer>;\n\n\tabstract convertToPdf(\n\t\tfilePath: string,\n\t\toptions?: PdfConversionOptions,\n\t): Promise<Buffer>;\n\n\tabstract mergePdfs(pdfPaths: (string | Buffer)[]): Promise<Buffer>;\n\n\tabstract splitPdf(pdfPath: string | Buffer): Promise<Buffer[]>;\n}\n\n// ============================================================================\n// Web Search Interfaces\n// ============================================================================\n\nexport abstract class IWebSearchService extends Service {\n\tstatic override readonly serviceType = ServiceType.WEB_SEARCH;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Web search and content discovery capabilities\";\n\n\tabstract search(\n\t\tquery: string,\n\t\toptions?: SearchOptions,\n\t): Promise<SearchResponse>;\n\n\tabstract searchNews(\n\t\tquery: string,\n\t\toptions?: NewsSearchOptions,\n\t): Promise<SearchResponse>;\n\n\tabstract searchImages(\n\t\tquery: string,\n\t\toptions?: ImageSearchOptions,\n\t): Promise<SearchResponse>;\n\n\tabstract searchVideos(\n\t\tquery: string,\n\t\toptions?: VideoSearchOptions,\n\t): Promise<SearchResponse>;\n\n\tabstract getSuggestions(query: string): Promise<string[]>;\n\n\tabstract getTrendingSearches(region?: string): Promise<string[]>;\n\n\tabstract getPageInfo(url: string): Promise<{\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tcontent: string;\n\t\tmetadata: Record<string, string>;\n\t\timages: string[];\n\t\tlinks: string[];\n\t}>;\n}\n\n// ============================================================================\n// Email Interfaces\n// ============================================================================\n\nexport abstract class IEmailService extends Service {\n\tstatic override readonly serviceType = ServiceType.EMAIL;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Email sending, receiving, and management capabilities\";\n\n\tabstract sendEmail(\n\t\tmessage: EmailMessage,\n\t\toptions?: EmailSendOptions,\n\t): Promise<string>;\n\n\tabstract getEmails(options?: EmailSearchOptions): Promise<EmailMessage[]>;\n\n\tabstract getEmail(messageId: string): Promise<EmailMessage>;\n\n\tabstract deleteEmail(messageId: string): Promise<void>;\n\n\tabstract markEmailAsRead(messageId: string, read: boolean): Promise<void>;\n\n\tabstract flagEmail(messageId: string, flagged: boolean): Promise<void>;\n\n\tabstract moveEmail(messageId: string, folderPath: string): Promise<void>;\n\n\tabstract getFolders(): Promise<EmailFolder[]>;\n\n\tabstract createFolder(folderName: string, parentPath?: string): Promise<void>;\n\n\tabstract getAccountInfo(): Promise<EmailAccount>;\n\n\tabstract searchEmails(\n\t\tquery: string,\n\t\toptions?: EmailSearchOptions,\n\t): Promise<EmailMessage[]>;\n}\n\n// ============================================================================\n// Message Interfaces\n// ============================================================================\n\nexport abstract class IMessagingService extends Service {\n\tstatic override readonly serviceType = ServiceType.MESSAGE;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Platform messaging and channel management capabilities\";\n\n\tabstract sendMessage(\n\t\tchannelId: UUID,\n\t\tcontent: MessageContent,\n\t\toptions?: MessageSendOptions,\n\t): Promise<UUID>;\n\n\tabstract getMessages(\n\t\tchannelId: UUID,\n\t\toptions?: MessageSearchOptions,\n\t): Promise<MessageInfo[]>;\n\n\tabstract getMessage(messageId: UUID): Promise<MessageInfo>;\n\n\tabstract editMessage(messageId: UUID, content: MessageContent): Promise<void>;\n\n\tabstract deleteMessage(messageId: UUID): Promise<void>;\n\n\tabstract addReaction(messageId: UUID, emoji: string): Promise<void>;\n\n\tabstract removeReaction(messageId: UUID, emoji: string): Promise<void>;\n\n\tabstract pinMessage(messageId: UUID): Promise<void>;\n\n\tabstract unpinMessage(messageId: UUID): Promise<void>;\n\n\tabstract getChannels(): Promise<MessageChannel[]>;\n\n\tabstract getChannel(channelId: UUID): Promise<MessageChannel>;\n\n\tabstract createChannel(\n\t\tname: string,\n\t\ttype: MessageChannel[\"type\"],\n\t\toptions?: {\n\t\t\tdescription?: string;\n\t\t\tparticipants?: UUID[];\n\t\t\tprivate?: boolean;\n\t\t},\n\t): Promise<UUID>;\n\n\tabstract searchMessages(\n\t\tquery: string,\n\t\toptions?: MessageSearchOptions,\n\t): Promise<MessageInfo[]>;\n}\n\n// ============================================================================\n// Post/Social Media Interfaces\n// ============================================================================\n\nexport abstract class IPostService extends Service {\n\tstatic override readonly serviceType = ServiceType.POST;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Social media posting and content management capabilities\";\n\n\tabstract createPost(\n\t\tcontent: PostContent,\n\t\toptions?: PostCreateOptions,\n\t): Promise<UUID>;\n\n\tabstract getPosts(options?: PostSearchOptions): Promise<PostInfo[]>;\n\n\tabstract getPost(postId: UUID): Promise<PostInfo>;\n\n\tabstract editPost(postId: UUID, content: PostContent): Promise<void>;\n\n\tabstract deletePost(postId: UUID): Promise<void>;\n\n\tabstract likePost(postId: UUID, like: boolean): Promise<void>;\n\n\tabstract sharePost(postId: UUID, comment?: string): Promise<UUID>;\n\n\tabstract savePost(postId: UUID, save: boolean): Promise<void>;\n\n\tabstract commentOnPost(postId: UUID, content: PostContent): Promise<UUID>;\n\n\tabstract getComments(\n\t\tpostId: UUID,\n\t\toptions?: PostSearchOptions,\n\t): Promise<PostInfo[]>;\n\n\tabstract schedulePost(\n\t\tcontent: PostContent,\n\t\tscheduledAt: Date,\n\t\toptions?: PostCreateOptions,\n\t): Promise<UUID>;\n\n\tabstract getPostAnalytics(postId: UUID): Promise<PostAnalytics>;\n\n\tabstract getTrendingPosts(options?: PostSearchOptions): Promise<PostInfo[]>;\n\n\tabstract searchPosts(\n\t\tquery: string,\n\t\toptions?: PostSearchOptions,\n\t): Promise<PostInfo[]>;\n}\n\n// ============================================================================\n// Transcription & Audio Interfaces\n// ============================================================================\n\n/**\n * Options for audio transcription.\n */\nexport interface TranscriptionOptions {\n\t/** Language code for transcription */\n\tlanguage?: string;\n\t/** Model to use for transcription */\n\tmodel?: string;\n\t/** Temperature for generation */\n\ttemperature?: number;\n\t/** Prompt to guide transcription */\n\tprompt?: string;\n\t/** Response format */\n\tresponse_format?: \"json\" | \"text\" | \"srt\" | \"vtt\" | \"verbose_json\";\n\t/** Timestamp granularities to include */\n\ttimestamp_granularities?: (\"word\" | \"segment\")[];\n\t/** Include word-level timestamps */\n\tword_timestamps?: boolean;\n\t/** Include segment-level timestamps */\n\tsegment_timestamps?: boolean;\n}\n\n/**\n * Result of audio transcription.\n */\nexport interface TranscriptionResult {\n\t/** Transcribed text */\n\ttext: string;\n\t/** Detected language */\n\tlanguage?: string;\n\t/** Audio duration in seconds */\n\tduration?: number;\n\t/** Transcription segments */\n\tsegments?: TranscriptionSegment[];\n\t/** Word-level transcription */\n\twords?: TranscriptionWord[];\n\t/** Overall confidence score */\n\tconfidence?: number;\n}\n\n/**\n * A segment of transcription.\n */\nexport interface TranscriptionSegment {\n\t/** Segment ID */\n\tid: number;\n\t/** Segment text */\n\ttext: string;\n\t/** Start time in seconds */\n\tstart: number;\n\t/** End time in seconds */\n\tend: number;\n\t/** Confidence score */\n\tconfidence?: number;\n\t/** Token IDs */\n\ttokens?: number[];\n\t/** Temperature used */\n\ttemperature?: number;\n\t/** Average log probability */\n\tavg_logprob?: number;\n\t/** Compression ratio */\n\tcompression_ratio?: number;\n\t/** No speech probability */\n\tno_speech_prob?: number;\n}\n\n/**\n * A word in transcription.\n */\nexport interface TranscriptionWord {\n\t/** The word */\n\tword: string;\n\t/** Start time in seconds */\n\tstart: number;\n\t/** End time in seconds */\n\tend: number;\n\t/** Confidence score */\n\tconfidence?: number;\n}\n\n/**\n * Options for speech-to-text.\n */\nexport interface SpeechToTextOptions {\n\t/** Language code */\n\tlanguage?: string;\n\t/** Model to use */\n\tmodel?: string;\n\t/** Enable continuous recognition */\n\tcontinuous?: boolean;\n\t/** Return interim results */\n\tinterimResults?: boolean;\n\t/** Maximum alternatives to return */\n\tmaxAlternatives?: number;\n}\n\n/**\n * Options for text-to-speech.\n */\nexport interface TextToSpeechOptions {\n\t/** Voice to use */\n\tvoice?: string;\n\t/** Model to use */\n\tmodel?: string;\n\t/** Speech speed */\n\tspeed?: number;\n\t/** Output format */\n\tformat?: \"mp3\" | \"wav\" | \"flac\" | \"aac\";\n\t/** Response format */\n\tresponse_format?: \"mp3\" | \"opus\" | \"aac\" | \"flac\";\n}\n\n// ============================================================================\n// Video Interfaces\n// ============================================================================\n\n/**\n * Video information.\n */\nexport interface VideoInfo {\n\t/** Video title */\n\ttitle?: string;\n\t/** Duration in seconds */\n\tduration?: number;\n\t/** Video URL */\n\turl: string;\n\t/** Thumbnail URL */\n\tthumbnail?: string;\n\t/** Video description */\n\tdescription?: string;\n\t/** Uploader name */\n\tuploader?: string;\n\t/** View count */\n\tviewCount?: number;\n\t/** Upload date */\n\tuploadDate?: Date;\n\t/** Available formats */\n\tformats?: VideoFormat[];\n}\n\n/**\n * Video format information.\n */\nexport interface VideoFormat {\n\t/** Format ID */\n\tformatId: string;\n\t/** Download URL */\n\turl: string;\n\t/** File extension */\n\textension: string;\n\t/** Quality label */\n\tquality: string;\n\t/** File size in bytes */\n\tfileSize?: number;\n\t/** Video codec */\n\tvideoCodec?: string;\n\t/** Audio codec */\n\taudioCodec?: string;\n\t/** Resolution (e.g., \"1920x1080\") */\n\tresolution?: string;\n\t/** Frames per second */\n\tfps?: number;\n\t/** Bitrate */\n\tbitrate?: number;\n}\n\n/**\n * Video download options.\n */\nexport interface VideoDownloadOptions {\n\t/** Preferred format */\n\tformat?: string;\n\t/** Quality preference */\n\tquality?: \"best\" | \"worst\" | \"bestvideo\" | \"bestaudio\" | string;\n\t/** Output file path */\n\toutputPath?: string;\n\t/** Extract audio only */\n\taudioOnly?: boolean;\n\t/** Extract video only (no audio) */\n\tvideoOnly?: boolean;\n\t/** Download subtitles */\n\tsubtitles?: boolean;\n\t/** Embed subtitles in video */\n\tembedSubs?: boolean;\n\t/** Write info JSON file */\n\twriteInfoJson?: boolean;\n}\n\n/**\n * Video processing options.\n */\nexport interface VideoProcessingOptions {\n\t/** Start time in seconds */\n\tstartTime?: number;\n\t/** End time in seconds */\n\tendTime?: number;\n\t/** Output format */\n\toutputFormat?: string;\n\t/** Target resolution */\n\tresolution?: string;\n\t/** Target bitrate */\n\tbitrate?: string;\n\t/** Target framerate */\n\tframerate?: number;\n\t/** Audio codec */\n\taudioCodec?: string;\n\t/** Video codec */\n\tvideoCodec?: string;\n}\n\n// ============================================================================\n// Browser Interfaces\n// ============================================================================\n\n/**\n * Browser navigation options.\n */\nexport interface BrowserNavigationOptions {\n\t/** Timeout in milliseconds */\n\ttimeout?: number;\n\t/** Wait until condition */\n\twaitUntil?: \"load\" | \"domcontentloaded\" | \"networkidle0\" | \"networkidle2\";\n\t/** Viewport size */\n\tviewport?: {\n\t\twidth: number;\n\t\theight: number;\n\t};\n\t/** User agent string */\n\tuserAgent?: string;\n\t/** Additional headers */\n\theaders?: Record<string, string>;\n}\n\n/**\n * Screenshot options.\n */\nexport interface ScreenshotOptions {\n\t/** Capture full page */\n\tfullPage?: boolean;\n\t/** Clip region */\n\tclip?: {\n\t\tx: number;\n\t\ty: number;\n\t\twidth: number;\n\t\theight: number;\n\t};\n\t/** Image format */\n\tformat?: \"png\" | \"jpeg\" | \"webp\";\n\t/** Image quality (0-100) */\n\tquality?: number;\n\t/** Omit background */\n\tomitBackground?: boolean;\n}\n\n/**\n * Element selector options.\n */\nexport interface ElementSelector {\n\t/** CSS selector */\n\tselector: string;\n\t/** Text content to match */\n\ttext?: string;\n\t/** Timeout in milliseconds */\n\ttimeout?: number;\n}\n\n/**\n * Extracted content from a page.\n */\nexport interface ExtractedContent {\n\t/** Text content */\n\ttext: string;\n\t/** HTML content */\n\thtml: string;\n\t/** Links found on page */\n\tlinks: Array<{\n\t\turl: string;\n\t\ttext: string;\n\t}>;\n\t/** Images found on page */\n\timages: Array<{\n\t\tsrc: string;\n\t\talt?: string;\n\t}>;\n\t/** Page title */\n\ttitle?: string;\n\t/** Page metadata */\n\tmetadata?: Record<string, string>;\n}\n\n/**\n * Click options.\n */\nexport interface ClickOptions {\n\t/** Timeout in milliseconds */\n\ttimeout?: number;\n\t/** Force click even if element is obscured */\n\tforce?: boolean;\n\t/** Wait for navigation after click */\n\twaitForNavigation?: boolean;\n}\n\n/**\n * Type/input options.\n */\nexport interface TypeOptions {\n\t/** Delay between keystrokes */\n\tdelay?: number;\n\t/** Timeout in milliseconds */\n\ttimeout?: number;\n\t/** Clear field before typing */\n\tclear?: boolean;\n}\n\n// ============================================================================\n// PDF Interfaces\n// ============================================================================\n\n/**\n * PDF text extraction result.\n */\nexport interface PdfExtractionResult {\n\t/** Extracted text */\n\ttext: string;\n\t/** Total page count */\n\tpageCount: number;\n\t/** PDF metadata */\n\tmetadata?: {\n\t\ttitle?: string;\n\t\tauthor?: string;\n\t\tcreatedAt?: Date;\n\t\tmodifiedAt?: Date;\n\t};\n}\n\n/**\n * PDF generation options.\n */\nexport interface PdfGenerationOptions {\n\t/** Paper format */\n\tformat?: \"A4\" | \"A3\" | \"Letter\";\n\t/** Page orientation */\n\torientation?: \"portrait\" | \"landscape\";\n\t/** Page margins */\n\tmargins?: {\n\t\ttop?: number;\n\t\tbottom?: number;\n\t\tleft?: number;\n\t\tright?: number;\n\t};\n\t/** Header content */\n\theader?: string;\n\t/** Footer content */\n\tfooter?: string;\n}\n\n/**\n * PDF conversion options.\n */\nexport interface PdfConversionOptions {\n\t/** Output quality */\n\tquality?: \"high\" | \"medium\" | \"low\";\n\t/** Output format */\n\toutputFormat?: \"pdf\" | \"pdf/a\";\n\t/** Enable compression */\n\tcompression?: boolean;\n}\n\n// ============================================================================\n// Web Search Interfaces\n// ============================================================================\n\n/**\n * Web search options.\n */\nexport interface SearchOptions {\n\t/** Maximum results to return */\n\tlimit?: number;\n\t/** Offset for pagination */\n\toffset?: number;\n\t/** Language code */\n\tlanguage?: string;\n\t/** Region code */\n\tregion?: string;\n\t/** Date range filter */\n\tdateRange?: {\n\t\tstart?: Date;\n\t\tend?: Date;\n\t};\n\t/** File type filter */\n\tfileType?: string;\n\t/** Limit to specific site */\n\tsite?: string;\n\t/** Sort order */\n\tsortBy?: \"relevance\" | \"date\" | \"popularity\";\n\t/** Safe search level */\n\tsafeSearch?: \"strict\" | \"moderate\" | \"off\";\n}\n\n/**\n * A single search result.\n */\nexport interface SearchResult {\n\t/** Result title */\n\ttitle: string;\n\t/** Result URL */\n\turl: string;\n\t/** Result description/snippet */\n\tdescription: string;\n\t/** Display URL */\n\tdisplayUrl?: string;\n\t/** Thumbnail URL */\n\tthumbnail?: string;\n\t/** Published date */\n\tpublishedDate?: Date;\n\t/** Source name */\n\tsource?: string;\n\t/** Relevance score */\n\trelevanceScore?: number;\n\t/** Text snippet */\n\tsnippet?: string;\n}\n\n/**\n * Search response containing results.\n */\nexport interface SearchResponse {\n\t/** Original query */\n\tquery: string;\n\t/** Search results */\n\tresults: SearchResult[];\n\t/** Total available results */\n\ttotalResults?: number;\n\t/** Search time in seconds */\n\tsearchTime?: number;\n\t/** Query suggestions */\n\tsuggestions?: string[];\n\t/** Token for next page */\n\tnextPageToken?: string;\n\t/** Related search queries */\n\trelatedSearches?: string[];\n}\n\n/**\n * News search options.\n */\nexport interface NewsSearchOptions extends SearchOptions {\n\t/** News category */\n\tcategory?:\n\t\t| \"general\"\n\t\t| \"business\"\n\t\t| \"entertainment\"\n\t\t| \"health\"\n\t\t| \"science\"\n\t\t| \"sports\"\n\t\t| \"technology\";\n\t/** Freshness filter */\n\tfreshness?: \"day\" | \"week\" | \"month\";\n}\n\n/**\n * Image search options.\n */\nexport interface ImageSearchOptions extends SearchOptions {\n\t/** Image size filter */\n\tsize?: \"small\" | \"medium\" | \"large\" | \"wallpaper\" | \"any\";\n\t/** Color filter */\n\tcolor?:\n\t\t| \"color\"\n\t\t| \"monochrome\"\n\t\t| \"red\"\n\t\t| \"orange\"\n\t\t| \"yellow\"\n\t\t| \"green\"\n\t\t| \"blue\"\n\t\t| \"purple\"\n\t\t| \"pink\"\n\t\t| \"brown\"\n\t\t| \"black\"\n\t\t| \"gray\"\n\t\t| \"white\";\n\t/** Image type filter */\n\ttype?: \"photo\" | \"clipart\" | \"line\" | \"animated\";\n\t/** Image layout filter */\n\tlayout?: \"square\" | \"wide\" | \"tall\" | \"any\";\n\t/** License filter */\n\tlicense?: \"any\" | \"public\" | \"share\" | \"sharecommercially\" | \"modify\";\n}\n\n/**\n * Video search options.\n */\nexport interface VideoSearchOptions extends SearchOptions {\n\t/** Duration filter */\n\tduration?: \"short\" | \"medium\" | \"long\" | \"any\";\n\t/** Resolution filter */\n\tresolution?: \"high\" | \"standard\" | \"any\";\n\t/** Quality filter */\n\tquality?: \"high\" | \"standard\" | \"any\";\n}\n\n// ============================================================================\n// Email Interfaces\n// ============================================================================\n\n/**\n * Email address with optional name.\n */\nexport interface EmailAddress {\n\t/** Email address */\n\temail: string;\n\t/** Display name */\n\tname?: string;\n}\n\n/**\n * Email attachment.\n */\nexport interface EmailAttachment {\n\t/** Filename */\n\tfilename: string;\n\t/** Content as buffer or base64 string */\n\tcontent: Buffer | string;\n\t/** MIME type */\n\tcontentType?: string;\n\t/** Content disposition */\n\tcontentDisposition?: \"attachment\" | \"inline\";\n\t/** Content ID for inline attachments */\n\tcid?: string;\n}\n\n/**\n * Email message.\n */\nexport interface EmailMessage {\n\t/** Sender address */\n\tfrom: EmailAddress;\n\t/** Recipients */\n\tto: EmailAddress[];\n\t/** CC recipients */\n\tcc?: EmailAddress[];\n\t/** BCC recipients */\n\tbcc?: EmailAddress[];\n\t/** Email subject */\n\tsubject: string;\n\t/** Plain text body */\n\ttext?: string;\n\t/** HTML body */\n\thtml?: string;\n\t/** Attachments */\n\tattachments?: EmailAttachment[];\n\t/** Reply-to address */\n\treplyTo?: EmailAddress;\n\t/** Send date */\n\tdate?: Date;\n\t/** Message ID */\n\tmessageId?: string;\n\t/** References header */\n\treferences?: string[];\n\t/** In-Reply-To header */\n\tinReplyTo?: string;\n\t/** Priority level */\n\tpriority?: \"high\" | \"normal\" | \"low\";\n}\n\n/**\n * Email send options.\n */\nexport interface EmailSendOptions {\n\t/** Number of retries */\n\tretry?: number;\n\t/** Timeout in milliseconds */\n\ttimeout?: number;\n\t/** Track email opens */\n\ttrackOpens?: boolean;\n\t/** Track link clicks */\n\ttrackClicks?: boolean;\n\t/** Tags for categorization */\n\ttags?: string[];\n}\n\n/**\n * Email search options.\n */\nexport interface EmailSearchOptions {\n\t/** Search query */\n\tquery?: string;\n\t/** Filter by sender */\n\tfrom?: string;\n\t/** Filter by recipient */\n\tto?: string;\n\t/** Filter by subject */\n\tsubject?: string;\n\t/** Filter by folder */\n\tfolder?: string;\n\t/** Filter emails since date */\n\tsince?: Date;\n\t/** Filter emails before date */\n\tbefore?: Date;\n\t/** Maximum results */\n\tlimit?: number;\n\t/** Offset for pagination */\n\toffset?: number;\n\t/** Filter unread only */\n\tunread?: boolean;\n\t/** Filter flagged only */\n\tflagged?: boolean;\n\t/** Filter with attachments only */\n\thasAttachments?: boolean;\n}\n\n/**\n * Email folder.\n */\nexport interface EmailFolder {\n\t/** Folder name */\n\tname: string;\n\t/** Folder path */\n\tpath: string;\n\t/** Folder type */\n\ttype: \"inbox\" | \"sent\" | \"drafts\" | \"trash\" | \"spam\" | \"custom\";\n\t/** Total message count */\n\tmessageCount?: number;\n\t/** Unread message count */\n\tunreadCount?: number;\n\t/** Child folders */\n\tchildren?: EmailFolder[];\n}\n\n/**\n * Email account information.\n */\nexport interface EmailAccount {\n\t/** Email address */\n\temail: string;\n\t/** Display name */\n\tname?: string;\n\t/** Email provider */\n\tprovider?: string;\n\t/** Available folders */\n\tfolders?: EmailFolder[];\n\t/** Storage used in bytes */\n\tquotaUsed?: number;\n\t/** Storage limit in bytes */\n\tquotaLimit?: number;\n}\n\n// ============================================================================\n// Message Interfaces\n// ============================================================================\n\n/**\n * Message participant information.\n */\nexport interface MessageParticipant {\n\t/** Participant ID */\n\tid: UUID;\n\t/** Display name */\n\tname: string;\n\t/** Username */\n\tusername?: string;\n\t/** Avatar URL */\n\tavatar?: string;\n\t/** Online status */\n\tstatus?: \"online\" | \"offline\" | \"away\" | \"busy\";\n}\n\n/**\n * Message attachment.\n */\nexport interface MessageAttachment {\n\t/** Attachment ID */\n\tid: UUID;\n\t/** Filename */\n\tfilename: string;\n\t/** File URL */\n\turl: string;\n\t/** MIME type */\n\tmimeType: string;\n\t/** File size in bytes */\n\tsize: number;\n\t/** Width for images/videos */\n\twidth?: number;\n\t/** Height for images/videos */\n\theight?: number;\n\t/** Duration for audio/video */\n\tduration?: number;\n\t/** Thumbnail URL */\n\tthumbnail?: string;\n}\n\n/**\n * Message reaction.\n */\nexport interface MessageReaction {\n\t/** Emoji used */\n\temoji: string;\n\t/** Number of reactions */\n\tcount: number;\n\t/** User IDs who reacted */\n\tusers: UUID[];\n\t/** Whether current user has reacted */\n\thasReacted: boolean;\n}\n\n/**\n * Message reference (reply/forward/quote).\n */\nexport interface MessageReference {\n\t/** Referenced message ID */\n\tmessageId: UUID;\n\t/** Channel of referenced message */\n\tchannelId: UUID;\n\t/** Type of reference */\n\ttype: \"reply\" | \"forward\" | \"quote\";\n}\n\n/**\n * Message content.\n */\nexport interface MessageContent {\n\t/** Plain text content */\n\ttext?: string;\n\t/** HTML content */\n\thtml?: string;\n\t/** Markdown content */\n\tmarkdown?: string;\n\t/** Attachments */\n\tattachments?: MessageAttachment[];\n\t/** Reactions */\n\treactions?: MessageReaction[];\n\t/** Reference to another message */\n\treference?: MessageReference;\n\t/** Mentioned user IDs */\n\tmentions?: UUID[];\n\t/** Embedded content */\n\tembeds?: Array<{\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\turl?: string;\n\t\timage?: string;\n\t\tfields?: Array<{\n\t\t\tname: string;\n\t\t\tvalue: string;\n\t\t\tinline?: boolean;\n\t\t}>;\n\t}>;\n}\n\n/**\n * Message information.\n */\nexport interface MessageInfo {\n\t/** Message ID */\n\tid: UUID;\n\t/** Channel ID */\n\tchannelId: UUID;\n\t/** Sender ID */\n\tsenderId: UUID;\n\t/** Message content */\n\tcontent: MessageContent;\n\t/** Sent timestamp */\n\ttimestamp: Date;\n\t/** Edit timestamp */\n\tedited?: Date;\n\t/** Deletion timestamp */\n\tdeleted?: Date;\n\t/** Whether message is pinned */\n\tpinned?: boolean;\n\t/** Thread information */\n\tthread?: {\n\t\tid: UUID;\n\t\tmessageCount: number;\n\t\tparticipants: UUID[];\n\t\tlastMessageAt: Date;\n\t};\n}\n\n/**\n * Message send options.\n */\nexport interface MessageSendOptions {\n\t/** Reply to message ID */\n\treplyTo?: UUID;\n\t/** Ephemeral (only visible to sender) */\n\tephemeral?: boolean;\n\t/** Silent (no notification) */\n\tsilent?: boolean;\n\t/** Scheduled send time */\n\tscheduled?: Date;\n\t/** Thread ID */\n\tthread?: UUID;\n\t/** Nonce for deduplication */\n\tnonce?: string;\n}\n\n/**\n * Message search options.\n */\nexport interface MessageSearchOptions {\n\t/** Search query */\n\tquery?: string;\n\t/** Filter by channel */\n\tchannelId?: UUID;\n\t/** Filter by sender */\n\tsenderId?: UUID;\n\t/** Filter messages before date */\n\tbefore?: Date;\n\t/** Filter messages after date */\n\tafter?: Date;\n\t/** Maximum results */\n\tlimit?: number;\n\t/** Offset for pagination */\n\toffset?: number;\n\t/** Filter with attachments only */\n\thasAttachments?: boolean;\n\t/** Filter pinned only */\n\tpinned?: boolean;\n\t/** Filter mentioning user */\n\tmentions?: UUID;\n}\n\n/**\n * Message channel.\n */\nexport interface MessageChannel {\n\t/** Channel ID */\n\tid: UUID;\n\t/** Channel name */\n\tname: string;\n\t/** Channel type */\n\ttype: \"text\" | \"voice\" | \"dm\" | \"group\" | \"announcement\" | \"thread\";\n\t/** Channel description */\n\tdescription?: string;\n\t/** Channel participants */\n\tparticipants?: MessageParticipant[];\n\t/** User permissions */\n\tpermissions?: {\n\t\tcanSend: boolean;\n\t\tcanRead: boolean;\n\t\tcanDelete: boolean;\n\t\tcanPin: boolean;\n\t\tcanManage: boolean;\n\t};\n\t/** Last message timestamp */\n\tlastMessageAt?: Date;\n\t/** Total message count */\n\tmessageCount?: number;\n\t/** Unread message count */\n\tunreadCount?: number;\n}\n\n// ============================================================================\n// Post/Social Media Interfaces\n// ============================================================================\n\n/**\n * Post media content.\n */\nexport interface PostMedia {\n\t/** Media ID */\n\tid: UUID;\n\t/** Media URL */\n\turl: string;\n\t/** Media type */\n\ttype: \"image\" | \"video\" | \"audio\" | \"document\";\n\t/** MIME type */\n\tmimeType: string;\n\t/** File size in bytes */\n\tsize: number;\n\t/** Width for images/videos */\n\twidth?: number;\n\t/** Height for images/videos */\n\theight?: number;\n\t/** Duration for audio/video */\n\tduration?: number;\n\t/** Thumbnail URL */\n\tthumbnail?: string;\n\t/** Description */\n\tdescription?: string;\n\t/** Alt text for accessibility */\n\taltText?: string;\n}\n\n/**\n * Post location.\n */\nexport interface PostLocation {\n\t/** Location name */\n\tname: string;\n\t/** Address */\n\taddress?: string;\n\t/** Coordinates */\n\tcoordinates?: {\n\t\tlatitude: number;\n\t\tlongitude: number;\n\t};\n\t/** Place ID from location service */\n\tplaceId?: string;\n}\n\n/**\n * Post author information.\n */\nexport interface PostAuthor {\n\t/** Author ID */\n\tid: UUID;\n\t/** Username */\n\tusername: string;\n\t/** Display name */\n\tdisplayName: string;\n\t/** Avatar URL */\n\tavatar?: string;\n\t/** Verified badge */\n\tverified?: boolean;\n\t/** Follower count */\n\tfollowerCount?: number;\n\t/** Following count */\n\tfollowingCount?: number;\n\t/** Bio */\n\tbio?: string;\n\t/** Website URL */\n\twebsite?: string;\n}\n\n/**\n * Post engagement metrics.\n */\nexport interface PostEngagement {\n\t/** Number of likes */\n\tlikes: number;\n\t/** Number of shares */\n\tshares: number;\n\t/** Number of comments */\n\tcomments: number;\n\t/** Number of views */\n\tviews?: number;\n\t/** Whether current user has liked */\n\thasLiked: boolean;\n\t/** Whether current user has shared */\n\thasShared: boolean;\n\t/** Whether current user has commented */\n\thasCommented: boolean;\n\t/** Whether current user has saved */\n\thasSaved: boolean;\n}\n\n/**\n * Post content.\n */\nexport interface PostContent {\n\t/** Text content */\n\ttext?: string;\n\t/** HTML content */\n\thtml?: string;\n\t/** Media attachments */\n\tmedia?: PostMedia[];\n\t/** Location */\n\tlocation?: PostLocation;\n\t/** Hashtags */\n\ttags?: string[];\n\t/** Mentioned user IDs */\n\tmentions?: UUID[];\n\t/** Link previews */\n\tlinks?: Array<{\n\t\turl: string;\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\timage?: string;\n\t}>;\n\t/** Poll */\n\tpoll?: {\n\t\tquestion: string;\n\t\toptions: Array<{\n\t\t\ttext: string;\n\t\t\tvotes: number;\n\t\t}>;\n\t\texpiresAt?: Date;\n\t\tmultipleChoice?: boolean;\n\t};\n}\n\n/**\n * Post information.\n */\nexport interface PostInfo {\n\t/** Post ID */\n\tid: UUID;\n\t/** Post author */\n\tauthor: PostAuthor;\n\t/** Post content */\n\tcontent: PostContent;\n\t/** Platform name */\n\tplatform: string;\n\t/** Platform-specific ID */\n\tplatformId: string;\n\t/** Post URL */\n\turl: string;\n\t/** Created timestamp */\n\tcreatedAt: Date;\n\t/** Edited timestamp */\n\teditedAt?: Date;\n\t/** Scheduled timestamp */\n\tscheduledAt?: Date;\n\t/** Engagement metrics */\n\tengagement: PostEngagement;\n\t/** Visibility level */\n\tvisibility: \"public\" | \"private\" | \"followers\" | \"friends\" | \"unlisted\";\n\t/** Reply to post ID */\n\treplyTo?: UUID;\n\t/** Thread information */\n\tthread?: {\n\t\tid: UUID;\n\t\tposition: number;\n\t\ttotal: number;\n\t};\n\t/** Cross-post information */\n\tcrossPosted?: Array<{\n\t\tplatform: string;\n\t\tplatformId: string;\n\t\turl: string;\n\t}>;\n}\n\n/**\n * Post creation options.\n */\nexport interface PostCreateOptions {\n\t/** Target platforms */\n\tplatforms?: string[];\n\t/** Scheduled time */\n\tscheduledAt?: Date;\n\t/** Visibility level */\n\tvisibility?: PostInfo[\"visibility\"];\n\t/** Reply to post ID */\n\treplyTo?: UUID;\n\t/** Create as thread */\n\tthread?: boolean;\n\t/** Location */\n\tlocation?: PostLocation;\n\t/** Hashtags */\n\ttags?: string[];\n\t/** Mentioned user IDs */\n\tmentions?: UUID[];\n\t/** Enable comments */\n\tenableComments?: boolean;\n\t/** Enable sharing */\n\tenableSharing?: boolean;\n\t/** Content warning */\n\tcontentWarning?: string;\n\t/** Mark as sensitive */\n\tsensitive?: boolean;\n}\n\n/**\n * Post search options.\n */\nexport interface PostSearchOptions {\n\t/** Search query */\n\tquery?: string;\n\t/** Filter by author */\n\tauthor?: UUID;\n\t/** Filter by platform */\n\tplatform?: string;\n\t/** Filter by tags */\n\ttags?: string[];\n\t/** Filter by mentions */\n\tmentions?: UUID[];\n\t/** Filter posts since date */\n\tsince?: Date;\n\t/** Filter posts before date */\n\tbefore?: Date;\n\t/** Maximum results */\n\tlimit?: number;\n\t/** Offset for pagination */\n\toffset?: number;\n\t/** Filter with media only */\n\thasMedia?: boolean;\n\t/** Filter with location only */\n\thasLocation?: boolean;\n\t/** Filter by visibility */\n\tvisibility?: PostInfo[\"visibility\"];\n\t/** Sort order */\n\tsortBy?: \"date\" | \"engagement\" | \"relevance\";\n}\n\n/**\n * Post analytics.\n */\nexport interface PostAnalytics {\n\t/** Post ID */\n\tpostId: UUID;\n\t/** Platform name */\n\tplatform: string;\n\t/** Total impressions */\n\timpressions: number;\n\t/** Unique reach */\n\treach: number;\n\t/** Engagement metrics */\n\tengagement: PostEngagement;\n\t/** Link clicks */\n\tclicks: number;\n\t/** Shares */\n\tshares: number;\n\t/** Saves */\n\tsaves: number;\n\t/** Demographics */\n\tdemographics?: {\n\t\tage?: Record<string, number>;\n\t\tgender?: Record<string, number>;\n\t\tlocation?: Record<string, number>;\n\t};\n\t/** Top performing hours */\n\ttopPerformingHours?: Array<{\n\t\thour: number;\n\t\tengagement: number;\n\t}>;\n}\n",
448
448
  "/**\n * Tool Policy Types\n *\n * Types and definitions for tool/action filtering and permissions in elizaOS.\n *\n * @module tools\n */\n\n// Re-export from channel-config to avoid duplication\nexport type { ToolPolicyConfig, ToolProfileId } from \"./channel-config\";\n\nimport type { ToolPolicyConfig, ToolProfileId } from \"./channel-config\";\n\n/**\n * Canonical tool name aliases for backward compatibility.\n * Maps legacy names to canonical names.\n */\nexport const TOOL_NAME_ALIASES: Record<string, string> = {\n\tbash: \"exec\",\n\t\"apply-patch\": \"apply_patch\",\n};\n\n/**\n * Predefined tool groups for easier policy configuration.\n * Use \"group:<name>\" syntax in policy configs (e.g., \"group:fs\").\n */\nexport const TOOL_GROUPS: Record<string, string[]> = {\n\t// Memory tools (provided by plugin-scratchpad)\n\t\"group:memory\": [\n\t\t\"scratchpad_search\",\n\t\t\"scratchpad_read\",\n\t\t\"read_attachment\",\n\t\t\"remove_from_scratchpad\",\n\t],\n\t// Web tools\n\t\"group:web\": [\"web_search\", \"web_fetch\"],\n\t// Basic workspace/file tools\n\t\"group:fs\": [\"read\", \"read_file\", \"write\", \"edit\", \"apply_patch\"],\n\t// Host/runtime execution tools\n\t\"group:runtime\": [\"exec\", \"process\"],\n\t// Session management tools\n\t\"group:sessions\": [\n\t\t\"sessions_list\",\n\t\t\"sessions_history\",\n\t\t\"sessions_send\",\n\t\t\"sessions_spawn\",\n\t\t\"session_status\",\n\t],\n\t// UI helpers\n\t\"group:ui\": [\"browser\", \"canvas\"],\n\t// Automation + infra\n\t\"group:automation\": [\"cron\", \"gateway\"],\n\t// Messaging surface\n\t\"group:messaging\": [\"message\"],\n\t// Nodes + device tools\n\t\"group:nodes\": [\"nodes\"],\n\t// All native tools (excludes provider plugins)\n\t\"group:all\": [\n\t\t\"browser\",\n\t\t\"canvas\",\n\t\t\"nodes\",\n\t\t\"cron\",\n\t\t\"message\",\n\t\t\"gateway\",\n\t\t\"agents_list\",\n\t\t\"sessions_list\",\n\t\t\"sessions_history\",\n\t\t\"sessions_send\",\n\t\t\"sessions_spawn\",\n\t\t\"session_status\",\n\t\t\"scratchpad_search\",\n\t\t\"scratchpad_read\",\n\t\t\"read_attachment\",\n\t\t\"read_file\",\n\t\t\"remove_from_scratchpad\",\n\t\t\"web_search\",\n\t\t\"web_fetch\",\n\t\t\"image\",\n\t\t\"read\",\n\t\t\"write\",\n\t\t\"edit\",\n\t\t\"apply_patch\",\n\t\t\"exec\",\n\t\t\"process\",\n\t],\n};\n\n/**\n * Predefined tool profiles with default allow/deny policies.\n */\nexport const TOOL_PROFILES: Record<ToolProfileId, ToolPolicyConfig> = {\n\tminimal: {\n\t\tallow: [\"session_status\"],\n\t},\n\tcoding: {\n\t\tallow: [\n\t\t\t\"group:fs\",\n\t\t\t\"group:runtime\",\n\t\t\t\"group:sessions\",\n\t\t\t\"group:memory\",\n\t\t\t\"image\",\n\t\t],\n\t},\n\tmessaging: {\n\t\tallow: [\n\t\t\t\"group:messaging\",\n\t\t\t\"sessions_list\",\n\t\t\t\"sessions_history\",\n\t\t\t\"sessions_send\",\n\t\t\t\"session_status\",\n\t\t],\n\t},\n\tfull: {\n\t\t// No restrictions - all tools allowed\n\t},\n};\n\n/**\n * Plugin tool groups for dynamic tool resolution.\n */\nexport interface PluginToolGroups {\n\t/** All tool names from plugins */\n\tall: string[];\n\t/** Tool names organized by plugin ID */\n\tbyPlugin: Map<string, string[]>;\n}\n\n/**\n * Result of allowlist resolution with diagnostics.\n */\nexport interface AllowlistResolution {\n\t/** The resolved policy after processing */\n\tpolicy: ToolPolicyConfig | undefined;\n\t/** Entries in the allowlist that weren't recognized */\n\tunknownAllowlist: string[];\n\t/** Whether the allowlist was stripped (contained only plugin tools) */\n\tstrippedAllowlist: boolean;\n}\n\n/**\n * Tool policy evaluation options.\n */\nexport interface ToolPolicyEvaluationOptions {\n\t/** The character's tool profile */\n\tprofile?: ToolProfileId;\n\t/** Character-level tool policy overrides */\n\tcharacterPolicy?: ToolPolicyConfig;\n\t/** Channel-specific tool policy overrides */\n\tchannelPolicy?: ToolPolicyConfig;\n\t/** Provider-specific tool policy overrides */\n\tproviderPolicy?: ToolPolicyConfig;\n\t/** Plugin tool groups for resolution */\n\tpluginGroups?: PluginToolGroups;\n\t/** Set of core tool names for validation */\n\tcoreTools?: Set<string>;\n}\n\n/**\n * Tool policy evaluation result.\n */\nexport interface ToolPolicyResult {\n\t/** Whether the tool is allowed */\n\tallowed: boolean;\n\t/** Reason for the decision */\n\treason: string;\n\t/** The effective policy after merging */\n\teffectivePolicy: ToolPolicyConfig;\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Normalize a tool name to its canonical form.\n * Handles aliases and case normalization.\n *\n * @param name - The tool name to normalize\n * @returns The canonical tool name\n */\nexport function normalizeToolName(name: string): string {\n\tconst normalized = name.trim().toLowerCase();\n\treturn TOOL_NAME_ALIASES[normalized] ?? normalized;\n}\n\n/**\n * Normalize a list of tool names.\n *\n * @param list - The list of tool names to normalize\n * @returns Normalized list with empty entries filtered out\n */\nexport function normalizeToolList(list?: string[]): string[] {\n\tif (!list) {\n\t\treturn [];\n\t}\n\treturn list.map(normalizeToolName).filter(Boolean);\n}\n\n/**\n * Expand tool groups in a list to their constituent tools.\n * Handles both group references (e.g., \"group:fs\") and individual tools.\n *\n * @param list - The list containing tool names and/or group references\n * @returns Expanded list with all groups resolved to individual tools\n */\nexport function expandToolGroups(list?: string[]): string[] {\n\tconst normalized = normalizeToolList(list);\n\tconst expanded: string[] = [];\n\n\tfor (const value of normalized) {\n\t\tconst group = TOOL_GROUPS[value];\n\t\tif (group) {\n\t\t\texpanded.push(...group);\n\t\t\tcontinue;\n\t\t}\n\t\texpanded.push(value);\n\t}\n\n\treturn Array.from(new Set(expanded));\n}\n\n/**\n * Resolve a tool profile to its policy configuration.\n *\n * @param profile - The profile ID to resolve\n * @returns The policy configuration, or undefined if profile is invalid\n */\nexport function resolveToolProfilePolicy(\n\tprofile?: string,\n): ToolPolicyConfig | undefined {\n\tif (!profile) {\n\t\treturn undefined;\n\t}\n\tconst resolved = TOOL_PROFILES[profile as ToolProfileId];\n\tif (!resolved) {\n\t\treturn undefined;\n\t}\n\t// Return undefined for 'full' profile (no restrictions)\n\tif (!resolved.allow && !resolved.deny) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tallow: resolved.allow ? [...resolved.allow] : undefined,\n\t\tdeny: resolved.deny ? [...resolved.deny] : undefined,\n\t};\n}\n\n/**\n * Collect all explicit allow entries from multiple policies.\n *\n * @param policies - Array of policies to collect from\n * @returns Combined allowlist entries\n */\nexport function collectExplicitAllowlist(\n\tpolicies: Array<ToolPolicyConfig | undefined>,\n): string[] {\n\tconst entries: string[] = [];\n\n\tfor (const policy of policies) {\n\t\tif (!policy?.allow) {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const value of policy.allow) {\n\t\t\tif (typeof value !== \"string\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst trimmed = value.trim();\n\t\t\tif (trimmed) {\n\t\t\t\tentries.push(trimmed);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn entries;\n}\n\n/**\n * Build plugin tool groups from a list of tools with metadata.\n *\n * @param params - Tools and metadata accessor\n * @returns Plugin tool groups organized by plugin ID\n */\nexport function buildPluginToolGroups<T extends { name: string }>(params: {\n\ttools: T[];\n\ttoolMeta: (tool: T) => { pluginId: string } | undefined;\n}): PluginToolGroups {\n\tconst all: string[] = [];\n\tconst byPlugin = new Map<string, string[]>();\n\n\tfor (const tool of params.tools) {\n\t\tconst meta = params.toolMeta(tool);\n\t\tif (!meta) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst name = normalizeToolName(tool.name);\n\t\tall.push(name);\n\t\tconst pluginId = meta.pluginId.toLowerCase();\n\t\tconst list = byPlugin.get(pluginId) ?? [];\n\t\tlist.push(name);\n\t\tbyPlugin.set(pluginId, list);\n\t}\n\n\treturn { all, byPlugin };\n}\n\n/**\n * Expand plugin group references in a list.\n *\n * @param list - The list containing potential plugin group references\n * @param groups - Plugin tool groups for resolution\n * @returns Expanded list with plugin groups resolved\n */\nexport function expandPluginGroups(\n\tlist: string[] | undefined,\n\tgroups: PluginToolGroups,\n): string[] | undefined {\n\tif (!list || list.length === 0) {\n\t\treturn list;\n\t}\n\n\tconst expanded: string[] = [];\n\tfor (const entry of list) {\n\t\tconst normalized = normalizeToolName(entry);\n\t\tif (normalized === \"group:plugins\") {\n\t\t\tif (groups.all.length > 0) {\n\t\t\t\texpanded.push(...groups.all);\n\t\t\t} else {\n\t\t\t\texpanded.push(normalized);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst tools = groups.byPlugin.get(normalized);\n\t\tif (tools && tools.length > 0) {\n\t\t\texpanded.push(...tools);\n\t\t\tcontinue;\n\t\t}\n\t\texpanded.push(normalized);\n\t}\n\n\treturn Array.from(new Set(expanded));\n}\n\n/**\n * Expand a policy with plugin group resolution.\n *\n * @param policy - The policy to expand\n * @param groups - Plugin tool groups for resolution\n * @returns Policy with plugin groups expanded\n */\nexport function expandPolicyWithPluginGroups(\n\tpolicy: ToolPolicyConfig | undefined,\n\tgroups: PluginToolGroups,\n): ToolPolicyConfig | undefined {\n\tif (!policy) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tallow: expandPluginGroups(policy.allow, groups),\n\t\tdeny: expandPluginGroups(policy.deny, groups),\n\t};\n}\n\n/**\n * Strip plugin-only allowlist to prevent accidentally disabling core tools.\n * When an allowlist contains only plugin tools, we remove it to avoid\n * inadvertently blocking core functionality.\n *\n * @param policy - The policy to check\n * @param groups - Plugin tool groups\n * @param coreTools - Set of core tool names\n * @returns Resolution result with diagnostic information\n */\nexport function stripPluginOnlyAllowlist(\n\tpolicy: ToolPolicyConfig | undefined,\n\tgroups: PluginToolGroups,\n\tcoreTools: Set<string>,\n): AllowlistResolution {\n\tif (!policy?.allow || policy.allow.length === 0) {\n\t\treturn { policy, unknownAllowlist: [], strippedAllowlist: false };\n\t}\n\n\tconst normalized = normalizeToolList(policy.allow);\n\tif (normalized.length === 0) {\n\t\treturn { policy, unknownAllowlist: [], strippedAllowlist: false };\n\t}\n\n\tconst pluginIds = new Set(groups.byPlugin.keys());\n\tconst pluginTools = new Set(groups.all);\n\tconst unknownAllowlist: string[] = [];\n\tlet hasCoreEntry = false;\n\n\tfor (const entry of normalized) {\n\t\tif (entry === \"*\") {\n\t\t\thasCoreEntry = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst isPluginEntry =\n\t\t\tentry === \"group:plugins\" ||\n\t\t\tpluginIds.has(entry) ||\n\t\t\tpluginTools.has(entry);\n\t\tconst expanded = expandToolGroups([entry]);\n\t\tconst isCoreEntry = expanded.some((tool) => coreTools.has(tool));\n\t\tif (isCoreEntry) {\n\t\t\thasCoreEntry = true;\n\t\t}\n\t\tif (!isCoreEntry && !isPluginEntry) {\n\t\t\tunknownAllowlist.push(entry);\n\t\t}\n\t}\n\n\tconst strippedAllowlist = !hasCoreEntry;\n\n\treturn {\n\t\tpolicy: strippedAllowlist ? { ...policy, allow: undefined } : policy,\n\t\tunknownAllowlist: Array.from(new Set(unknownAllowlist)),\n\t\tstrippedAllowlist,\n\t};\n}\n\n/**\n * Merge multiple tool policies into a single effective policy.\n * Later policies take precedence for conflicts.\n *\n * @param policies - Policies to merge in order of precedence\n * @returns Merged policy\n */\nexport function mergeToolPolicies(\n\t...policies: Array<ToolPolicyConfig | undefined>\n): ToolPolicyConfig {\n\tconst result: ToolPolicyConfig = {};\n\n\tfor (const policy of policies) {\n\t\tif (!policy) continue;\n\n\t\tif (policy.allow !== undefined) {\n\t\t\t// If a more specific policy has an allow list, it replaces (not merges)\n\t\t\tresult.allow = [...(policy.allow || [])];\n\t\t}\n\n\t\tif (policy.deny !== undefined) {\n\t\t\t// Deny lists are additive - combine them\n\t\t\tresult.deny = [...(result.deny || []), ...(policy.deny || [])];\n\t\t}\n\t}\n\n\t// Deduplicate\n\tif (result.allow) {\n\t\tresult.allow = Array.from(new Set(result.allow));\n\t}\n\tif (result.deny) {\n\t\tresult.deny = Array.from(new Set(result.deny));\n\t}\n\n\treturn result;\n}\n\n/**\n * Check if a tool is allowed by a policy.\n *\n * @param toolName - The tool name to check\n * @param policy - The policy to evaluate against\n * @returns Whether the tool is allowed\n */\nexport function isToolAllowedByPolicy(\n\ttoolName: string,\n\tpolicy: ToolPolicyConfig | undefined,\n): boolean {\n\tconst normalizedName = normalizeToolName(toolName);\n\n\t// No policy means all tools allowed\n\tif (!policy) {\n\t\treturn true;\n\t}\n\n\t// Check deny list first (deny takes precedence)\n\tif (policy.deny && policy.deny.length > 0) {\n\t\tconst expandedDeny = expandToolGroups(policy.deny);\n\t\tif (expandedDeny.includes(normalizedName)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Check allow list\n\tif (policy.allow && policy.allow.length > 0) {\n\t\tconst expandedAllow = expandToolGroups(policy.allow);\n\t\t// Wildcard allows everything not denied\n\t\tif (expandedAllow.includes(\"*\")) {\n\t\t\treturn true;\n\t\t}\n\t\treturn expandedAllow.includes(normalizedName);\n\t}\n\n\t// No allow list means all tools allowed (if not denied)\n\treturn true;\n}\n",
449
- "import type { UUID } from \"./primitives\";\n\nexport const TRIGGER_SCHEMA_VERSION = 1 as const;\n\nexport type TriggerType = \"interval\" | \"once\" | \"cron\";\nexport type TriggerWakeMode = \"inject_now\" | \"next_autonomy_cycle\";\nexport type TriggerLastStatus = \"success\" | \"error\" | \"skipped\";\nexport type TriggerKind = \"text\" | \"workflow\";\n\nexport interface TriggerConfig {\n\tversion: typeof TRIGGER_SCHEMA_VERSION;\n\ttriggerId: UUID;\n\tdisplayName: string;\n\tinstructions: string;\n\ttriggerType: TriggerType;\n\tenabled: boolean;\n\twakeMode: TriggerWakeMode;\n\tcreatedBy: string;\n\ttimezone?: string;\n\tintervalMs?: number;\n\tscheduledAtIso?: string;\n\tcronExpression?: string;\n\tmaxRuns?: number;\n\trunCount: number;\n\tnextRunAtMs?: number;\n\tlastRunAtIso?: string;\n\tlastStatus?: TriggerLastStatus;\n\tlastError?: string;\n\tdedupeKey?: string;\n\t// When undefined, treat as \"text\" for back-compat.\n\tkind?: TriggerKind;\n\tworkflowId?: string;\n\tworkflowName?: string;\n}\n\nexport interface TriggerRunRecord {\n\ttriggerRunId: UUID;\n\ttriggerId: UUID;\n\ttaskId: UUID;\n\tstartedAt: number;\n\tfinishedAt: number;\n\tstatus: TriggerLastStatus;\n\terror?: string;\n\tlatencyMs: number;\n\tsource: \"scheduler\" | \"manual\";\n}\n",
449
+ "import type { UUID } from \"./primitives\";\n\nexport const TRIGGER_SCHEMA_VERSION = 1 as const;\n\nexport type TriggerType = \"interval\" | \"once\" | \"cron\" | \"event\";\nexport type TriggerWakeMode = \"inject_now\" | \"next_autonomy_cycle\";\nexport type TriggerLastStatus = \"success\" | \"error\" | \"skipped\";\nexport type TriggerKind = \"text\" | \"workflow\";\n\nexport interface TriggerConfig {\n\tversion: typeof TRIGGER_SCHEMA_VERSION;\n\ttriggerId: UUID;\n\tdisplayName: string;\n\tinstructions: string;\n\ttriggerType: TriggerType;\n\tenabled: boolean;\n\twakeMode: TriggerWakeMode;\n\tcreatedBy: string;\n\ttimezone?: string;\n\tintervalMs?: number;\n\tscheduledAtIso?: string;\n\tcronExpression?: string;\n\teventKind?: string;\n\tmaxRuns?: number;\n\trunCount: number;\n\tnextRunAtMs?: number;\n\tlastRunAtIso?: string;\n\tlastStatus?: TriggerLastStatus;\n\tlastError?: string;\n\tdedupeKey?: string;\n\t// When undefined, treat as \"text\" for back-compat.\n\tkind?: TriggerKind;\n\tworkflowId?: string;\n\tworkflowName?: string;\n}\n\nexport interface TriggerRunRecord {\n\ttriggerRunId: UUID;\n\ttriggerId: UUID;\n\ttaskId: UUID;\n\tstartedAt: number;\n\tfinishedAt: number;\n\tstatus: TriggerLastStatus;\n\terror?: string;\n\tlatencyMs: number;\n\tsource: \"scheduler\" | \"manual\" | \"event\";\n\teventKind?: string;\n}\n",
450
450
  "// Core types\n\nexport { logger } from \"../logger\";\n// Utilities that are part of the public API.\nexport { addHeader, composePromptFromState, parseKeyValueXml } from \"../utils\";\nexport * from \"./agent\";\n// Channel configuration types for plugins\nexport * from \"./channel-config\";\nexport * from \"./components\";\nexport * from \"./database\";\nexport * from \"./environment\";\nexport * from \"./events\";\nexport * from \"./hook\";\nexport * from \"./knowledge\";\nexport * from \"./memory\";\nexport * from \"./memory-storage\";\nexport * from \"./messaging\";\nexport * from \"./model\";\n// Onboarding types\nexport * from \"./onboarding\";\nexport * from \"./pairing\";\nexport * from \"./payment\";\nexport * from \"./pipeline-hooks\";\nexport * from \"./plugin\";\nexport * from \"./plugin-store\";\nexport * from \"./primitives\";\nexport * from \"./prompt-batcher\";\nexport * from \"./prompt-optimization-hooks\";\nexport * from \"./prompt-optimization-score-card\";\nexport * from \"./prompt-optimization-trace\";\nexport * from \"./prompts\";\n// Proto-generated types (single source of truth)\n// These types are generated from /schemas/eliza/v1/*.proto\n// Use these for new code and cross-language interoperability\nexport * as proto from \"./proto.js\";\n// Re-export proto utilities for JSON conversion\n// JsonValue is also exported from primitives.ts, but we explicitly export it here for clarity\nexport { fromJson, type JsonObject, type JsonValue, toJson } from \"./proto.js\";\nexport * from \"./runtime\";\nexport * from \"./schema\";\nexport * from \"./schema-builder\";\nexport * from \"./service\";\nexport * from \"./service-interfaces\";\nexport * from \"./settings\";\nexport * from \"./state\";\nexport * from \"./streaming\";\nexport * from \"./task\";\nexport * from \"./tee\";\nexport * from \"./testing\";\nexport * from \"./tools\";\nexport * from \"./trigger\";\n",
451
451
  "// This is a generated file. Do not edit.\nmodule.exports.Space_Separator = /[\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/\nmodule.exports.ID_Start = /[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312E\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FEA\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDD40-\\uDD74\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF2D-\\uDF4A\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDFD1-\\uDFD5]|\\uD801[\\uDC00-\\uDC9D\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2]|\\uD804[\\uDC03-\\uDC37\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDF00-\\uDF19]|\\uD806[\\uDCA0-\\uDCDF\\uDCFF\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE83\\uDE86-\\uDE89\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50\\uDF93-\\uDF9F\\uDFE0\\uDFE1]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00-\\uDD1E\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]/\nmodule.exports.ID_Continue = /[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u0860-\\u086A\\u08A0-\\u08B4\\u08B6-\\u08BD\\u08D4-\\u08E1\\u08E3-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u09FC\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0AF9-\\u0AFF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58-\\u0C5A\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C80-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D00-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D54-\\u0D57\\u0D5F-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1C80-\\u1C88\\u1CD0-\\u1CD2\\u1CD4-\\u1CF9\\u1D00-\\u1DF9\\u1DFB-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312E\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FEA\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C5\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA8FD\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDD40-\\uDD74\\uDDFD\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDEE0\\uDF00-\\uDF1F\\uDF2D-\\uDF4A\\uDF50-\\uDF7A\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDFD1-\\uDFD5]|\\uD801[\\uDC00-\\uDC9D\\uDCA0-\\uDCA9\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE38-\\uDE3A\\uDE3F\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE6\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2]|\\uD804[\\uDC00-\\uDC46\\uDC66-\\uDC6F\\uDC7F-\\uDCBA\\uDCD0-\\uDCE8\\uDCF0-\\uDCF9\\uDD00-\\uDD34\\uDD36-\\uDD3F\\uDD50-\\uDD73\\uDD76\\uDD80-\\uDDC4\\uDDCA-\\uDDCC\\uDDD0-\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE37\\uDE3E\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEEA\\uDEF0-\\uDEF9\\uDF00-\\uDF03\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3C-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF50\\uDF57\\uDF5D-\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74]|\\uD805[\\uDC00-\\uDC4A\\uDC50-\\uDC59\\uDC80-\\uDCC5\\uDCC7\\uDCD0-\\uDCD9\\uDD80-\\uDDB5\\uDDB8-\\uDDC0\\uDDD8-\\uDDDD\\uDE00-\\uDE40\\uDE44\\uDE50-\\uDE59\\uDE80-\\uDEB7\\uDEC0-\\uDEC9\\uDF00-\\uDF19\\uDF1D-\\uDF2B\\uDF30-\\uDF39]|\\uD806[\\uDCA0-\\uDCE9\\uDCFF\\uDE00-\\uDE3E\\uDE47\\uDE50-\\uDE83\\uDE86-\\uDE99\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC36\\uDC38-\\uDC40\\uDC50-\\uDC59\\uDC72-\\uDC8F\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD47\\uDD50-\\uDD59]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE60-\\uDE69\\uDED0-\\uDEED\\uDEF0-\\uDEF4\\uDF00-\\uDF36\\uDF40-\\uDF43\\uDF50-\\uDF59\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50-\\uDF7E\\uDF8F-\\uDF9F\\uDFE0\\uDFE1]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00-\\uDD1E\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99\\uDC9D\\uDC9E]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB\\uDFCE-\\uDFFF]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A]|\\uD83A[\\uDC00-\\uDCC4\\uDCD0-\\uDCD6\\uDD00-\\uDD4A\\uDD50-\\uDD59]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]|\\uDB40[\\uDD00-\\uDDEF]/\n",
452
452
  "const unicode = require('../lib/unicode')\n\nmodule.exports = {\n isSpaceSeparator (c) {\n return typeof c === 'string' && unicode.Space_Separator.test(c)\n },\n\n isIdStartChar (c) {\n return typeof c === 'string' && (\n (c >= 'a' && c <= 'z') ||\n (c >= 'A' && c <= 'Z') ||\n (c === '$') || (c === '_') ||\n unicode.ID_Start.test(c)\n )\n },\n\n isIdContinueChar (c) {\n return typeof c === 'string' && (\n (c >= 'a' && c <= 'z') ||\n (c >= 'A' && c <= 'Z') ||\n (c >= '0' && c <= '9') ||\n (c === '$') || (c === '_') ||\n (c === '\\u200C') || (c === '\\u200D') ||\n unicode.ID_Continue.test(c)\n )\n },\n\n isDigit (c) {\n return typeof c === 'string' && /[0-9]/.test(c)\n },\n\n isHexDigit (c) {\n return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)\n },\n}\n",
@@ -375,7 +375,7 @@
375
375
  "import type { Metadata } from \"./primitives\";\nimport type { JsonValue } from \"./proto.js\";\nimport type { IAgentRuntime } from \"./runtime\";\n\n/**\n * Core service type registry that can be extended by plugins via module augmentation.\n * Plugins can extend this interface to add their own service types:\n *\n * @example\n * ```typescript\n * declare module '@elizaos/core' {\n * interface ServiceTypeRegistry {\n * MY_CUSTOM_SERVICE: 'my_custom_service';\n * }\n * }\n * ```\n */\nexport interface ServiceTypeRegistry {\n\tTRANSCRIPTION: \"transcription\";\n\tVIDEO: \"video\";\n\tBROWSER: \"browser\";\n\tPDF: \"pdf\";\n\tREMOTE_FILES: \"aws_s3\";\n\tWEB_SEARCH: \"web_search\";\n\tEMAIL: \"email\";\n\tTEE: \"tee\";\n\tTASK: \"task\";\n\tAPPROVAL: \"approval\";\n\tTOOL_POLICY: \"tool_policy\";\n\tWALLET: \"wallet\";\n\tLP_POOL: \"lp_pool\";\n\tTOKEN_DATA: \"token_data\";\n\tMESSAGE_SERVICE: \"message_service\";\n\tMESSAGE: \"message\";\n\tPOST: \"post\";\n\tHOOKS: \"hooks\";\n\tPAIRING: \"pairing\";\n\tAGENT_EVENT: \"agent_event\";\n\tOPTIMIZED_PROMPT: \"optimized_prompt\";\n\tUNKNOWN: \"unknown\";\n}\n\n/**\n * Type for service names that includes both core services and any plugin-registered services\n */\nexport type ServiceTypeName = ServiceTypeRegistry[keyof ServiceTypeRegistry];\n\n/**\n * Helper type to extract service type values from the registry\n */\nexport type ServiceTypeValue<K extends keyof ServiceTypeRegistry> =\n\tServiceTypeRegistry[K];\n\n/**\n * Helper type to check if a service type exists in the registry\n */\nexport type IsValidServiceType<T extends string> = T extends ServiceTypeName\n\t? true\n\t: false;\n\n/**\n * Type-safe service class definition\n */\nexport type TypedServiceClass<T extends ServiceTypeName> = {\n\tnew (runtime?: IAgentRuntime): Service;\n\tserviceType: T;\n\tstart(runtime: IAgentRuntime): Promise<Service>;\n};\n\n/**\n * Map of service type names to their implementation classes.\n * Plugins can extend this via module augmentation:\n * @example\n * ```typescript\n * declare module '@elizaos/core' {\n * interface ServiceClassMap {\n * MY_SERVICE: typeof MyService;\n * }\n * }\n * ```\n */\n// biome-ignore lint/complexity/noBannedTypes: Empty interface for module augmentation\nexport type ServiceClassMap = {};\n\n/**\n * Helper to infer service instance type from service type name\n */\nexport type ServiceInstance<T extends ServiceTypeName> =\n\tT extends keyof ServiceClassMap ? InstanceType<ServiceClassMap[T]> : Service;\n\n/**\n * Runtime service registry type\n */\nexport type ServiceRegistry<T extends ServiceTypeName = ServiceTypeName> = Map<\n\tT,\n\tService\n>;\n\n/**\n * Enumerates the recognized types of services that can be registered and used by the agent runtime.\n * Services provide specialized functionalities like audio transcription, video processing,\n * web browsing, PDF handling, file storage (e.g., AWS S3), web search, email integration,\n * secure execution via TEE (Trusted Execution Environment), and task management.\n * This constant is used in `AgentRuntime` for service registration and retrieval (e.g., `getService`).\n * Each service typically implements the `Service` abstract class or a more specific interface like `IVideoService`.\n */\nexport const ServiceType = {\n\tTRANSCRIPTION: \"transcription\",\n\tVIDEO: \"video\",\n\tBROWSER: \"browser\",\n\tPDF: \"pdf\",\n\tREMOTE_FILES: \"aws_s3\",\n\tWEB_SEARCH: \"web_search\",\n\tEMAIL: \"email\",\n\tTEE: \"tee\",\n\tTASK: \"task\",\n\tAPPROVAL: \"approval\",\n\tTOOL_POLICY: \"tool_policy\",\n\tWALLET: \"wallet\",\n\tLP_POOL: \"lp_pool\",\n\tTOKEN_DATA: \"token_data\",\n\tMESSAGE_SERVICE: \"message_service\",\n\tMESSAGE: \"message\",\n\tPOST: \"post\",\n\tHOOKS: \"hooks\",\n\tPAIRING: \"pairing\",\n\tAGENT_EVENT: \"agent_event\",\n\tVOICE_CACHE: \"voice_cache\",\n\tOPTIMIZED_PROMPT: \"optimized_prompt\",\n\tUNKNOWN: \"unknown\",\n} as const;\n\n/**\n * Client instance\n */\nexport abstract class Service {\n\t/** Runtime instance */\n\tprotected runtime!: IAgentRuntime;\n\n\tconstructor(runtime?: IAgentRuntime) {\n\t\tif (runtime) {\n\t\t\tthis.runtime = runtime;\n\t\t}\n\t}\n\n\tabstract stop(): Promise<void>;\n\n\t/** Service type */\n\tstatic serviceType: string;\n\n\t/** Service name */\n\tabstract capabilityDescription: string;\n\n\t/** Service configuration */\n\tconfig?: Metadata;\n\n\t/** Start service connection - subclasses must override this */\n\tstatic async start(_runtime: IAgentRuntime): Promise<Service> {\n\t\tthrow new Error(\"Service.start() must be implemented by subclass\");\n\t}\n\n\t/** Stop service connection - optional, subclasses may override this */\n\tstatic stopRuntime?(_runtime: IAgentRuntime): Promise<void>;\n\n\t/** Optional static method to register send handlers */\n\tstatic registerSendHandlers?(runtime: IAgentRuntime, service: Service): void;\n}\n\n/**\n * Generic service interface that provides better type checking for services\n * @template ConfigType The configuration type for this service\n * @template InputType The input type for processing\n * @template ResultType The result type returned by the service operations\n */\nexport interface TypedService<\n\tConfigType extends Metadata = Metadata,\n\tInputType = JsonValue,\n\tResultType = JsonValue,\n> extends Service {\n\t/**\n\t * The configuration for this service instance\n\t */\n\tconfig?: ConfigType;\n\n\t/**\n\t * Process an input with this service\n\t * @param input The input to process\n\t * @returns A promise resolving to the result\n\t */\n\tprocess(input: InputType): Promise<ResultType>;\n}\n\n/**\n * Generic factory function to create a typed service instance.\n * getService() is synchronous — no await needed.\n * @param runtime The agent runtime\n * @param serviceType The type of service to get\n * @returns The service instance or null if not available\n */\nexport function getTypedService<\n\tConfigType extends Metadata = Metadata,\n\tInputType = JsonValue,\n\tResultType = JsonValue,\n>(\n\truntime: IAgentRuntime,\n\tserviceType: ServiceTypeName,\n): TypedService<ConfigType, InputType, ResultType> | null {\n\treturn runtime.getService<TypedService<ConfigType, InputType, ResultType>>(\n\t\tserviceType,\n\t);\n}\n\n/**\n * Standardized service error type for consistent error handling\n */\nexport interface ServiceError {\n\tcode: string;\n\tmessage: string;\n\tdetails?: Record<string, JsonValue> | string | number | boolean | null;\n\tcause?: Error;\n}\n\n/**\n * Safely create a ServiceError from any caught error\n */\nexport function createServiceError(\n\terror: Error | string | JsonValue,\n\tcode = \"UNKNOWN_ERROR\",\n): ServiceError {\n\tif (error instanceof Error) {\n\t\treturn {\n\t\t\tcode,\n\t\t\tmessage: error.message,\n\t\t\tcause: error,\n\t\t};\n\t}\n\n\treturn {\n\t\tcode,\n\t\tmessage: String(error),\n\t};\n}\n",
376
376
  "/**\n * Service Interface Definitions for elizaOS\n *\n * This module provides standardized service interface definitions that plugins implement.\n * Data types are proto-generated; runtime classes remain TypeScript.\n */\n\nimport type { Content, UUID } from \"./primitives\";\nimport type {\n\tJsonValue,\n\tLpPositionDetails,\n\tPoolInfo,\n\tTokenBalance,\n\tTokenData,\n\tTransactionResult,\n\tWalletAsset,\n\tWalletPortfolio,\n} from \"./proto.js\";\nimport { Service, ServiceType } from \"./service\";\n\nexport type {\n\tLpPositionDetails,\n\tPoolInfo,\n\tTokenBalance,\n\tTokenData,\n\tTransactionResult,\n\tWalletAsset,\n\tWalletPortfolio,\n};\n\n// ============================================================================\n// Message Bus Service Interface\n// ============================================================================\n\nexport interface IMessageBusService extends Service {\n\tnotifyActionStart(\n\t\troomId: UUID,\n\t\tworldId: UUID,\n\t\tcontent: Content,\n\t\tmessageId?: UUID,\n\t): Promise<void>;\n\n\tnotifyActionUpdate(\n\t\troomId: UUID,\n\t\tworldId: UUID,\n\t\tcontent: Content,\n\t\tmessageId?: UUID,\n\t): Promise<void>;\n}\n\n// ============================================================================\n// Token & Wallet Interfaces\n// ============================================================================\n\nexport abstract class ITokenDataService extends Service {\n\tstatic override readonly serviceType = ServiceType.TOKEN_DATA;\n\tpublic readonly capabilityDescription =\n\t\t\"Provides standardized access to token market data.\" as string;\n\n\tabstract getTokenDetails(\n\t\taddress: string,\n\t\tchain: string,\n\t): Promise<TokenData | null>;\n\n\tabstract getTrendingTokens(\n\t\tchain?: string,\n\t\tlimit?: number,\n\t\ttimePeriod?: string,\n\t): Promise<TokenData[]>;\n\n\tabstract searchTokens(\n\t\tquery: string,\n\t\tchain?: string,\n\t\tlimit?: number,\n\t): Promise<TokenData[]>;\n\n\tabstract getTokensByAddresses(\n\t\taddresses: string[],\n\t\tchain: string,\n\t): Promise<TokenData[]>;\n}\n\nexport abstract class IWalletService extends Service {\n\tstatic override readonly serviceType = ServiceType.WALLET;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Provides standardized access to wallet balances and portfolios.\";\n\n\tabstract getPortfolio(owner?: string): Promise<WalletPortfolio>;\n\n\tabstract getBalance(assetAddress: string, owner?: string): Promise<number>;\n\n\tabstract transferSol(\n\t\tfrom: object,\n\t\tto: object,\n\t\tlamports: number,\n\t): Promise<string>;\n}\n\n// ============================================================================\n// Liquidity Pool Interfaces\n// ============================================================================\n\nexport abstract class ILpService extends Service {\n\tstatic override readonly serviceType = \"lp_pool\";\n\n\tpublic readonly capabilityDescription =\n\t\t\"Provides standardized access to DEX liquidity pools.\";\n\n\tabstract getDexName(): string;\n\n\tabstract getPools(\n\t\ttokenAMint?: string,\n\t\ttokenBMint?: string,\n\t): Promise<PoolInfo[]>;\n\n\tabstract addLiquidity(params: {\n\t\tuserVault: object;\n\t\tpoolId: string;\n\t\ttokenAAmountLamports: string;\n\t\ttokenBAmountLamports?: string;\n\t\tslippageBps: number;\n\t\ttickLowerIndex?: number;\n\t\ttickUpperIndex?: number;\n\t}): Promise<TransactionResult & { lpTokensReceived?: TokenBalance }>;\n\n\tabstract removeLiquidity(params: {\n\t\tuserVault: object;\n\t\tpoolId: string;\n\t\tlpTokenAmountLamports: string;\n\t\tslippageBps: number;\n\t}): Promise<TransactionResult & { tokensReceived?: TokenBalance[] }>;\n\n\tabstract getLpPositionDetails(\n\t\tuserAccountPublicKey: string,\n\t\tpoolOrPositionIdentifier: string,\n\t): Promise<LpPositionDetails | null>;\n\n\tabstract getMarketDataForPools(\n\t\tpoolIds: string[],\n\t): Promise<Record<string, Partial<PoolInfo>>>;\n}\n\n// ============================================================================\n// Transcription & Audio Interfaces\n// ============================================================================\n\nexport abstract class ITranscriptionService extends Service {\n\tstatic override readonly serviceType = ServiceType.TRANSCRIPTION;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Audio transcription and speech processing capabilities\";\n\n\tabstract transcribeAudio(\n\t\taudioPath: string | Buffer,\n\t\toptions?: TranscriptionOptions,\n\t): Promise<TranscriptionResult>;\n\n\tabstract transcribeVideo(\n\t\tvideoPath: string | Buffer,\n\t\toptions?: TranscriptionOptions,\n\t): Promise<TranscriptionResult>;\n\n\tabstract speechToText(\n\t\taudioStream: NodeJS.ReadableStream | Buffer,\n\t\toptions?: SpeechToTextOptions,\n\t): Promise<TranscriptionResult>;\n\n\tabstract textToSpeech(\n\t\ttext: string,\n\t\toptions?: TextToSpeechOptions,\n\t): Promise<Buffer>;\n\n\tabstract getSupportedLanguages(): Promise<string[]>;\n\n\tabstract getAvailableVoices(): Promise<\n\t\tArray<{\n\t\t\tid: string;\n\t\t\tname: string;\n\t\t\tlanguage: string;\n\t\t\tgender?: \"male\" | \"female\" | \"neutral\";\n\t\t}>\n\t>;\n\n\tabstract detectLanguage(audioPath: string | Buffer): Promise<string>;\n}\n\n// ============================================================================\n// Video Interfaces\n// ============================================================================\n\nexport abstract class IVideoService extends Service {\n\tstatic override readonly serviceType = ServiceType.VIDEO;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Video download, processing, and conversion capabilities\";\n\n\tabstract getVideoInfo(url: string): Promise<VideoInfo>;\n\n\tabstract downloadVideo(\n\t\turl: string,\n\t\toptions?: VideoDownloadOptions,\n\t): Promise<string>;\n\n\tabstract extractAudio(\n\t\tvideoPath: string,\n\t\toutputPath?: string,\n\t): Promise<string>;\n\n\tabstract getThumbnail(videoPath: string, timestamp?: number): Promise<string>;\n\n\tabstract convertVideo(\n\t\tvideoPath: string,\n\t\toutputPath: string,\n\t\toptions?: VideoProcessingOptions,\n\t): Promise<string>;\n\n\tabstract getAvailableFormats(url: string): Promise<VideoFormat[]>;\n}\n\n// ============================================================================\n// Browser Interfaces\n// ============================================================================\n\nexport abstract class IBrowserService extends Service {\n\tstatic override readonly serviceType = ServiceType.BROWSER;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Web browser automation and scraping capabilities\";\n\n\tabstract navigate(\n\t\turl: string,\n\t\toptions?: BrowserNavigationOptions,\n\t): Promise<void>;\n\n\tabstract screenshot(options?: ScreenshotOptions): Promise<Buffer>;\n\n\tabstract extractContent(selector?: string): Promise<ExtractedContent>;\n\n\tabstract click(\n\t\tselector: string | ElementSelector,\n\t\toptions?: ClickOptions,\n\t): Promise<void>;\n\n\tabstract type(\n\t\tselector: string,\n\t\ttext: string,\n\t\toptions?: TypeOptions,\n\t): Promise<void>;\n\n\tabstract waitForElement(selector: string | ElementSelector): Promise<void>;\n\n\tabstract evaluate<T = JsonValue>(\n\t\tscript: string,\n\t\t...args: JsonValue[]\n\t): Promise<T>;\n\n\tabstract getCurrentUrl(): Promise<string>;\n\n\tabstract goBack(): Promise<void>;\n\n\tabstract goForward(): Promise<void>;\n\n\tabstract refresh(): Promise<void>;\n}\n\n// ============================================================================\n// PDF Interfaces\n// ============================================================================\n\nexport abstract class IPdfService extends Service {\n\tstatic override readonly serviceType = ServiceType.PDF;\n\n\tpublic readonly capabilityDescription =\n\t\t\"PDF processing, extraction, and generation capabilities\";\n\n\tabstract extractText(pdfPath: string | Buffer): Promise<PdfExtractionResult>;\n\n\tabstract generatePdf(\n\t\thtmlContent: string,\n\t\toptions?: PdfGenerationOptions,\n\t): Promise<Buffer>;\n\n\tabstract convertToPdf(\n\t\tfilePath: string,\n\t\toptions?: PdfConversionOptions,\n\t): Promise<Buffer>;\n\n\tabstract mergePdfs(pdfPaths: (string | Buffer)[]): Promise<Buffer>;\n\n\tabstract splitPdf(pdfPath: string | Buffer): Promise<Buffer[]>;\n}\n\n// ============================================================================\n// Web Search Interfaces\n// ============================================================================\n\nexport abstract class IWebSearchService extends Service {\n\tstatic override readonly serviceType = ServiceType.WEB_SEARCH;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Web search and content discovery capabilities\";\n\n\tabstract search(\n\t\tquery: string,\n\t\toptions?: SearchOptions,\n\t): Promise<SearchResponse>;\n\n\tabstract searchNews(\n\t\tquery: string,\n\t\toptions?: NewsSearchOptions,\n\t): Promise<SearchResponse>;\n\n\tabstract searchImages(\n\t\tquery: string,\n\t\toptions?: ImageSearchOptions,\n\t): Promise<SearchResponse>;\n\n\tabstract searchVideos(\n\t\tquery: string,\n\t\toptions?: VideoSearchOptions,\n\t): Promise<SearchResponse>;\n\n\tabstract getSuggestions(query: string): Promise<string[]>;\n\n\tabstract getTrendingSearches(region?: string): Promise<string[]>;\n\n\tabstract getPageInfo(url: string): Promise<{\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tcontent: string;\n\t\tmetadata: Record<string, string>;\n\t\timages: string[];\n\t\tlinks: string[];\n\t}>;\n}\n\n// ============================================================================\n// Email Interfaces\n// ============================================================================\n\nexport abstract class IEmailService extends Service {\n\tstatic override readonly serviceType = ServiceType.EMAIL;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Email sending, receiving, and management capabilities\";\n\n\tabstract sendEmail(\n\t\tmessage: EmailMessage,\n\t\toptions?: EmailSendOptions,\n\t): Promise<string>;\n\n\tabstract getEmails(options?: EmailSearchOptions): Promise<EmailMessage[]>;\n\n\tabstract getEmail(messageId: string): Promise<EmailMessage>;\n\n\tabstract deleteEmail(messageId: string): Promise<void>;\n\n\tabstract markEmailAsRead(messageId: string, read: boolean): Promise<void>;\n\n\tabstract flagEmail(messageId: string, flagged: boolean): Promise<void>;\n\n\tabstract moveEmail(messageId: string, folderPath: string): Promise<void>;\n\n\tabstract getFolders(): Promise<EmailFolder[]>;\n\n\tabstract createFolder(folderName: string, parentPath?: string): Promise<void>;\n\n\tabstract getAccountInfo(): Promise<EmailAccount>;\n\n\tabstract searchEmails(\n\t\tquery: string,\n\t\toptions?: EmailSearchOptions,\n\t): Promise<EmailMessage[]>;\n}\n\n// ============================================================================\n// Message Interfaces\n// ============================================================================\n\nexport abstract class IMessagingService extends Service {\n\tstatic override readonly serviceType = ServiceType.MESSAGE;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Platform messaging and channel management capabilities\";\n\n\tabstract sendMessage(\n\t\tchannelId: UUID,\n\t\tcontent: MessageContent,\n\t\toptions?: MessageSendOptions,\n\t): Promise<UUID>;\n\n\tabstract getMessages(\n\t\tchannelId: UUID,\n\t\toptions?: MessageSearchOptions,\n\t): Promise<MessageInfo[]>;\n\n\tabstract getMessage(messageId: UUID): Promise<MessageInfo>;\n\n\tabstract editMessage(messageId: UUID, content: MessageContent): Promise<void>;\n\n\tabstract deleteMessage(messageId: UUID): Promise<void>;\n\n\tabstract addReaction(messageId: UUID, emoji: string): Promise<void>;\n\n\tabstract removeReaction(messageId: UUID, emoji: string): Promise<void>;\n\n\tabstract pinMessage(messageId: UUID): Promise<void>;\n\n\tabstract unpinMessage(messageId: UUID): Promise<void>;\n\n\tabstract getChannels(): Promise<MessageChannel[]>;\n\n\tabstract getChannel(channelId: UUID): Promise<MessageChannel>;\n\n\tabstract createChannel(\n\t\tname: string,\n\t\ttype: MessageChannel[\"type\"],\n\t\toptions?: {\n\t\t\tdescription?: string;\n\t\t\tparticipants?: UUID[];\n\t\t\tprivate?: boolean;\n\t\t},\n\t): Promise<UUID>;\n\n\tabstract searchMessages(\n\t\tquery: string,\n\t\toptions?: MessageSearchOptions,\n\t): Promise<MessageInfo[]>;\n}\n\n// ============================================================================\n// Post/Social Media Interfaces\n// ============================================================================\n\nexport abstract class IPostService extends Service {\n\tstatic override readonly serviceType = ServiceType.POST;\n\n\tpublic readonly capabilityDescription =\n\t\t\"Social media posting and content management capabilities\";\n\n\tabstract createPost(\n\t\tcontent: PostContent,\n\t\toptions?: PostCreateOptions,\n\t): Promise<UUID>;\n\n\tabstract getPosts(options?: PostSearchOptions): Promise<PostInfo[]>;\n\n\tabstract getPost(postId: UUID): Promise<PostInfo>;\n\n\tabstract editPost(postId: UUID, content: PostContent): Promise<void>;\n\n\tabstract deletePost(postId: UUID): Promise<void>;\n\n\tabstract likePost(postId: UUID, like: boolean): Promise<void>;\n\n\tabstract sharePost(postId: UUID, comment?: string): Promise<UUID>;\n\n\tabstract savePost(postId: UUID, save: boolean): Promise<void>;\n\n\tabstract commentOnPost(postId: UUID, content: PostContent): Promise<UUID>;\n\n\tabstract getComments(\n\t\tpostId: UUID,\n\t\toptions?: PostSearchOptions,\n\t): Promise<PostInfo[]>;\n\n\tabstract schedulePost(\n\t\tcontent: PostContent,\n\t\tscheduledAt: Date,\n\t\toptions?: PostCreateOptions,\n\t): Promise<UUID>;\n\n\tabstract getPostAnalytics(postId: UUID): Promise<PostAnalytics>;\n\n\tabstract getTrendingPosts(options?: PostSearchOptions): Promise<PostInfo[]>;\n\n\tabstract searchPosts(\n\t\tquery: string,\n\t\toptions?: PostSearchOptions,\n\t): Promise<PostInfo[]>;\n}\n\n// ============================================================================\n// Transcription & Audio Interfaces\n// ============================================================================\n\n/**\n * Options for audio transcription.\n */\nexport interface TranscriptionOptions {\n\t/** Language code for transcription */\n\tlanguage?: string;\n\t/** Model to use for transcription */\n\tmodel?: string;\n\t/** Temperature for generation */\n\ttemperature?: number;\n\t/** Prompt to guide transcription */\n\tprompt?: string;\n\t/** Response format */\n\tresponse_format?: \"json\" | \"text\" | \"srt\" | \"vtt\" | \"verbose_json\";\n\t/** Timestamp granularities to include */\n\ttimestamp_granularities?: (\"word\" | \"segment\")[];\n\t/** Include word-level timestamps */\n\tword_timestamps?: boolean;\n\t/** Include segment-level timestamps */\n\tsegment_timestamps?: boolean;\n}\n\n/**\n * Result of audio transcription.\n */\nexport interface TranscriptionResult {\n\t/** Transcribed text */\n\ttext: string;\n\t/** Detected language */\n\tlanguage?: string;\n\t/** Audio duration in seconds */\n\tduration?: number;\n\t/** Transcription segments */\n\tsegments?: TranscriptionSegment[];\n\t/** Word-level transcription */\n\twords?: TranscriptionWord[];\n\t/** Overall confidence score */\n\tconfidence?: number;\n}\n\n/**\n * A segment of transcription.\n */\nexport interface TranscriptionSegment {\n\t/** Segment ID */\n\tid: number;\n\t/** Segment text */\n\ttext: string;\n\t/** Start time in seconds */\n\tstart: number;\n\t/** End time in seconds */\n\tend: number;\n\t/** Confidence score */\n\tconfidence?: number;\n\t/** Token IDs */\n\ttokens?: number[];\n\t/** Temperature used */\n\ttemperature?: number;\n\t/** Average log probability */\n\tavg_logprob?: number;\n\t/** Compression ratio */\n\tcompression_ratio?: number;\n\t/** No speech probability */\n\tno_speech_prob?: number;\n}\n\n/**\n * A word in transcription.\n */\nexport interface TranscriptionWord {\n\t/** The word */\n\tword: string;\n\t/** Start time in seconds */\n\tstart: number;\n\t/** End time in seconds */\n\tend: number;\n\t/** Confidence score */\n\tconfidence?: number;\n}\n\n/**\n * Options for speech-to-text.\n */\nexport interface SpeechToTextOptions {\n\t/** Language code */\n\tlanguage?: string;\n\t/** Model to use */\n\tmodel?: string;\n\t/** Enable continuous recognition */\n\tcontinuous?: boolean;\n\t/** Return interim results */\n\tinterimResults?: boolean;\n\t/** Maximum alternatives to return */\n\tmaxAlternatives?: number;\n}\n\n/**\n * Options for text-to-speech.\n */\nexport interface TextToSpeechOptions {\n\t/** Voice to use */\n\tvoice?: string;\n\t/** Model to use */\n\tmodel?: string;\n\t/** Speech speed */\n\tspeed?: number;\n\t/** Output format */\n\tformat?: \"mp3\" | \"wav\" | \"flac\" | \"aac\";\n\t/** Response format */\n\tresponse_format?: \"mp3\" | \"opus\" | \"aac\" | \"flac\";\n}\n\n// ============================================================================\n// Video Interfaces\n// ============================================================================\n\n/**\n * Video information.\n */\nexport interface VideoInfo {\n\t/** Video title */\n\ttitle?: string;\n\t/** Duration in seconds */\n\tduration?: number;\n\t/** Video URL */\n\turl: string;\n\t/** Thumbnail URL */\n\tthumbnail?: string;\n\t/** Video description */\n\tdescription?: string;\n\t/** Uploader name */\n\tuploader?: string;\n\t/** View count */\n\tviewCount?: number;\n\t/** Upload date */\n\tuploadDate?: Date;\n\t/** Available formats */\n\tformats?: VideoFormat[];\n}\n\n/**\n * Video format information.\n */\nexport interface VideoFormat {\n\t/** Format ID */\n\tformatId: string;\n\t/** Download URL */\n\turl: string;\n\t/** File extension */\n\textension: string;\n\t/** Quality label */\n\tquality: string;\n\t/** File size in bytes */\n\tfileSize?: number;\n\t/** Video codec */\n\tvideoCodec?: string;\n\t/** Audio codec */\n\taudioCodec?: string;\n\t/** Resolution (e.g., \"1920x1080\") */\n\tresolution?: string;\n\t/** Frames per second */\n\tfps?: number;\n\t/** Bitrate */\n\tbitrate?: number;\n}\n\n/**\n * Video download options.\n */\nexport interface VideoDownloadOptions {\n\t/** Preferred format */\n\tformat?: string;\n\t/** Quality preference */\n\tquality?: \"best\" | \"worst\" | \"bestvideo\" | \"bestaudio\" | string;\n\t/** Output file path */\n\toutputPath?: string;\n\t/** Extract audio only */\n\taudioOnly?: boolean;\n\t/** Extract video only (no audio) */\n\tvideoOnly?: boolean;\n\t/** Download subtitles */\n\tsubtitles?: boolean;\n\t/** Embed subtitles in video */\n\tembedSubs?: boolean;\n\t/** Write info JSON file */\n\twriteInfoJson?: boolean;\n}\n\n/**\n * Video processing options.\n */\nexport interface VideoProcessingOptions {\n\t/** Start time in seconds */\n\tstartTime?: number;\n\t/** End time in seconds */\n\tendTime?: number;\n\t/** Output format */\n\toutputFormat?: string;\n\t/** Target resolution */\n\tresolution?: string;\n\t/** Target bitrate */\n\tbitrate?: string;\n\t/** Target framerate */\n\tframerate?: number;\n\t/** Audio codec */\n\taudioCodec?: string;\n\t/** Video codec */\n\tvideoCodec?: string;\n}\n\n// ============================================================================\n// Browser Interfaces\n// ============================================================================\n\n/**\n * Browser navigation options.\n */\nexport interface BrowserNavigationOptions {\n\t/** Timeout in milliseconds */\n\ttimeout?: number;\n\t/** Wait until condition */\n\twaitUntil?: \"load\" | \"domcontentloaded\" | \"networkidle0\" | \"networkidle2\";\n\t/** Viewport size */\n\tviewport?: {\n\t\twidth: number;\n\t\theight: number;\n\t};\n\t/** User agent string */\n\tuserAgent?: string;\n\t/** Additional headers */\n\theaders?: Record<string, string>;\n}\n\n/**\n * Screenshot options.\n */\nexport interface ScreenshotOptions {\n\t/** Capture full page */\n\tfullPage?: boolean;\n\t/** Clip region */\n\tclip?: {\n\t\tx: number;\n\t\ty: number;\n\t\twidth: number;\n\t\theight: number;\n\t};\n\t/** Image format */\n\tformat?: \"png\" | \"jpeg\" | \"webp\";\n\t/** Image quality (0-100) */\n\tquality?: number;\n\t/** Omit background */\n\tomitBackground?: boolean;\n}\n\n/**\n * Element selector options.\n */\nexport interface ElementSelector {\n\t/** CSS selector */\n\tselector: string;\n\t/** Text content to match */\n\ttext?: string;\n\t/** Timeout in milliseconds */\n\ttimeout?: number;\n}\n\n/**\n * Extracted content from a page.\n */\nexport interface ExtractedContent {\n\t/** Text content */\n\ttext: string;\n\t/** HTML content */\n\thtml: string;\n\t/** Links found on page */\n\tlinks: Array<{\n\t\turl: string;\n\t\ttext: string;\n\t}>;\n\t/** Images found on page */\n\timages: Array<{\n\t\tsrc: string;\n\t\talt?: string;\n\t}>;\n\t/** Page title */\n\ttitle?: string;\n\t/** Page metadata */\n\tmetadata?: Record<string, string>;\n}\n\n/**\n * Click options.\n */\nexport interface ClickOptions {\n\t/** Timeout in milliseconds */\n\ttimeout?: number;\n\t/** Force click even if element is obscured */\n\tforce?: boolean;\n\t/** Wait for navigation after click */\n\twaitForNavigation?: boolean;\n}\n\n/**\n * Type/input options.\n */\nexport interface TypeOptions {\n\t/** Delay between keystrokes */\n\tdelay?: number;\n\t/** Timeout in milliseconds */\n\ttimeout?: number;\n\t/** Clear field before typing */\n\tclear?: boolean;\n}\n\n// ============================================================================\n// PDF Interfaces\n// ============================================================================\n\n/**\n * PDF text extraction result.\n */\nexport interface PdfExtractionResult {\n\t/** Extracted text */\n\ttext: string;\n\t/** Total page count */\n\tpageCount: number;\n\t/** PDF metadata */\n\tmetadata?: {\n\t\ttitle?: string;\n\t\tauthor?: string;\n\t\tcreatedAt?: Date;\n\t\tmodifiedAt?: Date;\n\t};\n}\n\n/**\n * PDF generation options.\n */\nexport interface PdfGenerationOptions {\n\t/** Paper format */\n\tformat?: \"A4\" | \"A3\" | \"Letter\";\n\t/** Page orientation */\n\torientation?: \"portrait\" | \"landscape\";\n\t/** Page margins */\n\tmargins?: {\n\t\ttop?: number;\n\t\tbottom?: number;\n\t\tleft?: number;\n\t\tright?: number;\n\t};\n\t/** Header content */\n\theader?: string;\n\t/** Footer content */\n\tfooter?: string;\n}\n\n/**\n * PDF conversion options.\n */\nexport interface PdfConversionOptions {\n\t/** Output quality */\n\tquality?: \"high\" | \"medium\" | \"low\";\n\t/** Output format */\n\toutputFormat?: \"pdf\" | \"pdf/a\";\n\t/** Enable compression */\n\tcompression?: boolean;\n}\n\n// ============================================================================\n// Web Search Interfaces\n// ============================================================================\n\n/**\n * Web search options.\n */\nexport interface SearchOptions {\n\t/** Maximum results to return */\n\tlimit?: number;\n\t/** Offset for pagination */\n\toffset?: number;\n\t/** Language code */\n\tlanguage?: string;\n\t/** Region code */\n\tregion?: string;\n\t/** Date range filter */\n\tdateRange?: {\n\t\tstart?: Date;\n\t\tend?: Date;\n\t};\n\t/** File type filter */\n\tfileType?: string;\n\t/** Limit to specific site */\n\tsite?: string;\n\t/** Sort order */\n\tsortBy?: \"relevance\" | \"date\" | \"popularity\";\n\t/** Safe search level */\n\tsafeSearch?: \"strict\" | \"moderate\" | \"off\";\n}\n\n/**\n * A single search result.\n */\nexport interface SearchResult {\n\t/** Result title */\n\ttitle: string;\n\t/** Result URL */\n\turl: string;\n\t/** Result description/snippet */\n\tdescription: string;\n\t/** Display URL */\n\tdisplayUrl?: string;\n\t/** Thumbnail URL */\n\tthumbnail?: string;\n\t/** Published date */\n\tpublishedDate?: Date;\n\t/** Source name */\n\tsource?: string;\n\t/** Relevance score */\n\trelevanceScore?: number;\n\t/** Text snippet */\n\tsnippet?: string;\n}\n\n/**\n * Search response containing results.\n */\nexport interface SearchResponse {\n\t/** Original query */\n\tquery: string;\n\t/** Search results */\n\tresults: SearchResult[];\n\t/** Total available results */\n\ttotalResults?: number;\n\t/** Search time in seconds */\n\tsearchTime?: number;\n\t/** Query suggestions */\n\tsuggestions?: string[];\n\t/** Token for next page */\n\tnextPageToken?: string;\n\t/** Related search queries */\n\trelatedSearches?: string[];\n}\n\n/**\n * News search options.\n */\nexport interface NewsSearchOptions extends SearchOptions {\n\t/** News category */\n\tcategory?:\n\t\t| \"general\"\n\t\t| \"business\"\n\t\t| \"entertainment\"\n\t\t| \"health\"\n\t\t| \"science\"\n\t\t| \"sports\"\n\t\t| \"technology\";\n\t/** Freshness filter */\n\tfreshness?: \"day\" | \"week\" | \"month\";\n}\n\n/**\n * Image search options.\n */\nexport interface ImageSearchOptions extends SearchOptions {\n\t/** Image size filter */\n\tsize?: \"small\" | \"medium\" | \"large\" | \"wallpaper\" | \"any\";\n\t/** Color filter */\n\tcolor?:\n\t\t| \"color\"\n\t\t| \"monochrome\"\n\t\t| \"red\"\n\t\t| \"orange\"\n\t\t| \"yellow\"\n\t\t| \"green\"\n\t\t| \"blue\"\n\t\t| \"purple\"\n\t\t| \"pink\"\n\t\t| \"brown\"\n\t\t| \"black\"\n\t\t| \"gray\"\n\t\t| \"white\";\n\t/** Image type filter */\n\ttype?: \"photo\" | \"clipart\" | \"line\" | \"animated\";\n\t/** Image layout filter */\n\tlayout?: \"square\" | \"wide\" | \"tall\" | \"any\";\n\t/** License filter */\n\tlicense?: \"any\" | \"public\" | \"share\" | \"sharecommercially\" | \"modify\";\n}\n\n/**\n * Video search options.\n */\nexport interface VideoSearchOptions extends SearchOptions {\n\t/** Duration filter */\n\tduration?: \"short\" | \"medium\" | \"long\" | \"any\";\n\t/** Resolution filter */\n\tresolution?: \"high\" | \"standard\" | \"any\";\n\t/** Quality filter */\n\tquality?: \"high\" | \"standard\" | \"any\";\n}\n\n// ============================================================================\n// Email Interfaces\n// ============================================================================\n\n/**\n * Email address with optional name.\n */\nexport interface EmailAddress {\n\t/** Email address */\n\temail: string;\n\t/** Display name */\n\tname?: string;\n}\n\n/**\n * Email attachment.\n */\nexport interface EmailAttachment {\n\t/** Filename */\n\tfilename: string;\n\t/** Content as buffer or base64 string */\n\tcontent: Buffer | string;\n\t/** MIME type */\n\tcontentType?: string;\n\t/** Content disposition */\n\tcontentDisposition?: \"attachment\" | \"inline\";\n\t/** Content ID for inline attachments */\n\tcid?: string;\n}\n\n/**\n * Email message.\n */\nexport interface EmailMessage {\n\t/** Sender address */\n\tfrom: EmailAddress;\n\t/** Recipients */\n\tto: EmailAddress[];\n\t/** CC recipients */\n\tcc?: EmailAddress[];\n\t/** BCC recipients */\n\tbcc?: EmailAddress[];\n\t/** Email subject */\n\tsubject: string;\n\t/** Plain text body */\n\ttext?: string;\n\t/** HTML body */\n\thtml?: string;\n\t/** Attachments */\n\tattachments?: EmailAttachment[];\n\t/** Reply-to address */\n\treplyTo?: EmailAddress;\n\t/** Send date */\n\tdate?: Date;\n\t/** Message ID */\n\tmessageId?: string;\n\t/** References header */\n\treferences?: string[];\n\t/** In-Reply-To header */\n\tinReplyTo?: string;\n\t/** Priority level */\n\tpriority?: \"high\" | \"normal\" | \"low\";\n}\n\n/**\n * Email send options.\n */\nexport interface EmailSendOptions {\n\t/** Number of retries */\n\tretry?: number;\n\t/** Timeout in milliseconds */\n\ttimeout?: number;\n\t/** Track email opens */\n\ttrackOpens?: boolean;\n\t/** Track link clicks */\n\ttrackClicks?: boolean;\n\t/** Tags for categorization */\n\ttags?: string[];\n}\n\n/**\n * Email search options.\n */\nexport interface EmailSearchOptions {\n\t/** Search query */\n\tquery?: string;\n\t/** Filter by sender */\n\tfrom?: string;\n\t/** Filter by recipient */\n\tto?: string;\n\t/** Filter by subject */\n\tsubject?: string;\n\t/** Filter by folder */\n\tfolder?: string;\n\t/** Filter emails since date */\n\tsince?: Date;\n\t/** Filter emails before date */\n\tbefore?: Date;\n\t/** Maximum results */\n\tlimit?: number;\n\t/** Offset for pagination */\n\toffset?: number;\n\t/** Filter unread only */\n\tunread?: boolean;\n\t/** Filter flagged only */\n\tflagged?: boolean;\n\t/** Filter with attachments only */\n\thasAttachments?: boolean;\n}\n\n/**\n * Email folder.\n */\nexport interface EmailFolder {\n\t/** Folder name */\n\tname: string;\n\t/** Folder path */\n\tpath: string;\n\t/** Folder type */\n\ttype: \"inbox\" | \"sent\" | \"drafts\" | \"trash\" | \"spam\" | \"custom\";\n\t/** Total message count */\n\tmessageCount?: number;\n\t/** Unread message count */\n\tunreadCount?: number;\n\t/** Child folders */\n\tchildren?: EmailFolder[];\n}\n\n/**\n * Email account information.\n */\nexport interface EmailAccount {\n\t/** Email address */\n\temail: string;\n\t/** Display name */\n\tname?: string;\n\t/** Email provider */\n\tprovider?: string;\n\t/** Available folders */\n\tfolders?: EmailFolder[];\n\t/** Storage used in bytes */\n\tquotaUsed?: number;\n\t/** Storage limit in bytes */\n\tquotaLimit?: number;\n}\n\n// ============================================================================\n// Message Interfaces\n// ============================================================================\n\n/**\n * Message participant information.\n */\nexport interface MessageParticipant {\n\t/** Participant ID */\n\tid: UUID;\n\t/** Display name */\n\tname: string;\n\t/** Username */\n\tusername?: string;\n\t/** Avatar URL */\n\tavatar?: string;\n\t/** Online status */\n\tstatus?: \"online\" | \"offline\" | \"away\" | \"busy\";\n}\n\n/**\n * Message attachment.\n */\nexport interface MessageAttachment {\n\t/** Attachment ID */\n\tid: UUID;\n\t/** Filename */\n\tfilename: string;\n\t/** File URL */\n\turl: string;\n\t/** MIME type */\n\tmimeType: string;\n\t/** File size in bytes */\n\tsize: number;\n\t/** Width for images/videos */\n\twidth?: number;\n\t/** Height for images/videos */\n\theight?: number;\n\t/** Duration for audio/video */\n\tduration?: number;\n\t/** Thumbnail URL */\n\tthumbnail?: string;\n}\n\n/**\n * Message reaction.\n */\nexport interface MessageReaction {\n\t/** Emoji used */\n\temoji: string;\n\t/** Number of reactions */\n\tcount: number;\n\t/** User IDs who reacted */\n\tusers: UUID[];\n\t/** Whether current user has reacted */\n\thasReacted: boolean;\n}\n\n/**\n * Message reference (reply/forward/quote).\n */\nexport interface MessageReference {\n\t/** Referenced message ID */\n\tmessageId: UUID;\n\t/** Channel of referenced message */\n\tchannelId: UUID;\n\t/** Type of reference */\n\ttype: \"reply\" | \"forward\" | \"quote\";\n}\n\n/**\n * Message content.\n */\nexport interface MessageContent {\n\t/** Plain text content */\n\ttext?: string;\n\t/** HTML content */\n\thtml?: string;\n\t/** Markdown content */\n\tmarkdown?: string;\n\t/** Attachments */\n\tattachments?: MessageAttachment[];\n\t/** Reactions */\n\treactions?: MessageReaction[];\n\t/** Reference to another message */\n\treference?: MessageReference;\n\t/** Mentioned user IDs */\n\tmentions?: UUID[];\n\t/** Embedded content */\n\tembeds?: Array<{\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\turl?: string;\n\t\timage?: string;\n\t\tfields?: Array<{\n\t\t\tname: string;\n\t\t\tvalue: string;\n\t\t\tinline?: boolean;\n\t\t}>;\n\t}>;\n}\n\n/**\n * Message information.\n */\nexport interface MessageInfo {\n\t/** Message ID */\n\tid: UUID;\n\t/** Channel ID */\n\tchannelId: UUID;\n\t/** Sender ID */\n\tsenderId: UUID;\n\t/** Message content */\n\tcontent: MessageContent;\n\t/** Sent timestamp */\n\ttimestamp: Date;\n\t/** Edit timestamp */\n\tedited?: Date;\n\t/** Deletion timestamp */\n\tdeleted?: Date;\n\t/** Whether message is pinned */\n\tpinned?: boolean;\n\t/** Thread information */\n\tthread?: {\n\t\tid: UUID;\n\t\tmessageCount: number;\n\t\tparticipants: UUID[];\n\t\tlastMessageAt: Date;\n\t};\n}\n\n/**\n * Message send options.\n */\nexport interface MessageSendOptions {\n\t/** Reply to message ID */\n\treplyTo?: UUID;\n\t/** Ephemeral (only visible to sender) */\n\tephemeral?: boolean;\n\t/** Silent (no notification) */\n\tsilent?: boolean;\n\t/** Scheduled send time */\n\tscheduled?: Date;\n\t/** Thread ID */\n\tthread?: UUID;\n\t/** Nonce for deduplication */\n\tnonce?: string;\n}\n\n/**\n * Message search options.\n */\nexport interface MessageSearchOptions {\n\t/** Search query */\n\tquery?: string;\n\t/** Filter by channel */\n\tchannelId?: UUID;\n\t/** Filter by sender */\n\tsenderId?: UUID;\n\t/** Filter messages before date */\n\tbefore?: Date;\n\t/** Filter messages after date */\n\tafter?: Date;\n\t/** Maximum results */\n\tlimit?: number;\n\t/** Offset for pagination */\n\toffset?: number;\n\t/** Filter with attachments only */\n\thasAttachments?: boolean;\n\t/** Filter pinned only */\n\tpinned?: boolean;\n\t/** Filter mentioning user */\n\tmentions?: UUID;\n}\n\n/**\n * Message channel.\n */\nexport interface MessageChannel {\n\t/** Channel ID */\n\tid: UUID;\n\t/** Channel name */\n\tname: string;\n\t/** Channel type */\n\ttype: \"text\" | \"voice\" | \"dm\" | \"group\" | \"announcement\" | \"thread\";\n\t/** Channel description */\n\tdescription?: string;\n\t/** Channel participants */\n\tparticipants?: MessageParticipant[];\n\t/** User permissions */\n\tpermissions?: {\n\t\tcanSend: boolean;\n\t\tcanRead: boolean;\n\t\tcanDelete: boolean;\n\t\tcanPin: boolean;\n\t\tcanManage: boolean;\n\t};\n\t/** Last message timestamp */\n\tlastMessageAt?: Date;\n\t/** Total message count */\n\tmessageCount?: number;\n\t/** Unread message count */\n\tunreadCount?: number;\n}\n\n// ============================================================================\n// Post/Social Media Interfaces\n// ============================================================================\n\n/**\n * Post media content.\n */\nexport interface PostMedia {\n\t/** Media ID */\n\tid: UUID;\n\t/** Media URL */\n\turl: string;\n\t/** Media type */\n\ttype: \"image\" | \"video\" | \"audio\" | \"document\";\n\t/** MIME type */\n\tmimeType: string;\n\t/** File size in bytes */\n\tsize: number;\n\t/** Width for images/videos */\n\twidth?: number;\n\t/** Height for images/videos */\n\theight?: number;\n\t/** Duration for audio/video */\n\tduration?: number;\n\t/** Thumbnail URL */\n\tthumbnail?: string;\n\t/** Description */\n\tdescription?: string;\n\t/** Alt text for accessibility */\n\taltText?: string;\n}\n\n/**\n * Post location.\n */\nexport interface PostLocation {\n\t/** Location name */\n\tname: string;\n\t/** Address */\n\taddress?: string;\n\t/** Coordinates */\n\tcoordinates?: {\n\t\tlatitude: number;\n\t\tlongitude: number;\n\t};\n\t/** Place ID from location service */\n\tplaceId?: string;\n}\n\n/**\n * Post author information.\n */\nexport interface PostAuthor {\n\t/** Author ID */\n\tid: UUID;\n\t/** Username */\n\tusername: string;\n\t/** Display name */\n\tdisplayName: string;\n\t/** Avatar URL */\n\tavatar?: string;\n\t/** Verified badge */\n\tverified?: boolean;\n\t/** Follower count */\n\tfollowerCount?: number;\n\t/** Following count */\n\tfollowingCount?: number;\n\t/** Bio */\n\tbio?: string;\n\t/** Website URL */\n\twebsite?: string;\n}\n\n/**\n * Post engagement metrics.\n */\nexport interface PostEngagement {\n\t/** Number of likes */\n\tlikes: number;\n\t/** Number of shares */\n\tshares: number;\n\t/** Number of comments */\n\tcomments: number;\n\t/** Number of views */\n\tviews?: number;\n\t/** Whether current user has liked */\n\thasLiked: boolean;\n\t/** Whether current user has shared */\n\thasShared: boolean;\n\t/** Whether current user has commented */\n\thasCommented: boolean;\n\t/** Whether current user has saved */\n\thasSaved: boolean;\n}\n\n/**\n * Post content.\n */\nexport interface PostContent {\n\t/** Text content */\n\ttext?: string;\n\t/** HTML content */\n\thtml?: string;\n\t/** Media attachments */\n\tmedia?: PostMedia[];\n\t/** Location */\n\tlocation?: PostLocation;\n\t/** Hashtags */\n\ttags?: string[];\n\t/** Mentioned user IDs */\n\tmentions?: UUID[];\n\t/** Link previews */\n\tlinks?: Array<{\n\t\turl: string;\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\timage?: string;\n\t}>;\n\t/** Poll */\n\tpoll?: {\n\t\tquestion: string;\n\t\toptions: Array<{\n\t\t\ttext: string;\n\t\t\tvotes: number;\n\t\t}>;\n\t\texpiresAt?: Date;\n\t\tmultipleChoice?: boolean;\n\t};\n}\n\n/**\n * Post information.\n */\nexport interface PostInfo {\n\t/** Post ID */\n\tid: UUID;\n\t/** Post author */\n\tauthor: PostAuthor;\n\t/** Post content */\n\tcontent: PostContent;\n\t/** Platform name */\n\tplatform: string;\n\t/** Platform-specific ID */\n\tplatformId: string;\n\t/** Post URL */\n\turl: string;\n\t/** Created timestamp */\n\tcreatedAt: Date;\n\t/** Edited timestamp */\n\teditedAt?: Date;\n\t/** Scheduled timestamp */\n\tscheduledAt?: Date;\n\t/** Engagement metrics */\n\tengagement: PostEngagement;\n\t/** Visibility level */\n\tvisibility: \"public\" | \"private\" | \"followers\" | \"friends\" | \"unlisted\";\n\t/** Reply to post ID */\n\treplyTo?: UUID;\n\t/** Thread information */\n\tthread?: {\n\t\tid: UUID;\n\t\tposition: number;\n\t\ttotal: number;\n\t};\n\t/** Cross-post information */\n\tcrossPosted?: Array<{\n\t\tplatform: string;\n\t\tplatformId: string;\n\t\turl: string;\n\t}>;\n}\n\n/**\n * Post creation options.\n */\nexport interface PostCreateOptions {\n\t/** Target platforms */\n\tplatforms?: string[];\n\t/** Scheduled time */\n\tscheduledAt?: Date;\n\t/** Visibility level */\n\tvisibility?: PostInfo[\"visibility\"];\n\t/** Reply to post ID */\n\treplyTo?: UUID;\n\t/** Create as thread */\n\tthread?: boolean;\n\t/** Location */\n\tlocation?: PostLocation;\n\t/** Hashtags */\n\ttags?: string[];\n\t/** Mentioned user IDs */\n\tmentions?: UUID[];\n\t/** Enable comments */\n\tenableComments?: boolean;\n\t/** Enable sharing */\n\tenableSharing?: boolean;\n\t/** Content warning */\n\tcontentWarning?: string;\n\t/** Mark as sensitive */\n\tsensitive?: boolean;\n}\n\n/**\n * Post search options.\n */\nexport interface PostSearchOptions {\n\t/** Search query */\n\tquery?: string;\n\t/** Filter by author */\n\tauthor?: UUID;\n\t/** Filter by platform */\n\tplatform?: string;\n\t/** Filter by tags */\n\ttags?: string[];\n\t/** Filter by mentions */\n\tmentions?: UUID[];\n\t/** Filter posts since date */\n\tsince?: Date;\n\t/** Filter posts before date */\n\tbefore?: Date;\n\t/** Maximum results */\n\tlimit?: number;\n\t/** Offset for pagination */\n\toffset?: number;\n\t/** Filter with media only */\n\thasMedia?: boolean;\n\t/** Filter with location only */\n\thasLocation?: boolean;\n\t/** Filter by visibility */\n\tvisibility?: PostInfo[\"visibility\"];\n\t/** Sort order */\n\tsortBy?: \"date\" | \"engagement\" | \"relevance\";\n}\n\n/**\n * Post analytics.\n */\nexport interface PostAnalytics {\n\t/** Post ID */\n\tpostId: UUID;\n\t/** Platform name */\n\tplatform: string;\n\t/** Total impressions */\n\timpressions: number;\n\t/** Unique reach */\n\treach: number;\n\t/** Engagement metrics */\n\tengagement: PostEngagement;\n\t/** Link clicks */\n\tclicks: number;\n\t/** Shares */\n\tshares: number;\n\t/** Saves */\n\tsaves: number;\n\t/** Demographics */\n\tdemographics?: {\n\t\tage?: Record<string, number>;\n\t\tgender?: Record<string, number>;\n\t\tlocation?: Record<string, number>;\n\t};\n\t/** Top performing hours */\n\ttopPerformingHours?: Array<{\n\t\thour: number;\n\t\tengagement: number;\n\t}>;\n}\n",
377
377
  "/**\n * Tool Policy Types\n *\n * Types and definitions for tool/action filtering and permissions in elizaOS.\n *\n * @module tools\n */\n\n// Re-export from channel-config to avoid duplication\nexport type { ToolPolicyConfig, ToolProfileId } from \"./channel-config\";\n\nimport type { ToolPolicyConfig, ToolProfileId } from \"./channel-config\";\n\n/**\n * Canonical tool name aliases for backward compatibility.\n * Maps legacy names to canonical names.\n */\nexport const TOOL_NAME_ALIASES: Record<string, string> = {\n\tbash: \"exec\",\n\t\"apply-patch\": \"apply_patch\",\n};\n\n/**\n * Predefined tool groups for easier policy configuration.\n * Use \"group:<name>\" syntax in policy configs (e.g., \"group:fs\").\n */\nexport const TOOL_GROUPS: Record<string, string[]> = {\n\t// Memory tools (provided by plugin-scratchpad)\n\t\"group:memory\": [\n\t\t\"scratchpad_search\",\n\t\t\"scratchpad_read\",\n\t\t\"read_attachment\",\n\t\t\"remove_from_scratchpad\",\n\t],\n\t// Web tools\n\t\"group:web\": [\"web_search\", \"web_fetch\"],\n\t// Basic workspace/file tools\n\t\"group:fs\": [\"read\", \"read_file\", \"write\", \"edit\", \"apply_patch\"],\n\t// Host/runtime execution tools\n\t\"group:runtime\": [\"exec\", \"process\"],\n\t// Session management tools\n\t\"group:sessions\": [\n\t\t\"sessions_list\",\n\t\t\"sessions_history\",\n\t\t\"sessions_send\",\n\t\t\"sessions_spawn\",\n\t\t\"session_status\",\n\t],\n\t// UI helpers\n\t\"group:ui\": [\"browser\", \"canvas\"],\n\t// Automation + infra\n\t\"group:automation\": [\"cron\", \"gateway\"],\n\t// Messaging surface\n\t\"group:messaging\": [\"message\"],\n\t// Nodes + device tools\n\t\"group:nodes\": [\"nodes\"],\n\t// All native tools (excludes provider plugins)\n\t\"group:all\": [\n\t\t\"browser\",\n\t\t\"canvas\",\n\t\t\"nodes\",\n\t\t\"cron\",\n\t\t\"message\",\n\t\t\"gateway\",\n\t\t\"agents_list\",\n\t\t\"sessions_list\",\n\t\t\"sessions_history\",\n\t\t\"sessions_send\",\n\t\t\"sessions_spawn\",\n\t\t\"session_status\",\n\t\t\"scratchpad_search\",\n\t\t\"scratchpad_read\",\n\t\t\"read_attachment\",\n\t\t\"read_file\",\n\t\t\"remove_from_scratchpad\",\n\t\t\"web_search\",\n\t\t\"web_fetch\",\n\t\t\"image\",\n\t\t\"read\",\n\t\t\"write\",\n\t\t\"edit\",\n\t\t\"apply_patch\",\n\t\t\"exec\",\n\t\t\"process\",\n\t],\n};\n\n/**\n * Predefined tool profiles with default allow/deny policies.\n */\nexport const TOOL_PROFILES: Record<ToolProfileId, ToolPolicyConfig> = {\n\tminimal: {\n\t\tallow: [\"session_status\"],\n\t},\n\tcoding: {\n\t\tallow: [\n\t\t\t\"group:fs\",\n\t\t\t\"group:runtime\",\n\t\t\t\"group:sessions\",\n\t\t\t\"group:memory\",\n\t\t\t\"image\",\n\t\t],\n\t},\n\tmessaging: {\n\t\tallow: [\n\t\t\t\"group:messaging\",\n\t\t\t\"sessions_list\",\n\t\t\t\"sessions_history\",\n\t\t\t\"sessions_send\",\n\t\t\t\"session_status\",\n\t\t],\n\t},\n\tfull: {\n\t\t// No restrictions - all tools allowed\n\t},\n};\n\n/**\n * Plugin tool groups for dynamic tool resolution.\n */\nexport interface PluginToolGroups {\n\t/** All tool names from plugins */\n\tall: string[];\n\t/** Tool names organized by plugin ID */\n\tbyPlugin: Map<string, string[]>;\n}\n\n/**\n * Result of allowlist resolution with diagnostics.\n */\nexport interface AllowlistResolution {\n\t/** The resolved policy after processing */\n\tpolicy: ToolPolicyConfig | undefined;\n\t/** Entries in the allowlist that weren't recognized */\n\tunknownAllowlist: string[];\n\t/** Whether the allowlist was stripped (contained only plugin tools) */\n\tstrippedAllowlist: boolean;\n}\n\n/**\n * Tool policy evaluation options.\n */\nexport interface ToolPolicyEvaluationOptions {\n\t/** The character's tool profile */\n\tprofile?: ToolProfileId;\n\t/** Character-level tool policy overrides */\n\tcharacterPolicy?: ToolPolicyConfig;\n\t/** Channel-specific tool policy overrides */\n\tchannelPolicy?: ToolPolicyConfig;\n\t/** Provider-specific tool policy overrides */\n\tproviderPolicy?: ToolPolicyConfig;\n\t/** Plugin tool groups for resolution */\n\tpluginGroups?: PluginToolGroups;\n\t/** Set of core tool names for validation */\n\tcoreTools?: Set<string>;\n}\n\n/**\n * Tool policy evaluation result.\n */\nexport interface ToolPolicyResult {\n\t/** Whether the tool is allowed */\n\tallowed: boolean;\n\t/** Reason for the decision */\n\treason: string;\n\t/** The effective policy after merging */\n\teffectivePolicy: ToolPolicyConfig;\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Normalize a tool name to its canonical form.\n * Handles aliases and case normalization.\n *\n * @param name - The tool name to normalize\n * @returns The canonical tool name\n */\nexport function normalizeToolName(name: string): string {\n\tconst normalized = name.trim().toLowerCase();\n\treturn TOOL_NAME_ALIASES[normalized] ?? normalized;\n}\n\n/**\n * Normalize a list of tool names.\n *\n * @param list - The list of tool names to normalize\n * @returns Normalized list with empty entries filtered out\n */\nexport function normalizeToolList(list?: string[]): string[] {\n\tif (!list) {\n\t\treturn [];\n\t}\n\treturn list.map(normalizeToolName).filter(Boolean);\n}\n\n/**\n * Expand tool groups in a list to their constituent tools.\n * Handles both group references (e.g., \"group:fs\") and individual tools.\n *\n * @param list - The list containing tool names and/or group references\n * @returns Expanded list with all groups resolved to individual tools\n */\nexport function expandToolGroups(list?: string[]): string[] {\n\tconst normalized = normalizeToolList(list);\n\tconst expanded: string[] = [];\n\n\tfor (const value of normalized) {\n\t\tconst group = TOOL_GROUPS[value];\n\t\tif (group) {\n\t\t\texpanded.push(...group);\n\t\t\tcontinue;\n\t\t}\n\t\texpanded.push(value);\n\t}\n\n\treturn Array.from(new Set(expanded));\n}\n\n/**\n * Resolve a tool profile to its policy configuration.\n *\n * @param profile - The profile ID to resolve\n * @returns The policy configuration, or undefined if profile is invalid\n */\nexport function resolveToolProfilePolicy(\n\tprofile?: string,\n): ToolPolicyConfig | undefined {\n\tif (!profile) {\n\t\treturn undefined;\n\t}\n\tconst resolved = TOOL_PROFILES[profile as ToolProfileId];\n\tif (!resolved) {\n\t\treturn undefined;\n\t}\n\t// Return undefined for 'full' profile (no restrictions)\n\tif (!resolved.allow && !resolved.deny) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tallow: resolved.allow ? [...resolved.allow] : undefined,\n\t\tdeny: resolved.deny ? [...resolved.deny] : undefined,\n\t};\n}\n\n/**\n * Collect all explicit allow entries from multiple policies.\n *\n * @param policies - Array of policies to collect from\n * @returns Combined allowlist entries\n */\nexport function collectExplicitAllowlist(\n\tpolicies: Array<ToolPolicyConfig | undefined>,\n): string[] {\n\tconst entries: string[] = [];\n\n\tfor (const policy of policies) {\n\t\tif (!policy?.allow) {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const value of policy.allow) {\n\t\t\tif (typeof value !== \"string\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst trimmed = value.trim();\n\t\t\tif (trimmed) {\n\t\t\t\tentries.push(trimmed);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn entries;\n}\n\n/**\n * Build plugin tool groups from a list of tools with metadata.\n *\n * @param params - Tools and metadata accessor\n * @returns Plugin tool groups organized by plugin ID\n */\nexport function buildPluginToolGroups<T extends { name: string }>(params: {\n\ttools: T[];\n\ttoolMeta: (tool: T) => { pluginId: string } | undefined;\n}): PluginToolGroups {\n\tconst all: string[] = [];\n\tconst byPlugin = new Map<string, string[]>();\n\n\tfor (const tool of params.tools) {\n\t\tconst meta = params.toolMeta(tool);\n\t\tif (!meta) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst name = normalizeToolName(tool.name);\n\t\tall.push(name);\n\t\tconst pluginId = meta.pluginId.toLowerCase();\n\t\tconst list = byPlugin.get(pluginId) ?? [];\n\t\tlist.push(name);\n\t\tbyPlugin.set(pluginId, list);\n\t}\n\n\treturn { all, byPlugin };\n}\n\n/**\n * Expand plugin group references in a list.\n *\n * @param list - The list containing potential plugin group references\n * @param groups - Plugin tool groups for resolution\n * @returns Expanded list with plugin groups resolved\n */\nexport function expandPluginGroups(\n\tlist: string[] | undefined,\n\tgroups: PluginToolGroups,\n): string[] | undefined {\n\tif (!list || list.length === 0) {\n\t\treturn list;\n\t}\n\n\tconst expanded: string[] = [];\n\tfor (const entry of list) {\n\t\tconst normalized = normalizeToolName(entry);\n\t\tif (normalized === \"group:plugins\") {\n\t\t\tif (groups.all.length > 0) {\n\t\t\t\texpanded.push(...groups.all);\n\t\t\t} else {\n\t\t\t\texpanded.push(normalized);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst tools = groups.byPlugin.get(normalized);\n\t\tif (tools && tools.length > 0) {\n\t\t\texpanded.push(...tools);\n\t\t\tcontinue;\n\t\t}\n\t\texpanded.push(normalized);\n\t}\n\n\treturn Array.from(new Set(expanded));\n}\n\n/**\n * Expand a policy with plugin group resolution.\n *\n * @param policy - The policy to expand\n * @param groups - Plugin tool groups for resolution\n * @returns Policy with plugin groups expanded\n */\nexport function expandPolicyWithPluginGroups(\n\tpolicy: ToolPolicyConfig | undefined,\n\tgroups: PluginToolGroups,\n): ToolPolicyConfig | undefined {\n\tif (!policy) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tallow: expandPluginGroups(policy.allow, groups),\n\t\tdeny: expandPluginGroups(policy.deny, groups),\n\t};\n}\n\n/**\n * Strip plugin-only allowlist to prevent accidentally disabling core tools.\n * When an allowlist contains only plugin tools, we remove it to avoid\n * inadvertently blocking core functionality.\n *\n * @param policy - The policy to check\n * @param groups - Plugin tool groups\n * @param coreTools - Set of core tool names\n * @returns Resolution result with diagnostic information\n */\nexport function stripPluginOnlyAllowlist(\n\tpolicy: ToolPolicyConfig | undefined,\n\tgroups: PluginToolGroups,\n\tcoreTools: Set<string>,\n): AllowlistResolution {\n\tif (!policy?.allow || policy.allow.length === 0) {\n\t\treturn { policy, unknownAllowlist: [], strippedAllowlist: false };\n\t}\n\n\tconst normalized = normalizeToolList(policy.allow);\n\tif (normalized.length === 0) {\n\t\treturn { policy, unknownAllowlist: [], strippedAllowlist: false };\n\t}\n\n\tconst pluginIds = new Set(groups.byPlugin.keys());\n\tconst pluginTools = new Set(groups.all);\n\tconst unknownAllowlist: string[] = [];\n\tlet hasCoreEntry = false;\n\n\tfor (const entry of normalized) {\n\t\tif (entry === \"*\") {\n\t\t\thasCoreEntry = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst isPluginEntry =\n\t\t\tentry === \"group:plugins\" ||\n\t\t\tpluginIds.has(entry) ||\n\t\t\tpluginTools.has(entry);\n\t\tconst expanded = expandToolGroups([entry]);\n\t\tconst isCoreEntry = expanded.some((tool) => coreTools.has(tool));\n\t\tif (isCoreEntry) {\n\t\t\thasCoreEntry = true;\n\t\t}\n\t\tif (!isCoreEntry && !isPluginEntry) {\n\t\t\tunknownAllowlist.push(entry);\n\t\t}\n\t}\n\n\tconst strippedAllowlist = !hasCoreEntry;\n\n\treturn {\n\t\tpolicy: strippedAllowlist ? { ...policy, allow: undefined } : policy,\n\t\tunknownAllowlist: Array.from(new Set(unknownAllowlist)),\n\t\tstrippedAllowlist,\n\t};\n}\n\n/**\n * Merge multiple tool policies into a single effective policy.\n * Later policies take precedence for conflicts.\n *\n * @param policies - Policies to merge in order of precedence\n * @returns Merged policy\n */\nexport function mergeToolPolicies(\n\t...policies: Array<ToolPolicyConfig | undefined>\n): ToolPolicyConfig {\n\tconst result: ToolPolicyConfig = {};\n\n\tfor (const policy of policies) {\n\t\tif (!policy) continue;\n\n\t\tif (policy.allow !== undefined) {\n\t\t\t// If a more specific policy has an allow list, it replaces (not merges)\n\t\t\tresult.allow = [...(policy.allow || [])];\n\t\t}\n\n\t\tif (policy.deny !== undefined) {\n\t\t\t// Deny lists are additive - combine them\n\t\t\tresult.deny = [...(result.deny || []), ...(policy.deny || [])];\n\t\t}\n\t}\n\n\t// Deduplicate\n\tif (result.allow) {\n\t\tresult.allow = Array.from(new Set(result.allow));\n\t}\n\tif (result.deny) {\n\t\tresult.deny = Array.from(new Set(result.deny));\n\t}\n\n\treturn result;\n}\n\n/**\n * Check if a tool is allowed by a policy.\n *\n * @param toolName - The tool name to check\n * @param policy - The policy to evaluate against\n * @returns Whether the tool is allowed\n */\nexport function isToolAllowedByPolicy(\n\ttoolName: string,\n\tpolicy: ToolPolicyConfig | undefined,\n): boolean {\n\tconst normalizedName = normalizeToolName(toolName);\n\n\t// No policy means all tools allowed\n\tif (!policy) {\n\t\treturn true;\n\t}\n\n\t// Check deny list first (deny takes precedence)\n\tif (policy.deny && policy.deny.length > 0) {\n\t\tconst expandedDeny = expandToolGroups(policy.deny);\n\t\tif (expandedDeny.includes(normalizedName)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Check allow list\n\tif (policy.allow && policy.allow.length > 0) {\n\t\tconst expandedAllow = expandToolGroups(policy.allow);\n\t\t// Wildcard allows everything not denied\n\t\tif (expandedAllow.includes(\"*\")) {\n\t\t\treturn true;\n\t\t}\n\t\treturn expandedAllow.includes(normalizedName);\n\t}\n\n\t// No allow list means all tools allowed (if not denied)\n\treturn true;\n}\n",
378
- "import type { UUID } from \"./primitives\";\n\nexport const TRIGGER_SCHEMA_VERSION = 1 as const;\n\nexport type TriggerType = \"interval\" | \"once\" | \"cron\";\nexport type TriggerWakeMode = \"inject_now\" | \"next_autonomy_cycle\";\nexport type TriggerLastStatus = \"success\" | \"error\" | \"skipped\";\nexport type TriggerKind = \"text\" | \"workflow\";\n\nexport interface TriggerConfig {\n\tversion: typeof TRIGGER_SCHEMA_VERSION;\n\ttriggerId: UUID;\n\tdisplayName: string;\n\tinstructions: string;\n\ttriggerType: TriggerType;\n\tenabled: boolean;\n\twakeMode: TriggerWakeMode;\n\tcreatedBy: string;\n\ttimezone?: string;\n\tintervalMs?: number;\n\tscheduledAtIso?: string;\n\tcronExpression?: string;\n\tmaxRuns?: number;\n\trunCount: number;\n\tnextRunAtMs?: number;\n\tlastRunAtIso?: string;\n\tlastStatus?: TriggerLastStatus;\n\tlastError?: string;\n\tdedupeKey?: string;\n\t// When undefined, treat as \"text\" for back-compat.\n\tkind?: TriggerKind;\n\tworkflowId?: string;\n\tworkflowName?: string;\n}\n\nexport interface TriggerRunRecord {\n\ttriggerRunId: UUID;\n\ttriggerId: UUID;\n\ttaskId: UUID;\n\tstartedAt: number;\n\tfinishedAt: number;\n\tstatus: TriggerLastStatus;\n\terror?: string;\n\tlatencyMs: number;\n\tsource: \"scheduler\" | \"manual\";\n}\n",
378
+ "import type { UUID } from \"./primitives\";\n\nexport const TRIGGER_SCHEMA_VERSION = 1 as const;\n\nexport type TriggerType = \"interval\" | \"once\" | \"cron\" | \"event\";\nexport type TriggerWakeMode = \"inject_now\" | \"next_autonomy_cycle\";\nexport type TriggerLastStatus = \"success\" | \"error\" | \"skipped\";\nexport type TriggerKind = \"text\" | \"workflow\";\n\nexport interface TriggerConfig {\n\tversion: typeof TRIGGER_SCHEMA_VERSION;\n\ttriggerId: UUID;\n\tdisplayName: string;\n\tinstructions: string;\n\ttriggerType: TriggerType;\n\tenabled: boolean;\n\twakeMode: TriggerWakeMode;\n\tcreatedBy: string;\n\ttimezone?: string;\n\tintervalMs?: number;\n\tscheduledAtIso?: string;\n\tcronExpression?: string;\n\teventKind?: string;\n\tmaxRuns?: number;\n\trunCount: number;\n\tnextRunAtMs?: number;\n\tlastRunAtIso?: string;\n\tlastStatus?: TriggerLastStatus;\n\tlastError?: string;\n\tdedupeKey?: string;\n\t// When undefined, treat as \"text\" for back-compat.\n\tkind?: TriggerKind;\n\tworkflowId?: string;\n\tworkflowName?: string;\n}\n\nexport interface TriggerRunRecord {\n\ttriggerRunId: UUID;\n\ttriggerId: UUID;\n\ttaskId: UUID;\n\tstartedAt: number;\n\tfinishedAt: number;\n\tstatus: TriggerLastStatus;\n\terror?: string;\n\tlatencyMs: number;\n\tsource: \"scheduler\" | \"manual\" | \"event\";\n\teventKind?: string;\n}\n",
379
379
  "// Core types\n\nexport { logger } from \"../logger\";\n// Utilities that are part of the public API.\nexport { addHeader, composePromptFromState, parseKeyValueXml } from \"../utils\";\nexport * from \"./agent\";\n// Channel configuration types for plugins\nexport * from \"./channel-config\";\nexport * from \"./components\";\nexport * from \"./database\";\nexport * from \"./environment\";\nexport * from \"./events\";\nexport * from \"./hook\";\nexport * from \"./knowledge\";\nexport * from \"./memory\";\nexport * from \"./memory-storage\";\nexport * from \"./messaging\";\nexport * from \"./model\";\n// Onboarding types\nexport * from \"./onboarding\";\nexport * from \"./pairing\";\nexport * from \"./payment\";\nexport * from \"./pipeline-hooks\";\nexport * from \"./plugin\";\nexport * from \"./plugin-store\";\nexport * from \"./primitives\";\nexport * from \"./prompt-batcher\";\nexport * from \"./prompt-optimization-hooks\";\nexport * from \"./prompt-optimization-score-card\";\nexport * from \"./prompt-optimization-trace\";\nexport * from \"./prompts\";\n// Proto-generated types (single source of truth)\n// These types are generated from /schemas/eliza/v1/*.proto\n// Use these for new code and cross-language interoperability\nexport * as proto from \"./proto.js\";\n// Re-export proto utilities for JSON conversion\n// JsonValue is also exported from primitives.ts, but we explicitly export it here for clarity\nexport { fromJson, type JsonObject, type JsonValue, toJson } from \"./proto.js\";\nexport * from \"./runtime\";\nexport * from \"./schema\";\nexport * from \"./schema-builder\";\nexport * from \"./service\";\nexport * from \"./service-interfaces\";\nexport * from \"./settings\";\nexport * from \"./state\";\nexport * from \"./streaming\";\nexport * from \"./task\";\nexport * from \"./tee\";\nexport * from \"./testing\";\nexport * from \"./tools\";\nexport * from \"./trigger\";\n",
380
380
  "import type { Plugin } from \"../../../types/index.ts\";\nimport { type IAgentRuntime, logger } from \"../../../types/index.ts\";\nimport { clipboardAppendAction } from \"./actions/append.ts\";\nimport { clipboardDeleteAction } from \"./actions/delete.ts\";\nimport { clipboardListAction } from \"./actions/list.ts\";\nimport { clipboardReadAction } from \"./actions/read.ts\";\nimport { readAttachmentAction } from \"./actions/read-attachment.ts\";\nimport { readFileAction } from \"./actions/read-file.ts\";\nimport { removeFromClipboardAction } from \"./actions/remove-from-clipboard.ts\";\nimport { clipboardSearchAction } from \"./actions/search.ts\";\n// Actions\nimport { clipboardWriteAction } from \"./actions/write.ts\";\n\n// Providers\nimport { clipboardProvider } from \"./providers/clipboard.ts\";\n\n/**\n * Clipboard Plugin for ElizaOS\n *\n * Provides file-based memory storage that persists across sessions.\n * The agent can write, read, search, and manage clipboard entries\n * which are stored as markdown files.\n *\n * Actions:\n * - READ_FILE: Read a local text file for the current task\n * - READ_ATTACHMENT: Read a stored attachment by attachment ID\n * - REMOVE_FROM_CLIPBOARD: Clear bounded working-memory state\n * - CLIPBOARD_WRITE: Create a new clipboard entry\n * - CLIPBOARD_READ: Read a specific entry by ID\n * - CLIPBOARD_SEARCH: Search entries by content\n * - CLIPBOARD_LIST: List all entries\n * - CLIPBOARD_DELETE: Delete an entry\n * - CLIPBOARD_APPEND: Append content to an existing entry\n *\n * Provider:\n * - clipboard: Provides summary of entries to agent context\n */\nexport const clipboardPlugin: Plugin = {\n\tname: \"clipboard\",\n\tdescription:\n\t\t\"File-based memory storage for persistent notes and memories that can be written, read, searched, and managed across sessions.\",\n\n\tproviders: [clipboardProvider],\n\n\tactions: [\n\t\treadFileAction,\n\t\treadAttachmentAction,\n\t\tremoveFromClipboardAction,\n\t\tclipboardWriteAction,\n\t\tclipboardReadAction,\n\t\tclipboardSearchAction,\n\t\tclipboardListAction,\n\t\tclipboardDeleteAction,\n\t\tclipboardAppendAction,\n\t],\n\n\tasync init(\n\t\t_config: Record<string, string>,\n\t\t_runtime: IAgentRuntime,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tlogger.info(\"[ClipboardPlugin] Initializing...\");\n\n\t\t\t// The service will create the directory on first use\n\t\t\tlogger.info(\"[ClipboardPlugin] Initialized successfully\");\n\t\t} catch (error) {\n\t\t\tlogger.error(\n\t\t\t\t\"[ClipboardPlugin] Error initializing:\",\n\t\t\t\terror instanceof Error ? error.message : String(error),\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\t},\n};\n\nexport default clipboardPlugin;\n\nexport { clipboardAppendAction } from \"./actions/append.ts\";\nexport { clipboardDeleteAction } from \"./actions/delete.ts\";\nexport { clipboardListAction } from \"./actions/list.ts\";\nexport { clipboardReadAction } from \"./actions/read.ts\";\nexport { readAttachmentAction } from \"./actions/read-attachment.ts\";\nexport { readFileAction } from \"./actions/read-file.ts\";\nexport { removeFromClipboardAction } from \"./actions/remove-from-clipboard.ts\";\nexport { clipboardSearchAction } from \"./actions/search.ts\";\n// Export actions\nexport { clipboardWriteAction } from \"./actions/write.ts\";\n// Export provider\nexport { clipboardProvider } from \"./providers/clipboard.ts\";\n// Export service\nexport {\n\tClipboardService,\n\tcreateClipboardService,\n} from \"./services/clipboardService.ts\";\nexport {\n\tmaybeStoreTaskClipboardItem,\n\tresolveClipboardTitle,\n\tshouldAddToClipboard,\n\ttype TaskClipboardPersistenceResult,\n} from \"./services/taskClipboardPersistence.ts\";\nexport {\n\tcreateTaskClipboardService,\n\tTaskClipboardService,\n} from \"./services/taskClipboardService.ts\";\n// Export types\nexport type {\n\tAddTaskClipboardItemInput,\n\tClipboardConfig,\n\tClipboardEntry,\n\tClipboardReadOptions,\n\tClipboardSearchOptions,\n\tClipboardSearchResult,\n\tClipboardWriteOptions,\n\tTaskClipboardItem,\n\tTaskClipboardSnapshot,\n\tTaskClipboardSourceType,\n} from \"./types.ts\";\n",
381
381
  "import {\n\ttype Action,\n\ttype HandlerCallback,\n\ttype HandlerOptions,\n\ttype IAgentRuntime,\n\tlogger,\n\ttype Memory,\n\tModelType,\n\tparseKeyValueXml,\n\ttype State,\n} from \"../../../../types/index.ts\";\nimport { createClipboardService } from \"../services/clipboardService.ts\";\nimport { requireActionSpec } from \"../specs.ts\";\n\ninterface AppendInput {\n\tid: string;\n\tcontent: string;\n}\n\nfunction isValidAppendInput(obj: Record<string, unknown>): boolean {\n\treturn (\n\t\ttypeof obj.id === \"string\" &&\n\t\tobj.id.length > 0 &&\n\t\ttypeof obj.content === \"string\" &&\n\t\tobj.content.length > 0\n\t);\n}\n\nconst EXTRACT_TEMPLATE = `Extract the clipboard entry ID and content to append from the user's message.\n\nUser message: {{text}}\n\nAvailable clipboard entries:\n{{entries}}\n\nRespond with XML containing:\n- id: The ID of the clipboard entry to append to (required)\n- content: The new content to append (required)\n\n<response>\n<id>entry-id</id>\n<content>Content to append</content>\n</response>`;\n\nasync function extractAppendInfo(\n\truntime: IAgentRuntime,\n\tmessage: Memory,\n\tavailableEntries: string,\n): Promise<AppendInput | null> {\n\tconst prompt = EXTRACT_TEMPLATE.replace(\n\t\t\"{{text}}\",\n\t\tmessage.content.text ?? \"\",\n\t).replace(\"{{entries}}\", availableEntries);\n\n\tconst result = await runtime.useModel(ModelType.TEXT_SMALL, {\n\t\tprompt,\n\t\tstopSequences: [],\n\t});\n\n\tlogger.debug(\"[ClipboardAppend] Extract result:\", result);\n\n\tconst parsed = parseKeyValueXml(String(result)) as Record<\n\t\tstring,\n\t\tunknown\n\t> | null;\n\n\tif (!parsed || !isValidAppendInput(parsed)) {\n\t\tlogger.error(\"[ClipboardAppend] Failed to extract valid append info\");\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tid: String(parsed.id),\n\t\tcontent: String(parsed.content),\n\t};\n}\n\nconst spec = requireActionSpec(\"CLIPBOARD_APPEND\");\n\nexport const clipboardAppendAction: Action = {\n\tname: spec.name,\n\tsimiles: spec.similes ? [...spec.similes] : [],\n\tdescription: spec.description,\n\n\tvalidate: async (\n\t\truntime: IAgentRuntime,\n\t\tmessage: Memory,\n\t\tstate?: State,\n\t\toptions?: HandlerOptions,\n\t): Promise<boolean> => {\n\t\tconst __avTextRaw =\n\t\t\ttypeof message?.content?.text === \"string\" ? message.content.text : \"\";\n\t\tconst __avText = __avTextRaw.toLowerCase();\n\t\tconst __avKeywords = [\"clipboard\", \"append\"];\n\t\tconst __avKeywordOk =\n\t\t\t__avKeywords.length > 0 &&\n\t\t\t__avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));\n\t\tconst __avRegex = /\\b(?:clipboard|append)\\b/i;\n\t\tconst __avRegexOk = __avRegex.test(__avText);\n\t\tconst __avSource = String(message?.content?.source ?? \"\");\n\t\tconst __avExpectedSource = \"\";\n\t\tconst __avSourceOk = __avExpectedSource\n\t\t\t? __avSource === __avExpectedSource\n\t\t\t: Boolean(__avSource || state || runtime?.agentId || runtime?.getService);\n\t\tconst __avOptions = options && typeof options === \"object\" ? options : {};\n\t\tconst __avInputOk =\n\t\t\t__avText.trim().length > 0 ||\n\t\t\tObject.keys(__avOptions as Record<string, unknown>).length > 0 ||\n\t\t\tBoolean(message?.content && typeof message.content === \"object\");\n\n\t\tif (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst __avLegacyValidate = async (\n\t\t\t_runtime: IAgentRuntime,\n\t\t\t_message: Memory,\n\t\t): Promise<boolean> => {\n\t\t\treturn true;\n\t\t};\n\t\ttry {\n\t\t\treturn Boolean(await __avLegacyValidate(runtime, message));\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t},\n\n\thandler: async (\n\t\truntime: IAgentRuntime,\n\t\tmessage: Memory,\n\t\t_stateFromTrigger: State | undefined,\n\t\t_options: HandlerOptions | undefined,\n\t\tcallback?: HandlerCallback,\n\t\t_responses?: Memory[],\n\t) => {\n\t\tconst service = createClipboardService(runtime);\n\n\t\t// Get list of available entries for context\n\t\tconst entries = await service.list();\n\t\tconst entriesContext = entries\n\t\t\t.map((e) => `- ${e.id}: \"${e.title}\"`)\n\t\t\t.join(\"\\n\");\n\n\t\tif (entries.length === 0) {\n\t\t\tif (callback) {\n\t\t\t\tawait callback({\n\t\t\t\t\ttext: \"There are no clipboard entries to append to. Create one first with CLIPBOARD_WRITE.\",\n\t\t\t\t\tactions: [\"CLIPBOARD_APPEND_EMPTY\"],\n\t\t\t\t\tsource: message.content.source,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn { success: false, text: \"No entries available\" };\n\t\t}\n\n\t\tconst appendInfo = await extractAppendInfo(\n\t\t\truntime,\n\t\t\tmessage,\n\t\t\tentriesContext,\n\t\t);\n\n\t\tif (!appendInfo) {\n\t\t\tif (callback) {\n\t\t\t\tawait callback({\n\t\t\t\t\ttext: `I couldn't determine which note to update or what to add. Available entries:\\n${entriesContext}`,\n\t\t\t\t\tactions: [\"CLIPBOARD_APPEND_FAILED\"],\n\t\t\t\t\tsource: message.content.source,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn { success: false, text: \"Failed to extract append info\" };\n\t\t}\n\n\t\ttry {\n\t\t\t// Check if entry exists\n\t\t\tconst exists = await service.exists(appendInfo.id);\n\t\t\tif (!exists) {\n\t\t\t\tif (callback) {\n\t\t\t\t\tawait callback({\n\t\t\t\t\t\ttext: `Clipboard entry \"${appendInfo.id}\" not found. Available entries:\\n${entriesContext}`,\n\t\t\t\t\t\tactions: [\"CLIPBOARD_APPEND_NOT_FOUND\"],\n\t\t\t\t\t\tsource: message.content.source,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn { success: false, text: \"Entry not found\" };\n\t\t\t}\n\n\t\t\t// Get existing entry to preserve title\n\t\t\tconst existingEntry = await service.read(appendInfo.id);\n\n\t\t\t// Write with append option\n\t\t\tconst entry = await service.write(\n\t\t\t\texistingEntry.title,\n\t\t\t\tappendInfo.content,\n\t\t\t\t{\n\t\t\t\t\tappend: true,\n\t\t\t\t\ttags: existingEntry.tags,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tconst successMessage = `Successfully appended content to \"${entry.title}\" (${entry.id}).`;\n\n\t\t\tif (callback) {\n\t\t\t\tawait callback({\n\t\t\t\t\ttext: successMessage,\n\t\t\t\t\tactions: [\"CLIPBOARD_APPEND_SUCCESS\"],\n\t\t\t\t\tsource: message.content.source,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn { success: true, text: successMessage, entry };\n\t\t} catch (error) {\n\t\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\t\tlogger.error(\"[ClipboardAppend] Error:\", errorMsg);\n\t\t\tif (callback) {\n\t\t\t\tawait callback({\n\t\t\t\t\ttext: `Failed to append to the note: ${errorMsg}`,\n\t\t\t\t\tactions: [\"CLIPBOARD_APPEND_FAILED\"],\n\t\t\t\t\tsource: message.content.source,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn { success: false, text: \"Failed to append to clipboard entry\" };\n\t\t}\n\t},\n\n\texamples: [],\n};\n\nexport default clipboardAppendAction;\n",