From 699fd273168fe25ac114a8bcfc9eb10bb2ba9625 Mon Sep 17 00:00:00 2001 From: Volodymyr Makukha Date: Mon, 6 Jul 2026 19:20:23 +0100 Subject: [PATCH] Fix liberate_extract timeout --- apps/cli/ai/tools/data-liberation.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/cli/ai/tools/data-liberation.ts b/apps/cli/ai/tools/data-liberation.ts index 1357df9cc3..87b3b7b1b1 100644 --- a/apps/cli/ai/tools/data-liberation.ts +++ b/apps/cli/ai/tools/data-liberation.ts @@ -9,6 +9,10 @@ import { textResult } from './utils'; const engineDir = path.join( import.meta.dirname, 'data-liberation-agent' ); +// Engine ops (extract/screenshot/reconstruct) routinely run for minutes; the MCP SDK's +// 60 s default times them out (-32001) even though the engine keeps working. +const ENGINE_CALL_TIMEOUT_MS = 600_000; + let chromiumPromise: Promise< void > | null = null; function ensureEngineChromium(): Promise< void > { @@ -147,10 +151,14 @@ export const dataLiberationTool = defineTool( await ensureEngineChromium(); - const result = await client.callTool( { - name: args.tool, - arguments: normalizeArgs( args.args ), - } ); + const result = await client.callTool( + { + name: args.tool, + arguments: normalizeArgs( args.args ), + }, + undefined, + { timeout: ENGINE_CALL_TIMEOUT_MS, resetTimeoutOnProgress: true } + ); const rawContent = Array.isArray( result.content ) ? ( result.content as DataLiberationResultContent[] )