@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
51 lines • 2.81 kB
TypeScript
import type { McpFormBinding, McpFormScope, McpFormSettled, McpPresenterIdentity } from "../../core/mcp-form-types.ts";
import type { McpFormDialog } from "./mcp-form-dialog.ts";
import type { Binding, Connection, McpPresenterConnection, McpPresenterState } from "./mcp-presenter-bindings.ts";
/** A grant that may answer secret prompts on the sealed route (D11 secret phase 4.3, 5.1). */
export declare const SECRET_INPUT_FEATURE = "secret_input_v1";
/** A signed acquire's feature list: at most 16 short strings. Unknown names are ignored, never an error. */
export declare function features(value: unknown): value is readonly string[];
export interface McpPresenterRegistration {
readonly id: string;
}
export interface Registration extends McpPresenterRegistration {
readonly principal: string;
readonly generation: string;
readonly binding: Binding;
readonly connection: Connection;
readonly kind: McpFormScope["presenterKind"];
readonly elsewhere: boolean;
/** The signed acquire carried `secret_input_v1`; recorded apart from `elsewhere`. */
readonly secretInput: boolean;
active: boolean;
}
export interface Grant {
readonly id: string;
readonly registration: Registration;
readonly scope: McpFormScope;
readonly answeredBy: NonNullable<McpFormSettled["answeredBy"]>;
readonly lifetime: AbortController;
readonly dialogs: Map<string, McpFormDialog>;
}
export declare function enroll(state: McpPresenterState, principal?: string, identity?: McpPresenterIdentity): {
register: (handle: McpFormBinding, sender: McpPresenterConnection, options: {
readonly kind: McpFormScope["presenterKind"];
readonly features?: readonly string[];
}) => McpPresenterRegistration;
acquire: (handle: McpPresenterRegistration) => {
readonly grantId: string;
readonly scope: McpFormScope;
};
revoke: (handle: McpPresenterRegistration) => void;
};
export declare function current(state: McpPresenterState, grant: Grant): boolean;
export declare function holders(state: McpPresenterState, binding: Binding): Grant[];
/**
* Whether a current account-principal grant on this binding negotiated `secret_input_v1`: only those can become
* sealed holders (D11 secret phase 5.1 conditions 2 and 3), so only they need a host token.
*/
export declare function secretInputHeld(state: McpPresenterState, handle: McpFormBinding): boolean;
/** The current account-principal grants on this binding that negotiated `secret_input_v1` (5.1 conditions 1-3). */
export declare function secretCandidates(state: McpPresenterState, handle: McpFormBinding): Grant[];
export declare function revoke(state: McpPresenterState, registration: Registration, operation?: boolean): void;
//# sourceMappingURL=mcp-presenter-grants.d.ts.map