fix(agent): 恢复桌面端执行轨迹

This commit is contained in:
2026-09-08 08:04:31 +08:00
parent 8b5d1f3b08
commit 2010778780
4 changed files with 109 additions and 8 deletions
+6 -1
View File
@@ -62,7 +62,12 @@ app = FastAPI(
app.add_middleware(
CORSMiddleware,
allow_origins=["http://127.0.0.1:5173", "http://localhost:5173"],
allow_origins=[
"http://127.0.0.1:5173",
"http://localhost:5173",
"http://tauri.localhost",
"tauri://localhost",
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
+12
View File
@@ -77,6 +77,18 @@ def test_health() -> None:
assert response.model_dump() == {"status": "ok"}
@pytest.mark.parametrize("origin", ["http://tauri.localhost", "tauri://localhost"])
def test_desktop_origins_can_read_streaming_api(origin: str) -> None:
from fastapi.testclient import TestClient
from app.main import app
response = TestClient(app).get("/health", headers={"Origin": origin})
assert response.status_code == 200
assert response.headers["access-control-allow-origin"] == origin
def test_mcp_create_and_trust_are_not_executed_on_event_loop(monkeypatch) -> None:
from app import routes
from app.contracts import McpServerCreateRequest, McpServerTrustRequest