import { TransactionRunner, type OperationContext } from '@n8n/db'; import { AgentExecutionUpdateBroadcaster } from './agent-execution-update-broadcaster'; import { type AgentPlanDocument } from './plans/agent-plan.schema'; import { type AgentPlanReadiness } from './plans/agent-plan.validation'; import { AgentExecutionThreadRepository } from './repositories/agent-execution-thread.repository'; import { AgentPlanRepository, type AgentPlanRecord } from './repositories/agent-plan.repository'; type PlanDocumentInput = { data: unknown; formatVersion: number; }; type PlanWrite = { threadId: string; planId: string; expectedRevision: number; }; export type AgentPlanSnapshot = Omit & { data: AgentPlanDocument; readiness: AgentPlanReadiness; }; export declare class AgentPlanService { private readonly repository; private readonly txRunner; private readonly threads; private readonly updates; constructor(repository: AgentPlanRepository, txRunner: TransactionRunner, threads: AgentExecutionThreadRepository, updates: AgentExecutionUpdateBroadcaster); createActivePlan(input: PlanDocumentInput & { id: string; threadId: string; }, ctx: OperationContext): Promise; findActivePlan(threadId: string, ctx: OperationContext): Promise; findLatestPlan(threadId: string, ctx: OperationContext): Promise; findPlan(threadId: string, planId: string, ctx: OperationContext): Promise; findRevision(threadId: string, planId: string, revision: number, ctx: OperationContext): Promise<{ createdAt: Date; planId: string; revision: number; formatVersion: number; closedAt: Date | null; data: { title: string; description: string; presentation?: { label: string; detail?: string | undefined; } | undefined; items: ({ id: string; title: string; description: string; dependsOn: string[]; resultSummary?: string | undefined; kind: "task"; fallbackFor?: string | undefined; jobId: string; } | { id: string; title: string; description: string; dependsOn: string[]; resultSummary?: string | undefined; kind: "task"; fallbackFor?: string | undefined; status: "cancelled" | "done" | "failed" | "in_progress" | "paused" | "pending"; startedAt: string | null; endedAt: string | null; } | { id: string; title: string; description: string; dependsOn: string[]; resultSummary?: string | undefined; kind: "group"; tasks: ({ id: string; title: string; description: string; dependsOn: string[]; resultSummary?: string | undefined; kind: "task"; fallbackFor?: string | undefined; jobId: string; } | { id: string; title: string; description: string; dependsOn: string[]; resultSummary?: string | undefined; kind: "task"; fallbackFor?: string | undefined; status: "cancelled" | "done" | "failed" | "in_progress" | "paused" | "pending"; startedAt: string | null; endedAt: string | null; })[]; })[]; }; } | null>; listHistory(threadId: string, planId: string, options: { afterRevision?: number; limit?: number; }, ctx: OperationContext): Promise<{ items: import("./repositories/agent-plan.repository").AgentPlanRevisionMetadata[]; nextCursor: number | null; }>; replacePlan(input: PlanWrite & PlanDocumentInput, ctx: OperationContext): Promise; updatePlan(input: PlanWrite & { formatVersion: number; }, update: (current: AgentPlanDocument) => unknown, ctx: OperationContext): Promise; closePlan(input: PlanWrite, ctx: OperationContext): Promise; private write; private loadForWrite; private resolve; } export {};