From 8c4ae6e682a5acfd0d1c442ee14705c56f7db651 Mon Sep 17 00:00:00 2001 From: Nav Date: Mon, 21 Sep 2026 04:39:08 +0000 Subject: [PATCH] types: trim challenges.d.ts to the public detectBotChallenge surface Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- types/challenges.d.ts | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/types/challenges.d.ts b/types/challenges.d.ts index 68fc795..c19508b 100644 --- a/types/challenges.d.ts +++ b/types/challenges.d.ts @@ -1,10 +1,5 @@ import type { UntrustedValue } from "./untrusted-value.js"; -/** Guidance text returned when `publicSearchPolicy: "block"` stops a navigation. */ -export const PUBLIC_SEARCH_BLOCK_ADVICE: string; -/** Guidance text attached to a detected search-provider challenge. */ -export const SEARCH_CHALLENGE_ADVICE: string; - /** A detected bot challenge as results report it to the caller. */ export interface BotChallenge { type: "bot_challenge"; @@ -21,41 +16,5 @@ export interface BotChallenge { advice: string; } -/** How long a recorded 403/429/503 block keeps forcing the full challenge scan. */ -export const CHALLENGE_BLOCK_WINDOW_MS: number; -/** - * Up to this many unreadable frames force the full scan (reading them costs - * less than the round trips the gate saves). Past the budget, only a - * challenge-looking frame URL triggers it. - */ -export const CHALLENGE_UNREAD_FRAME_BUDGET: number; - -/** Cheap per-run state used to decide whether a full challenge scan is due. */ -export interface ChallengeScanState { - /** Providers left unresolved by the previous completed scan. */ - openProviders?: { size: number } | readonly unknown[]; - /** Epoch ms of the last 403/429/503 main-document response, 0 if none. */ - blockedAt?: number; - /** Epoch ms to compare `blockedAt` against; defaults to `Date.now()`. */ - now?: number; - main?: { url?: string; title?: string; text?: string }; - /** Every frame the full scan would read, with whatever is already known. */ - frames?: readonly { - url?: string; - title?: string; - text?: string; - visible?: boolean | null; - /** `true` only when `text` is the frame's real text; absent means unread. */ - readable?: boolean; - }[]; - solvedProviders?: readonly string[]; -} - -/** Should the worker pay for a full challenge scan before this run? */ -export function challengeScanNeeded(state?: ChallengeScanState): boolean; /** Scan page metadata for a known bot challenge; null when none matches. */ export function detectBotChallenge(metadata?: UntrustedValue): BotChallenge | null; -/** Does this frame URL host a challenge widget? */ -export function frameUrlLooksLikeChallenge(url: string): boolean; -/** Is this navigation targeting a public search-result UI? */ -export function isPublicSearchNavigation(url: string): boolean;