import type { LTEnvelope, LTReturn } from '../../../types'; /** * MCP Triage workflow (leaf). * * Activated when a human resolver flags `needsTriage` in their resolution * payload. Dynamically adapts to ANY workflow type using available * MCP tools scoped by tag affinity. * * Tool ecosystem grows over time: * - Built-in servers: translation, vision, mcp-workflows, human-queue, * workflow-compiler, db, http-fetch, file-storage, oauth, claude-code * - User-registered external MCP servers * - Compiled YAML workflows from past triage executions * * Tools are scoped by the original workflow's `tool_tags` configuration * (plus base tags: workflows, compiled, database). Full tool definitions * are cached at the module level — only lightweight IDs flow through * the durable execution log. * * **First entry** (no `envelope.resolver`): * 1. Gather upstream tasks and escalation history * 2. Load scoped tools (tag-filtered, cached) * 3. LLM agentic loop with tool IDs * 4. Returns `{ correctedData }` or escalates to engineer * * **Re-entry** (has `envelope.resolver` — engineer responded): * 1. Engineer may have installed new tools or provided guidance * 2. LLM re-evaluates with fresh tool inventory * 3. Returns `{ correctedData }` or re-escalates */ export declare function mcpTriage(envelope: LTEnvelope): Promise;