diff --git a/python/routes/artifacts.py b/python/routes/artifacts.py index 0f50f733..8d0d240b 100644 --- a/python/routes/artifacts.py +++ b/python/routes/artifacts.py @@ -1,6 +1,6 @@ # 104:16 """HTTP API for the unified artifacts archive.""" -from typing import Any, Optional +from typing import Optional import datetime as _dt from fastapi import APIRouter, HTTPException, Request, Query diff --git a/python/routes/energy.py b/python/routes/energy.py index e54f8812..dba21e5a 100644 --- a/python/routes/energy.py +++ b/python/routes/energy.py @@ -25,7 +25,7 @@ import re from fastapi import APIRouter, HTTPException, Request from pydantic import BaseModel, Field, field_validator -from typing import Optional, Any, Literal +from typing import Optional, Literal from sqlalchemy import text as sa_text from ..services.energy_registry import ( diff --git a/python/services/energy_registry.py b/python/services/energy_registry.py index dfad56e1..84e05af0 100644 --- a/python/services/energy_registry.py +++ b/python/services/energy_registry.py @@ -1,7 +1,10 @@ # 328:125 +import logging import contextvars import json import os +logger = logging.getLogger(__name__) + from pathlib import Path from typing import Optional @@ -174,7 +177,10 @@ async def set_active_provider_persistent(self, provider_id: str) -> bool: return False try: from ..database import get_session - async with get_session() as session: + logger.warning( + "Failed to persist active provider to DB; keeping in-memory selection.", + exc_info=True, + ) await session.execute( sa_text( "INSERT INTO a0p_settings (key, value) " diff --git a/python/services/gemini_native.py b/python/services/gemini_native.py index a8203583..d70e9145 100644 --- a/python/services/gemini_native.py +++ b/python/services/gemini_native.py @@ -13,7 +13,6 @@ from __future__ import annotations import asyncio -import copy import json import os from typing import Any, Optional diff --git a/python/services/tools/__init__.py b/python/services/tools/__init__.py index 3c8a819c..83809054 100644 --- a/python/services/tools/__init__.py +++ b/python/services/tools/__init__.py @@ -72,6 +72,8 @@ def _discover() -> dict[str, ModuleType]: def registry() -> dict[str, ToolSpec]: """Return {name: ToolSpec}, sorted by tool name for cache stability. + + Validates tool metadata at boot, including canonical side-effects. Enforces: any tool with "security_active" in side_effects must declare a non-None approval_scope (gates offensive tooling by construction).""" mods = _discover() diff --git a/server/index.ts b/server/index.ts index 0c05256c..77d4f70d 100644 --- a/server/index.ts +++ b/server/index.ts @@ -5,7 +5,6 @@ import fs from "fs"; import crypto from "crypto"; import { spawn, type ChildProcess } from "child_process"; import express from "express"; -import multer from "multer"; import { createProxyMiddleware, fixRequestBody } from "http-proxy-middleware"; import { setupAuth,