type ErrorContext = Record; interface PptrKitErrorOptions { retryable?: boolean; context?: ErrorContext; cause?: unknown; } /** Base error for the @technical-1 suite. */ declare class PptrKitError extends Error { readonly retryable: boolean; readonly context: ErrorContext; constructor(message: string, opts?: PptrKitErrorOptions); } /** A selector never appeared / matched. Terminal by default. */ declare class SelectorNotFoundError extends PptrKitError { readonly selector: string; constructor(selector: string, opts?: PptrKitErrorOptions); } /** Navigation to a URL failed. Retryable by default. */ declare class NavigationError extends PptrKitError { readonly url: string; constructor(url: string, opts?: PptrKitErrorOptions); } /** An operation exceeded its time budget. Retryable by default. */ declare class TimeoutError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** A captcha / anti-bot challenge was encountered. Terminal by default. */ declare class CaptchaError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** A proxy connection / auth failure. Retryable by default. */ declare class ProxyError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** Session persist/restore failure. Terminal by default. */ declare class SessionError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** A required configuration value was missing or invalid. Terminal. */ declare class ConfigError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** A browser-pool misuse (bad size, use-after-drain). Terminal. */ declare class PoolError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** * A BrowserContext lifecycle failure (create / close / targets / permission * override). Terminal by default like PoolError; transient CDP rejections * (context create/close hiccup, permission override race) pass retryable:true * explicitly at the throw site. */ declare class ContextError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** * A file-download operation failed. Terminal by default; transient * download failures (CDP hiccup, mid-poll fs race) pass `retryable:true` * explicitly at the throw site. */ declare class DownloadError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** * A network-layer operation failed. Terminal by default (covers programmer * misuse — empty pattern list, body capture not enabled, invalid JSON); * transient CDP/body-read failures pass `retryable:true` explicitly. */ declare class NetworkError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** * A Web/Service Worker operation failed — in-worker evaluation, or a worker * lifecycle-observer consumer callback that threw. Terminal by default; the * transient cases (worker destroyed/detached mid-evaluate, CDP hiccup) pass * `retryable:true` explicitly at the throw site. */ declare class WorkerError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** * A raw Chrome DevTools Protocol operation failed (open session, send command, * detach). Terminal by default — a bad method name or bad params is programmer * error — but transient CDP failures (session detached, target closed) pass * `retryable:true` explicitly at the throw site. */ declare class CdpError extends PptrKitError { constructor(message: string, opts?: PptrKitErrorOptions); } /** * An operation was cancelled via an `AbortSignal`. Terminal (never retried): * the caller asked to stop. Its stable `name === "AbortError"` is the * cross-realm-safe cancellation discriminant — consumers detect aborts by * name, not by matching the message string. */ declare class AbortError extends PptrKitError { constructor(message?: string, opts?: PptrKitErrorOptions); } /** Log levels, ordered least→most severe. Mirrors the template runner's levels. */ declare const LOG_LEVELS: readonly ["debug", "info", "step", "success", "warn", "error"]; type LogLevel = (typeof LOG_LEVELS)[number]; /** * Dependency-injected logging contract. Packages accept an optional `Logger` * and never import a concrete implementation. Implementations live in * `@technical-1/logger`. */ interface Logger { log(message: string, level?: LogLevel): void; } /** Mixed into option objects for packages that emit log lines. */ interface LoggerOption { logger?: Logger; } /** Mixed into option objects for time-bounded operations (milliseconds). */ interface TimeoutOption { timeout?: number; } export { AbortError, CaptchaError, CdpError, ConfigError, ContextError, DownloadError, type ErrorContext, LOG_LEVELS, type LogLevel, type Logger, type LoggerOption, NavigationError, NetworkError, PoolError, PptrKitError, type PptrKitErrorOptions, ProxyError, SelectorNotFoundError, SessionError, TimeoutError, type TimeoutOption, WorkerError };