/** * tasks/result flow — blocks until the task reaches a terminal status, then * returns the underlying request's result verbatim. * * Per MCP 2025-11-25 §Result Retrieval: * - For terminal tasks, MUST return exactly what the underlying request would * have returned (a `CallToolResult` on success, or the original JSON-RPC * error on failure). * - For non-terminal tasks, MUST block until terminal. We use the store's * pub/sub `subscribeTerminal` so cross-node unblocking works automatically. * - The response MUST include `_meta['io.modelcontextprotocol/related-task']` * with the `taskId` (unlike `tasks/get`/`list`/`cancel`). * * @module task/flows/tasks-result.flow */ import { z } from '@frontmcp/lazy-zod'; import { type AuthInfo } from '@frontmcp/protocol'; import { FlowBase, type FlowRunOptions } from '../../common'; declare const inputSchema: import("@frontmcp/lazy-zod").ZodObject<{ request: import("@frontmcp/lazy-zod").ZodObject<{ method: import("@frontmcp/lazy-zod").ZodLiteral<"tasks/result">; params: import("@frontmcp/lazy-zod").ZodObject<{ _meta: import("@frontmcp/lazy-zod").ZodOptional>; "io.modelcontextprotocol/related-task": import("@frontmcp/lazy-zod").ZodOptional>; }, import("zod/v4/core").$loose>>; taskId: import("@frontmcp/lazy-zod").ZodString; }, import("zod/v4/core").$strip>; }, import("zod/v4/core").$strip>; ctx: import("@frontmcp/lazy-zod").ZodAny; }, import("zod/v4/core").$strip>; declare const outputSchema: import("@frontmcp/lazy-zod").ZodObject<{ _meta: import("@frontmcp/lazy-zod").ZodOptional>; "io.modelcontextprotocol/related-task": import("@frontmcp/lazy-zod").ZodOptional>; }, import("zod/v4/core").$loose>>; }, import("zod/v4/core").$loose>; declare const stateSchema: import("@frontmcp/lazy-zod").ZodObject<{ taskId: import("@frontmcp/lazy-zod").ZodString; sessionId: import("@frontmcp/lazy-zod").ZodString; authInfo: z.ZodType; }, import("zod/v4/core").$strip>; declare const plan: { readonly pre: ["parseInput"]; readonly execute: ["awaitTerminal"]; }; declare global { interface ExtendFlows { 'tasks:result': FlowRunOptions; } } declare const name: "tasks:result"; export default class TasksResultFlow extends FlowBase { logger: import("../../common").FrontMcpLogger; parseInput(): Promise; awaitTerminal(): Promise; /** * Block until the task reaches a terminal state. * * Two wake-up paths: * 1. `subscribeTerminal` — instant for backends whose pub/sub reaches this * process (memory, Redis/Upstash, SQLite within the same process). * 2. Periodic `store.get` polling — the only path that works for the * SQLite backend when the caller and the runner live in different * processes (CLI runner + future stdio invocation). Without this, those * callers would block forever since the child's EventEmitter never * reaches the parent. */ private waitForTerminal; private pollDelayMs; private respondWithOutcome; } /** * Thrown from `tasks:result` when the underlying request terminated in error. * The handler converts this back into the exact JSON-RPC error per spec. */ export declare class JsonRpcReplayError extends Error { readonly code: number; readonly data: unknown; readonly taskId: string; constructor(code: number, message: string, data: unknown, taskId: string); toJsonRpcError(): { code: number; message: string; data?: unknown; }; } export {}; //# sourceMappingURL=tasks-result.flow.d.ts.map