Adds the "Tools MCP IdeA" tab to the project Permissions panel, alongside the existing "Système" (file/command) tab. Lets the user grant/revoke MCP tool capabilities per agent or project-wide default, grouped by domain (Lecture projet, Lecture tickets, Délégation agents, Contexte et mémoire, Tickets, Travail et exécution, Skills) instead of a flat 25-checkbox list, per the UX conception in carnet #82. - domain/ports/adapters (Tauri, HTTP, mock): wire get_mcp_tool_permissions, update_project_mcp_tool_permissions, update_agent_mcp_tool_permissions (already merged backend API, #82 lots B1-B4) onto PermissionGateway. - useMcpToolPermissions: view-model owning the durable MCP tool policy document, distinct from the file/command permissions in usePermissions. - McpToolPermissionsPanel: target selector (Défaut projet + agents with Hérité/Override badges) and grouped editor — inherited agents are read-only until "Créer un override" (prefilled with the effective allowlist), per-row Ajouté/Retiré diffing against the project default, inline confirmation before granting a write tool at project-default level, and unsaved-draft protection on target change. - mcpToolGroups.ts: presentational-only domain grouping and short French labels — the read/write classification itself always comes from the backend-provided catalogue, never hardcoded here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
import { invoke } from "@tauri-apps/api/core";
|
|
|
|
import type {
|
|
EffectivePermissions,
|
|
McpToolPolicy,
|
|
PermissionSet,
|
|
ProjectMcpToolPermissions,
|
|
ProjectPermissions,
|
|
} from "@/domain";
|
|
import type { PermissionGateway } from "@/ports";
|
|
|
|
/** Tauri-backed permissions gateway. */
|
|
export class TauriPermissionGateway implements PermissionGateway {
|
|
getProjectPermissions(projectId: string): Promise<ProjectPermissions> {
|
|
return invoke<ProjectPermissions>("get_project_permissions", { projectId });
|
|
}
|
|
|
|
updateProjectPermissions(
|
|
projectId: string,
|
|
permissions: PermissionSet | null,
|
|
): Promise<ProjectPermissions> {
|
|
return invoke<ProjectPermissions>("update_project_permissions", {
|
|
request: { projectId, permissions },
|
|
});
|
|
}
|
|
|
|
updateAgentPermissions(
|
|
projectId: string,
|
|
agentId: string,
|
|
permissions: PermissionSet | null,
|
|
): Promise<ProjectPermissions> {
|
|
return invoke<ProjectPermissions>("update_agent_permissions", {
|
|
request: { projectId, agentId, permissions },
|
|
});
|
|
}
|
|
|
|
resolveAgentPermissions(
|
|
projectId: string,
|
|
agentId: string,
|
|
): Promise<EffectivePermissions | null> {
|
|
return invoke<EffectivePermissions | null>("resolve_agent_permissions", {
|
|
request: { projectId, agentId },
|
|
});
|
|
}
|
|
|
|
getMcpToolPermissions(projectId: string): Promise<ProjectMcpToolPermissions> {
|
|
return invoke<ProjectMcpToolPermissions>("get_mcp_tool_permissions", {
|
|
projectId,
|
|
});
|
|
}
|
|
|
|
updateProjectMcpToolPermissions(
|
|
projectId: string,
|
|
policy: McpToolPolicy | null,
|
|
): Promise<ProjectMcpToolPermissions> {
|
|
return invoke<ProjectMcpToolPermissions>(
|
|
"update_project_mcp_tool_permissions",
|
|
{ request: { projectId, policy } },
|
|
);
|
|
}
|
|
|
|
updateAgentMcpToolPermissions(
|
|
projectId: string,
|
|
agentId: string,
|
|
policy: McpToolPolicy | null,
|
|
): Promise<ProjectMcpToolPermissions> {
|
|
return invoke<ProjectMcpToolPermissions>(
|
|
"update_agent_mcp_tool_permissions",
|
|
{ request: { projectId, agentId, policy } },
|
|
);
|
|
}
|
|
}
|