@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
54 lines • 1.63 kB
TypeScript
/**
* File Read Tracker
*
* Tracks when files were last read by the workspace.
* Used to enforce "read before write" semantics.
*/
/**
* Record of when a file was read.
*/
export interface FileReadRecord {
/** The file path that was read */
path: string;
/** When the file was read */
readAt: Date;
/** The file's modification time when it was read */
modifiedAtRead: Date;
}
/**
* Interface for tracking file reads.
*/
export interface FileReadTracker {
/** Record that a file was read */
recordRead(path: string, modifiedAt: Date): void;
/** Get the last read record for a path */
getReadRecord(path: string): FileReadRecord | undefined;
/**
* Check if file needs re-reading.
* Returns needsReRead: true if file was never read or was modified since last read.
*/
needsReRead(path: string, currentModifiedAt: Date): {
needsReRead: boolean;
reason?: string;
};
/** Clear read record (typically after a successful write) */
clearReadRecord(path: string): void;
/** Clear all records */
clear(): void;
}
/**
* In-memory implementation of FileReadTracker.
*/
export declare class InMemoryFileReadTracker implements FileReadTracker {
private records;
recordRead(path: string, modifiedAt: Date): void;
getReadRecord(path: string): FileReadRecord | undefined;
needsReRead(path: string, currentModifiedAt: Date): {
needsReRead: boolean;
reason?: string;
};
clearReadRecord(path: string): void;
clear(): void;
private normalizePath;
}
//# sourceMappingURL=file-read-tracker.d.ts.map