feat: vendor permission system source

This commit is contained in:
云服务部-叶林立
2026-08-19 14:35:19 +08:00
parent 198584daf8
commit 410c50a3e5
809 changed files with 157793 additions and 139 deletions
@@ -0,0 +1,27 @@
import { classifyToolKind } from "./access-intent/tool-kind";
// NOTE: the ask prompts are now payload builders under src/presentation/, and
// denial text is a render over the payload (presentation/agent-renderer.ts).
// This module retains only the pre-check reasons, refused before any payload
// exists to render.
export function formatMissingToolNameReason(): string {
return "Tool call was blocked because no tool name was provided. Use a registered tool name from pi.getAllTools().";
}
export function formatUnknownToolReason(
toolName: string,
availableToolNames: readonly string[],
): string {
const preview = availableToolNames.slice(0, 10);
const suffix = availableToolNames.length > preview.length ? ", ..." : "";
const availableList =
preview.length > 0 ? `${preview.join(", ")}${suffix}` : "none";
const mcpHint =
classifyToolKind(toolName) === "mcp"
? ""
: ' If this was intended as an MCP server tool, call the registered \'mcp\' tool when available (for example: {"tool":"server:tool"}).';
return `Tool '${toolName}' is not registered in this runtime and was blocked before permission checks.${mcpHint} Registered tools: ${availableList}.`;
}