/** * Interceptor lifecycle helpers. * * Extracted from the main execute() function so the interceptor * reads as a high-level pipeline. Each helper handles one phase * of the workflow lifecycle. */ import type { LTEnvelope } from '../../types'; import type { ProxiedActivities } from './state'; import type { WorkflowIdentity, TaskContext } from './types'; /** Result of re-run detection and escalation resolution. */ interface ReRunContext { isReRun: boolean; task: any | null; metadata: Record | null; } /** Extract workflow identity fields from the HotMesh context map. */ export declare function extractWorkflowIdentity(ctx: Map): WorkflowIdentity; /** Derive the task queue from the workflow topic. */ export declare function deriveTaskQueue(wf: WorkflowIdentity): string; /** * Detect re-runs and resolve the prior escalation. * * A re-run occurs when `envelope.resolver` + `envelope.lt.escalationId` * are both present — meaning a human (or AI) resolved an escalation * and a new workflow was started with the resolver data. */ export declare function resolveReRun(activities: ProxiedActivities, envelope: LTEnvelope | undefined, existingTask: any | null, wf: WorkflowIdentity, taskQueue: string): Promise; /** * Ensure a task record exists and resolve routing + origin lineage. * * Handles three cases: * - Task already exists (from executeLT pre-creation) → use it * - Re-run task found by escalation context → reuse it * - No task → create a standalone task * * Also injects originId back into the envelope for downstream consistency. */ export declare function ensureTaskWithRouting(activities: ProxiedActivities, wf: WorkflowIdentity, envelope: LTEnvelope | undefined, existingTask: any | null, taskQueue: string, reRun: ReRunContext): Promise; /** Publish workflow.started event (guarded against replay). */ export declare function publishStartedEvents(wf: WorkflowIdentity, taskQueue: string, taskId: string | undefined, originId: string): void; /** Complete a task and signal parent for plain (non-LTReturn) results. */ export declare function completePlainResult(activities: ProxiedActivities, wf: WorkflowIdentity, taskQueue: string, taskId: string | undefined, routing: Record | null, result: any): Promise; export {};