@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
40 lines • 2.2 kB
TypeScript
import type { ExtensionContext } from "../../types.ts";
export interface DispatchIdentity {
readonly owner: object;
readonly metadata: string;
readonly operation?: string;
}
export interface DispatchRequest {
readonly toolCallId: string;
readonly parentToolCallId?: string;
readonly toolName: string;
readonly input: Record<string, unknown>;
readonly identity: DispatchIdentity;
}
export interface DispatchPolicy {
readonly action: "allow" | "ask" | "deny";
readonly fingerprint: string;
}
export interface DispatchAuthorizer {
policy(request: DispatchRequest, ctx: ExtensionContext): DispatchPolicy;
ask(request: DispatchRequest, ctx: ExtensionContext, signal: AbortSignal | undefined): Promise<void>;
}
/** Retirement cannot remove the authorizer installed by a newer extension load. */
export declare function registerDispatchAuthorizer(session: object, authorizer: DispatchAuthorizer): () => void;
export declare function hasDispatchAuthorizer(session: object): boolean;
/** Keep the policy and operation that were actually presented, not their post-reply replacements. */
export declare function prepareDispatchApproval(session: object, request: DispatchRequest, policy: DispatchPolicy): () => void;
/**
* Move the approval recorded for the preflight's arguments object onto the frozen copy the tool will execute. The
* approval leaves `from` in every case (that object never executes); it lands on `to` only while `to` is exactly
* the input that was approved and its authorizer is not retired, so a later in-place change asks again (senpi#5795).
* Never throws: anything that is not an object is a no-op.
*/
export declare function transferDispatchApproval(from: unknown, to: unknown): void;
export declare function forgetDispatchApproval(input: object): void;
/**
* Resolve live permission after MCP readiness. The returned synchronous fence must
* pass immediately before dispatch; a false result requires preparation again.
*/
export declare function authorizeToolDispatch(session: object, request: DispatchRequest, ctx: ExtensionContext, signal: AbortSignal | undefined): Promise<() => boolean>;
//# sourceMappingURL=dispatch.d.ts.map