/** * @packageDocumentation * GS2-7 (B20) — pure, presentation-only formatters for the history surfaces. * * Shared by the `gth history` / `gth insights` CLI commands AND the `/history` `/search` * `/insights` TUI slash commands so both render identically and both are unit-testable without a * DB or a terminal. Every function is a pure `data -> string[]` transform (one display line per * element); no I/O, no colour codes. */ import type { ConversationSummary, HistoryInsights, SessionRecord, SessionSearchResult } from '#src/history/historyStore.js'; import type { CheckpointStoreStats, PrunableConversation, ReclaimSummary } from '#src/history/checkpointRetention.js'; /** * Render FTS search hits: a header line per hit plus its snippet (or a prompt preview when the * snippet is empty). Returns a friendly single line when there are none. */ export declare function formatSearchResults(results: SessionSearchResult[]): string[]; /** * The placeholder `gth history list` prints where a conversation has no run id — a row written * before run ids existed. Same width as a run id, so the columns after it stay aligned. */ export declare const NO_RUN_ID_PLACEHOLDER: string; /** * GS2-19 — render a conversation-grained listing: one header + last-turn preview per conversation. * The header carries the count / timespan / last message that make the conversation the top-level * unit (`gth history list`), replacing the old flat per-turn list. * * GS2-106 — `showRunId` puts the conversation's run id straight after its integer id, so it can be * copied; a row without one shows {@link NO_RUN_ID_PLACEHOLDER} and stays addressable by its * integer. Off by default: the in-session lists (`/resume`, `/history`) are read at a prompt where * the integer is what gets typed, and a 36-character column there costs every row a line. */ export declare function formatConversationList(conversations: ConversationSummary[], options?: { showRunId?: boolean; }): string[]; /** * GS2-19 — render one conversation's full thread (all turns in order) for `gth history show `. * Each turn shows its prompt and response preview so a search hit can be expanded into context. */ export declare function formatConversationThread(turns: SessionRecord[]): string[]; /** * GS2-107 — a byte count a person can read at a glance. Binary units, one decimal above KB, because * the number this renders is the answer to "how much of my disk is this", not an accounting figure. */ export declare function formatBytes(bytes: number): string; /** * GS2-107 — the one line that makes the conversation store's volume visible where a person already * looks (`gth history list`), naming both the detail and the remedy so neither has to be discovered. * * The file size and the checkpoint share are separate numbers because the same file also holds the * transcripts and the search index; one figure labelled as checkpoints would overstate them. That * split stands. * * What the byte figure is attributed to does not (DL-4 transparency). `checkpointBytes` is the * checkpoint tables' whole share — checkpoint and metadata blobs **plus every pending write**, * attached or orphaned — while `checkpointCount` and `threadCount` count checkpoint rows alone. A * sentence reading "`X` is `N` checkpoints across `T` threads" therefore charged the pending-write * bytes to a population that does not contain them: those `N` checkpoints do not weigh `X`. So the * bytes are named for the population they actually cover, and each count is a clause saying what is * inside that total rather than a thing claiming to weigh it. * * Every clause is true on its own fields and is dropped when its count is zero, so no store renders * `0 checkpoints across 0 threads` — which is what lets `historyCommand` show this line for a store * holding nothing but pending writes whose checkpoints never landed. `writeOnlyBytes` is a subset of * the total by construction (a write-only thread has no checkpoint row to contribute anything else), * so its clause says "of that": those bytes are part of the figure, never additional to it. */ export declare function formatStoreSizeLine(stats: CheckpointStoreStats): string; /** * GS2-107 — the readout in full, for `gth insights`: what the checkpoint tables hold, how much of it * is already unreachable, and which threads are the big ones. */ export declare function formatCheckpointStoreStats(stats: CheckpointStoreStats): string[]; /** * GS2-107 — what `gth history prune` will remove, said BEFORE it removes it. A prune costs a resume, * so the plan names every conversation by the id a person would have typed to resume it, and states * plainly that the transcript is not what is going away. */ export declare function formatPrunePlan(candidates: PrunableConversation[], unaddressableThreads: number, unaddressableBytes: number, writeOnlyThreads: number, writeOnlyBytes: number): string[]; /** GS2-107 — what a completed prune actually removed. */ export declare function formatPruneResult(removed: ReclaimSummary, fileBytesBefore: number, fileBytesAfter: number, vacuumed: boolean): string[]; /** Render the analytics summary: totals, top tools, per-command breakdown. */ export declare function formatInsightsSummary(insights: HistoryInsights): string[];