@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
71 lines • 2.72 kB
TypeScript
/** A live file watch's record: its options, its proven identity and its check-loop state. */
import type { FSWatcher, Stats } from "node:fs";
import type { FileWatchLoop as FileWatchLoopType } from "./monitor-file-watch.ts";
import { type MonitorRecordBase } from "./monitor-types.ts";
export interface RegisterFileMonitorOptions {
readonly description: string;
readonly path: string;
readonly persistent?: boolean;
readonly deadlineMs?: number | null;
/** Caller-supplied stable identity so a restore can re-bind the same "mon_" id. */
readonly monitorId?: string;
readonly event: "create" | "modify";
readonly timeoutMs: number;
readonly cwd: string;
readonly approvedParent?: string;
/** Durability deadline of a `checkpointed-file` watch; omitted for a one-shot ephemeral one. */
readonly expiresAt?: number;
}
export interface FileMonitorRecord extends MonitorRecordBase {
readonly id: string;
readonly monitorId: string;
readonly sessionId: string;
readonly description: string;
readonly startedAtMs: number;
readonly command: null;
readonly filter: null;
readonly persistent: boolean;
readonly deadlineMs: number | null;
fireCount: number;
lastFiredAtMs: number | null;
readonly expiresAt: number | undefined;
readonly path: string;
readonly canonicalPath: string;
readonly canonicalParent: string;
readonly event: "create" | "modify";
readonly watcher: FSWatcher;
readonly release: () => void;
readonly watch: FileWatchLoopType;
paused: boolean;
settled: boolean;
present: boolean;
mtimeMs: number;
size: number;
digest: string;
device: number;
inode: number;
pendingChange: boolean;
dirty: boolean;
dirtyPasses: number;
dirtyWindowStartedAt: number;
checking: Promise<void> | undefined;
/** Unset for a persistent watch: it has no live deadline, only its durability expiry. */
readonly deadline: ReturnType<typeof setTimeout> | undefined;
}
export interface NewFileRecordInput {
readonly id: string;
readonly options: RegisterFileMonitorOptions;
readonly path: string;
readonly canonicalPath: string;
readonly approvedParent: string;
readonly watcher: FSWatcher;
readonly release: (() => void) | undefined;
readonly digest: string;
readonly initial: Stats | null;
/** Runs one check pass (the watch loop's trigger). */
readonly check: () => void;
/** The registration timeout elapsed for an ephemeral watch. */
readonly timedOut: () => void;
}
export declare function newFileRecord(input: NewFileRecordInput): FileMonitorRecord;
//# sourceMappingURL=file-monitor-record.d.ts.map