/** * Agentic QE v3 - Handoff Manager * Manages transitions between human and agent claimants * * Use cases: * - Agent requests human review of generated tests * - Human requests agent assistance with investigation * - Escalation when agent is stuck * - Graceful handoff with context preservation */ import { Claim, Claimant, ClaimantType, PendingHandoff, IHandoffManager, IClaimService, IClaimRepository } from './interfaces'; import { EventBus } from '../../kernel/interfaces'; import { DomainName, AgentType } from '../../shared/types'; export interface HandoffManagerConfig { /** Timeout for pending handoffs (ms) */ handoffTimeoutMs: number; /** How often to check for timed out handoffs (ms) */ checkIntervalMs: number; /** Maximum pending handoffs per claim */ maxPendingPerClaim: number; /** Default agent type for agent assist requests */ defaultAgentType: AgentType; /** Enable notifications */ enableNotifications: boolean; } export declare class HandoffManager implements IHandoffManager { private readonly claimService; private readonly repository; private readonly eventBus?; private readonly config; private readonly pendingHandoffs; private checkTimer; private initialized; constructor(claimService: IClaimService, repository: IClaimRepository, eventBus?: EventBus | undefined, config?: Partial); initialize(): Promise; dispose(): Promise; requestHumanReview(claimId: string, notes?: string): Promise; requestAgentAssist(claimId: string, preferredDomain?: DomainName): Promise; completeHandoff(handoffId: string, toClaimant: Claimant): Promise; cancelHandoff(handoffId: string): Promise; getPendingHandoffs(): Promise; /** * Get pending handoffs for a specific claim */ getPendingForClaim(claimId: string): Promise; /** * Get pending handoffs by target type */ getPendingByTargetType(targetType: ClaimantType): Promise; /** * Get pending handoffs requested by a specific claimant */ getPendingByRequestor(requestorId: string): Promise; /** * Get a specific pending handoff */ getHandoff(handoffId: string): Promise; /** * Find available agent for handoff */ findAvailableAgent(preferredDomain?: DomainName, preferredType?: AgentType): Promise; /** * Check if a claim has pending handoffs */ hasPendingHandoffs(claimId: string): boolean; /** * Get handoff statistics */ getStatistics(): HandoffStatistics; private getPendingCountForClaim; private cleanupExpiredHandoffs; private emitHandoffRequestedEvent; private emitHandoffCompletedEvent; private emitHandoffCancelledEvent; private emitHandoffExpiredEvent; } export interface HandoffStatistics { totalPending: number; byTargetType: Record; avgWaitTimeMs: number; oldestHandoffAt?: Date; } /** * Create a handoff manager */ export declare function createHandoffManager(claimService: IClaimService, repository: IClaimRepository, eventBus?: EventBus, config?: Partial): HandoffManager; /** * Suggest appropriate claim type based on handoff context */ export declare function suggestClaimTypeForHandoff(currentClaimType: string, targetType: ClaimantType): string; /** * Calculate handoff priority based on claim and wait time */ export declare function calculateHandoffPriority(handoff: PendingHandoff): number; //# sourceMappingURL=handoff-manager.d.ts.map