feat(bias): implement data models and storage for tool weighting and bias profiles

This commit is contained in:
2026-03-10 09:27:12 -04:00
parent ee19cc1d2a
commit 77a0b385d5
6 changed files with 264 additions and 154 deletions

View File

@@ -3,14 +3,14 @@ import asyncio
from src import ai_client
from src import mcp_client
from src import models
from src.models import ToolPreset
from src.models import ToolPreset, Tool
from unittest.mock import MagicMock, patch
@pytest.mark.asyncio
async def test_tool_auto_approval():
# Setup a preset with read_file as auto
preset = ToolPreset(name="AutoTest", categories={
"General": {"read_file": "auto"}
"General": [Tool(name="read_file", approval="auto")]
})
with patch("src.tool_presets.ToolPresetManager.load_all", return_value={"AutoTest": preset}):
@@ -39,7 +39,7 @@ async def test_tool_auto_approval():
async def test_tool_ask_approval():
# Setup a preset with run_powershell as ask
preset = ToolPreset(name="AskTest", categories={
"General": {"run_powershell": "ask"}
"General": [Tool(name="run_powershell", approval="ask")]
})
with patch("src.tool_presets.ToolPresetManager.load_all", return_value={"AskTest": preset}):
@@ -65,7 +65,7 @@ async def test_tool_ask_approval():
async def test_tool_rejection():
# Setup a preset with run_powershell as ask
preset = ToolPreset(name="AskTest", categories={
"General": {"run_powershell": "ask"}
"General": [Tool(name="run_powershell", approval="ask")]
})
with patch("src.tool_presets.ToolPresetManager.load_all", return_value={"AskTest": preset}):