/**
 * errors.ts — error taxonomy for @aperant/driver-sdk.
 *
 * Every driver-layer failure raises one of these classes. The taxonomy
 * is load-bearing for the resolver + audit log + verification.json's
 * `meta.fallback_attempts[].reason` field.
 *
 * Conventions:
 *   - Every class sets `.name` to its class identifier so structured
 *     audit lines can serialize the discriminator without `instanceof`
 *     gymnastics in cross-realm contexts.
 *   - Every class extends Error so plain Node consumers can match with
 *     try/catch.
 */
/** A driver manifest violates the structural contract (JSON-Schema). */
export class DriverManifestSchemaError extends Error {
    name = 'DriverManifestSchemaError';
    /** JSON-pointer paths into the manifest where validation failed. */
    errors;
    constructor(message, errors = []) {
        super(message);
        this.errors = errors;
    }
}
/** A driver's runtime configuration is invalid (missing env, malformed args). */
export class DriverConfigError extends Error {
    name = 'DriverConfigError';
}
/** A driver's preflight check failed (missing binary, unreachable service). */
export class DriverPreflightError extends Error {
    name = 'DriverPreflightError';
    /** Structured list of unsatisfied preflight requirements. */
    missing;
    constructor(message, missing = []) {
        super(message);
        this.missing = missing;
    }
}
/** A driver verb invocation failed at the transport / RPC layer. */
export class DriverInvocationError extends Error {
    name = 'DriverInvocationError';
    /** The IDL verb name that was being invoked. */
    verb;
    constructor(message, verb) {
        super(message);
        this.verb = verb;
    }
}
/** A driver succeeded but evidence capture (screenshot, dom_dump) failed. */
export class DriverEvidenceCaptureError extends Error {
    name = 'DriverEvidenceCaptureError';
}
/** A non-first-party driver invocation is blocked by TOFU + policy. */
export class DriverNotApprovedError extends Error {
    name = 'DriverNotApprovedError';
    driverId;
    trustTier;
    constructor(message, driverId, trustTier) {
        super(message);
        this.driverId = driverId;
        this.trustTier = trustTier;
    }
}
/**
 * The resolver exhausted its driver chain without satisfying a REQUIRED
 * capability. Fail-closed — verdict logic must NOT silently turn this
 * into a `blocked_by_platform` skip (ID-02).
 */
export class UnsatisfiedRequiredCapabilityError extends Error {
    name = 'UnsatisfiedRequiredCapabilityError';
    capability;
    /** Drivers attempted, with the reason each was rejected. */
    attempts;
    constructor(message, capability, attempts = []) {
        super(message);
        this.capability = capability;
        this.attempts = attempts;
    }
}
//# sourceMappingURL=errors.js.map