chore: sync database worker branch with upstream v3

This commit is contained in:
InfinityPacer
2026-08-23 04:48:50 +08:00
111 changed files with 605 additions and 391 deletions
+3 -1
View File
@@ -27,7 +27,9 @@ import threading
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
# worker 脚本路径。用绝对路径直接执行,而不是 -m 或 import:
+3 -1
View File
@@ -17,7 +17,9 @@ from app.runtime.capabilities.model import (
SelectorSchema,
)
from app.runtime.capabilities.registry import CapabilityRegistry
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
_DEFAULT_CAPABILITY_ROOT = Path(__file__).resolve().parent
+3 -1
View File
@@ -12,7 +12,9 @@ from pathlib import Path
from typing import Any, Dict, Optional
from uuid import uuid4
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.adapters.network.http import RequestUtils
+3 -1
View File
@@ -11,7 +11,9 @@ from urllib.parse import urlsplit
from langchain_core.messages import AIMessage, AIMessageChunk
from app.agent.llm.gateway import resolve_llm_provider_runtime
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
if TYPE_CHECKING:
+3 -1
View File
@@ -20,7 +20,9 @@ import aiofiles
import httpx
import jwt
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.runtime.log import logger
from app.schemas.types import LlmProviderAction, SystemConfigKey
+3 -1
View File
@@ -6,7 +6,9 @@ from typing import Dict, List, Optional
from langchain_core.messages import BaseMessage, messages_from_dict, messages_to_dict
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.agentdata import AgentChatPort as AgentChatOper
from app.runtime.log import logger
from app.schemas.agent import ConversationMemory
+3 -1
View File
@@ -68,7 +68,9 @@ from app.agent.tools.impl.mcp import (
)
from app.agent.tools.impl.query_system_settings import QuerySystemSettingsTool
from app.chain.agent import AgentChain
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.events import eventmanager
from app.runtime.observability import record_metric
from app.application.plugin.runtime import get_plugin_manager
+3 -1
View File
@@ -10,7 +10,9 @@ from typing import Any, Dict, Optional
import yaml
from app.agent.llm.capability import AgentCapabilityManager
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.schemas.notification import ChannelCapability
from app.schemas.notification import ChannelCapabilities
+3 -1
View File
@@ -11,7 +11,9 @@ from urllib.parse import urlencode, urljoin, urlparse
from app.agent.skills.metadata import parse_skill_metadata
from app.runtime.cache import cached, fresh
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.adapters.network.http import RequestUtils
from app.foundation.singleton import WeakSingleton
+3 -1
View File
@@ -17,7 +17,9 @@ from app.agent.policy.sanitizer import (
)
from app.agent.tools.tags import ToolTag
from app.chain import ChainBase
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.messaging.agent import matches_channel_admin
from app.runtime.extensions.service_config import ServiceConfigHelper
from app.runtime.log import logger
+3 -1
View File
@@ -4,7 +4,9 @@ import json
import shutil
from typing import Any, Optional
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.plugin.runtime import get_plugin_manager
from app.application.plugin.install import PluginInstallCommand
from app.application.configuration import get_configured_system_config as SystemConfigOper
+3 -1
View File
@@ -14,7 +14,9 @@ from pathlib import Path
from typing import Any, Optional
from app.agent.tools.impl._command_safety import validate_command_safety
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
if os.name == "posix":
+3 -1
View File
@@ -12,7 +12,9 @@ from app.agent.tools.tags import ToolTag
from app.chain.download import DownloadChain
from app.chain.media import MediaChain
from app.chain.search import SearchChain
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import Context
from app.domain.metainfo import MetaInfo
from app.application.agentdata import SitePort as SiteOper
+3 -1
View File
@@ -7,7 +7,9 @@ from pydantic import BaseModel, Field, model_validator
from app.agent.tools.base import MoviePilotTool
from app.agent.tools.tags import ToolTag
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.agentdata import AgentChatPort as AgentChatOper
from app.application.agentdata import AgentTaskPort as AgentTaskOper
from app.runtime.scheduling import TimerUtils
+3 -1
View File
@@ -5,7 +5,9 @@ from pydantic import BaseModel, Field
from app.agent.tools.base import MoviePilotTool
from app.agent.tools.tags import ToolTag
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.agentdata import AgentTaskPort as AgentTaskOper
@@ -15,10 +15,10 @@ from app.agent.tools.impl._system_setting_utils import (
resolve_setting_spec,
should_redact_setting,
)
from app.runtime.config import settings
from app.application.configuration import (
SystemConfigReader,
get_configured_system_config as SystemConfigOper,
get_runtime_settings,
)
from app.runtime.log import logger
@@ -128,7 +128,7 @@ class QuerySystemSettingsTool(MoviePilotTool):
def _load_setting_value(self, spec: SettingSpec):
"""读取指定设置项的当前值。"""
if spec.source == "settings":
return getattr(settings, spec.key)
return get_runtime_settings().get(spec.key)
return self._get_system_config().get(spec.systemconfig_key)
@staticmethod
+3 -1
View File
@@ -9,7 +9,9 @@ from pydantic import BaseModel, Field
from app.agent.tools.base import MoviePilotTool
from app.agent.tools.tags import ToolTag
from app.chain.media import MediaChain
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import Context
from app.domain.meta.metamusic import MetaMusic
from app.domain.metainfo import MetaInfo
+3 -1
View File
@@ -10,7 +10,9 @@ from app.agent.tools.base import MoviePilotTool
from app.agent.tools.tags import ToolTag
from app.chain.media import MediaChain
from app.chain.scraping import ScrapingChain
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.schemas.workflow import FileItem
from app.schemas.types import (
+3 -1
View File
@@ -9,7 +9,9 @@ from pydantic import BaseModel, Field
from app.agent.tools.base import MoviePilotTool
from app.agent.tools.tags import ToolTag
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
# 搜索超时时间(秒)
+3 -1
View File
@@ -6,7 +6,9 @@ from pydantic import BaseModel, Field
from app.agent.llm.capability import AgentCapabilityManager
from app.agent.tools.base import MoviePilotTool
from app.agent.tools.tags import ToolTag
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.schemas.message import Message
from app.schemas.message import MessageType
+3 -1
View File
@@ -7,7 +7,9 @@ from pydantic import BaseModel, Field, model_validator
from app.agent.tools.base import MoviePilotTool
from app.agent.tools.tags import ToolTag
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.agentdata import AgentTaskPort as AgentTaskOper
from app.runtime.scheduling import TimerUtils
@@ -16,11 +16,11 @@ from app.agent.tools.impl._system_setting_utils import (
resolve_setting_spec,
should_redact_setting,
)
from app.runtime.config import settings
from app.runtime.events import eventmanager
from app.application.configuration import (
SystemConfigService,
get_configured_system_config as SystemConfigOper,
get_runtime_settings,
)
from app.runtime.log import logger
from app.schemas.event import ConfigChangeEventData
@@ -126,7 +126,7 @@ class UpdateSystemSettingsTool(MoviePilotTool):
def _load_setting_value(self, spec: SettingSpec):
"""读取指定设置项的当前值。"""
if spec.source == "settings":
return getattr(settings, spec.key)
return get_runtime_settings().get(spec.key)
return self._get_system_config().get(spec.systemconfig_key)
@staticmethod
@@ -274,7 +274,7 @@ class UpdateSystemSettingsTool(MoviePilotTool):
changed = False
message = ""
if spec.source == "settings":
success, message = settings.update_setting(spec.key, next_value)
success, message = get_runtime_settings().update(spec.key, next_value)
if success is False:
return json.dumps(
{
+4 -1
View File
@@ -280,7 +280,7 @@ class RuntimeSettingsService:
def update(self, key: str, value: Any) -> tuple[Optional[bool], str]:
"""更新单个部署设置。"""
return self._settings.update_setting(key=key, value=value)
return self._settings.update_setting(key, value)
class SystemConfigService:
@@ -383,6 +383,9 @@ def configure_runtime_settings(service: RuntimeSettingsService) -> None:
"""由组合根登记管理 API 使用的部署设置服务。"""
global _runtime_settings_service
_runtime_settings_service = service
from app.runtime.settings import configure_runtime_settings_compat
configure_runtime_settings_compat(service)
def get_runtime_settings() -> RuntimeSettingsService:
+4 -1
View File
@@ -15,7 +15,10 @@ from urllib.request import ProxyHandler, Request, build_opener, urlopen
import click
import psutil
from app.runtime.config import Settings, settings
from app.runtime.config import Settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.state import SystemHelper
from app.application.backup import BackupArtifact
from app.startup.database import build_database_governance
+8
View File
@@ -43,6 +43,14 @@ def run_legacy_sync_query(operation: Callable[[Session], _R]) -> _R:
except Exception as close_err: # noqa: BLE001 兼容查询释放失败不改变返回语义
logger.error(f"释放数据库会话失败:{close_err}")
async def run_legacy_async_query(
operation: Callable[[AsyncSession], Awaitable[_R]],
) -> _R:
"""为移除异步查询装饰器的旧 Model ABI 提供一次性异步会话。"""
async with async_session_scope() as db:
return await operation(db)
def _get_args_db(
args: tuple[Any, ...],
kwargs: dict[str, Any],
+53 -13
View File
@@ -4,7 +4,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import Mapped, Session, mapped_column
from app.db.base import get_id_column, Base
from app.db.decorators import db_query, async_db_query
from app.db.decorators import run_legacy_async_query, run_legacy_sync_query
class PluginData(Base):
@@ -21,28 +21,54 @@ class PluginData(Base):
)
@classmethod
@db_query
def get_plugin_data(cls, db: Session, plugin_id: str):
def get_plugin_data(cls, db: Session | None = None, plugin_id: str | None = None):
"""在调用方 Session 中读取插件全部数据,并兼容旧无会话入口。"""
if plugin_id is None:
raise TypeError("plugin_id is required")
if not isinstance(db, Session):
return run_legacy_sync_query(lambda session: cls.get_plugin_data(session, plugin_id))
return list(db.execute(select(cls).where(cls.plugin_id == plugin_id)).scalars().all())
@classmethod
@async_db_query
async def async_get_plugin_data(cls, db: AsyncSession, plugin_id: str):
async def async_get_plugin_data(
cls, db: AsyncSession | None = None, plugin_id: str | None = None
):
"""在调用方 AsyncSession 中读取插件全部数据,并兼容旧无会话入口。"""
if plugin_id is None:
raise TypeError("plugin_id is required")
if not isinstance(db, AsyncSession):
return await run_legacy_async_query(
lambda session: cls.async_get_plugin_data(session, plugin_id)
)
result = await db.execute(select(cls).where(cls.plugin_id == plugin_id))
return list(result.scalars().all())
@classmethod
@db_query
def get_plugin_data_by_key(cls, db: Session, plugin_id: str, key: str):
def get_plugin_data_by_key(
cls, db: Session | None = None, plugin_id: str | None = None, key: str | None = None
):
"""在调用方 Session 中按键读取插件数据,并兼容旧无会话入口。"""
if plugin_id is None or key is None:
raise TypeError("plugin_id and key are required")
if not isinstance(db, Session):
return run_legacy_sync_query(
lambda session: cls.get_plugin_data_by_key(session, plugin_id, key)
)
return db.execute(
select(cls).where(cls.plugin_id == plugin_id, cls.key == key)
).scalars().first()
@classmethod
@async_db_query
async def async_get_plugin_data_by_key(
cls, db: AsyncSession, plugin_id: str, key: str
cls, db: AsyncSession | None = None, plugin_id: str | None = None, key: str | None = None
):
"""在调用方 AsyncSession 中按键读取插件数据,并兼容旧无会话入口。"""
if plugin_id is None or key is None:
raise TypeError("plugin_id and key are required")
if not isinstance(db, AsyncSession):
return await run_legacy_async_query(
lambda session: cls.async_get_plugin_data_by_key(session, plugin_id, key)
)
result = await db.execute(
select(cls).where(cls.plugin_id == plugin_id, cls.key == key)
)
@@ -59,14 +85,28 @@ class PluginData(Base):
db.execute(delete(cls).where(cls.plugin_id == plugin_id))
@classmethod
@db_query
def get_plugin_data_by_plugin_id(cls, db: Session, plugin_id: str):
def get_plugin_data_by_plugin_id(
cls, db: Session | None = None, plugin_id: str | None = None
):
"""在调用方 Session 中按插件 ID 读取数据,并兼容旧无会话入口。"""
if plugin_id is None:
raise TypeError("plugin_id is required")
if not isinstance(db, Session):
return run_legacy_sync_query(
lambda session: cls.get_plugin_data_by_plugin_id(session, plugin_id)
)
return list(db.execute(select(cls).where(cls.plugin_id == plugin_id)).scalars().all())
@classmethod
@async_db_query
async def async_get_plugin_data_by_plugin_id(
cls, db: AsyncSession, plugin_id: str
cls, db: AsyncSession | None = None, plugin_id: str | None = None
):
"""在调用方 AsyncSession 中按插件 ID 读取数据,并兼容旧无会话入口。"""
if plugin_id is None:
raise TypeError("plugin_id is required")
if not isinstance(db, AsyncSession):
return await run_legacy_async_query(
lambda session: cls.async_get_plugin_data_by_plugin_id(session, plugin_id)
)
result = await db.execute(select(cls).where(cls.plugin_id == plugin_id))
return list(result.scalars().all())
+19 -6
View File
@@ -4,7 +4,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import Mapped, Session, mapped_column
from app.db.base import Base, get_id_column
from app.db.decorators import db_query, async_db_query
from app.db.decorators import run_legacy_async_query
class SiteIcon(Base):
@@ -22,12 +22,25 @@ class SiteIcon(Base):
base64: Mapped[Optional[str]] = mapped_column(String)
@classmethod
@db_query
def get_by_domain(cls, db: Session, domain: str):
"""在调用方 Session 中查询站点图标。"""
return db.execute(select(cls).where(cls.domain == domain)).scalars().first()
@classmethod
@async_db_query
async def async_get_by_domain(cls, db: AsyncSession, domain: str):
result = await db.execute(select(cls).where(cls.domain == domain))
return result.scalar_one_or_none()
async def async_get_by_domain(
cls,
db: AsyncSession | None = None,
domain: str | None = None,
):
"""在调用方 AsyncSession 中查询站点图标。"""
if domain is None:
raise TypeError("domain is required")
async def query(session: AsyncSession):
"""在给定异步会话中执行站点图标查询。"""
result = await session.execute(select(cls).where(cls.domain == domain))
return result.scalar_one_or_none()
if isinstance(db, AsyncSession):
return await query(db)
return await run_legacy_async_query(query)
+19 -6
View File
@@ -6,7 +6,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import Mapped, Session, mapped_column
from app.db.base import get_id_column, Base
from app.db.decorators import db_query, async_db_query
from app.db.decorators import run_legacy_async_query
class SiteStatistic(Base):
@@ -30,15 +30,28 @@ class SiteStatistic(Base):
note: Mapped[Optional[Any]] = mapped_column(JSON)
@classmethod
@db_query
def get_by_domain(cls, db: Session, domain: str):
"""在调用方 Session 中查询站点统计。"""
return db.execute(select(cls).where(cls.domain == domain)).scalars().first()
@classmethod
@async_db_query
async def async_get_by_domain(cls, db: AsyncSession, domain: str):
result = await db.execute(select(cls).where(cls.domain == domain))
return result.scalar_one_or_none()
async def async_get_by_domain(
cls,
db: AsyncSession | None = None,
domain: str | None = None,
):
"""在调用方 AsyncSession 中查询站点统计,并兼容旧无会话调用。"""
if domain is None:
raise TypeError("domain is required")
async def query(session: AsyncSession):
"""在给定异步会话中执行站点统计查询。"""
result = await session.execute(select(cls).where(cls.domain == domain))
return result.scalar_one_or_none()
if isinstance(db, AsyncSession):
return await query(db)
return await run_legacy_async_query(query)
@classmethod
def reset(cls, db: Session):
+1 -2
View File
@@ -3,7 +3,6 @@ from sqlalchemy import String, UniqueConstraint, JSON, select
from sqlalchemy.orm import Mapped, Session, mapped_column
from app.db.base import get_id_column, Base
from app.db.decorators import db_query
class UserConfig(Base):
@@ -24,8 +23,8 @@ class UserConfig(Base):
)
@classmethod
@db_query
def get_by_key(cls, db: Session, username: str, key: str):
"""在调用方 Session 中查询用户配置。"""
return db.execute(
select(cls).where(cls.username == username, cls.key == key)
).scalars().first()
+3 -1
View File
@@ -20,7 +20,9 @@ import psutil
from app.adapters.system.backup.database import verify_database_backup
from app.adapters.system.backup.files import BackupFiles
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.topology import process_topology_issue
from app.doctor.models import DoctorFinding, DoctorFindingStatus, DoctorReport, DoctorSeverity
from app.adapters.system.host import SystemUtils
+3 -1
View File
@@ -6,7 +6,9 @@ import sys
from datetime import datetime
from typing import Any, Optional
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.doctor.checks import default_checks
from app.doctor.models import (
DoctorFinding,
+3 -1
View File
@@ -22,7 +22,9 @@ from app.adapters.web.security.access import (
)
from app.application.security.token import create_access_token, decode_access_token
from app.runtime.extensions.plugin_manager import PluginManager
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.correlation import get_correlation_id
from app.runtime.localization import LocaleHelper
from app.runtime.log import configure_correlation_id_provider, logger
+4 -1
View File
@@ -55,7 +55,10 @@ elif SystemUtils.is_frozen():
sys.stderr = open(os.devnull, 'w')
from app.factory import app
from app.runtime.config import global_vars, settings
from app.runtime.config import global_vars
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.topology import (
UnsupportedProcessTopologyError,
validate_process_topology,
+3 -1
View File
@@ -9,7 +9,9 @@ from pathlib import Path
from typing import Any, Optional, Tuple, Union
from uuid import UUID
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.modules import _ModuleBase
from app.schemas.types import ModuleType, OtherModulesType
+3 -1
View File
@@ -1,7 +1,9 @@
from typing import List, Optional, Tuple, Union
from app.schemas.context import MediaPerson as _SchemaMediaPerson
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo
from app.domain.meta.metabase import MetaBase
from app.domain.scraper import MediaScraperHelper
+3 -1
View File
@@ -2,7 +2,9 @@ from datetime import date
from typing import Optional
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
+3 -1
View File
@@ -2,7 +2,9 @@ from dataclasses import dataclass
from typing import Any, List, Optional, Tuple, Union
from app.schemas.context import MediaPerson as _SchemaMediaPerson
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo
from app.domain.meta.metabase import MetaBase
from app.domain.scraper import MediaScraperHelper
+3 -1
View File
@@ -4,7 +4,9 @@ from typing import Optional
import requests
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
+3 -1
View File
@@ -9,7 +9,9 @@ import discord
from discord import app_commands
import httpx
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo, Context
from app.domain.metainfo import MetaInfo
from app.runtime.log import logger
+3 -1
View File
@@ -4,7 +4,9 @@ from typing import Any, List, Optional, Tuple, Union
import cn2an
from app.schemas.context import MediaPerson as _SchemaMediaPerson
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import (
MediaInfo,
MusicAlbumInfo,
+3 -1
View File
@@ -13,7 +13,9 @@ import requests
from bs4 import BeautifulSoup
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
from app.foundation.singleton import WeakSingleton
+3 -1
View File
@@ -14,7 +14,9 @@ from app.schemas.mediaserver import MediaServerLibrary as _SchemaMediaServerLibr
from app.schemas.mediaserver import MediaServerPlayItem as _SchemaMediaServerPlayItem
from app.schemas.mediaserver import RefreshMediaItem as _SchemaRefreshMediaItem
from app.schemas.mediaserver import WebhookEventInfo as _SchemaWebhookEventInfo
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.mediaserver import MediaServerIdentityHelper, MusicMediaServerHelper
from app.runtime.log import logger
from app.schemas.mediaserver import MediaServerItem
+3 -1
View File
@@ -4,7 +4,9 @@ from typing import Optional, Tuple, Union
from app.runtime.cache import cached
from app.domain.context import MediaInfo
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.modules import _ModuleBase
from app.schemas.types import MediaType, ModuleType, OtherModulesType
+3 -1
View File
@@ -50,7 +50,9 @@ from lark_oapi.event.callback.model.p2_card_action_trigger import (
P2CardActionTriggerResponse,
)
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import Context, MediaInfo
from app.application.security.user import get_configured_user_channel_lookup
from app.application.messaging.agent import matches_channel_admin
+3 -1
View File
@@ -1,7 +1,9 @@
from pathlib import Path
from typing import Any, Optional, List, Tuple, Union, Dict, Callable
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo, MusicInfo
from app.domain.meta.metabase import MetaBase
from app.domain.meta.metamusic import MetaMusic
+4 -1
View File
@@ -10,7 +10,10 @@ import requests
from app.schemas.file import StorageUsage as _SchemaStorageUsage
from app.schemas.workflow import FileItem as _SchemaFileItem
from app.runtime.config import settings, global_vars
from app.runtime.settings import RuntimeSettingsCompat
from app.runtime.config import global_vars
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.modules.filemanager import StorageBase
from app.modules.filemanager.storages import transfer_process
+4 -1
View File
@@ -8,7 +8,10 @@ from typing import Optional, List
from app.schemas.file import StorageUsage as _SchemaStorageUsage
from app.schemas.workflow import FileItem as _SchemaFileItem
from app.runtime.cache import cached
from app.runtime.config import settings, global_vars
from app.runtime.settings import RuntimeSettingsCompat
from app.runtime.config import global_vars
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.modules.filemanager.storages import StorageBase, transfer_process
from app.schemas.exception import OperationInterrupted, StorageQueryError
+4 -1
View File
@@ -6,7 +6,10 @@ from typing import Optional, List
from app.schemas.file import StorageUsage as _SchemaStorageUsage
from app.schemas.workflow import FileItem as _SchemaFileItem
from app.runtime.config import global_vars, settings
from app.runtime.config import global_vars
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.directory import DirectoryHelper
from app.runtime.log import logger
from app.adapters.system.fsproxy import fsproxy
+3 -1
View File
@@ -8,7 +8,9 @@ from typing import Optional, List, Union
from app.schemas.file import StorageUsage as _SchemaStorageUsage
from app.schemas.workflow import FileItem as _SchemaFileItem
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.modules.filemanager.storages import StorageBase, transfer_process
from app.schemas.exception import StorageQueryError
+4 -1
View File
@@ -14,7 +14,10 @@ from smbprotocol.exceptions import (
from app.schemas.file import StorageUsage as _SchemaStorageUsage
from app.schemas.workflow import FileItem as _SchemaFileItem
from app.runtime.config import settings, global_vars
from app.runtime.settings import RuntimeSettingsCompat
from app.runtime.config import global_vars
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.modules.filemanager import StorageBase
from app.modules.filemanager.storages import transfer_process
+4 -1
View File
@@ -14,7 +14,10 @@ from cryptography.hazmat.primitives import hashes
from app.schemas.file import StorageUsage as _SchemaStorageUsage
from app.schemas.workflow import FileItem as _SchemaFileItem
from app.runtime.config import settings, global_vars
from app.runtime.settings import RuntimeSettingsCompat
from app.runtime.config import global_vars
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.modules.filemanager import StorageBase
from app.modules.filemanager.storages import transfer_process
+3 -1
View File
@@ -4,7 +4,9 @@ from typing import Optional, List, Tuple
from jinja2 import Template
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo, MusicInfo
from app.runtime.events import eventmanager
from app.domain.meta.metabase import MetaBase
+3 -1
View File
@@ -11,7 +11,9 @@ from app.domain.meta.metabase import MetaBase
from app.domain.scraper import MediaScraperHelper
from app.foundation.text import convert as zhconv_convert
from app.modules import _ModuleBase
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.schemas.context import MediaCredit, MediaImageSet
from app.schemas.media import normalize_media_source
+3 -1
View File
@@ -9,7 +9,9 @@ from pydantic import BaseModel, ConfigDict, Field, ValidationError
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
TModel = TypeVar("TModel", bound=BaseModel)
+3 -1
View File
@@ -8,7 +8,9 @@ from urllib.parse import urljoin, urlsplit
from requests import Session
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.adapters.network.cloudflare import under_challenge
from app.runtime.log import logger
from app.adapters.network.http import RequestUtils
+4 -2
View File
@@ -4,7 +4,9 @@ from urllib.parse import urljoin
from typing import Optional, Tuple
from app.runtime.log import logger
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.adapters.network.http import RequestUtils
from app.domain import site as site_rules
from app.foundation import temporal as time_tools
@@ -232,4 +234,4 @@ class RousiSiteUserInfo(SiteParserBase):
proxies=settings.PROXY if self._proxy else None
).post_res(
url=urljoin(self._base_url, "api/messages/read-all")
)
)
+3 -1
View File
@@ -9,7 +9,9 @@ from fastapi.concurrency import run_in_threadpool
from jinja2 import Template
from pyquery import PyQuery
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.schemas.types import MediaType
from app.adapters.system import rust as rust_accel
+3 -1
View File
@@ -1,7 +1,9 @@
import urllib.parse
from typing import Tuple, List
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.runtime.log import logger
from app.schemas.types import MediaType
+3 -1
View File
@@ -1,6 +1,8 @@
from typing import Tuple, List, Optional
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.runtime.log import logger
from app.schemas.types import MediaType
+3 -1
View File
@@ -4,7 +4,9 @@ import re
from typing import Tuple, List, Optional
from urllib.parse import urlparse
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.runtime.log import logger
from app.schemas.types import MediaType
+3 -1
View File
@@ -2,7 +2,9 @@ import base64
import json
from typing import List, Optional, Tuple
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.runtime.log import logger
from app.schemas.types import MediaType
+3 -1
View File
@@ -3,7 +3,9 @@ import json
import time
from typing import List, Optional, Tuple
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.schemas.types import MediaType
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
+3 -1
View File
@@ -2,7 +2,9 @@ import re
from typing import Tuple, List, Optional
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
from app.foundation.singleton import SingletonClass
+3 -1
View File
@@ -1,7 +1,9 @@
from typing import List, Tuple, Optional
from urllib.parse import quote
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.schemas.types import MediaType
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
+3 -1
View File
@@ -2,7 +2,9 @@ import base64
import json
from typing import List, Optional, Tuple
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.schemas.types import MediaType
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
+3 -1
View File
@@ -11,7 +11,9 @@ from app.schemas.mediaserver import MediaServerItemUserState as _SchemaMediaServ
from app.schemas.mediaserver import MediaServerLibrary as _SchemaMediaServerLibrary
from app.schemas.mediaserver import MediaServerPlayItem as _SchemaMediaServerPlayItem
from app.schemas.mediaserver import WebhookEventInfo as _SchemaWebhookEventInfo
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.mediaserver import MediaServerIdentityHelper, MusicMediaServerHelper
from app.runtime.log import logger
from app.schemas.types import MediaType
+3 -1
View File
@@ -1,7 +1,9 @@
from typing import Any, Optional, Tuple, Union
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MusicInfo
from app.runtime.log import logger
from app.modules import _ModuleBase
+3 -1
View File
@@ -4,7 +4,9 @@ import time
from typing import Any, Optional, Tuple, Union
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MusicInfo, MusicLyrics
from app.domain.meta.metamusic import MetaMusic
from app.runtime.log import logger
+3 -1
View File
@@ -8,7 +8,9 @@ from typing import Any, Iterable, Optional, Tuple, Union
from requests import Session
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import (
MusicAlbumInfo,
MusicArtistInfo,
+3 -1
View File
@@ -6,7 +6,9 @@ from time import time
from typing import Optional
from app.runtime.cache import FileCache, TTLCache
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MusicInfo
from app.domain.meta.metamusic import MetaMusic
from app.runtime.log import logger
+3 -1
View File
@@ -12,7 +12,9 @@ from typing import Optional, List, Tuple
from PIL import Image
from app.runtime.cache import FileCache
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo, Context
from app.domain.metainfo import MetaInfo
from app.runtime.log import logger
+3 -1
View File
@@ -10,7 +10,9 @@ from slack_bolt import App
from slack_bolt.adapter.socket_mode import SocketModeHandler
from slack_sdk import WebClient
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo, Context
from app.domain.metainfo import MetaInfo
from app.runtime.log import logger
+3 -1
View File
@@ -4,7 +4,9 @@ from urllib.parse import urljoin, urlparse
from lxml import etree
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import Context
from app.application.site.query import get_configured_site_query_service
from app.application.site.sites import SitesHelper # pylint: disable=import-error,no-name-in-module
+3 -1
View File
@@ -36,7 +36,9 @@ try:
except ImportError:
from telegramify_markdown.type import ContentTypes, File, Photo, Text # noqa: E402
from app.runtime.config import settings # noqa: E402
from app.runtime.settings import RuntimeSettingsCompat # noqa: E402
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo, Context # noqa: E402
from app.domain.metainfo import MetaInfo # noqa: E402
from app.application.image import ImageHelper # noqa: E402
+3 -1
View File
@@ -1,7 +1,9 @@
from typing import Any, Optional, Tuple, Union
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import (
MusicAlbumInfo,
MusicArtistInfo,
+3 -1
View File
@@ -6,7 +6,9 @@ import cn2an
from app.schemas.context import MediaPerson as _SchemaMediaPerson
from app.schemas.tmdb import TmdbSeason as _SchemaTmdbSeason
from app.schemas.tmdb import TmdbEpisode as _SchemaTmdbEpisode
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo
from app.domain.meta.metabase import MetaBase
from app.runtime.log import logger
+3 -1
View File
@@ -5,7 +5,9 @@ from typing import Union
import ruamel.yaml
from ruamel.yaml import CommentedMap
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.schemas.category import CategoryConfig
from app.foundation.singleton import WeakSingleton
+3 -1
View File
@@ -2,7 +2,9 @@ from pathlib import Path
from typing import Optional, Tuple
from xml.dom import minidom
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo
from app.domain.meta.metabase import MetaBase
from app.schemas.types import MediaType
+3 -1
View File
@@ -6,7 +6,9 @@ from time import time
from typing import Any, Optional
from app.runtime.cache import FileCache, TTLCache
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.meta.metabase import MetaBase
from app.runtime.log import logger
from app.schemas.types import MediaSource, MediaType
+3 -1
View File
@@ -2,7 +2,9 @@ import re
import traceback
from typing import Optional, List
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.schemas.types import MediaType
from app.foundation import text as text_tools
@@ -1,5 +1,7 @@
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from ..tmdb import TMDb
try:
+3 -1
View File
@@ -10,7 +10,9 @@ import requests
import requests.exceptions
from app.runtime.cache import cached, fresh, async_fresh
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
from .exceptions import TMDbException, TMDbConnectionError
+3 -1
View File
@@ -1,7 +1,9 @@
from threading import Lock
from typing import Optional, Tuple, Union
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.modules import _ModuleBase
from app.modules.thetvdb import tvdb_v4_official
+3 -1
View File
@@ -8,7 +8,9 @@ import urllib.parse
from http import HTTPStatus
from app.runtime.cache import cached
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.adapters.network.http import RequestUtils
+3 -1
View File
@@ -7,7 +7,9 @@ from enum import Enum
from typing import List, Optional, Union
from urllib.parse import quote
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.adapters.network.http import RequestUtils, requests
+4 -1
View File
@@ -3,7 +3,10 @@ from typing import Union, Tuple
from pywebpush import webpush, WebPushException
from app.runtime.config import global_vars, settings
from app.runtime.config import global_vars
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.modules import _ModuleBase, _MessageBase
from app.schemas.message import Message
+3 -1
View File
@@ -12,7 +12,9 @@ import websocket
from Crypto.Cipher import AES
from app.runtime.cache import FileCache
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo, Context
from app.domain.metainfo import MetaInfo
from app.application.messaging.agent import matches_channel_admin
+3 -1
View File
@@ -17,7 +17,9 @@ from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from app.runtime.cache import FileCache
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import Context, MediaInfo
from app.domain.metainfo import MetaInfo
from app.runtime.log import logger
@@ -13,7 +13,9 @@ from app.runtime.capabilities.model import (
SelectorSchema,
)
from app.runtime.capabilities.registry import CapabilityRegistry
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.extensions.service_config import ServiceConfigHelper
from app.schemas.types import (
DownloaderType,
+3 -1
View File
@@ -12,7 +12,9 @@ from app.runtime.capabilities.model import (
CapabilitySpec,
)
from app.runtime.capabilities.runtime import CapabilityRuntime
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.events import Event, EventHandlerBinding, eventmanager
from app.runtime.extensions.host_module_adapter import (
HOST_MODULE_KIND,
+3 -1
View File
@@ -7,7 +7,9 @@ from collections.abc import Callable, Mapping
from typing import Any, Optional
from app.foundation.version import compare_version
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.extensions.plugin.contracts import supports_plugin_hook
from app.runtime.extensions.plugin.storage import PluginStorage
from app.runtime.extensions.plugin.system import PluginSystemServices
+3 -1
View File
@@ -15,7 +15,9 @@ from app.foundation.singleton import Singleton
from app.foundation.version import compare_version
from app.runtime.log import logger
from app.runtime.observability import observe_compat_facade
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.events import EventHandlerBinding, eventmanager
from app.runtime.reload import ConfigReloadMixin
from app.runtime.extensions.plugin.loader import PluginLoader
+44 -6
View File
@@ -9,24 +9,63 @@ from typing import Any
RuntimeSettingProvider = Callable[[str], Any]
_provider: RuntimeSettingProvider | None = None
_runtime_settings_service: Any | None = None
# 测试和插件可能临时替换某个模块上的 importlib.import_module;保存原始函数,
# 让兼容代理的 legacy Settings 解析不受这类局部替身影响。
_import_module = importlib.import_module
class RuntimeSettingsCompat:
"""为旧模块级 Settings 访问提供动态 runtime 配置代理。"""
@staticmethod
def _legacy_settings() -> Any:
"""返回旧 Settings 实例,供 runtime 尚未装配时的兼容回退使用。"""
return _import_module("app.runtime.config").settings
def __getattr__(self, key: str) -> Any:
"""读取当前组合根配置;未装配时沿用旧 Settings 回退。"""
return get_runtime_setting(key)
def __setattr__(self, key: str, value: Any) -> None:
"""把旧模块级覆盖同步到 legacy Settings,保持测试和插件注入语义。"""
legacy_settings = importlib.import_module("app.runtime.config").settings
setattr(legacy_settings, key, value)
setattr(self._legacy_settings(), key, value)
def __delattr__(self, key: str) -> None:
"""删除旧模块级覆盖,使配置对象恢复其原有属性解析。"""
legacy_settings = importlib.import_module("app.runtime.config").settings
delattr(legacy_settings, key)
delattr(self._legacy_settings(), key)
def model_dump(
self,
*,
include: set[str] | None = None,
exclude: set[str] | None = None,
**kwargs: Any,
) -> dict[str, Any]:
"""导出当前配置快照,保留旧 Settings 的序列化入口。"""
if _runtime_settings_service is not None:
return _runtime_settings_service.snapshot(include=include, exclude=exclude)
return self._legacy_settings().model_dump(
include=include, exclude=exclude, **kwargs
)
def update_setting(self, key: str, value: Any) -> tuple[Any, str]:
"""更新单项配置,兼容插件对模块级 Settings 的公开调用。"""
if _runtime_settings_service is not None:
return _runtime_settings_service.update(key, value)
return self._legacy_settings().update_setting(key, value)
def update_settings(self, env: dict[str, Any]) -> dict[str, tuple[Any, str]]:
"""批量更新配置,兼容旧 Settings 的管理接口。"""
if _runtime_settings_service is not None:
return _runtime_settings_service.update_many(env)
return self._legacy_settings().update_settings(env=env)
def configure_runtime_settings_compat(service: Any) -> None:
"""由应用组合根注入可变配置服务,避免低层代理反向导入应用层。"""
global _runtime_settings_service
_runtime_settings_service = service
def configure_runtime_setting_provider(provider: RuntimeSettingProvider) -> None:
@@ -39,5 +78,4 @@ def get_runtime_setting(key: str) -> Any:
"""读取单项运行配置;启动早期未装配时回退旧 Settings ABI。"""
if _provider is not None:
return _provider(key)
legacy_settings = importlib.import_module("app.runtime.config").settings
return getattr(legacy_settings, key)
return getattr(RuntimeSettingsCompat._legacy_settings(), key)
+3 -1
View File
@@ -11,7 +11,9 @@ from typing import Optional, Tuple
import docker
import psutil
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger
from app.runtime.reload import ConfigReloadMixin
from app.foundation.environment import is_docker
+3 -1
View File
@@ -1,7 +1,9 @@
from concurrent.futures import ThreadPoolExecutor
from contextvars import copy_context
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.foundation.singleton import Singleton
+3 -1
View File
@@ -12,7 +12,9 @@ from app.agent.runtime_loader import (
from app.agent.llm.gateway import register_llm_provider_runtime
from app.application.agent import register_agent_service_providers
from app.application.messaging.skill import register_skill_catalog_provider
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.events import Event, eventmanager
from app.runtime.log import logger
from app.schemas.types import EventType
+3 -1
View File
@@ -20,7 +20,9 @@ from app.db.engine import get_engine
from app.db.health import probe_database
from app.db.maintenance import DatabaseCleanupRepository
from app.db.session import SessionFactory
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
def build_database_governance() -> DatabaseGovernance:
+3 -1
View File
@@ -10,7 +10,9 @@ from alembic.util import CommandError
from sqlalchemy import inspect
from sqlalchemy.engine import Engine
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.db.base import Base
from app.db.engine import get_engine
from app.db.models import load_all_models
+3 -1
View File
@@ -6,7 +6,9 @@ from app.domain.meta.runtime import configure_recognition_runtime
from app.domain.meta.words import configure_custom_words_provider
from app.domain.metainfo import clear_rust_parse_options_cache
from app.adapters.system import rust as rust_accelerator
from app.runtime.config import settings
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.recognition import RecognitionRuleService
+4 -1
View File
@@ -26,7 +26,10 @@ except Exception:
from app.chain.system import SystemChain
from app.application.plugin.runtime import get_plugin_manager
from app.runtime.config import global_vars, settings
from app.runtime.config import global_vars
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.health import get_application_health
from app.runtime.topology import validate_process_topology
from app.adapters.external.server import MoviePilotServerHelper

Some files were not shown because too many files have changed in this diff Show More