@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
27 lines • 1.92 kB
TypeScript
import { type RepositoryIdentity, type RepositoryMatch } from "./repository-identity.ts";
export declare function readRecordedRepositoryIdentity(sessionFile: string): Promise<RepositoryIdentity | undefined>;
/**
* Whether `cwd` is the git repository a session was recorded in. The session side prefers the live
* checkout at its recorded cwd and falls back to the identity the session recorded, because a moved
* repository leaves nothing at the old path to ask.
*/
export declare function classifySessionRepository(sessionFile: string, sessionCwd: string, cwd: string, read?: (dir: string) => Promise<RepositoryIdentity | undefined>): Promise<RepositoryMatch>;
export declare function readSessionCwd(sessionFile: string): Promise<string | undefined>;
/**
* Moves a session recorded under another project into `targetCwd`'s session directory and points its
* header at `targetCwd`. The id, file name, every entry after the header, and the session's extension
* sidecars are kept. The relocated copy is complete before the source is removed, so an interrupted
* rebind leaves the session readable in at least one place. Returns the session file's new path.
*
* The move runs under the session's cross-process move lock and refuses (`SessionHeldError`) while
* another live process has the session open. A rebind that finds the same move already done by a
* concurrent process returns that target.
*
* `beforeRename` runs right before the rename that lands the file, after the wait for the lock and the rewrite. If it
* throws, nothing lands: the rewritten copy is removed, the sidecars already moved go back, and the source stays.
*/
export declare function rebindSessionFile(sourcePath: string, targetCwd: string, sessionDir?: string, options?: {
readonly moveLockWaitMs?: number;
readonly beforeRename?: () => void | Promise<void>;
}): Promise<string>;
//# sourceMappingURL=session-rebind.d.ts.map