import { type WebsiteBlocklistConfig } from '../agent/tools/url-safety.js'; import type { AutomationEvent } from '../automations/domain/types.js'; import type { Config } from '../config/schema.js'; export declare const WEB_WATCH_STATE_NAMESPACE = "proactive.web-watches"; export declare const MIN_WEB_WATCH_INTERVAL_MS: number; export declare const DEFAULT_WEB_WATCH_INTERVAL_MS: number; export declare const MAX_WEB_WATCH_INTERVAL_MS: number; export declare const MAX_ACTIVE_WEB_WATCHES = 15; export type WebWatchDeliveryMode = 'immediate' | 'triage' | 'digest'; export interface WebWatchRecord { id: string; ownerId: string; url: string; title: string; condition: string; deliveryMode: WebWatchDeliveryMode; intervalMs: number; subscriptionId: string; projectId?: string; enabled: boolean; revision: number; baselineHash: string | null; lastText: string | null; lastCheckedAt: number | null; nextCheckAt: number; lastChangedAt: number | null; lastStatus: 'pending' | 'ok' | 'error'; lastError: string | null; consecutiveErrors: number; errorNotifiedAt: number | null; createdAt: number; updatedAt: number; } /** * Extracts readable, noise-reduced text from HTML / JSON / plain text for stable diffing. */ export declare function normalizeWebWatchText(raw: string, contentType: string): { title?: string; text: string; }; export declare function computeWebWatchDelta(previousText: string, nextText: string): { changed: boolean; addedLines: string[]; removedLines: string[]; summary: string; }; export declare function listWebWatches(ownerId: string): WebWatchRecord[]; export declare function getWebWatch(ownerId: string, watchId: string): WebWatchRecord | undefined; export declare function createOrReuseWebWatch(input: { ownerId: string; url: string; title?: string; condition: string; deliveryMode?: WebWatchDeliveryMode; intervalMs?: number; projectId?: string; blocklist?: WebsiteBlocklistConfig; }, now?: number): { outcome: 'created' | 'reused_active'; watch: WebWatchRecord; }; export declare function patchWebWatch(ownerId: string, watchId: string, patch: { expectedRevision?: number; enabled?: boolean; condition?: string; intervalMs?: number; deliveryMode?: WebWatchDeliveryMode; }, now?: number): WebWatchRecord; export declare function deleteWebWatch(ownerId: string, watchId: string, now?: number): boolean; export interface WebWatchFetchResult { text: string; contentType: string; url: string; } /** * Periodically polls due public URL watches using SSRF-safe read-only fetches, * establishes initial baseline silently, diffs normalized text, and emits * Proactive Hub events only on meaningful changes or repeated coverage failures. */ export declare class WebWatchSignalProducer { private readonly deps; private scanning; constructor(deps: { ownerId?: string; getConfig: () => Config; ingestEvent: (event: AutomationEvent) => void; fetchPage?: (url: string, blocklist: WebsiteBlocklistConfig | undefined) => Promise; now?: () => number; }); checkOne(watchId: string, ownerId?: string): Promise<'baseline' | 'unchanged' | 'changed' | 'error' | 'skipped'>; scanDue(limit?: number): Promise; }