export interface LoopTeamKey {
    teamName: string;
    encryptedKey: string;
    teamAddress: string;
    agentId: string;
    permissions: string[];
    createdAt: string;
    updatedAt: string;
}
export interface TeamResult<T> {
    teamName: string;
    data: T[];
}
export interface AggregationResult<T> {
    results: TeamResult<T>[];
    failures: {
        teamName: string;
        reason: string;
    }[];
    skipped: {
        teamName: string;
        reason: string;
    }[];
    totalTeams: number;
}
/**
 * Load all LoopTeamKey nodes for an account from Neo4j.
 */
export declare function loadTeamKeys(accountId: string): Promise<LoopTeamKey[]>;
/**
 * Make a GET request to the Loop API V2.
 */
export declare function loopGet<T>(apiKey: string, path: string, toolName: string, teamName: string): Promise<T>;
/**
 * Make a POST request to the Loop API V2.
 * For write operations: create viewings, record feedback, submit enquiries, etc.
 * Returns parsed JSON response. Treats 204 as success with empty result.
 */
export declare function loopPost<T>(apiKey: string, path: string, body: unknown, toolName: string, teamName: string): Promise<T>;
/**
 * Make a PUT request to the Loop API V2.
 * For update operations: batch matching, submit quotes, update preferences, etc.
 */
export declare function loopPut<T>(apiKey: string, path: string, body: unknown, toolName: string, teamName: string): Promise<T>;
export declare class LoopApiError extends Error {
    readonly status: number;
    readonly teamName: string;
    readonly path: string;
    readonly responseBody?: string | undefined;
    constructor(status: number, teamName: string, path: string, responseBody?: string | undefined);
}
/**
 * Fan out a request across all registered teams for an account, merging results.
 *
 * Each tool provides a `buildRequest` function that takes a decrypted API key
 * and returns the data for that team. The aggregation engine handles:
 * - Key loading and decryption
 * - Permission checking
 * - Concurrent fan-out via Promise.allSettled
 * - Result merging with teamName tags
 * - Aggregate logging
 *
 * When `teamName` is provided, only that team is queried (no fan-out).
 */
export declare function aggregateAcrossTeams<T>(accountId: string, endpointGroup: string, toolName: string, buildRequest: (apiKey: string, teamName: string) => Promise<T[]>, options?: {
    teamName?: string;
    limitPerTeam?: number;
    limitTotal?: number;
}): Promise<AggregationResult<T>>;
/**
 * Resolve a single team's API key with permission checking.
 * Handles key loading, decryption, and permission validation.
 * Used for both reads and writes that target a specific team — no fan-out.
 */
export declare function withTeamKey<T>(accountId: string, teamName: string, endpointGroup: string, toolName: string, execute: (apiKey: string) => Promise<T>): Promise<T>;
/**
 * Format an aggregation result into a human-readable text response.
 */
export declare function formatAggregationResult<T>(result: AggregationResult<T>, formatItem: (item: T, teamName: string) => string, entityName: string): string;
//# sourceMappingURL=loop-api.d.ts.map