/** * Shared utility for executing activities through an optional interceptor chain. * Used by both RemoteWorker (WebSocket) and LongPollWorker (HTTP). */ import type { ActivityInterceptor } from '../core/interceptor.ts'; import { composeActivityInterceptors } from '../core/interceptor.ts'; export interface TaskInfo { activityName: string; operationId: string; attempt?: number; input: unknown; headers?: Record; workflowExecutionToken?: string; attemptToken: string; } export interface ComposedInterceptor { execute: ReturnType['execute']; } type ActivityExecutionContext = { signal: AbortSignal; workflowExecutionToken?: string; activityAttemptToken?: string; }; /** * Pre-compose interceptors once (at construction time) so the chain * is not rebuilt on every task execution. */ export declare function buildComposedInterceptor(interceptors: ActivityInterceptor[] | undefined): ComposedInterceptor | null; /** * Execute an activity function, optionally wrapped by a pre-composed interceptor chain. * Provides a consistent AbortSignal and headers Map to the interception context. */ export declare function executeWithInterceptors(activityFunction: (input: unknown, context?: ActivityExecutionContext) => Promise, task: TaskInfo, composed: ComposedInterceptor | null, signal?: AbortSignal): Promise; export {};