@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
28 lines • 1.34 kB
TypeScript
import type { UiRequestChange } from "./snapshot-types.ts";
import type { RpcExtensionUIRequest, RpcExtensionUIResponse } from "./rpc-types.ts";
type PendingRequest = {
resolve: (value: RpcExtensionUIResponse) => void;
reject: (error: Error) => void;
frame?: RpcExtensionUIRequest;
};
export declare const sessionDialogRequests: WeakMap<object, SessionExtensionUiRequests>;
/** Per-session extension UI request state; never share this map between bindings. */
export declare class SessionExtensionUiRequests {
private readonly pending;
private readonly claimed;
private readonly changed;
constructor(changed?: (change?: UiRequestChange) => void);
set(id: string, request: PendingRequest): void;
delete(id: string): void;
snapshot(): RpcExtensionUIRequest[];
/**
* The first answer wins: it claims the request before `beforeAnswer` runs, so an answer that arrives while
* `beforeAnswer` runs finds the request claimed and settles nothing. A claim whose `beforeAnswer` throws is
* released and the request stays pending. The request stays listed in `snapshot()` until it settles.
*/
resolve(response: RpcExtensionUIResponse, beforeAnswer?: () => void): boolean;
cancelAll(): void;
close(): void;
}
export {};
//# sourceMappingURL=session-extension-ui-requests.d.ts.map