/** * MessageProcessorService - Effect-based message processing * * This service handles routing and processing of user messages using Effect patterns. * It replaces the class-based MessageProcessor with proper Effect service composition. */ import { Context, Effect, Layer, Stream } from 'effect'; import type { AgentMessage, AgentResponse } from '../agent/agent'; import type { StreamEvent } from '../stream/events'; import type { Tracer } from '../tracing'; import { RouteExecutionError } from './errors'; import type { ContextStorageError } from '../context/errors'; import type { PipelineExecutionError } from '../pipeline/errors'; import type { IntentMatchError, ActionHandlerNotFoundError, IntentRouteError } from '../intent/errors'; import type { NoAgentsAvailableError } from '../routing/errors'; /** * Extended error type that includes all possible errors from message processing */ export type MessageProcessorError = import('./errors').MessageProcessorError | ContextStorageError | PipelineExecutionError | RouteError; import type { RouteResult, ProcessingOptions, MemoryDefaults, SemanticMatcherFn } from './types'; import { AgentService } from '../agent/service'; import { ContextStorageService } from '../context/service'; /** * Configuration for MessageProcessorService */ export interface MessageProcessorConfig { defaultAgentId?: string; memoryDefaults: MemoryDefaults; tracer?: Tracer; } /** * Route options for routing a message */ export interface RouteOptions { conversationId?: string; sequentialVisibility?: boolean; } /** * Route error type - all errors that can occur during message routing */ export type RouteError = RouteExecutionError | PipelineExecutionError | IntentMatchError | ActionHandlerNotFoundError | IntentRouteError | NoAgentsAvailableError; /** * MessageProcessorService interface */ export interface MessageProcessorService { /** * Route a message to the appropriate handler */ routeMessage(message: string, semanticMatcher?: SemanticMatcherFn, previousMessages?: AgentMessage[], options?: RouteOptions): Effect.Effect; /** * Process a user message through the intent system */ processMessage(message: string, options?: ProcessingOptions): Effect.Effect; /** * Stream a user message through the intent system */ streamMessage(message: string, options?: ProcessingOptions): Stream.Stream; /** * Process OpenAI-compatible chat messages */ processChatMessage(messages: Array<{ role: string; content: string; }>, options?: ProcessingOptions): Effect.Effect; /** * Update service configuration */ updateConfig(config: Partial): Effect.Effect; /** * Get current configuration */ getConfig(): Effect.Effect; } export declare const MessageProcessorService: Context.Tag; /** * Live layer for MessageProcessorService * * This layer requires all dependent services to be provided. * Optional services (IntentMatcher, IntentRouter, MessageRouter) can be * provided separately using the FromInstance layer factories. */ export declare const MessageProcessorServiceLive: Layer.Layer; /** * Create a MessageProcessorService layer with initial configuration */ export declare const MessageProcessorServiceLiveWithConfig: (initialConfig: Partial) => Layer.Layer; //# sourceMappingURL=service.d.ts.map