@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
55 lines • 2.75 kB
TypeScript
import type { McpFormBinding } from "../../core/mcp-form-types.ts";
import type { McpFormClock, McpPresenterFrame } from "./mcp-form-dialog.ts";
import { type Grant, type McpPresenterRegistration, type Registration } from "./mcp-presenter-grants.ts";
export type Sender = (frame: McpPresenterFrame) => boolean;
export interface McpPresenterConnection {
readonly id: string;
readonly epoch: string;
readonly nonce: string;
}
export interface Connection extends McpPresenterConnection {
readonly send: Sender;
readonly attachments: Map<Binding, {
readonly id: string;
readonly epoch: string;
}>;
}
export interface Binding extends McpFormBinding {
readonly sessionId: string;
readonly durableId: string;
readonly lifetime: AbortController;
readonly admit: () => void;
readonly listeners: Set<() => void>;
/** Every holder of this binding; each grant passes `current()` on its own. */
readonly grants: Set<Grant>;
/** The binding's one form FIFO, whichever holder answers (D11 S3-3b T10). */
readonly queue: object;
/** Open from the first holder until the last one leaves: the readiness version and presentation lifetime. */
presence?: {
readonly id: string;
readonly lifetime: AbortController;
};
}
export interface McpPresenterConnectionContext {
hostInstance: string;
connectionNonce: string;
bindingEpoch: string;
attachmentId: string;
attachmentEpoch: string;
}
/** The state one `McpPresenterAuthority` owns; the bindings, grants and forms modules all act on the same instance. */
export interface McpPresenterState {
readonly instance: string;
readonly clock: McpFormClock;
readonly connections: Map<McpPresenterConnection, Connection>;
readonly bindings: Map<string, Binding>;
readonly registrations: Map<McpPresenterRegistration, Registration>;
}
export declare function dispose(state: McpPresenterState): void;
export declare function connect(state: McpPresenterState, id: string, send: Sender): McpPresenterConnection;
export declare function attach(state: McpPresenterState, sender: McpPresenterConnection, handle: McpFormBinding): void;
export declare function connectionContext(state: McpPresenterState, sender: McpPresenterConnection, sessionId: string): McpPresenterConnectionContext | undefined;
export declare function detach(state: McpPresenterState, sender: McpPresenterConnection, handle?: McpFormBinding): void;
export declare function withdraw(state: McpPresenterState, sender: McpPresenterConnection): void;
export declare function bind(state: McpPresenterState, sessionId: string, durableId: string, admit: () => void): McpFormBinding;
//# sourceMappingURL=mcp-presenter-bindings.d.ts.map