import { type AgentExecutionCounter, type BuiltTelemetry, type CredentialProvider, type DelegateSubAgentCancelRequest, type DelegateSubAgentResumeRequest, type GenerateResult, type JSONValue, type StreamChunk, type SubAgentTaskPath } from '@n8n/agents';
import type { SubAgentSpawnRequest } from '@n8n/api-types';
import { Logger } from '@n8n/backend-common';
import type { User } from '@n8n/db';
import type { AgentRunTelemetryType } from '../../../interfaces';
import { AgentExecutionService } from '../agent-execution.service';
import type { AgentRuntimeInstrumentation } from '../agent-runtime-instrumentation';
import { N8NCheckpointStorage } from '../integrations/n8n-checkpoint-storage';
import type { WorkflowToolExecutionMode } from '../tools/workflow-tool-factory';
import { SubAgentSourceResolver } from './sub-agent-source-resolver';
export interface SubAgentForegroundRunContext {
    projectId: string;
    parentAgentId?: string;
    credentialProvider: CredentialProvider;
    runType: AgentRunTelemetryType;
    workflowToolExecutionMode?: WorkflowToolExecutionMode;
    executionCounter?: AgentExecutionCounter;
    abortSignal?: AbortSignal;
    telemetry?: BuiltTelemetry;
    user?: User;
    instrumentation?: AgentRuntimeInstrumentation;
    onChunk?: (chunk: StreamChunk) => void;
}
export interface SubAgentForegroundResult {
    taskPath: SubAgentTaskPath;
    threadId: string;
    status: 'completed' | 'failed' | 'suspended';
    result: GenerateResult;
    resumeContext?: JSONValue;
}
export declare class SubAgentForegroundRunner {
    private readonly sourceResolver;
    private readonly agentExecutionService;
    private readonly checkpointStorage;
    private readonly logger;
    constructor(sourceResolver: SubAgentSourceResolver, agentExecutionService: AgentExecutionService, checkpointStorage: N8NCheckpointStorage, logger: Logger);
    runForeground(request: SubAgentSpawnRequest, context: SubAgentForegroundRunContext): Promise<SubAgentForegroundResult>;
    resumeForeground(request: DelegateSubAgentResumeRequest, context: SubAgentForegroundRunContext): Promise<SubAgentForegroundResult>;
    cancelForeground(request: DelegateSubAgentCancelRequest): Promise<void>;
    private executeForeground;
    private recordSubAgentExecution;
}
