/** * Does a stored `project.worktree` value name `dir` or something under it? * * Exact-or-prefix on purpose: a mirror root has no sub-project registrations * today, but if OpenCode ever registers one, it must die with the tree rather * than keep the root handle alive. Never matches a SIBLING whose path merely * starts with the same string (`taskrun-abc` vs `taskrun-abc2` are different * mirrors), which is why the prefix comparison appends a separator. * Pure so the matching rule is pinned by a test without a database. */ export declare function projectRegistryMatches(candidate: string, dir: string): boolean; /** * Delete every registry row whose directory IS `dir` or lies UNDER it. * * Two shapes exist, and the 2026-10-18 version only handled the first: * * 1. the mirror registered as its OWN project (`project.worktree` names the * mirror) - the whole project row goes, children with it; * 2. the mirror as a `worktree` CHILD of the linked-folder project (what a * real run leaves behind: `project.worktree` names `.../frontend` while * the `worktree` table names `.../.teamshare-worktrees/taskrun-`). * * Shape 2 is why a torn-down mirror kept its handle: `project.worktree` * (`.../frontend`) is neither equal to the mirror nor under it, so the old * code matched nothing, returned 0, and the service re-acquired the handle * at every restart from the surviving `worktree` row. The 2026-10-22 * incident (`taskrun-355a48b1`) was exactly this: the row, not the code * path, was the lock. * * Child rows of a SURVIVING project are deleted only when their own * directory matches - the linked folder's own rows (`.../frontend`) never * match a mirror dir, so the human's project registration is untouched. * * @returns the number of `project` rows deleted. Best-effort: returns 0 when * the DB is missing, locked or unreadable - housekeeping never fails * a run. */ export declare function forgetOpencodeProject(dir: string): number;