UNPKG

@code-yeongyu/senpi

Version:

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

42 lines • 1.51 kB
import { FileWatchLoop } from "./monitor-file-watch.js"; import { allocateMonitorId } from "./monitor-types.js"; export function newFileRecord(input) { const { id, options, path, canonicalPath, approvedParent, watcher, release, digest, initial } = input; const persistent = options.persistent ?? options.expiresAt !== undefined; return { id, monitorId: options.monitorId ?? allocateMonitorId(), sessionId: id, description: options.description, startedAtMs: Date.now(), command: null, filter: null, persistent, deadlineMs: persistent ? null : (options.deadlineMs ?? Date.now() + options.timeoutMs), fireCount: 0, lastFiredAtMs: null, expiresAt: options.expiresAt, path, canonicalPath, canonicalParent: approvedParent, event: options.event, watcher, release: release ?? (() => { }), watch: new FileWatchLoop(input.check), paused: false, settled: false, present: initial !== null, mtimeMs: initial?.mtimeMs ?? 0, size: initial?.size ?? 0, digest, device: initial?.dev ?? 0, inode: initial?.ino ?? 0, pendingChange: false, dirty: false, dirtyPasses: 0, dirtyWindowStartedAt: 0, checking: undefined, deadline: persistent ? undefined : setTimeout(input.timedOut, options.timeoutMs), }; } //# sourceMappingURL=file-monitor-record.js.map