/**
 * IDE Adapter SDK -- public interface surface.
 *
 * Defines the abstract TypeScript interfaces and error hierarchy for
 * IDE-layer governance adapters. Every IDE adapter (Claude Code, Cursor,
 * GitHub Copilot Workspace, Continue.dev) implements `IdeAdapter`.
 *
 * The governance runtime dispatches tool-invocation interception, policy
 * evaluation, reviewer routing, audit-chain emission, and session lifecycle
 * through this interface. No IDE-specific branching is permitted in the
 * runtime layer -- all IDE logic lives in the concrete adapter.
 *
 * Spec: P3-IDE-01 (IDE Adapter SDK)
 * AC:   1-3, 17, 22-24 (interfaces, base, error hierarchy, identity types)
 *
 * @connexum/ai-governance
 */
import { LlmProviderError } from '../llm-adapters/index.js';
// ---------------------------------------------------------------------------
// Re-export LlmProviderError so consumers of the IDE surface do not have to
// import directly from llm-adapters.
// ---------------------------------------------------------------------------
export { LlmProviderError };
// ---------------------------------------------------------------------------
// Error hierarchy (AC 17)
// ---------------------------------------------------------------------------
/**
 * Base error for all IDE adapter errors.
 * Extends LlmProviderError so the error hierarchy is unified:
 *   LlmProviderError -> IdeAdapterError -> (subclasses)
 *
 * No raw Error escapes any adapter. Every catch block calls translateError().
 */
export class IdeAdapterError extends LlmProviderError {
    ideId;
    constructor(opts) {
        super({
            message: opts.message,
            code: opts.code,
            providerId: opts.ideId,
            adapterId: opts.adapterId,
            raw: opts.raw,
        });
        this.name = 'IdeAdapterError';
        this.ideId = opts.ideId;
    }
}
/**
 * The IDE does not support the requested operation or integration surface.
 * Adapters throw this instead of returning null/undefined for unsupported methods.
 *
 * `.surface` describes which method or IDE surface is unsupported.
 */
export class IdeUnsupportedError extends IdeAdapterError {
    surface;
    constructor(opts) {
        super({ ...opts, code: 'IDE_UNSUPPORTED' });
        this.name = 'IdeUnsupportedError';
        this.surface = opts.surface;
    }
}
/**
 * User identity could not be resolved and anonymous sessions are not permitted.
 * Thrown at initialize time (fail-closed) when identity resolution fails.
 */
export class IdeAttributionError extends IdeAdapterError {
    constructor(opts) {
        super({ ...opts, code: 'IDE_ATTRIBUTION_FAILED' });
        this.name = 'IdeAttributionError';
    }
}
/**
 * PR-boundary enforcement failure (Copilot Workspace adapter).
 * `.prUrl` and `.checkRunId` are optional because the error may fire before
 * a check-run is created.
 */
export class PrBoundaryEnforcementError extends IdeAdapterError {
    prUrl;
    checkRunId;
    constructor(opts) {
        super({ ...opts, code: 'PR_BOUNDARY_FAILED' });
        this.name = 'PrBoundaryEnforcementError';
        this.prUrl = opts.prUrl;
        this.checkRunId = opts.checkRunId;
    }
}
/**
 * Session lifecycle error (initialize without policy pack, session not found, etc.)
 */
export class IdeSessionError extends IdeAdapterError {
    constructor(opts) {
        super({ ...opts, code: 'IDE_SESSION_INVALID' });
        this.name = 'IdeSessionError';
    }
}
//# sourceMappingURL=index.js.map