/** * Shared XHR/Fetch interceptor JavaScript generators. * * Provides a single source of truth for monkey-patching browser * fetch() and XMLHttpRequest to capture API responses matching * a URL pattern. Used by: * - Page.installInterceptor() (browser.ts) * - stepIntercept (pipeline/steps/intercept.ts) * - stepTap (pipeline/steps/tap.ts) */ /** * Generate JavaScript source that installs a fetch/XHR interceptor. * Captured responses are pushed to `window.__opencli_intercepted`. * * @param patternExpr - JS expression resolving to a URL substring to match (e.g. a JSON.stringify'd string) * @param opts.arrayName - Global array name for captured data (default: '__opencli_intercepted') * @param opts.patchGuard - Global boolean name to prevent double-patching (default: '__opencli_interceptor_patched') */ export declare function generateInterceptorJs(patternExpr: string, opts?: { arrayName?: string; patchGuard?: string; }): string; /** * Generate JavaScript source to read and clear intercepted data. */ export declare function generateReadInterceptedJs(arrayName?: string): string; /** * Generate a self-contained tap interceptor for store-action bridge. * Unlike the global interceptor, this one: * - Installs temporarily, restores originals in finally block * - Resolves a promise on first capture (for immediate await) * - Returns captured data directly * * Reuses the shared DISGUISE_FN for consistent toString() disguising. */ export declare function generateTapInterceptorJs(patternExpr: string): { setupVar: string; capturedVar: string; promiseVar: string; resolveVar: string; fetchPatch: string; xhrPatch: string; restorePatch: string; };