diff --git a/backend/apps/agents/browser/runner.py b/backend/apps/agents/browser/runner.py index 40a70868..de3fd131 100644 --- a/backend/apps/agents/browser/runner.py +++ b/backend/apps/agents/browser/runner.py @@ -65,7 +65,7 @@ async def run_browser_agent( await ws_manager.emit_message(session_id, user_msg) try: - for turn in range(MAX_TURNS): + for _ in range(MAX_TURNS): if cancel_event.is_set(): break response = await client.messages.create( diff --git a/backend/apps/agents/browser_mcp_server.py b/backend/apps/agents/browser_mcp_server.py index 8878889f..a26e8e7d 100644 --- a/backend/apps/agents/browser_mcp_server.py +++ b/backend/apps/agents/browser_mcp_server.py @@ -36,15 +36,6 @@ def send_response(id_, result=None, error=None): sys.stdout.write(json.dumps(msg) + "\n") sys.stdout.flush() - -def send_notification(method, params=None): - msg = {"jsonrpc": "2.0", "method": method} - if params is not None: - msg["params"] = params - sys.stdout.write(json.dumps(msg) + "\n") - sys.stdout.flush() - - def call_backend(action: str, browser_id: str, params: dict | None = None, tab_id: str = "") -> dict: payload = json.dumps({ "action": action, diff --git a/backend/apps/analytics/collector.py b/backend/apps/analytics/collector.py index 75fa7764..88b54eb4 100644 --- a/backend/apps/analytics/collector.py +++ b/backend/apps/analytics/collector.py @@ -62,16 +62,6 @@ def _get_installation_id() -> str: _installation_id = uuid4().hex return _installation_id - -def _is_opted_in() -> bool: - """Check if user has opted in to analytics.""" - try: - from backend.apps.settings.settings import load_settings - return getattr(load_settings(), "analytics_opt_in", True) - except Exception: - return True - - def record( event_type: str, properties: dict | None = None, @@ -115,9 +105,4 @@ def identify(extra_properties: dict | None = None): }, ) except Exception as e: - logger.debug(f"PostHog identify failed (non-critical): {e}") - - -def get_collector(): - """Backward compat — returns None since we no longer have a local collector.""" - return None + logger.debug(f"PostHog identify failed (non-critical): {e}") \ No newline at end of file diff --git a/backend/apps/common/model_registry.py b/backend/apps/common/model_registry.py index 3e9fcb5d..450f390d 100644 --- a/backend/apps/common/model_registry.py +++ b/backend/apps/common/model_registry.py @@ -24,7 +24,7 @@ class ModelDef: # fmt: off ALL_MODELS: list[ModelDef] = [ # Anthropic - ModelDef("sonnet", "Claude Sonnet 4.6", "claude-sonnet-4-6", "Anthropic", "anthropic", 1_000_000, 3.0, 15.0), + ModelDef("sonnet", label="Claude Sonnet 4.6", model_id="claude-sonnet-4-6", provider="Anthropic", api="anthropic", context_window=1_000_000, input_cost_per_1m=3.0, output_cost_per_1m=15.0), ModelDef("opus", "Claude Opus 4.6", "claude-opus-4-6", "Anthropic", "anthropic", 1_000_000, 5.0, 25.0), ModelDef("haiku", "Claude Haiku 4.5", "claude-haiku-4-5", "Anthropic", "anthropic", 200_000, 1.0, 5.0), # OpenAI diff --git a/backend/config/paths.py b/backend/config/paths.py index 083ebdfb..4a96a9a7 100644 --- a/backend/config/paths.py +++ b/backend/config/paths.py @@ -34,6 +34,4 @@ OUTPUTS_DIR = os.path.join(DATA_ROOT, "outputs") OUTPUTS_WORKSPACE_DIR = os.path.join(DATA_ROOT, "outputs_workspace") SKILLS_WORKSPACE_DIR = os.path.join(DATA_ROOT, "skills_workspace") DASHBOARD_LAYOUT_DIR = os.path.join(DATA_ROOT, "dashboard_layout") -BUILTIN_PERMISSIONS_PATH = os.path.join(DATA_ROOT, "builtin_permissions.json") - -BACKEND_DIR = _BACKEND_DIR +BUILTIN_PERMISSIONS_PATH = os.path.join(DATA_ROOT, "builtin_permissions.json") \ No newline at end of file diff --git a/backend/main.py b/backend/main.py index 17bd4ae9..2ed9c0e2 100644 --- a/backend/main.py +++ b/backend/main.py @@ -41,8 +41,6 @@ app.add_middleware( allow_headers=["*"], ) -x = 1 - @app.websocket("/ws/agents/{session_id}") async def websocket_session(websocket: WebSocket, session_id: str): await ws_manager.connect_session(session_id, websocket) diff --git a/backend/ports.py b/backend/ports.py index 7d9c74e9..cc690a6d 100644 --- a/backend/ports.py +++ b/backend/ports.py @@ -12,8 +12,6 @@ with open(_config_path) as _f: _cfg = json.load(_f) BACKEND_DEV_PORT: int = _cfg["backend"]["dev"] -BACKEND_PROD_PORT: int = _cfg["backend"]["prod"] -FRONTEND_DEV_PORT: int = _cfg["frontend"]["dev"] NINE_ROUTER_DEV_PORT: int = _cfg["nineRouter"]["dev"] NINE_ROUTER_PROD_PORT: int = _cfg["nineRouter"]["prod"] diff --git a/backend/tests/test_analytics.py b/backend/tests/test_analytics.py index e412f3c6..54ecf008 100644 --- a/backend/tests/test_analytics.py +++ b/backend/tests/test_analytics.py @@ -9,13 +9,10 @@ Run with: cd backend && python -m pytest tests/test_analytics.py -v """ -import asyncio import json import os -import sys import tempfile -from datetime import datetime, timedelta -from unittest.mock import AsyncMock, MagicMock, patch, call +from unittest.mock import MagicMock from uuid import uuid4 import pytest