diff --git a/app/agent/llm/capability.py b/app/agent/llm/capability.py index 4ba797ecf..bc8b8e650 100644 --- a/app/agent/llm/capability.py +++ b/app/agent/llm/capability.py @@ -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 diff --git a/app/agent/llm/helper.py b/app/agent/llm/helper.py index 7ae716fae..6325f757b 100644 --- a/app/agent/llm/helper.py +++ b/app/agent/llm/helper.py @@ -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: diff --git a/app/agent/llm/provider.py b/app/agent/llm/provider.py index 0661fe2a5..f947a8333 100644 --- a/app/agent/llm/provider.py +++ b/app/agent/llm/provider.py @@ -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 diff --git a/app/agent/orchestrator.py b/app/agent/orchestrator.py index 154bc5b1f..8687cf80a 100644 --- a/app/agent/orchestrator.py +++ b/app/agent/orchestrator.py @@ -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 diff --git a/app/agent/tools/base.py b/app/agent/tools/base.py index ec0c2f05f..cbefa569a 100644 --- a/app/agent/tools/base.py +++ b/app/agent/tools/base.py @@ -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 diff --git a/docs/refactor/backend-architecture-next-stage.md b/docs/refactor/backend-architecture-next-stage.md index 2d2723ef1..47c8e05ea 100644 --- a/docs/refactor/backend-architecture-next-stage.md +++ b/docs/refactor/backend-architecture-next-stage.md @@ -1048,6 +1048,8 @@ runtime provider,旧插件或测试替换模块级 `settings` 时仍保持原 查询装饰器由 112 个降至 106 个,插件数据与事务专项测试及架构基线通过。 Agent 能力适配器、记忆和提示词模块改用 `RuntimeSettingsCompat` 动态运行时端口,保留模块级覆盖和 导入早期回退;配置债务由 101 个文件降至 98 个,Agent 能力、提示词与运行时专项测试通过。 +随后将 LLM capability/helper/provider、Agent orchestrator 和工具基础类统一切换到同一动态运行时端口; +配置债务由 98 个文件降至 93 个,LLM、Agent 生命周期与工具专项测试通过。 同日修正适配器配置下沉边界:OCR、CookieCloud、DoH、Rust 和资源签名等低层实现不再直接依赖 `app.application`,由 `app.runtime.settings` 端口承接组合根注入;未启动装配时仍回退旧 Settings ABI, diff --git a/tests/fixtures/architecture/configuration-debt-baseline.json b/tests/fixtures/architecture/configuration-debt-baseline.json index 6dc83987a..71a21a402 100644 --- a/tests/fixtures/architecture/configuration-debt-baseline.json +++ b/tests/fixtures/architecture/configuration-debt-baseline.json @@ -9,15 +9,10 @@ "root": "app" }, "settings_imports": { - "count": 98, + "count": 93, "files": [ "app/adapters/system/fsproxy.py", - "app/agent/llm/capability.py", - "app/agent/llm/helper.py", - "app/agent/llm/provider.py", - "app/agent/orchestrator.py", "app/agent/skills/registry.py", - "app/agent/tools/base.py", "app/agent/tools/impl/_plugin_tool_utils.py", "app/agent/tools/impl/_terminal_session.py", "app/agent/tools/impl/add_download_tasks.py", diff --git a/tests/fixtures/architecture/dependency-baseline.json b/tests/fixtures/architecture/dependency-baseline.json index b1faf0e50..f529cc0e3 100644 --- a/tests/fixtures/architecture/dependency-baseline.json +++ b/tests/fixtures/architecture/dependency-baseline.json @@ -14,7 +14,7 @@ "workflow_to_db": [] }, "edge_count": 6419, - "edge_sha256": "d5ae653cf616d76dfefea690bb71c32f54b07612af9c5c9cd4372ac6b55b6cae", + "edge_sha256": "91e14e6acb6220fccd8ac3e2df899303f4e4fe6532c92079378d4b350be4d06e", "edges": [ "app -> app.runtime", "app -> app.runtime.compat", @@ -199,10 +199,10 @@ "app.agent.llm.capability -> app.agent.llm", "app.agent.llm.capability -> app.agent.llm.helper", "app.agent.llm.capability -> app.runtime", - "app.agent.llm.capability -> app.runtime.config", "app.agent.llm.capability -> app.runtime.extensions", "app.agent.llm.capability -> app.runtime.extensions.service_config", "app.agent.llm.capability -> app.runtime.log", + "app.agent.llm.capability -> app.runtime.settings", "app.agent.llm.capability -> app.schemas", "app.agent.llm.capability -> app.schemas.notification", "app.agent.llm.capability -> app.schemas.types", @@ -211,8 +211,8 @@ "app.agent.llm.helper -> app.agent.llm.gateway", "app.agent.llm.helper -> app.agent.llm.server_tools", "app.agent.llm.helper -> app.runtime", - "app.agent.llm.helper -> app.runtime.config", "app.agent.llm.helper -> app.runtime.log", + "app.agent.llm.helper -> app.runtime.settings", "app.agent.llm.provider -> app.agent", "app.agent.llm.provider -> app.agent.llm", "app.agent.llm.provider -> app.agent.llm.helper", @@ -221,8 +221,8 @@ "app.agent.llm.provider -> app.foundation", "app.agent.llm.provider -> app.foundation.singleton", "app.agent.llm.provider -> app.runtime", - "app.agent.llm.provider -> app.runtime.config", "app.agent.llm.provider -> app.runtime.log", + "app.agent.llm.provider -> app.runtime.settings", "app.agent.llm.provider -> app.schemas", "app.agent.llm.provider -> app.schemas.types", "app.agent.mcp -> app.adapters", @@ -352,10 +352,10 @@ "app.agent.orchestrator -> app.foundation", "app.agent.orchestrator -> app.foundation.identity", "app.agent.orchestrator -> app.runtime", - "app.agent.orchestrator -> app.runtime.config", "app.agent.orchestrator -> app.runtime.events", "app.agent.orchestrator -> app.runtime.log", "app.agent.orchestrator -> app.runtime.observability", + "app.agent.orchestrator -> app.runtime.settings", "app.agent.orchestrator -> app.schemas", "app.agent.orchestrator -> app.schemas.event", "app.agent.orchestrator -> app.schemas.message", @@ -422,10 +422,10 @@ "app.agent.tools.base -> app.application.messaging.agent", "app.agent.tools.base -> app.chain", "app.agent.tools.base -> app.runtime", - "app.agent.tools.base -> app.runtime.config", "app.agent.tools.base -> app.runtime.extensions", "app.agent.tools.base -> app.runtime.extensions.service_config", "app.agent.tools.base -> app.runtime.log", + "app.agent.tools.base -> app.runtime.settings", "app.agent.tools.base -> app.schemas", "app.agent.tools.base -> app.schemas.message", "app.agent.tools.base -> app.schemas.types",