import type { ExtensionContext } from "@earendil-works/pi-coding-agent"; /** * A reconciliation outlives the session it began in, and every extension ctx accessor throws once * that session is replaced or reloaded. Reading the branch is the only way to ask, so a replaced * session answers "no" instead of throwing into callers that have nowhere to catch it. */ export function onLiveBranch(ctx: ExtensionContext, entryId: string | null): boolean { try { const branch = ctx.sessionManager.getBranch(); return entryId === null || branch.some((entry) => entry.id === entryId); } catch { return false; } }