Merge lab into refactor/routes-email-subpackage

This commit is contained in:
Alexandre Teixeira
2026-10-01 02:15:36 +01:00
179 changed files with 51333 additions and 48558 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ from email.mime.multipart import MIMEMultipart
from src.task_endpoint import resolve_task_candidates, task_llm_call_async
from routes.email_helpers import (
from .email_helpers import (
_strip_think, _extract_reply, _apply_email_style_mechanics, _load_settings, _save_settings, _get_email_config,
_send_smtp_message,
_imap_connect, _imap, _decode_header,
+3 -3
View File
@@ -43,7 +43,7 @@ from src.constants import DATA_DIR
from src.llm_core import llm_call_async
from src.upload_limits import read_upload_limited, EMAIL_COMPOSE_UPLOAD_MAX_BYTES
from routes.email_helpers import (
from .email_helpers import (
_strip_think, _extract_reply, _apply_email_style_mechanics, require_owner, require_user, _assert_owns_account,
_account_visible_to_owner,
_q, _attach_compose_uploads, _cleanup_compose_uploads,
@@ -64,7 +64,7 @@ from routes.email_helpers import (
ATTACHMENTS_DIR, COMPOSE_UPLOADS_DIR, SCHEDULED_DB,
attachment_extract_dir, _email_cache_owner_clause, email_translation_body_hash,
)
from routes.email_pollers import _start_poller
from .email_pollers import _start_poller
logger = logging.getLogger(__name__)
@@ -444,7 +444,7 @@ def _record_email_received_events(owner: str, account_id: str | None, folder: st
async def _run_away_reply_check():
try:
from routes.email_pollers import _auto_summarize_pass
from .email_pollers import _auto_summarize_pass
result = await _auto_summarize_pass(
days_back=1,
account_id=account_id,
+11 -4
View File
@@ -181,10 +181,17 @@ def setup_mcp_routes(mcp_manager: McpManager):
if transport == "http" and not url:
raise HTTPException(400, "url is required for HTTP transport")
# Parse JSON fields
try:
parsed_args = json.loads(args) if args else []
except json.JSONDecodeError:
# Parse JSON fields. args is not defaulted on a parse failure: an
# unparseable value is silently discarded downstream (stdio spawns
# with an empty argv), so the caller must be told instead.
if args:
try:
parsed_args = json.loads(args)
except json.JSONDecodeError:
raise HTTPException(400, "args must be valid JSON, e.g. [\"-y\", \"pkg\"]")
if not isinstance(parsed_args, list):
raise HTTPException(400, "args must be a JSON array, e.g. [\"-y\", \"pkg\"]")
else:
parsed_args = []
try:
parsed_env = json.loads(env) if env else {}