import type { AKTree, ActionType, AgentConfig, CaptureObjective, CaptureRepairCause, InteractiveElement } from './types.js'; export interface SecurityContext { rootUrl?: string; currentUrl?: string; credentials?: AgentConfig['credentials']; interactiveElements: InteractiveElement[]; akTree?: AKTree; currentLang?: string; currentTheme?: 'light' | 'dark'; runMode?: AgentConfig['runMode']; currentObjective?: CaptureObjective; activeRepairCause?: CaptureRepairCause | null; } export interface SecurityDecision { allowed: boolean; reason?: string; target?: InteractiveElement | null; } /** * Is `candidateUrl` part of the same first-party site as `scopeUrl`, for the * purpose of the PROGRESS signal and analytics-blocking (NOT navigation * guarding)? This is deliberately MORE permissive than the navigation * site-scope model so the app's own backend on a sibling host/port still reads * as first-party: * - real domains: same registrable domain (eTLD+1) match — `app.example.com`, * `api.example.com` and `example.com` are all the same site (the navigation * guard, in contrast, requires a strict sub-domain match); * - localhost / private IPs: same host, REGARDLESS of port — a Vite app on * `:5173` calling its API on `:3000` is the same first-party app; * - shared-hosting suffixes (`*.vercel.app`, …): exact host (so sibling * previews stay foreign — they are genuinely distinct sites). * * Used to scope the adaptive-wait progress signal (AUT-240) to the app's own * traffic, so third-party telemetry (PostHog beacons, analytics/ad pixels, * Sentry, …) no longer reads as "the page is making progress" and the stuck * watchdog can still cut a wait whose condition will never be met. * * Fail-OPEN by design: a false "first-party" only makes the watchdog slightly * more patient (still bounded by the per-media cap), whereas a false "foreign" * could suppress a real progress signal and cut a legitimately-slow page early. * So when in doubt we count it as first-party: * - unparseable / non-http(s) `scopeUrl` (e.g. `about:blank` before the first * navigation commits) ⇒ true (don't filter); * - non-http(s) `candidateUrl` (`data:` / `blob:` / `about:`) ⇒ true (in-page * resource). * * NOTE: this MUST NOT be used to gate navigation — it intentionally does not use * the navigation `isWithinProjectScope` model. Use `isAllowedNavigation` there. */ export declare function isFirstPartyForProgress(scopeUrl: string | null | undefined, candidateUrl: string): boolean; /** * Back-compat alias for the progress / analytics first-party predicate. * @deprecated Prefer {@link isFirstPartyForProgress}; this name is kept so the * progress listeners and analytics-block guard keep compiling unchanged. */ export declare function isFirstPartyUrl(scopeUrl: string | null | undefined, candidateUrl: string): boolean; export declare function evaluateResolvedActionSecurity(action: ActionType, args: Record, context: SecurityContext, target: InteractiveElement | null): SecurityDecision; export declare function evaluateActionSecurity(action: ActionType, args: Record, context: SecurityContext): SecurityDecision; export declare function describeSecurityTarget(target: InteractiveElement | null | undefined): string;