UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

48 lines • 2.03 kB
export { createFsWatchEventSource } from "./watch-event-source.ts"; export type WatchTarget = { readonly id: string; readonly kind: "dir" | "dir-recursive"; readonly path: string; readonly allowList?: readonly string[]; readonly filter?: (relPath: string) => boolean; }; export type WatchEventListener = (eventType: string, filename: string | null) => void; export type WatchEventSource = (path: string, listener: WatchEventListener, options?: { readonly recursive: boolean; }) => () => void; export type WatchClock = { setTimeout(callback: () => void, delayMs: number): ReturnType<typeof setTimeout>; clearTimeout(timer: ReturnType<typeof setTimeout>): void; }; export type RealChange = { readonly changedPaths: readonly string[]; readonly created: readonly string[]; readonly deleted: readonly string[]; }; export type ConfigReloadWatchEngineOptions = { readonly targets: readonly WatchTarget[]; readonly subscribe: WatchEventSource; readonly onRealChange: (change: RealChange) => void; readonly onError?: (error: unknown, path: string) => void; readonly debounceMs?: number; readonly clock?: WatchClock; /** Test seam. Production callers use SHA-256 of file bytes. */ readonly hashFile?: (path: string) => string; }; /** * Hash-gates filesystem events. Targets are directories by design: watching a * file directly breaks when editors atomically rename a replacement over it. */ export declare class ConfigReloadWatchEngine { #private; constructor(options: ConfigReloadWatchEngineOptions); /** * Marks the engine inert and cancels every subscription synchronously, then * joins whatever native disposal those unsubscribers return. Repeated close() * callers share that join. Dispatch already checks `#closed`, so stale events * cannot start reload work while disposal is outstanding. */ close(): Promise<void>; getBaselineSnapshot(): ReadonlyMap<string, string>; } //# sourceMappingURL=watch-engine.d.ts.map