import { StreamEvent } from '../../types/stream.js'; import { TriggeredIntent, ThreadObject } from '../../types/memory.js'; import { MemoryModule } from '../../modules/memory/memory.module.js'; import { ModelModule } from '../../modules/models/model.module.js'; import { OnIntentFallback } from '../../types/agent.js'; import { PIIService } from '../pii.service.js'; import { ToolCallingService } from '../tool-calling.service.js'; import { WorkflowExecutionService } from '../workflow-execution.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 '../../modules/models/base.model.js'; import 'http-status-codes'; 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 '../user-workflow.service.js'; import '../workflow-variable-resolver.service.js'; declare class IntentFulfillService { private modelModule; private memoryModule; private onIntentFallback?; private aggregateService; private piiService?; private toolCallingService; private workflowExecutionService?; constructor(modelModule: ModelModule, memoryModule: MemoryModule, toolCallingService: ToolCallingService, onIntentFallback?: OnIntentFallback, piiService?: PIIService, workflowExecutionService?: WorkflowExecutionService); /** * Fulfills the detected intent by generating a streaming response. * * Manages the complete inference loop including: * - Loading prompts and conversation history * - Collecting available tools from modules * - Executing model inference with tool support * - Processing tool calls iteratively until completion * - Streaming results as Server-Sent Events * * @param query - The user's input query * @param threadId - Thread identifier for context * @param thread - Previous conversation history * @param intent - Optional detected intent with custom prompt * @returns AsyncGenerator yielding StreamEvent objects */ private intentFulfilling; /** * Returns the appropriate stream for a triggered intent. * Uses fallback handler if no intent matched and fallback is configured. */ private getIntentStream; /** * Fulfills an intent by running its mapped workflow. If the workflow * fails before producing any event (unknown id, missing definition), * falls back to the prompt-based fulfillment path so a stale mapping * never disables the intent. Failures after streaming started are * rethrown to avoid duplicating a partial response. */ private intentWorkflowFulfilling; /** * Processes all triggered intents and generates a unified response. * * Workflow: * 1. Process each intent sequentially, collecting results * 2. Yield thinking_process events for progress visibility * 3. Use AggregateService to unify results if needsAggregation is true * 4. Stream the final (possibly aggregated) response * * @param intents - Array of triggered intents to process * @param thread - The thread history * @param originalQuery - The user's original query (for aggregate context) * @param needsAggregation - Whether the results need to be aggregated * @returns AsyncGenerator yielding StreamEvent objects */ intentFulfill(intents: Array, thread: ThreadObject, originalQuery: string, needsAggregation: boolean): AsyncGenerator; private buildIntentThinkingData; } export { IntentFulfillService };