/** Resolve an existing session for exactly one project, from the shared registry. * Never fall back to another project. */ import { type SessionListingTransport as SessionDiscoveryTransport } from './discovery.js'; /** Nearest ancestor containing the project's canonical manifest. */ export declare function findProjectRootFrom(dir: string): string | null; /** The minimal slice of `EditorTransport` `resolveSession` actually needs — narrower than the full interface so a test double only has to implement one method. */ export type SessionListingTransport = SessionDiscoveryTransport; export interface ResolvedSession { /** Editor dev-server port the resolved session is listening on. */ port: number; /** Absolute project root — the nearest ancestor of the requested directory containing `volter.project.json`. */ projectRoot: string; } export interface SessionResolutionDeps { /** Session listing + liveness verification — defaults to a real `HttpSessionDiscovery`. Overridable for tests. */ transport?: SessionListingTransport; /** Project-root discovery — defaults to the real fs walk (`findProjectRootFrom` above). Overridable for tests. */ findProjectRootFrom?: (dir: string) => string | null; } /** The code a refusal carries when the registry was read and no session opens the project: the * one state in which "no editor is open here" is a fact, which `close` answers as done. */ export declare const NO_SESSION_FOR_PROJECT = "VOLTER_NO_SESSION_FOR_PROJECT"; /** The `code` of the refusal for this project's session whose manifest does not load; it carries `session`. */ export declare const SESSION_MANIFEST_UNREADABLE = "VOLTER_SESSION_MANIFEST_UNREADABLE"; /** * Resolve `projectDir` (default `process.cwd()`) to its already-running editor * session from the shared registry, with each discovery probe bounded by * `EDITOR_SESSION_DISCOVERY_TIMEOUT_MS`. * Throw when no project manifest or matching live session is found. */ export declare function resolveSession(projectDir?: string, deps?: SessionResolutionDeps): Promise;