@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
54 lines • 2.68 kB
TypeScript
import type { SessionSummary } from "./session-summary.ts";
import type { SessionSummaryStore } from "./session-summary-cache.ts";
import type { FileStamp } from "./session-summary-lru.ts";
export { SESSION_SUMMARY_INDEX_FILE } from "./session-summary-index-file.ts";
/**
* Upper bound on live index bytes per sessions directory. It sits well above the
* in-memory cache's 64 MiB because the index is read once per cold listing, not
* retained; past it the least recently active sessions are left out and stream
* like any cache miss.
*/
export declare const SESSION_SUMMARY_INDEX_MAX_BYTES: number;
export type SessionSummaryIndexOptions = {
readonly maxBytes?: number;
/** Keep the index file here instead of in the session directory (a store this engine only reads). */
readonly indexDir?: string;
};
/** Forget every index snapshot, as a fresh process would start. */
export declare function forgetSessionSummaryIndexSnapshots(): void;
/**
* Persistent summaries for one sessions directory, stored as
* `<dir>/.session-summaries.index` (senpi#2087).
*
* It is the second cache level behind the in-memory LRU: a cold process lists an
* unchanged directory by reading this one file instead of re-streaming every
* session. The file is loaded lazily on the first in-memory miss it can serve,
* so a warm process does not read it again for a session that just changed.
* Nothing here throws or logs: an unreadable, corrupt,
* or unwritable index only means the listing streams, and its rows are
* identical either way.
*/
export declare class SessionSummaryIndex implements SessionSummaryStore {
private readonly path;
private readonly maxBytes;
private loading;
private snapshot;
private readonly recorded;
constructor(dir: string, options?: SessionSummaryIndexOptions);
lookup(filePath: string, stamp: FileStamp): Promise<SessionSummary | undefined>;
record(filePath: string, stamp: FileStamp, summary: SessionSummary): void;
/**
* Bring the index up to date after a listing of `presentFiles`.
*
* Summaries the index lacks are appended one line each. The file is rewritten
* instead (temp file, then rename) when it is unusable, or when its entry
* bytes exceed twice the live entries' bytes: superseded lines, torn lines,
* removed sessions, and entries over the byte budget all count as dead.
*/
persist(presentFiles: readonly string[]): Promise<void>;
private currentSnapshot;
/** Stat before reading, so a concurrent writer can only make the snapshot look stale. */
private load;
private remember;
}
//# sourceMappingURL=session-summary-index.d.ts.map