import { TokenBudgetRefusalError, type TokenBudgetRefusal } from '../narrowing.js';
import type { Tokenizer } from '../../tokens.js';
import type { CodebaseIndex } from '../types.js';
import type { LiveEntity, LiveEntityIndex } from './resolve.js';
import type { EntityDiagnostic } from './types.js';
import type { OccEntityContextManyEntry, OccEntityContextManyOmission, OccEntityContextRuntimeOptions, OccEntityContextPayload, OccEntityContextResult } from './api-types.js';
export interface EntityContextContext {
    repoRoot: string;
    index: CodebaseIndex;
    live: LiveEntityIndex;
    tokenizer: Tokenizer;
    /** Held data-format snapshots, which are not members of the code index. */
    formatFiles?: ReadonlyMap<string, string>;
}
export declare class EntityContextBudgetError extends TokenBudgetRefusalError {
    readonly name = "EntityContextBudgetError";
    constructor(refusal: TokenBudgetRefusal, format: 'text' | 'json');
}
/** Exact text serializer used both for budget admission and public rendering. */
export declare function renderEntityContextText(result: OccEntityContextResult): string;
/** JSON serializer used both for budget admission and public rendering. */
export declare function renderEntityContextJson(result: OccEntityContextResult, pretty?: boolean): string;
/**
 * A token-budgeted source bundle for an entity and what depends on it.
 *
 * The budget is a hard ceiling, never an estimate: an entity is admitted whole
 * or not at all, so the bundle can always be handed to a model without the last
 * function in it being cut mid-body. What did not fit is reported per role
 * rather than dropped silently.
 */
export declare function entityContext(entity: LiveEntity, options: OccEntityContextRuntimeOptions, context: EntityContextContext): Promise<OccEntityContextPayload>;
export interface EntityContextManyTarget {
    targetIndex: number;
    entity: LiveEntity;
}
export interface EntityContextManyBundle {
    entries: OccEntityContextManyEntry[];
    includedTargetIndexes: number[];
    tokenBudget: number;
    tokensUsed: number;
    tokenizer: string;
    truncated: boolean;
    omissions: OccEntityContextManyOmission[];
    diagnostics: EntityDiagnostic[];
}
/**
 * One whole-entity context bundle for several roots under one shared budget.
 *
 * This lower-level helper accepts already-resolved live entities. The session
 * method owns aligned query outcomes; keeping resolution there lets a mixed
 * batch retain misses and ambiguities without making this graph traversal know
 * about query parsing.
 */
export declare function entityContextMany(targets: readonly EntityContextManyTarget[], options: OccEntityContextRuntimeOptions, context: EntityContextContext): Promise<EntityContextManyBundle>;
