import { StreamEvent } from '../types/stream.js'; import { MessageRole, ThreadType } from '../types/memory.js'; import { MemoryModule } from '../modules/memory/memory.module.js'; import { ModelFetchOptions } from '../modules/models/base.model.js'; import { ModelModule } from '../modules/models/model.module.js'; import { IntentFulfillService } from './intents/fulfill.service.js'; import { IntentTriggerService } from './intents/trigger.service.js'; import { PIIService } from './pii.service.js'; import '../types/connector.js'; import '../modules/memory/base.memory.js'; import '../types/document.js'; import '../types/list.js'; import '../types/schedule.js'; import '../types/agent.js'; import 'http-status-codes'; import './tool-calling.service.js'; import '../modules/a2a/a2a.module.js'; import '@a2a-js/sdk'; import '../modules/mcp/mcp.module.js'; import '../types/mcp.js'; import '@modelcontextprotocol/sdk/client/sse.js'; import '@modelcontextprotocol/sdk/client/stdio.js'; import '@modelcontextprotocol/sdk/client/streamableHttp.js'; import './workflow-execution.service.js'; import './user-workflow.service.js'; import './workflow-variable-resolver.service.js'; /** * Service for processing user queries through the agent's AI pipeline. * * Orchestrates the query processing workflow including intent detection, * model inference, tool execution, and response generation. Manages * conversation context and coordinates between different modules. */ declare class QueryService { private modelModule; private memoryModule; private intentTriggerService; private intentFulfillService; private piiService?; constructor(modelModule: ModelModule, memoryModule: MemoryModule, intentTriggerService: IntentTriggerService, intentFulfillService: IntentFulfillService, piiService?: PIIService); addTextMessage(userId: string, threadId: string, role: MessageRole, content: string, metadata?: Record): Promise; generateTitle(query: string, options?: ModelFetchOptions): Promise; filterThinkingDataForStorage(data: Extract["data"]): Promise["data"]>; /** * Main entry point for processing streaming user queries. * * Handles the complete query lifecycle: * 1. Loads or creates thread from memory * 2. Detects intent from the query * 3. Fulfills the intent with streaming AI response * 4. Updates conversation history in real-time * * @param threadMetadata - Metadata containing type, userId, and optional threadId * @param threadMetadata.type - The type of thread (e.g., chat, workflow) * @param threadMetadata.userId - The user's unique identifier * @param threadMetadata.threadId - Optional thread identifier * @param query - The user's input query * @returns AsyncGenerator yielding StreamEvent objects for SSE */ handleQuery(threadMetadata: { type: ThreadType; userId: string; threadId?: string; workflowId?: string; title?: string; options?: ModelFetchOptions; }, queryData: { query: string; displayQuery?: string; documentIds?: string[]; }, isA2A?: boolean): AsyncGenerator; } export { QueryService };