/** * Task runner — executes a `tools/call` request in the background and records * its terminal outcome. * * Called synchronously (fire-and-forget) from the task-creation path in the * existing `tools:call-tool` flow. The outer HTTP request will already have * returned the `CreateTaskResult` by the time this resumes. * * Runtime approach: we re-dispatch the underlying `tools/call` request through * `scope.runFlowForOutput('tools:call-tool', ...)` with the `task` field * stripped so the flow executes the tool normally. Any result or thrown error * is captured into a TaskOutcome and written to the store as a terminal state. * * Cross-node cancel: we subscribe to the cancel channel for the duration of * execution. If a cancel is signalled, the AbortController fires, which the * tool is expected to observe through the standard execution context. * * @module task/helpers/task-runner */ import type { FrontMcpLogger } from '../../common'; import type { TaskStore } from '../store'; import type { TaskRegistry } from '../task.registry'; import { type TaskRecord } from '../task.types'; import type { TaskNotifier } from './task-notifier'; /** Narrow interface over scope to avoid circular type import. */ export interface TaskRunnerScope { runFlowForOutput(name: 'tools:call-tool', input: TInput): Promise; } export interface RunTaskParams { /** Persisted record (already stored in status `working`). */ record: TaskRecord; /** Raw request params AFTER removing the `task` field, to pass to the flow. */ cleanedRequestParams: Record; /** The original request handler context (carries authInfo etc.). */ ctx: unknown; scope: TaskRunnerScope; store: TaskStore; registry: TaskRegistry; notifier: TaskNotifier; logger?: FrontMcpLogger; } /** * Schedule background execution and return immediately. The returned Promise * resolves once the task reaches a terminal state — primarily useful in tests. */ export declare function runTaskInBackground(params: RunTaskParams): Promise; //# sourceMappingURL=task-runner.d.ts.map