@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
41 lines • 1.66 kB
TypeScript
import type { HandoverParkedEntry } from "./host-handover-parked.ts";
import type { PredecessorPeer, RouteEndpoint } from "./predecessor-peer.ts";
import type { RpcResponse } from "./rpc-types.ts";
import type { RpcSessionRow } from "./session-registry-types.ts";
import type { RouterContext } from "./session-router-context.ts";
export interface Attachment {
peer: Promise<PredecessorPeer>;
count: number;
authority?: {
incarnation: number;
epochOffset: number;
};
}
export interface Route {
path: string;
id: string;
endpoint: RouteEndpoint;
upstream?: string;
row?: RpcSessionRow;
generation?: number;
switching: boolean;
park?: HandoverParkedEntry;
terminal?: boolean;
/** Settles once the session is local: resolved when the reopen took it over, rejected when it cannot. */
local: ReturnType<typeof Promise.withResolvers<void>>;
attachments: Map<string, Attachment>;
}
/** Only sessions for which the normal registry actually found a standing foreign claim get a route. */
export declare class RouteTable {
readonly byPath: Map<string, Route>;
readonly byId: Map<string, Route>;
readonly host: RouterContext;
reopen?: (entry: HandoverParkedEntry) => Promise<RpcResponse | undefined>;
constructor(host: RouterContext);
holds(route: Route): boolean;
route(path: string, endpoint: RouteEndpoint): Route;
/** A forgotten route releases everything it owns: every attachment's peer is closed (senpi#7140). */
forget(route: Route): void;
dropPeer(route: Route, caller: string): void;
}
//# sourceMappingURL=predecessor-route-table.d.ts.map