feat: track compaction count + verbose notice

This commit is contained in:
Peter Steinberger
2026-01-06 02:41:48 +01:00
parent 3c6dea3ef3
commit b30bae89ed
12 changed files with 293 additions and 6 deletions

View File

@@ -44,6 +44,7 @@ import type { ReplyPayload } from "../types.js";
import { isAbortTrigger, setAbortMemory } from "./abort.js";
import type { InlineDirectives } from "./directive-handling.js";
import { stripMentions, stripStructuralPrefixes } from "./mentions.js";
import { incrementCompactionCount } from "./session-updates.js";
export type CommandContext = {
surface: string;
@@ -444,6 +445,14 @@ export async function handleCommands(params: {
: "Compacted"
: "Compaction skipped"
: "Compaction failed";
if (result.ok && result.compacted) {
await incrementCompactionCount({
sessionEntry,
sessionStore,
sessionKey,
storePath,
});
}
const reason = result.reason?.trim();
const line = reason
? `${compactLabel}: ${reason}${contextSummary}`