import type { ToolCallInfo } from '../types';
export type ApprovalStatus = 'pending' | 'approved' | 'rejected';
/**
 * Approval request for a tool execution.
 *
 * When a tool has `needsApproval: true` in AI SDK v6, the agent
 * will pause and wait for approval before executing the tool.
 */
export interface ApprovalRequest {
    /** Unique request ID */
    id: string;
    /** Agent session ID */
    sessionId: string;
    /** Agent ID */
    agentId: string;
    /** Tenant ID for scoping */
    tenantId?: string;
    /** Tool name requiring approval */
    toolName: string;
    /** Tool call ID from AI SDK */
    toolCallId: string;
    /** Tool arguments */
    toolArgs: unknown;
    /** Human-readable reason for approval */
    reason: string;
    /** When the approval was requested */
    requestedAt: Date;
    /** Current status */
    status: ApprovalStatus;
    /** Additional context payload */
    payload?: Record<string, unknown>;
    /** Who resolved the approval */
    reviewer?: string;
    /** When the approval was resolved */
    resolvedAt?: Date;
    /** Reviewer notes */
    notes?: string;
}
/**
 * Storage interface for approval requests.
 */
export interface ApprovalStore {
    create(request: ApprovalRequest): Promise<void>;
    get(id: string): Promise<ApprovalRequest | null>;
    getByToolCallId(toolCallId: string): Promise<ApprovalRequest | null>;
    update(id: string, updates: Partial<Omit<ApprovalRequest, 'id' | 'sessionId'>>): Promise<void>;
    list(options?: {
        status?: ApprovalStatus;
        agentId?: string;
        tenantId?: string;
    }): Promise<ApprovalRequest[]>;
}
export interface InMemoryApprovalStoreOptions {
    maxItems?: number;
}
/**
 * In-memory approval store for development and testing.
 */
export declare class InMemoryApprovalStore implements ApprovalStore {
    private readonly items;
    private readonly maxItems;
    constructor(options?: InMemoryApprovalStoreOptions);
    create(request: ApprovalRequest): Promise<void>;
    get(id: string): Promise<ApprovalRequest | null>;
    getByToolCallId(toolCallId: string): Promise<ApprovalRequest | null>;
    update(id: string, updates: Partial<Omit<ApprovalRequest, 'id' | 'sessionId'>>): Promise<void>;
    list(options?: {
        status?: ApprovalStatus;
        agentId?: string;
        tenantId?: string;
    }): Promise<ApprovalRequest[]>;
    clear(): void;
    private evictIfNeeded;
}
/**
 * Approval workflow for managing tool execution approvals.
 *
 * Integrates with AI SDK v6's `needsApproval` feature on tools.
 *
 * @example
 * ```typescript
 * const workflow = new ApprovalWorkflow();
 *
 * // When a tool needs approval
 * const request = await workflow.requestApproval({
 *   sessionId: 'sess_123',
 *   agentId: 'support.bot.v1',
 *   toolName: 'delete_account',
 *   toolCallId: 'call_abc',
 *   toolArgs: { userId: 'user_123' },
 *   reason: 'Account deletion requires human approval',
 * });
 *
 * // When approval is granted
 * await workflow.approve(request.id, 'admin@example.com', 'Verified identity');
 *
 * // Or rejected
 * await workflow.reject(request.id, 'admin@example.com', 'Suspicious activity');
 * ```
 */
export declare class ApprovalWorkflow {
    private readonly store;
    constructor(store?: ApprovalStore);
    /**
     * Request approval for a tool execution.
     */
    requestApproval(params: {
        sessionId: string;
        agentId: string;
        tenantId?: string;
        toolName: string;
        toolCallId: string;
        toolArgs: unknown;
        reason: string;
        payload?: Record<string, unknown>;
    }): Promise<ApprovalRequest>;
    /**
     * Request approval from an AI SDK tool call.
     */
    requestApprovalFromToolCall(toolCall: ToolCallInfo, context: {
        sessionId: string;
        agentId: string;
        tenantId?: string;
        reason?: string;
        /** Locale for i18n (BCP 47). Falls back to 'en'. */
        locale?: string;
    }): Promise<ApprovalRequest>;
    /**
     * Approve a pending request.
     */
    approve(id: string, reviewer: string, notes?: string): Promise<void>;
    /**
     * Reject a pending request.
     */
    reject(id: string, reviewer: string, notes?: string): Promise<void>;
    /**
     * Get approval status for a tool call.
     */
    getStatus(toolCallId: string): Promise<ApprovalStatus | null>;
    /**
     * Check if a tool call is approved.
     */
    isApproved(toolCallId: string): Promise<boolean>;
    /**
     * List pending approvals.
     */
    listPending(options?: {
        agentId?: string;
        tenantId?: string;
    }): Promise<ApprovalRequest[]>;
    /**
     * Get approval request by ID.
     */
    get(id: string): Promise<ApprovalRequest | null>;
}
/**
 * Create an approval workflow instance.
 */
export declare function createApprovalWorkflow(store?: ApprovalStore | InMemoryApprovalStoreOptions): ApprovalWorkflow;
