UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

23 lines • 1.21 kB
import { prepareDispatchApproval } from "./dispatch.js"; // ToolInfo retains the registered schema object. Its identity scopes metadata // to the offered definition, without adding private fields to provider schemas. const identities = new WeakMap(); export function registerDispatchIdentity(parameters, identity) { identities.set(parameters, identity); } export function getDispatchIdentity(parameters, input) { return identities.get(parameters)?.(input); } export function prepareMcpDispatchApproval(pi, event, ctx, authorizer) { // Other tools retain their existing preflight path, including calls while // the extension runtime is still starting and cannot list tools (#2617). if (!event.toolName.startsWith("mcp_")) return undefined; const tool = pi.getAllTools().find((candidate) => candidate.name === event.toolName); const identity = tool === undefined ? undefined : getDispatchIdentity(tool.parameters, event.input); if (identity === undefined) return undefined; const request = { ...event, identity }; return prepareDispatchApproval(ctx.sessionManager, request, authorizer.policy(request, ctx)); } //# sourceMappingURL=dispatch-metadata.js.map