refactor: route agent tool settings through runtime

This commit is contained in:
jxxghp
2026-08-23 02:51:25 +08:00
parent 41ee5aacdc
commit 05d4ca79e7
7 changed files with 25 additions and 16 deletions
+5 -2
View File
@@ -11,7 +11,10 @@ from urllib.parse import urlencode, urljoin, urlparse
from app.agent.skills.metadata import parse_skill_metadata from app.agent.skills.metadata import parse_skill_metadata
from app.runtime.cache import cached, fresh from app.runtime.cache import cached, fresh
from app.runtime.config import settings from app.runtime.settings import RuntimeSettingsCompat
from app.application.configuration import get_runtime_settings
settings = RuntimeSettingsCompat()
from app.runtime.log import logger from app.runtime.log import logger
from app.adapters.network.http import RequestUtils from app.adapters.network.http import RequestUtils
from app.foundation.singleton import WeakSingleton from app.foundation.singleton import WeakSingleton
@@ -200,7 +203,7 @@ class SkillHelper(metaclass=WeakSingleton):
将技能源列表写回配置文件,并同步更新内存中的 settings。 将技能源列表写回配置文件,并同步更新内存中的 settings。
""" """
filtered_sources = [item.strip() for item in sources if item and item.strip()] filtered_sources = [item.strip() for item in sources if item and item.strip()]
success, message = settings.update_setting( success, message = get_runtime_settings().update(
key="SKILL_MARKET", key="SKILL_MARKET",
value=",".join(filtered_sources), value=",".join(filtered_sources),
) )
+3 -1
View File
@@ -4,7 +4,9 @@ import json
import shutil import shutil
from typing import Any, Optional 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.runtime import get_plugin_manager
from app.application.plugin.install import PluginInstallCommand from app.application.plugin.install import PluginInstallCommand
from app.application.configuration import get_configured_system_config as SystemConfigOper 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 typing import Any, Optional
from app.agent.tools.impl._command_safety import validate_command_safety 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 from app.runtime.log import logger
if os.name == "posix": if os.name == "posix":
+3 -1
View File
@@ -6,7 +6,9 @@ from pydantic import BaseModel, Field
from app.agent.llm.capability import AgentCapabilityManager from app.agent.llm.capability import AgentCapabilityManager
from app.agent.tools.base import MoviePilotTool from app.agent.tools.base import MoviePilotTool
from app.agent.tools.tags import ToolTag 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.runtime.log import logger
from app.schemas.message import Message from app.schemas.message import Message
from app.schemas.message import MessageType from app.schemas.message import MessageType
@@ -1050,6 +1050,8 @@ Agent 能力适配器、记忆和提示词模块改用 `RuntimeSettingsCompat`
导入早期回退;配置债务由 101 个文件降至 98 个,Agent 能力、提示词与运行时专项测试通过。 导入早期回退;配置债务由 101 个文件降至 98 个,Agent 能力、提示词与运行时专项测试通过。
随后将 LLM capability/helper/provider、Agent orchestrator 和工具基础类统一切换到同一动态运行时端口; 随后将 LLM capability/helper/provider、Agent orchestrator 和工具基础类统一切换到同一动态运行时端口;
配置债务由 98 个文件降至 93 个,LLM、Agent 生命周期与工具专项测试通过。 配置债务由 98 个文件降至 93 个,LLM、Agent 生命周期与工具专项测试通过。
技能注册表、插件工具辅助、终端会话和语音工具也已切换到动态运行时端口,技能市场写入改走配置服务;
配置债务由 93 个文件降至 89 个,技能、工具和安全专项测试通过。
同日修正适配器配置下沉边界:OCR、CookieCloud、DoH、Rust 和资源签名等低层实现不再直接依赖 同日修正适配器配置下沉边界:OCR、CookieCloud、DoH、Rust 和资源签名等低层实现不再直接依赖
`app.application`,由 `app.runtime.settings` 端口承接组合根注入;未启动装配时仍回退旧 Settings ABI `app.application`,由 `app.runtime.settings` 端口承接组合根注入;未启动装配时仍回退旧 Settings ABI
@@ -9,19 +9,15 @@
"root": "app" "root": "app"
}, },
"settings_imports": { "settings_imports": {
"count": 93, "count": 89,
"files": [ "files": [
"app/adapters/system/fsproxy.py", "app/adapters/system/fsproxy.py",
"app/agent/skills/registry.py",
"app/agent/tools/impl/_plugin_tool_utils.py",
"app/agent/tools/impl/_terminal_session.py",
"app/agent/tools/impl/add_download_tasks.py", "app/agent/tools/impl/add_download_tasks.py",
"app/agent/tools/impl/create_agent_task.py", "app/agent/tools/impl/create_agent_task.py",
"app/agent/tools/impl/query_agent_tasks.py", "app/agent/tools/impl/query_agent_tasks.py",
"app/agent/tools/impl/recognize_media.py", "app/agent/tools/impl/recognize_media.py",
"app/agent/tools/impl/scrape_metadata.py", "app/agent/tools/impl/scrape_metadata.py",
"app/agent/tools/impl/search_web.py", "app/agent/tools/impl/search_web.py",
"app/agent/tools/impl/send_voice_message.py",
"app/agent/tools/impl/update_agent_task.py", "app/agent/tools/impl/update_agent_task.py",
"app/cli.py", "app/cli.py",
"app/db/base.py", "app/db/base.py",
+8 -6
View File
@@ -13,8 +13,8 @@
"runtime_to_db": [], "runtime_to_db": [],
"workflow_to_db": [] "workflow_to_db": []
}, },
"edge_count": 6419, "edge_count": 6421,
"edge_sha256": "91e14e6acb6220fccd8ac3e2df899303f4e4fe6532c92079378d4b350be4d06e", "edge_sha256": "808e0a96b5cce123d86ce90ae4538258c6cc817a6204dc06346888c4f69d344b",
"edges": [ "edges": [
"app -> app.runtime", "app -> app.runtime",
"app -> app.runtime.compat", "app -> app.runtime.compat",
@@ -404,13 +404,15 @@
"app.agent.skills.registry -> app.agent", "app.agent.skills.registry -> app.agent",
"app.agent.skills.registry -> app.agent.skills", "app.agent.skills.registry -> app.agent.skills",
"app.agent.skills.registry -> app.agent.skills.metadata", "app.agent.skills.registry -> app.agent.skills.metadata",
"app.agent.skills.registry -> app.application",
"app.agent.skills.registry -> app.application.configuration",
"app.agent.skills.registry -> app.foundation", "app.agent.skills.registry -> app.foundation",
"app.agent.skills.registry -> app.foundation.singleton", "app.agent.skills.registry -> app.foundation.singleton",
"app.agent.skills.registry -> app.foundation.url", "app.agent.skills.registry -> app.foundation.url",
"app.agent.skills.registry -> app.runtime", "app.agent.skills.registry -> app.runtime",
"app.agent.skills.registry -> app.runtime.cache", "app.agent.skills.registry -> app.runtime.cache",
"app.agent.skills.registry -> app.runtime.config",
"app.agent.skills.registry -> app.runtime.log", "app.agent.skills.registry -> app.runtime.log",
"app.agent.skills.registry -> app.runtime.settings",
"app.agent.tools.base -> app.agent", "app.agent.tools.base -> app.agent",
"app.agent.tools.base -> app.agent.callback", "app.agent.tools.base -> app.agent.callback",
"app.agent.tools.base -> app.agent.policy", "app.agent.tools.base -> app.agent.policy",
@@ -566,7 +568,7 @@
"app.agent.tools.impl._plugin_tool_utils -> app.application.plugin.runtime", "app.agent.tools.impl._plugin_tool_utils -> app.application.plugin.runtime",
"app.agent.tools.impl._plugin_tool_utils -> app.application.scheduling", "app.agent.tools.impl._plugin_tool_utils -> app.application.scheduling",
"app.agent.tools.impl._plugin_tool_utils -> app.runtime", "app.agent.tools.impl._plugin_tool_utils -> app.runtime",
"app.agent.tools.impl._plugin_tool_utils -> app.runtime.config", "app.agent.tools.impl._plugin_tool_utils -> app.runtime.settings",
"app.agent.tools.impl._plugin_tool_utils -> app.schemas", "app.agent.tools.impl._plugin_tool_utils -> app.schemas",
"app.agent.tools.impl._plugin_tool_utils -> app.schemas.plugin", "app.agent.tools.impl._plugin_tool_utils -> app.schemas.plugin",
"app.agent.tools.impl._plugin_tool_utils -> app.schemas.types", "app.agent.tools.impl._plugin_tool_utils -> app.schemas.types",
@@ -582,8 +584,8 @@
"app.agent.tools.impl._terminal_session -> app.agent.tools.impl", "app.agent.tools.impl._terminal_session -> app.agent.tools.impl",
"app.agent.tools.impl._terminal_session -> app.agent.tools.impl._command_safety", "app.agent.tools.impl._terminal_session -> app.agent.tools.impl._command_safety",
"app.agent.tools.impl._terminal_session -> app.runtime", "app.agent.tools.impl._terminal_session -> app.runtime",
"app.agent.tools.impl._terminal_session -> app.runtime.config",
"app.agent.tools.impl._terminal_session -> app.runtime.log", "app.agent.tools.impl._terminal_session -> app.runtime.log",
"app.agent.tools.impl._terminal_session -> app.runtime.settings",
"app.agent.tools.impl._torrent_search_utils -> app.agent", "app.agent.tools.impl._torrent_search_utils -> app.agent",
"app.agent.tools.impl._torrent_search_utils -> app.agent.tools", "app.agent.tools.impl._torrent_search_utils -> app.agent.tools",
"app.agent.tools.impl._torrent_search_utils -> app.agent.tools.impl", "app.agent.tools.impl._torrent_search_utils -> app.agent.tools.impl",
@@ -1313,8 +1315,8 @@
"app.agent.tools.impl.send_voice_message -> app.agent.tools.base", "app.agent.tools.impl.send_voice_message -> app.agent.tools.base",
"app.agent.tools.impl.send_voice_message -> app.agent.tools.tags", "app.agent.tools.impl.send_voice_message -> app.agent.tools.tags",
"app.agent.tools.impl.send_voice_message -> app.runtime", "app.agent.tools.impl.send_voice_message -> app.runtime",
"app.agent.tools.impl.send_voice_message -> app.runtime.config",
"app.agent.tools.impl.send_voice_message -> app.runtime.log", "app.agent.tools.impl.send_voice_message -> app.runtime.log",
"app.agent.tools.impl.send_voice_message -> app.runtime.settings",
"app.agent.tools.impl.send_voice_message -> app.schemas", "app.agent.tools.impl.send_voice_message -> app.schemas",
"app.agent.tools.impl.send_voice_message -> app.schemas.message", "app.agent.tools.impl.send_voice_message -> app.schemas.message",
"app.agent.tools.impl.switch_persona -> app.agent", "app.agent.tools.impl.switch_persona -> app.agent",