histoire
Version:
A fast story book powered by Vite
24 lines • 1.27 kB
TypeScript
import type { UiAgentThreadBase } from '@histoire/shared';
import type { ThreadFileCodec } from './file.js';
/** Uploads younger than this may still be waiting in an open composer. */
export declare const ORPHAN_ATTACHMENT_AGE: number;
/** One persisted conversation file whose records may reference uploads. */
export interface AttachmentSource {
/** Project-relative file path. */
file: string;
/** Record format of that file. */
codec: ThreadFileCodec<UiAgentThreadBase>;
}
/**
* Deletes generated uploads that no conversation references and that are older than `maxAge`,
* i.e. files uploaded from a composer whose message was never saved.
* Only regular files with generated names are touched; symlinks and the symlinked folder are refused.
* Any unreadable source aborts the sweep, so a corrupt file never causes data loss.
* @param root Project root.
* @param sources Every conversation file sharing `.histoire/attachments`.
* @param maxAge Minimum age in milliseconds.
* @param now Current time in milliseconds.
* @returns Deleted stored names.
*/
export declare function sweepAttachments(root: string, sources: readonly AttachmentSource[], maxAge?: number, now?: number): Promise<string[]>;
//# sourceMappingURL=attachments-sweep.d.ts.map