import type { BuiltTool } from '@n8n/agents'; import { type AgentJsonToolConfig, type AgentToolOutputFile, type AgentToolSkippedFile } from '@n8n/api-types'; import type { WorkflowEntity } from '@n8n/db'; import type { IBinaryKeyData, INode, INodeExecutionData, RelatedAgentRun, WorkflowExecuteMode } from 'n8n-workflow'; import { z } from 'zod'; import type { ActiveExecutions } from '../../../active-executions'; import type { SubworkflowPolicyChecker } from '../../../executions/pre-execution-checks'; import type { EphemeralNodeExecutor } from '../../../node-execution/ephemeral-node-executor'; import type { WorkflowRunner } from '../../../workflow-runner'; import type { CallableWorkflowLoader } from '../../../workflows/callable/callable-workflow-loader.service'; import type { InstrumentToolAdditionalData } from '../evaluation/agent-evaluation.contracts'; interface WorkflowWaitState { waitTill?: Date; } interface WorkflowToolResult { executionId: string; status: string; data?: Record; error?: string; note?: string; jobId?: string; files?: AgentToolOutputFile[]; skippedFiles?: AgentToolSkippedFile[]; } export interface WorkflowToolExecutionResult extends WorkflowToolResult { wait?: WorkflowWaitState; items?: Record; } export type WorkflowToolExecutionMode = Extract; export interface WorkflowToolContext { workflowLoader: CallableWorkflowLoader; executor: EphemeralNodeExecutor; workflowRunner: WorkflowRunner; subworkflowPolicyChecker: SubworkflowPolicyChecker; activeExecutions: ActiveExecutions; projectId: string; executionMode: WorkflowToolExecutionMode; usePublishedWorkflowVersion?: boolean; agentId?: string; integrationType?: string; previewChat?: boolean; publishedN8nChat?: boolean; userId?: string; supportsHitl?: boolean; backgroundTasksEnabled?: boolean; instrumentToolAdditionalData?: InstrumentToolAdditionalData; } export interface WorkflowToolRunContext extends WorkflowToolContext { abortSignal?: AbortSignal; agentRun?: RelatedAgentRun; } type WorkflowToolInputsConfig = NonNullable['inputs']>; export declare function getFixedWorkflowToolInputs(inputs: WorkflowToolInputsConfig | undefined): Record; export declare function buildWorkflowToolInputSchema(schema: z.ZodObject, inputs: WorkflowToolInputsConfig | undefined): z.ZodObject; export declare function mergeWorkflowToolInput(llmInput: Record, inputs: WorkflowToolInputsConfig | undefined, fullSchema: z.ZodObject, expressionValues?: Record): Record; export declare function executeWorkflow(workflow: WorkflowEntity, triggerNode: INode, inputData: Record, context: WorkflowToolRunContext, allOutputs?: boolean, instrumentedToolName?: string, binary?: IBinaryKeyData): Promise; export declare function extractResult(executionId: string, allOutputs: boolean): Promise; export declare function resolveWorkflowTool(descriptor: Extract, context: WorkflowToolContext): Promise; export declare function buildUnavailableWorkflowTool(descriptor: Extract, context: WorkflowToolContext): BuiltTool; export {};