Phase 5: add getKeptEntries — branch slice from firstKeptEntryId.

Implements kept-window boundary per SPEC §6.4 for dedup before re-inject.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-17 11:17:30 +07:00
parent 1296090909
commit 6ccb580ca1
+10
View File
@@ -0,0 +1,10 @@
import type { SessionEntry } from "@earendil-works/pi-coding-agent";
/** Branch slice from firstKeptEntryId through tail (SPEC §6.4). */
export function getKeptEntries(branch: SessionEntry[], firstKeptEntryId: string): SessionEntry[] {
const startIndex = branch.findIndex((entry) => entry.id === firstKeptEntryId);
if (startIndex < 0) {
return [];
}
return branch.slice(startIndex);
}