@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
34 lines • 1.77 kB
TypeScript
/**
* The asynchronous file seam of compact current-state storage (senpi#4272) and the failures it
* reports. Every spool access goes through `CompactStorageIo`; nothing here blocks the host loop.
*/
export type CompactStorageOperation = "spool_create" | "spill_write" | "value_write" | "node_write" | "page_write" | "leaf_read" | "page_read" | "reclaim";
export interface CompactStorageFailure {
readonly operation: CompactStorageOperation;
readonly path: string;
readonly cause: string;
/** Accepted bytes this failure leaves resident in memory instead of on disk. */
readonly retainedInMemoryBytes: number;
}
/** One leaf's bytes inside a segment file that packs a flush batch. */
export interface CompactFileRange {
readonly offset: number;
readonly length: number;
}
/** Asynchronous file access the host supplies; the default is node's promise filesystem. */
export interface CompactStorageIo {
writeFile(path: string, data: Buffer): Promise<void>;
/** The whole file, or at most `range.length` bytes from `range.offset`. */
readFile(path: string, range?: CompactFileRange): Promise<Buffer>;
unlink(path: string): Promise<void>;
}
export declare const nodeCompactStorageIo: CompactStorageIo;
/** Never throws: a host-supplied cause that cannot be described must not abort the failure report. */
export declare function describeCause(cause: unknown): string;
/** Committed storage that can no longer be read: a real error, never empty content. */
export declare class CompactStorageReadError extends Error {
readonly operation: CompactStorageOperation;
readonly path: string;
constructor(operation: CompactStorageOperation, path: string, cause: unknown);
}
//# sourceMappingURL=compact-storage-io.d.ts.map