import { TaskRequest } from '../types/performer'; import { ILogger } from '../utils/logger'; /** * Task execution context containing metadata and utilities */ export interface TaskContext { /** The original task request */ readonly request: TaskRequest; /** Task start timestamp */ readonly startTime: number; /** Unique execution ID for this task run */ readonly executionId: string; /** Logger instance for this task */ readonly logger: ILogger; /** Cancellation signal */ readonly signal: AbortSignal; /** Custom metadata storage */ readonly metadata: Map; } /** * Task execution result with metadata */ export interface TaskExecutionResult { /** The task response */ result: Uint8Array; /** Execution duration in milliseconds */ duration: number; /** Success status */ success: boolean; /** Error message if failed */ error?: string; /** Custom metadata */ metadata?: Record; } /** * Task processing pipeline stage */ export interface TaskProcessingStage { /** Stage name for logging */ name: string; /** Execute the stage */ execute(context: TaskContext): Promise; } /** * Task execution metrics */ export interface TaskMetrics { /** Task ID */ taskId: string; /** Execution ID */ executionId: string; /** Start timestamp */ startTime: number; /** End timestamp */ endTime?: number; /** Duration in milliseconds */ duration?: number; /** Success status */ success?: boolean; /** Error message */ error?: string; /** Payload size in bytes */ payloadSize: number; /** Result size in bytes */ resultSize?: number; /** Custom metrics */ customMetrics?: Record; } /** * Task context builder for creating task execution contexts */ export declare class TaskContextBuilder { private request; private logger; private timeout; private abortController; constructor(request: TaskRequest, logger: ILogger, timeout?: number); /** * Build the task context */ build(): TaskContext; /** * Cancel the task execution */ cancel(): void; /** * Generate a unique execution ID */ private generateExecutionId; /** * Create a task-specific logger */ private createTaskLogger; } /** * Task execution pipeline for processing tasks through multiple stages */ export declare class TaskPipeline { private stages; /** * Add a processing stage to the pipeline */ addStage(stage: TaskProcessingStage): this; /** * Execute all stages in the pipeline */ execute(context: TaskContext): Promise; } /** * Built-in processing stages */ export declare class ValidationStage implements TaskProcessingStage { private validator; name: string; constructor(validator: (context: TaskContext) => Promise); execute(context: TaskContext): Promise; } export declare class MetricsStage implements TaskProcessingStage { private metricsCollector; name: string; constructor(metricsCollector: (metrics: TaskMetrics) => void); execute(context: TaskContext): Promise; } //# sourceMappingURL=taskContext.d.ts.map