/** * Watch a captured page for change (RCL-08). * * WHAT THIS IS NOT: a scheduler, a daemon, or a fetcher. `checkWatches` is * invoked by something else — mono-agent's scheduler drives it — and it does * not touch the network. It re-reads what the pipeline already stored and * compares content hashes, which is exactly the versioning RCL-06 put there. * A re-capture is what makes a page "change"; this reports it. * * The watch list is a small JSON file next to the metadata log, keyed by the * page's identity URL (or, for a local file, its path). Writes go through a * temp file and a rename so a crashed check cannot leave a half-written list. * * @module v1/cli/knowledge/watch */ import { type SectionDiff } from './section-diff.js'; export declare const WATCH_FILE = "watches.json"; export declare const DEFAULT_INTERVAL_SECONDS = 86400; export interface WatchEntry { /** Identity: the capture's canonical URL, or an indexed file path. */ url: string; scope: string; intervalSeconds: number; /** Content hash last seen by a check — the baseline the next one compares to. */ lastHash?: string; lastCheckedAt?: string; lastChangedAt?: string; addedAt: string; label?: string; } export type WatchStatus = 'changed' | 'unchanged' | 'new' | 'missing' | 'not-due'; export interface WatchCheck { url: string; scope: string; status: WatchStatus; checkedAt: string; filePath?: string; title?: string; previousHash?: string; currentHash?: string; version?: number; capturedAt?: string; /** Present on `changed`, unless the previous version's file is gone. */ diff?: SectionDiff; /** Why a change could not be summarized, when it could not. */ note?: string; } export interface WatchCheckReport { checked: number; changed: number; skipped: number; results: WatchCheck[]; } export declare function listWatches(rootDir: string): WatchEntry[]; /** `30m`, `6h`, `2d`, or bare seconds. Throws on a typo — a watch that * silently defaulted to daily would look like it was working. */ export declare function parseInterval(value: string | number | undefined): number; export interface AddWatchOptions { interval?: string | number; scope?: string; label?: string; now?: Date; } /** * Watch `target` (a URL, a docId or an indexed path). * * The baseline is seeded from what is indexed RIGHT NOW, so the first check * after adding reports nothing — a watch exists to catch the NEXT change, not * to re-announce the capture that created it. Re-adding an existing watch * updates its interval and label and keeps the baseline. */ export declare function addWatch(rootDir: string, target: string, opts?: AddWatchOptions): Promise; /** Stop watching. Matches the stored identity URL, a docId, or a path. */ export declare function removeWatch(rootDir: string, target: string, scope?: string): boolean; export interface CheckWatchesOptions { scope?: string; /** Check every watch regardless of its interval. */ force?: boolean; /** Report without updating the stored baselines. */ dryRun?: boolean; now?: Date; } /** * Which watched pages have changed since the last check. * * Reads only what is already indexed: a page "changes" when a new capture of * it was ingested under a new content hash. Each change carries a section-level * summary (`diffSections`) built from the previous version's own archived * file, or a note saying why it could not be built. */ export declare function checkWatches(rootDir: string, opts?: CheckWatchesOptions): Promise; //# sourceMappingURL=watch.d.ts.map