@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
21 lines • 1.43 kB
TypeScript
/**
* `attach_session { takeover: true, holder }` on a machine-owned host (R21; S37): opening a session elsewhere takes it
* over. The takeover is recorded durably first; then the caller attaches and every other connection's holds on the
* session are released with one `session_released { reason: "taken_over" }` record and no error. The session and its
* running turn go on untouched, and the host's other sessions are not touched at all.
*
* Only the ledger commit is awaited before the host's shared state is read. Everything after it (the re-checks, the
* caller's attach, the removal of every other connection's holds) runs without a gap, so a disconnect, a
* `release_attachment`, a drain or a second takeover that lands during the notices and the deferred releases finds
* those holds already gone and cannot release one twice.
*/
import type { RpcAttachmentCommand } from "./attachment-types.ts";
import type { RpcResponse } from "./rpc-types.ts";
import type { RouterContext } from "./session-router-context.ts";
type TakeoverCommand = Extract<RpcAttachmentCommand, {
type: "attach_session";
}>;
/** Refuses on any other host; else records the takeover, runs `attach` for the caller, and lets the others go. */
export declare function takeOver(host: RouterContext, command: TakeoverCommand, owner: string, attach: () => void): Promise<RpcResponse>;
export {};
//# sourceMappingURL=attach-takeover.d.ts.map