@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
33 lines • 1.85 kB
TypeScript
import { checkSessionHolders } from "../core/foreign-session-holders.ts";
import type { AppMode } from "../core/project-trust.ts";
import type { SessionManager } from "../core/session-manager.ts";
/** Warn after the runtime publishes its holder; an advisory lookup must not abort startup. */
export declare function prepareSessionOpening(manager: SessionManager, mode: AppMode): Promise<void>;
/** A live session on this machine's multi-session host that the terminal attaches to instead of opening it. */
export interface HostAttachTarget {
readonly socket: string;
readonly sessionId: string;
}
export type StartupAdmission = "open" | "cancelled" | "refused" | {
readonly attach: HostAttachTarget;
};
/**
* Exit code of a startup refused because another live process holds the session. The schedule runner reads it to
* leave the occurrence pending instead of failing it (senpi#5756).
*/
export declare const SESSION_HELD_EXIT_CODE = 76;
export interface StartupAdmissionIo {
readonly canAsk: boolean;
readonly confirm: (question: string) => Promise<boolean>;
readonly err: (line: string) => void;
readonly lookup?: typeof checkSessionHolders;
/** The opening can be served by attaching to a host that holds it (not for a rebind, which rewrites the file). */
readonly canAttach?: boolean;
}
/**
* Startup admission for a session another live process holds (senpi#5756, the startup path of #5744): opening it
* would start a second run of the same session. Without a person to ask it is refused with the holder named; on a
* terminal the person chooses to cancel or to take over (the holder is asked to exit first, as /resume does).
*/
export declare function admitStartupSession(sessionFile: string | undefined, io: StartupAdmissionIo): Promise<StartupAdmission>;
//# sourceMappingURL=session-opening.d.ts.map