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:
+10
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user