/**
* The memory system-prompt blocks — pure. Two tiers (the two-tier memory split):
* - `# Story so far` — the whole-story summary (a summary of chapter summaries),
* updated only at a chapter close. The story's stable backbone.
* - `# Chapter so far` — the current chapter's rolling summary, recompressed
* every few messages while the act is in progress.
* Both are reinjected every turn so the model keeps continuity after old messages
* leave the context window, and both are omitted when empty (the opening chapter
* has no story summary yet; an early chapter has no chapter summary yet).
*/
/** Build the `# Story so far` block (whole-story summary), or null when empty. */
export function memoryBlock(storySummary: string): string | null {
const text = (storySummary ?? "").trim();
if (!text) return null;
return `# Story so far\n${text}`;
}
/** Build the `# Chapter so far` block (current chapter summary), or null when empty. */
export function chapterBlock(chapterSummary: string): string | null {
const text = (chapterSummary ?? "").trim();
if (!text) return null;
return `# Chapter so far\n${text}`;
}