@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
18 lines • 804 B
JavaScript
/** Lifecycle bookkeeping cannot invalidate a caller's optimistic transcript token. */
export function lifecycleEditLeaf(manager, expectedLeafId) {
const currentLeafId = manager.getLeafId();
if (expectedLeafId === undefined)
return currentLeafId;
let leafId = currentLeafId;
while (leafId !== null && leafId !== expectedLeafId) {
const entry = manager.getEntry(leafId);
if (entry?.type !== "custom" ||
(entry.customType !== "session-lifecycle" &&
entry.customType !== "work-custody" &&
entry.customType !== "child-lifecycle"))
return currentLeafId;
leafId = entry.parentId;
}
return leafId === expectedLeafId ? expectedLeafId : currentLeafId;
}
//# sourceMappingURL=lifecycle-edit-leaf.js.map