v2.18.3 (#861)
Co-authored-by: Clément Drouin <clement.drouin@mistral.ai> Co-authored-by: Laure Hugo <201583486+laure0303@users.noreply.github.com> Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com> Co-authored-by: Peter Evers <peter.evers@mistral.ai> Co-authored-by: Jules YZERD <newtonlormont@gmail.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
d50704e694
commit
4e495f658d
130 changed files with 1042 additions and 552 deletions
|
|
@ -16,7 +16,7 @@ from vibe.core.config import MCPOAuth, MCPStreamableHttp
|
|||
from vibe.core.tools.mcp import MCPRegistry
|
||||
|
||||
|
||||
def _registry_with_uncached_oauth(alias: str) -> MCPRegistry:
|
||||
def _registry_with_uncached_oauth(alias: str, *, disabled: bool = False) -> MCPRegistry:
|
||||
registry = MCPRegistry()
|
||||
registry.sync_active_servers([
|
||||
MCPStreamableHttp(
|
||||
|
|
@ -24,6 +24,7 @@ def _registry_with_uncached_oauth(alias: str) -> MCPRegistry:
|
|||
transport="streamable-http",
|
||||
url="https://mcp.example.com/mcp",
|
||||
auth=MCPOAuth(type="oauth", scopes=["read"]),
|
||||
disabled=disabled,
|
||||
)
|
||||
])
|
||||
assert registry.needs_auth == set()
|
||||
|
|
@ -53,6 +54,49 @@ async def test_tui_mcp_auth_notice_uses_status_for_uncached_oauth() -> None:
|
|||
assert "sentry" in message._content
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tui_mcp_auth_notice_skips_disabled_servers() -> None:
|
||||
mount = AsyncMock()
|
||||
app = cast(
|
||||
VibeApp,
|
||||
SimpleNamespace(
|
||||
agent_loop=SimpleNamespace(
|
||||
mcp_registry=_registry_with_uncached_oauth("sentry", disabled=True)
|
||||
),
|
||||
_mount_and_scroll=mount,
|
||||
),
|
||||
)
|
||||
|
||||
await VibeApp._show_mcp_auth_required_notice(app)
|
||||
|
||||
mount.assert_not_awaited()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_acp_mcp_auth_notice_skips_disabled_servers() -> None:
|
||||
agent = VibeAcpAgentLoop()
|
||||
client = FakeClient()
|
||||
agent.on_connect(client)
|
||||
session = cast(
|
||||
AcpSessionLoop,
|
||||
SimpleNamespace(
|
||||
id="session-id",
|
||||
agent_loop=SimpleNamespace(
|
||||
mcp_registry=_registry_with_uncached_oauth("sentry", disabled=True)
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
await agent._notify_mcp_auth_required(session)
|
||||
|
||||
messages = [
|
||||
notification.update
|
||||
for notification in client._session_updates
|
||||
if isinstance(notification.update, AgentMessageChunk)
|
||||
]
|
||||
assert messages == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_acp_mcp_auth_notice_uses_status_for_uncached_oauth() -> None:
|
||||
agent = VibeAcpAgentLoop()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue