/**
 * TabnineAdapter -- Tabnine adapter.
 *
 * Tabnine is an enterprise code-completion AI that is editor-agnostic (VS Code,
 * JetBrains, Vim, Emacs, Eclipse, Sublime Text, Visual Studio). Its original
 * positioning is enterprise-compliance-first: every enterprise deal involves
 * a security questionnaire. That customer base is already sensitized to
 * governance -- making this adapter a high-value integration.
 *
 * Deployment modes:
 *   tabnine-cloud            -- Tabnine-managed SaaS (EU and US clusters)
 *   enterprise-self-hosted   -- Customer-operated instance on VPC or air-gapped
 *                               hardware. Tabnine Enterprise can train models on
 *                               customer code locally without sending data outside
 *                               the perimeter.
 *   pro                      -- Tabnine Pro individual subscription. No enterprise
 *                               controls; no on-premises model training.
 *
 * Hook surfaces (seven distinct governable surfaces):
 *   inlineCompletionRequested(file, cursor, context)
 *     Inline completion gate. Most frequent surface; scanned for secrets in
 *     surrounding context before the completion call is dispatched.
 *   chatRequested(prompt)
 *     Tabnine Chat gate. Scanned for secrets and PHI before dispatch.
 *   codeReviewRequested(diff, filePath)
 *     Automated code review on a diff fragment. Diff is scanned for secrets
 *     before review generation.
 *   testGenerationRequested(functionContext, targetFile)
 *     Test scaffold generation gate. Function context scanned for PHI indicators
 *     under HIPAA binding before test generation proceeds.
 *   documentationRequested(symbolContext, targetFile)
 *     Auto-documentation generation gate. Symbol context scanned for secrets
 *     and PHI before dispatch.
 *   commitMessageRequested(diff, branchName)
 *     Commit message generation gate (mirrors JetBrains/Cody pattern). Diff
 *     is scanned for secrets on added lines before message generation.
 *   learnFromCodebaseRequested(repos, dataScope)
 *     On-premises codebase learning gate -- THE TABNINE-DISTINCT SURFACE.
 *     Tabnine Enterprise can fine-tune a local model on customer code. This
 *     is a HEAVILY governable surface: the training corpus may contain PII,
 *     IP, secrets, or regulated health data. Strict-mode enforcement:
 *       - 'pro' mode: ALWAYS DENIED. Pro has no on-prem learning capability.
 *       - 'tabnine-cloud': ALWAYS DENIED. Model training uses Tabnine servers
 *         (data leaves the customer perimeter).
 *       - 'enterprise-self-hosted': ALLOWED only when `learnFromCodebase: true`
 *         is explicitly set in the adapter config (default: false).
 *     The governance default is deny; explicit opt-in required for enterprise.
 *
 * Tabnine-specific pen-tests:
 *   PT-ADAPT-TABNINE-1: empty packBinding[] throws UnboundDataError pre-call
 *   PT-ADAPT-TABNINE-2: Tabnine API key / auth token never appears in audit entries
 *   PT-ADAPT-TABNINE-3: malformed config (invalid deploymentMode) throws at construction
 *   PT-ADAPT-TABNINE-4: learnFromCodebase privacy gate -- rejection produces audit entry
 *                        with reason code "tabnine-learn-from-codebase-not-permitted-in-mode"
 *
 * Spec: P3-SUB-IDE-07
 *
 * @connexum/ai-governance
 */
import { BaseIdeAdapter } from './base';
import { type IdeAdapterConfig, type IdeAdapterCapabilities, type IdeSessionContext, type ToolInvocationContext, type ToolInvocationDecision, type UserIdentity, type ReviewerTier } from './index';
/**
 * Tabnine deployment modes.
 *
 *   tabnine-cloud          -- Tabnine-managed SaaS (EU and US data clusters).
 *   enterprise-self-hosted -- Customer-operated instance. Supports on-premises
 *                             model training on customer code (learnFromCodebase).
 *   pro                    -- Individual Tabnine Pro subscription. No enterprise
 *                             controls; on-prem model training not available.
 *
 * Governance notes:
 *   - learnFromCodebase is only permitted in 'enterprise-self-hosted' mode AND
 *     requires an explicit opt-in flag (learnFromCodebase: true) in config.
 *   - 'tabnine-cloud' is ineligible for learnFromCodebase because model training
 *     data would leave the customer network perimeter.
 *   - Under HIPAA binding, only 'enterprise-self-hosted' passes the data-residency
 *     check by default. 'tabnine-cloud' requires a Tabnine BAA. 'pro' is never
 *     BAA-eligible.
 */
export type TabnineDeploymentMode = 'tabnine-cloud' | 'enterprise-self-hosted' | 'pro';
export declare const TABNINE_VALID_DEPLOYMENT_MODES: readonly TabnineDeploymentMode[];
export declare const TABNINE_BAA_ELIGIBLE_MODES: readonly TabnineDeploymentMode[];
/**
 * Modes where learnFromCodebase is architecturally possible
 * (i.e. training runs on-premises). Even within this set, the config
 * opt-in flag is still required.
 */
export declare const TABNINE_LEARN_CAPABLE_MODES: readonly TabnineDeploymentMode[];
export interface TabnineAdapterConfig extends IdeAdapterConfig {
    /**
     * Tabnine deployment mode. Required. No default -- must be explicitly
     * declared so the adapter knows data-residency and training-eligibility
     * bounds without guessing.
     */
    deploymentMode: TabnineDeploymentMode;
    /**
     * Explicit opt-in for on-premises codebase learning (learnFromCodebase).
     * Only meaningful in 'enterprise-self-hosted' mode. Default: false.
     *
     * Setting this to true is a deliberate governance decision: the operator
     * acknowledges that the training corpus will be scanned for secrets and
     * PHI before the learn operation is permitted, and that the training data
     * scope must be within pack-binding bounds.
     */
    learnFromCodebase?: boolean;
    /** Reviewer tier for HIPAA-bound PHI gate. Default: T2_LEAD */
    hipaaReviewerTier?: ReviewerTier;
    /** Reviewer tier for test generation under regulated packs. Default: T2_LEAD */
    testGenReviewerTier?: ReviewerTier;
}
export interface TabnineInlineCompletionContext {
    filePath: string;
    cursorPosition?: {
        line: number;
        column: number;
    };
    surroundingContext?: string;
    sessionId?: string;
}
export interface TabnineChatContext {
    promptText: string;
    sessionId?: string;
}
export interface TabnineCodeReviewContext {
    diff: string;
    filePath?: string;
    sessionId?: string;
}
export interface TabnineTestGenerationContext {
    functionContext: string;
    targetFile?: string;
    sessionId?: string;
}
export interface TabnineDocumentationContext {
    symbolContext: string;
    targetFile?: string;
    sessionId?: string;
}
export interface TabnineCommitMessageContext {
    diff: string;
    branchName?: string;
    sessionId?: string;
}
export interface TabnineLearnFromCodebaseContext {
    repos: string[];
    dataScope?: string;
    sessionId?: string;
}
export declare class TabnineAdapter extends BaseIdeAdapter {
    readonly adapterId = "tabnine";
    readonly ideId = "tabnine";
    private tabnineConfig;
    initialize(config: IdeAdapterConfig): void;
    resolveUserIdentity(session: IdeSessionContext): Promise<UserIdentity>;
    interceptToolInvocation(ctx: ToolInvocationContext): Promise<ToolInvocationDecision>;
    private _gateInlineCompletionRequest;
    private _gateChatRequest;
    private _gateCodeReviewRequest;
    private _gateTestGenerationRequest;
    private _gateDocumentationRequest;
    private _gateCommitMessageRequest;
    wrapLearnFromCodebase(ctx: TabnineLearnFromCodebaseContext): Promise<ToolInvocationDecision>;
    wrapInlineCompletion(ctx: TabnineInlineCompletionContext): Promise<ToolInvocationDecision>;
    wrapChat(ctx: TabnineChatContext): Promise<ToolInvocationDecision>;
    wrapCodeReview(ctx: TabnineCodeReviewContext): Promise<ToolInvocationDecision>;
    wrapTestGeneration(ctx: TabnineTestGenerationContext): Promise<ToolInvocationDecision>;
    wrapDocumentation(ctx: TabnineDocumentationContext): Promise<ToolInvocationDecision>;
    wrapCommitMessage(ctx: TabnineCommitMessageContext): Promise<ToolInvocationDecision>;
    private _gateLearnFromCodebaseRequest;
    getIdeCapabilities(): IdeAdapterCapabilities;
    translateError(raw: unknown): import('./index').IdeAdapterError;
    getDeploymentMode(): TabnineDeploymentMode;
    isLearnFromCodebaseEnabled(): boolean;
    private _scanForSecrets;
    private _scanForPhiIndicators;
    private _isHipaaBinding;
    /**
     * Scan a unified diff for secrets. Returns the first finding or null.
     * Only scans added lines (lines starting with '+').
     */
    private _scanDiffForSecrets;
    /**
     * Check deployment-mode-level compliance for the active pack binding.
     * Returns a DENY decision if 'pro' mode is used under a regulated pack binding
     * (pro has no BAA eligibility), or null if no issue.
     */
    private _checkDeploymentModeCompliance;
}
//# sourceMappingURL=tabnine.d.ts.map