Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions components/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"highlight.js": "^11.11.1",
"lucide-react": "^0.542.0",
"marked": "^17.0.4",
"next": "16.2.2",
"next": "16.2.3",
"next-themes": "^0.4.6",
"python-struct": "^1.1.3",
"radix-ui": "^1.4.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ async def switch_model(request: Request):
return await _perform_model_switch(bridge, context, new_model, previous_model)


async def _perform_model_switch(bridge, context, new_model: str, previous_model: str) -> dict:
async def _perform_model_switch(
bridge, context, new_model: str, previous_model: str
) -> dict:
"""Execute the model switch: update env, rebuild adapter, emit event."""
logger.info(f"Switching model from '{previous_model}' to '{new_model}'")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def initialize(

try:
mlflow.set_tracking_uri(tracking_uri)
exp_name = os.getenv("MLFLOW_EXPERIMENT_NAME", "ambient-code-sessions").strip()
exp_name = os.getenv(
"MLFLOW_EXPERIMENT_NAME", "ambient-code-sessions"
).strip()
if not exp_name:
exp_name = "ambient-code-sessions"
mlflow.set_experiment(exp_name)
Expand Down Expand Up @@ -92,7 +94,13 @@ def initialize(
self.session_id,
exp_name,
)
_ = (prompt, model, workflow_url, workflow_branch, workflow_path) # reserved for tags
_ = (
prompt,
model,
workflow_url,
workflow_branch,
workflow_path,
) # reserved for tags
return True

def _apply_mask(self, value: Any) -> Any:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@
resolve_message_mask_fn,
)

# Alias for tests and legacy imports
_privacy_masking_function = privacy_mask_message_data
from ambient_runner.platform.security_utils import (
sanitize_exception_message,
sanitize_model_name,
validate_and_sanitize_for_logging,
with_sync_timeout,
)

# Alias for tests and legacy imports
_privacy_masking_function = privacy_mask_message_data

# Canonical token key names used across usage dicts from the Claude Agent SDK.
_TOKEN_KEYS = (
"input_tokens",
Expand Down
2 changes: 1 addition & 1 deletion components/runners/ambient-runner/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"uvicorn[standard]>=0.41.0",
"ag-ui-protocol>=0.1.13",
"pydantic>=2.12.5",
"aiohttp>=3.13.3",
"aiohttp>=3.13.4",
"requests>=2.32.5",
"pyjwt>=2.11.0",
]
Expand Down
48 changes: 37 additions & 11 deletions components/runners/ambient-runner/tests/test_mcp_config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
"""Tests for MCP config loading with custom/project/disabled server merging."""

import json
import os
import tempfile
from pathlib import Path
from unittest.mock import patch

import pytest

from ambient_runner.platform.config import load_mcp_config
from ambient_runner.platform.context import RunnerContext
Expand All @@ -31,7 +27,10 @@ def test_loads_from_default_file(self, tmp_path: Path):
json.dumps(
{
"mcpServers": {
"context7": {"type": "http", "url": "https://mcp.context7.com/mcp"},
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
},
"webfetch": {"command": "uvx", "args": ["mcp-server-fetch"]},
}
}
Expand All @@ -51,7 +50,10 @@ def test_merges_custom_session_servers(self, tmp_path: Path):
json.dumps(
{
"mcpServers": {
"context7": {"type": "http", "url": "https://mcp.context7.com/mcp"},
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
},
}
}
)
Expand All @@ -76,7 +78,15 @@ def test_merges_custom_session_servers(self, tmp_path: Path):
def test_merges_project_level_servers(self, tmp_path: Path):
"""Project-level custom servers should be merged with defaults."""
mcp_file = tmp_path / ".mcp.json"
mcp_file.write_text(json.dumps({"mcpServers": {"default-server": {"type": "http", "url": "https://default.com"}}}))
mcp_file.write_text(
json.dumps(
{
"mcpServers": {
"default-server": {"type": "http", "url": "https://default.com"}
}
}
)
)

project_mcp = {
"custom": {
Expand Down Expand Up @@ -127,8 +137,14 @@ def test_disables_default_servers(self, tmp_path: Path):
json.dumps(
{
"mcpServers": {
"context7": {"type": "http", "url": "https://mcp.context7.com/mcp"},
"deepwiki": {"type": "http", "url": "https://mcp.deepwiki.com/mcp"},
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
},
"deepwiki": {
"type": "http",
"url": "https://mcp.deepwiki.com/mcp",
},
"webfetch": {"command": "uvx", "args": ["mcp-server-fetch"]},
}
}
Expand Down Expand Up @@ -180,7 +196,13 @@ def test_returns_none_when_all_disabled(self, tmp_path: Path):
"""Should return None when all servers are disabled."""
mcp_file = tmp_path / ".mcp.json"
mcp_file.write_text(
json.dumps({"mcpServers": {"only-server": {"type": "http", "url": "https://only.com"}}})
json.dumps(
{
"mcpServers": {
"only-server": {"type": "http", "url": "https://only.com"}
}
}
)
)
custom = {"disabled": ["only-server"]}
ctx = _make_context(
Expand All @@ -195,7 +217,11 @@ def test_returns_none_when_all_disabled(self, tmp_path: Path):
def test_handles_invalid_custom_json(self, tmp_path: Path):
"""Should handle invalid JSON in CUSTOM_MCP_SERVERS gracefully."""
mcp_file = tmp_path / ".mcp.json"
mcp_file.write_text(json.dumps({"mcpServers": {"s1": {"type": "http", "url": "https://s1.com"}}}))
mcp_file.write_text(
json.dumps(
{"mcpServers": {"s1": {"type": "http", "url": "https://s1.com"}}}
)
)
ctx = _make_context(
{
"MCP_CONFIG_FILE": str(mcp_file),
Expand Down
Loading
Loading