Vocero needs to query AquaPortal on behalf of the caller selected by the existing phone link. This adds server-owned conversations and MCP tool execution for voice and HTTP reasoning while leaving the speech pipeline unchanged. Release notes: - Added browser-bound conversations that keep backend credentials server-side and isolate callers. - Connected the eight-tool AquaPortal catalog through authenticated Streamable HTTP with full input schemas and structured results. - Added bounded multi-step tool execution with cancellation, expiry, and stale-result protection. - Updated browser bootstrap, tool progress, reasoning headers, and conversation cleanup. - Disabled legacy unscoped content preloads in MCP mode and documented configuration and deployment constraints. - Preserved disabled-mode contracts and added local SDK, WebSocket, and browser regression coverage. Reviewed-on: AquaPortal/s2s#1
37 lines
1.8 KiB
Python
37 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
import os
|
|
|
|
logger = logging.getLogger("s2s")
|
|
_logging_configured = False
|
|
if not _logging_configured:
|
|
_handler = logging.StreamHandler()
|
|
_handler.setFormatter(
|
|
logging.Formatter(
|
|
"%(asctime)s %(levelname)-7s [%(name)s] %(message)s",
|
|
datefmt="%Y-%m-%d %H:%M:%S",
|
|
)
|
|
)
|
|
logging.basicConfig(level=logging.DEBUG, handlers=[_handler], force=True)
|
|
_lvl_env = (os.environ.get("LOG_LEVEL") or os.environ.get("S2S_LOG_LEVEL") or "INFO").strip().upper()
|
|
_is_debug = _lvl_env in {"DEBUG", "TRACE", "10"}
|
|
# Keep noisy loggers quiet unless LOG_LEVEL explicitly enables debug.
|
|
logging.getLogger("httpx").setLevel(logging.DEBUG if _is_debug else logging.WARNING)
|
|
logging.getLogger("websockets").setLevel(logging.DEBUG if _is_debug else logging.INFO)
|
|
logging.getLogger("uvicorn").setLevel(logging.DEBUG if _is_debug else logging.INFO)
|
|
logging.getLogger("uvicorn.access").setLevel(logging.DEBUG if _is_debug else logging.INFO)
|
|
logging.getLogger("httpcore").setLevel(logging.DEBUG if _is_debug else logging.WARNING)
|
|
# The MCP SDK logs raw protocol messages and error bodies. Our integration
|
|
# reports safe operation metadata and public errors at its own boundary.
|
|
logging.getLogger("mcp").setLevel(logging.CRITICAL)
|
|
logger.setLevel(logging.DEBUG if _is_debug else logging.DEBUG) # s2s always uses at least DEBUG in development
|
|
_logging_configured = True
|
|
logger.debug(
|
|
"LOG_LEVEL env=%s — noisy-logger levels: httpx=%s uvicorn=%s websockets=%s",
|
|
_lvl_env,
|
|
logging.getLevelName(logging.getLogger("httpx").level),
|
|
logging.getLevelName(logging.getLogger("uvicorn").level),
|
|
logging.getLevelName(logging.getLogger("websockets").level),
|
|
)
|