/** * TaskExecutor — extracted from PhotonServer * * Encapsulates all MCP Tasks protocol handling (spec v2025-11-25): * - Task creation from tool calls (task mode) * - GetTask, ListTasks, CancelTask, GetTaskPayload handlers * - Input resolution via elicitation * * Dependency direction: PhotonServer → TaskExecutor (never the reverse). */ import type { Server } from '@modelcontextprotocol/sdk/server/index.js'; import type { LogLevel } from './shared/logger.js'; /** Minimal interface for executing a tool — avoids importing PhotonLoader */ export interface ToolExecutor { executeTool(photon: { name: string; }, toolName: string, args: Record, options: { outputHandler?: (data: any) => void; inputProvider?: (ask: any) => Promise; }): Promise; } /** Minimal interface for creating an input provider via MCP elicitation */ export interface InputProviderFactory { createMCPInputProvider(server?: Server): (ask: any) => Promise; } /** Logger callback matching PhotonServer's log() signature */ export type TaskLog = (level: LogLevel, message: string, meta?: Record) => void; export declare class TaskExecutor { private log; private toolExecutor; private inputProviderFactory; constructor(log: TaskLog, toolExecutor: ToolExecutor, inputProviderFactory: InputProviderFactory); /** * Handle task-mode tool call: when request params contain a `task` field, * run the tool asynchronously and return a task reference. * * Returns the MCP response if task mode applies, or null if it doesn't. */ handleTaskModeCall(photonName: string, toolName: string, args: Record, taskField: { ttl?: number; }): { content: Array<{ type: string; text: string; }>; }; /** * Handle tasks/get — returns wire-format task status. */ handleGetTask(taskId: string): any; /** * Handle tasks/list — returns paginated task list. */ handleListTasks(cursor?: string): any; /** * Handle tasks/cancel — aborts the task and returns updated status. */ handleCancelTask(taskId: string): any; /** * Handle tasks/get_result — blocks until task completes or times out. * Handles input_required states via elicitation. */ handleGetTaskPayload(taskId: string, server: Server): Promise; /** * Format a terminal task result for MCP response. */ private formatTaskResult; } //# sourceMappingURL=task-executor.d.ts.map