/**
 * CodyIdeAdapter -- Sourcegraph Cody adapter.
 *
 * Sourcegraph Cody is an enterprise code intelligence + AI assistant that
 * wraps the Sourcegraph platform's code-search and context-fetch engine.
 * Customer base: enterprise dev orgs, regulated industries (banks, healthcare,
 * large government agencies).
 *
 * Deployment modes:
 *   sourcegraph-cloud -- Sourcegraph-managed SaaS
 *   self-hosted       -- Customer-operated Sourcegraph instance (air-gapped,
 *                        private cloud, on-premise)
 *   free-pro          -- Individual Cody Free / Cody Pro; no enterprise features
 *                        (no embeddings index, limited context window)
 *
 * Hook surfaces (all seven are separate governable surfaces):
 *   codeSearchRequested(query, repos)  -- code-search query gate; context
 *     returned from code search can contain secrets; pre-result gate.
 *   contextFetchRequested(filePaths)   -- fetch of repository context
 *     (files, symbols, docs) before injection into the AI prompt.
 *   autocompleteRequested(file, cursor, context) -- inline autocomplete gate.
 *   chatRequested(prompt, repoContext) -- chat request gate; Cody chat can
 *     have attached repo context injected into the prompt window.
 *   commitMessageRequested(diff)       -- Cody-generated commit message gate;
 *     classify diff for secrets before generation. (PT-ADAPT-CODY-1 indirectly)
 *   recipeExecutionRequested(recipe, args) -- Cody "recipes" (explain code,
 *     generate tests, etc.) are structured AI workflows. Recipe execution is
 *     treated as a bounded autonomous operation requiring pack compliance.
 *   embeddingsIndexRequested(repos)    -- Embeddings index build for a repo;
 *     only available in self-hosted and sourcegraph-cloud modes. free-pro mode
 *     does NOT support embeddings; the adapter explicitly blocks this surface
 *     in free-pro mode regardless of pack binding.
 *
 * Cody-specific pen-tests:
 *   PT-ADAPT-CODY-1: empty packBinding[] throws UnboundDataError pre-call
 *   PT-ADAPT-CODY-2: auth tokens / API keys never appear in audit entries
 *   PT-ADAPT-CODY-3: malformed config (invalid deploymentMode) throws at construction
 *   PT-ADAPT-CODY-4: embeddingsIndex blocked in free-pro mode
 *
 * Spec: P3-SUB-IDE-06
 *
 * @connexum/ai-governance
 */
import { BaseIdeAdapter } from './base';
import { type IdeAdapterConfig, type IdeAdapterCapabilities, type IdeSessionContext, type ToolInvocationContext, type ToolInvocationDecision, type UserIdentity, type ReviewerTier } from './index';
/**
 * Sourcegraph Cody deployment modes.
 *
 *   sourcegraph-cloud -- Sourcegraph-managed SaaS (available for enterprise).
 *   self-hosted       -- Customer-operated Sourcegraph instance.
 *   free-pro          -- Individual Cody Free or Cody Pro account.
 *
 * Governance notes:
 *   - Embeddings index is only supported on sourcegraph-cloud and self-hosted.
 *     The adapter blocks embeddingsIndexRequested in free-pro mode.
 *   - Under HIPAA binding, only self-hosted passes the data-residency check
 *     by default (customer controls the instance). sourcegraph-cloud requires
 *     an active BAA with Sourcegraph; free-pro is never BAA-eligible.
 */
export type CodyDeploymentMode = 'sourcegraph-cloud' | 'self-hosted' | 'free-pro';
export declare const CODY_BAA_ELIGIBLE_MODES: CodyDeploymentMode[];
export interface CodyAdapterConfig extends IdeAdapterConfig {
    /**
     * Sourcegraph Cody deployment mode.
     * Required. No default -- must be explicitly declared so the adapter
     * knows data-residency bounds without guessing.
     */
    deploymentMode: CodyDeploymentMode;
    /**
     * Base URL of the Sourcegraph instance (for self-hosted deployments).
     * Used for audit provenance only; never injected into secret logs.
     * Ignored for sourcegraph-cloud and free-pro.
     */
    sourcegraphInstanceUrl?: string;
    /** Reviewer tier for HIPAA-bound PHI gate. Default: T2_LEAD */
    hipaaReviewerTier?: ReviewerTier;
    /** Reviewer tier for recipe execution under regulated packs. Default: T2_LEAD */
    recipeReviewerTier?: ReviewerTier;
}
export interface CodyCodeSearchContext {
    query: string;
    repos?: string[];
    maxResults?: number;
    sessionId?: string;
}
export interface CodyContextFetchContext {
    filePaths: string[];
    symbols?: string[];
    sessionId?: string;
}
export interface CodyCommitDiffContext {
    diff: string;
    branchName?: string;
    sessionId?: string;
}
export interface CodyRecipeContext {
    recipeId: string;
    recipeArgs?: Record<string, unknown>;
    targetFilePath?: string;
    sessionId?: string;
}
export interface CodyEmbeddingsIndexContext {
    repos: string[];
    sessionId?: string;
}
export declare class CodyAdapter extends BaseIdeAdapter {
    readonly adapterId = "sourcegraph-cody";
    readonly ideId = "sourcegraph-cody";
    private codyConfig;
    initialize(config: IdeAdapterConfig): void;
    resolveUserIdentity(session: IdeSessionContext): Promise<UserIdentity>;
    interceptToolInvocation(ctx: ToolInvocationContext): Promise<ToolInvocationDecision>;
    private _gateAutocompleteRequest;
    private _gateChatRequest;
    private _auditSuggestionAccepted;
    private _auditSuggestionRejected;
    codeSearchRequested(ctx: CodyCodeSearchContext): Promise<ToolInvocationDecision>;
    contextFetchRequested(ctx: CodyContextFetchContext): Promise<ToolInvocationDecision>;
    commitMessageRequested(ctx: CodyCommitDiffContext): Promise<ToolInvocationDecision>;
    recipeExecutionRequested(ctx: CodyRecipeContext): Promise<ToolInvocationDecision>;
    embeddingsIndexRequested(ctx: CodyEmbeddingsIndexContext): Promise<ToolInvocationDecision>;
    private _gateCodeSearchRequest;
    private _gateContextFetchRequest;
    private _gateCommitMessageRequest;
    private _gateRecipeExecutionRequest;
    private _gateEmbeddingsIndexRequest;
    getIdeCapabilities(): IdeAdapterCapabilities;
    translateError(raw: unknown): import('./index').IdeAdapterError;
    getDeploymentMode(): CodyDeploymentMode;
    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;
    /**
     * Returns true if the file path matches a sensitive pattern.
     * Sensitive paths must not be injected into Cody context windows.
     */
    private _isSensitivePath;
    /**
     * Check deployment-mode-level compliance for the active pack binding.
     * Returns a DENY decision if free-pro is used under a regulated pack binding
     * (free-pro has no BAA eligibility), or null if no issue.
     */
    private _checkDeploymentModeCompliance;
}
//# sourceMappingURL=cody.d.ts.map