@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
44 lines • 1.89 kB
TypeScript
import type { ExtensionToolContext } from "../../types.ts";
import { type DispatchIdentity } from "../permission-system/dispatch.ts";
import type { McpToolCatalogEntry } from "./catalog.ts";
import { type McpAsyncErrorSink } from "./wrap.ts";
export interface McpInvocation {
readonly toolCallId: string;
readonly toolName: string;
readonly input: Record<string, unknown>;
readonly context?: ExtensionToolContext;
}
export interface McpInvocationError {
readonly kind: "unavailable" | "schema_changed" | "permission_denied";
readonly server: string;
readonly tool: string;
readonly message: string;
readonly currentDefinition?: McpToolCatalogEntry["schema"];
}
export type McpPreparedInvocation = {
readonly kind: "ready";
readonly entry: McpToolCatalogEntry;
readonly isCurrent: () => boolean;
} | {
readonly kind: "refused";
readonly error: McpInvocationError;
};
export interface McpInvocationResolver {
identity(entry: McpToolCatalogEntry): DispatchIdentity;
resolve(entry: McpToolCatalogEntry, args: Record<string, unknown>, invocation: McpInvocation | undefined, signal: AbortSignal | undefined): Promise<McpPreparedInvocation>;
}
interface InvocationScope {
readonly owner: object;
readonly sink: McpAsyncErrorSink;
readonly configuration: string;
readonly contextRequired: boolean;
readonly sessionManager?: object;
/** Another session this binding serves as one of its execution scopes (brain/hand S16c). */
readonly servesSession?: (sessionManager: object | undefined) => boolean;
readonly isCurrent: () => boolean;
readonly ready: () => Promise<void>;
readonly current: (tool: string) => McpToolCatalogEntry | undefined;
}
export declare function createMcpInvocationResolver(scope: InvocationScope): McpInvocationResolver;
export {};
//# sourceMappingURL=invocation.d.ts.map