/** * dep-watcher — File-change → Mailbox bridge for dependency monitoring. * * Watches dependency manifest files (package.json, go.mod, Cargo.toml, etc.) * and when they change (create/update), posts a message to the inter-agent * mailbox. A tech-stack analysis agent can then pick up the message and * run a full tech-stack validation, feeding results back to the coding LLM. * * This module is a *config factory*, not a watcher itself. It produces * configuration that the file-watcher plugin (`watch_start`) can consume, * plus a callback that posts to a Mailbox instance. * * Usage: * const cfg = makeDependencyWatcherConfig({ * projectRoot: '/path/to/project', * mailbox, * targetAgent: 'tech-stack-agent', * }); * // cfg.watchPaths → pass to watch_start * // cfg.onChange → call on file-watcher:changed events * * @module dep-watcher */ import type { Mailbox } from './mailbox-types.js'; /** * Files that declare project dependencies. When any of these change * (create/update), a mailbox message triggers a tech-stack audit. */ export declare const DEPENDENCY_FILE_PATTERNS: ReadonlyArray; export interface DepWatchEntry { /** Relative path from project root that changed. */ path: string; /** Event type from the file watcher: 'change', 'add', 'delete' (rare). */ event: string; /** ISO8601 timestamp of when the change was detected. */ timestamp: string; } export interface DependencyWatcherConfig { /** Paths to pass to `watch_start` — the project-root-relative dependency files. */ watchPaths: string[]; /** Callback to invoke when a dependency file changes. Posts to mailbox. */ onChange: (entry: DepWatchEntry) => Promise; /** Debounce window in ms — multiple changes to the same file within this window are collapsed. */ debounceMs: number; /** Cancel all in-flight debounce timers. Call when the file watcher is * stopped (session end / project switch) so pending setTimeouts — each * holding a closure over the mailbox + entry — don't leak. */ dispose: () => void; } interface DependencyWatcherOptions { /** Absolute path to the project root. */ projectRoot: string; /** The mailbox instance where messages will be posted. */ mailbox: Mailbox; /** Agent id that should receive the tech-stack audit task. */ targetAgent?: string | undefined; /** Agent id of the watcher (sender). */ watcherAgentId?: string | undefined; /** Debounce window in ms. Default: 3000 (3 seconds). */ debounceMs?: number | undefined; /** Only watch these specific patterns. Defaults to DEPENDENCY_FILE_PATTERNS. */ patterns?: string[] | undefined; } /** * Build a dependency watcher configuration. The returned `watchPaths` can be * passed directly to the `watch_start` tool, and `onChange` should be wired * to the `file-watcher:changed` custom event. * * When a dependency file changes, `onChange` posts a high-priority `assign` * message to the mailbox targeting the tech-stack agent, with the changed * file path and event type in the body. */ export declare function makeDependencyWatcherConfig(opts: DependencyWatcherOptions): DependencyWatcherConfig; export {}; //# sourceMappingURL=dep-watcher.d.ts.map