mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-18 12:43:58 +08:00
refactor: reorganize backend module boundaries
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -10,7 +10,7 @@ rust/**/target/
|
||||
nginx/
|
||||
test.py
|
||||
safety_report.txt
|
||||
app/infrastructure/*.bin
|
||||
app/application/site/*.bin
|
||||
app/plugins/**
|
||||
!app/plugins/__init__.py
|
||||
config/cookies/
|
||||
|
||||
58
AGENTS.md
58
AGENTS.md
@@ -56,52 +56,56 @@ The historical `app/core`, `app/helper`, and `app/utils` directories are compati
|
||||
|
||||
| Package | Owns | Must Not Own | Representative Files |
|
||||
|---|---|---|---|
|
||||
| `app/foundation/` | Generic mechanisms that work without MoviePilot business state: HTTP transport, reflection/module loading, crypto, URL/object primitives, and structures | `settings`, DB/SystemConfig, MoviePilot business rules, concrete products, legacy import paths | `http.py`, `module.py`, `url.py`, `structures.py` |
|
||||
| `app/foundation/` | 无状态、无配置和无 I/O 的底层机制:反射/动态导入、加密、DOM、身份、集合、单例、文本、URL 和版本比较 | `settings`、DB/SystemConfig、网络请求、运行日志、MoviePilot 业务规则、旧导入路径 | `reflection.py`, `crypto.py`, `collections.py`, `text.py`, `url.py` |
|
||||
| `app/domain/` | Pure MoviePilot business semantics and models for media, recognition, sites, and torrents | Persistence, global settings reads, network/filesystem clients, Rust imports, service discovery, process lifecycle | `context.py`, `media.py`, `metainfo.py`, `scraper.py`, `meta/` |
|
||||
| `app/platform/` | Process-wide runtime contracts and policy: configuration, events, complete logging runtime, cache contracts/in-memory behavior, concurrency, scheduling, rate limiting, localization, GC, restart state | Named third-party integrations, DB-backed business services, Redis/file cache adapter implementations | `config.py`, `events.py`, `log.py`, `cache.py`, `thread.py`, `gc.py`, `runtime.py` |
|
||||
| `app/infrastructure/` | Configured technical adapters to Redis, files and standard streams, OS/process facilities, browser/display, DNS, RSS transport, package/resource installation, Rust, generated site resources | Media/site/torrent business decisions, plugin lifecycle, named ecosystem workflows, process restart policy after an adapter action | `cache.py`, `stdio.py`, `redis.py`, `resource.py`, `rss.py`, `rust.py`, `system.py` |
|
||||
| `app/integrations/` | Concrete external products and ecosystems, including plugin markets, MoviePilot remote service, CookieCloud, OCR, and IP-location providers | Generic HTTP/DNS/filesystem primitives or reusable domain semantics | `market.py`, `server.py`, `cookiecloud.py`, `ocr.py`, `location.py` |
|
||||
| `app/extensions/` | Discovery, loading, registration, and lifecycle of runtime modules, plugins, and configured service implementations | Generic module import mechanics, plugin-facing compatibility APIs, unrelated business workflows | `module_manager.py`, `plugin_manager.py`, `service_registry.py` |
|
||||
| `app/messaging/` | Message rendering/routing, interactions, and Agent-to-message bridging | Authentication policy, generic HTTP clients, configured service discovery, endpoint-only Web Push behavior | `message.py`, `interaction.py`, `agent.py` |
|
||||
| `app/security/` | Authentication, authorization, cookies, passkeys, OTP/two-factor, path/URL safety, SSRF and signing policy | Generic URL parsing, process runtime policy, ordinary business validation | `access.py`, `auth.py`, `cookie.py`, `passkey.py`, `otp.py`, `twofactor.py`, `url.py` |
|
||||
| `app/services/` | Focused application services and service-bound rules, including persisted configuration, configured capability discovery, notification selection, and media-server normalization/matching | Multi-domain use-case orchestration, generic primitives, concrete product protocols | `recognition.py`, `filter.py`, `notification.py`, `mediaserver.py`, `history.py`, `image.py`, `torrent.py` |
|
||||
| `app/runtime/` | 进程级运行机制和策略:配置、事件、完整日志、缓存契约/内存行为、并发、调度、限流、本地化、GC 和重启状态 | 具体外部产品、业务流程、Redis/文件缓存实现 | `config.py`, `events.py`, `log.py`, `cache.py`, `thread.py`, `state.py` |
|
||||
| `app/runtime/extensions/` | 模块、插件和配置化服务实现的发现、注册与生命周期 | 通用反射机制、插件公开 API、无关业务流程 | `module_manager.py`, `plugin_manager.py`, `service_registry.py` |
|
||||
| `app/adapters/network/` | HTTP、浏览器、DNS、Cloudflare 和 IP 等通用网络技术适配 | RSS/站点业务编排、身份认证策略、命名外部产品流程 | `http.py`, `browser.py`, `doh.py`, `ip.py` |
|
||||
| `app/adapters/cache/` | Redis 与文件缓存等具体持久化实现 | 缓存协议、装饰器和进程内缓存策略 | `backends.py`, `redis.py` |
|
||||
| `app/adapters/system/` | 操作系统、文件、进程、标准流、包/资源安装、显示和 Rust 加速适配 | 业务规则、进程重启决策 | `host.py`, `stdio.py`, `package.py`, `resource.py`, `rust.py` |
|
||||
| `app/adapters/external/` | CookieCloud、插件市场、OCR、IP 归属和 MoviePilot Server 等命名外部生态 | 通用 HTTP/DNS/文件机制或可复用领域语义 | `market.py`, `server.py`, `cookiecloud.py`, `ocr.py`, `location.py` |
|
||||
| `app/application/` | 读取配置/持久化状态的聚焦应用服务和服务族规则 | 多领域 Chain 编排、底层通用机制、通用传输协议 | `recognition.py`, `filter.py`, `notification.py`, `mediaserver.py`, `rss.py`, `site/sites.*` |
|
||||
| `app/application/messaging/` | 消息渲染/路由、交互和 Agent 到消息桥接 | 认证策略、通用 HTTP、服务发现、仅端点使用的 Web Push 行为 | `message.py`, `interaction.py`, `agent.py` |
|
||||
| `app/application/security/` | 认证、授权、Cookie、Passkey、OTP/二次认证、路径/URL 安全、SSRF 和签名策略 | 通用 URL 解析、进程运行策略、普通业务校验 | `access.py`, `auth.py`, `cookie.py`, `passkey.py`, `otp.py`, `twofactor.py`, `url.py` |
|
||||
| `app/chain/` | Reusable use-case orchestration across modules, services, Oper classes, events, and caches | Transport schemas, backend-specific protocol details, generic primitives | `media.py`, `download.py`, `subscribe.py`, `transfer.py` |
|
||||
| `app/startup/` | Composition root: inject providers/adapters, order initialization and shutdown, decide restart/lifecycle policy | Reusable business rules or adapter implementation details | `lifecycle.py`, `domain_initializer.py`, `cache_initializer.py`, `modules_initializer.py` |
|
||||
| `app/sdk/` | Deliberately curated stable imports for new plugins | Canonical implementation logic or host-internal dependencies | `cache.py`, `logging.py`, `media.py`, `network.py`, `services.py` |
|
||||
| `app/compat/` | Standard-library-only exact legacy import routing and DEBUG diagnostics | Business implementation, wildcard alias guessing, eager canonical imports | `manifest.py`, `imports.py`, `diagnostics.py` |
|
||||
| `app/runtime/compat/` | 仅依赖标准库的精确旧导入路由和 DEBUG 诊断 | 业务实现、通配猜测、目标模块的提前导入 | `manifest.py`, `imports.py`, `diagnostics.py` |
|
||||
|
||||
容易误分的三个边界必须按实际职责判断:`application/rss.py` 同时承担 Feed/种子语义、站点规则和浏览器回退,不是单纯 HTTP 传输;`application/site/sites.*` 及 `user.sites.v3.bin` 共同构成站点目录、认证和索引应用能力,只有下载安装机制留在 `adapters/system/resource.py`;`foundation/crypto.py` 只提供无状态 RSA/摘要/AES 算法,认证、签名、令牌和二次验证策略仍属于 `application/security/`。
|
||||
|
||||
### Placement Decision Order
|
||||
|
||||
Use these questions in order before creating or moving a module:
|
||||
|
||||
1. Is it generic and independent of MoviePilot state? Put it in `foundation`.
|
||||
1. Is it generic, free of MoviePilot state and I/O? Put it in `foundation`.
|
||||
2. Is it a pure core MoviePilot rule/model that is independent of a configured service boundary? Put it in `domain`.
|
||||
3. Is it process-wide runtime policy or a contract used by adapters? Put it in `platform`.
|
||||
4. Does it perform configured technical I/O against Redis, files, OS, browser, RSS, or Rust? Put it in `infrastructure`.
|
||||
5. Does it implement a named external product/ecosystem workflow? Put it in `integrations`.
|
||||
6. Does it discover or manage modules/plugins/service implementations? Put it in `extensions`.
|
||||
7. Does it own authentication, authorization, signing, SSRF, URL/path safety, OTP, passkeys, or two-factor behavior? Put it in `security`.
|
||||
8. Does it read persisted user configuration, coordinate one bounded capability, or normalize/match one service family? Put it in `services`.
|
||||
3. Is it process-wide runtime policy or a contract used by adapters? Put it in `runtime`.
|
||||
4. Does it discover or manage modules/plugins/service implementations? Put it in `runtime/extensions`.
|
||||
5. Does it perform configured network, cache, OS/process, file, package/resource, stdio, or Rust I/O? Put it under the matching `adapters` technical boundary.
|
||||
6. Does it implement a named external product/ecosystem workflow? Put it in `adapters/external`.
|
||||
7. Does it own authentication, authorization, signing, SSRF, URL/path safety, OTP, passkeys, or two-factor behavior? Put it in `application/security`.
|
||||
8. Does it read persisted user configuration, coordinate one bounded capability, or normalize/match one service family? Put it in `application`.
|
||||
9. Does it coordinate several modules/services/Oper classes for one use case? Put it in `chain`.
|
||||
10. Is it public to plugins or only preserving an old path? Curate it in `sdk` or map it in `compat`; do not move implementation there.
|
||||
10. Is it public to plugins or only preserving an old path? Curate it in `sdk` or map it in `runtime/compat`; do not move implementation there.
|
||||
|
||||
### Enforced Split Examples
|
||||
|
||||
These decisions are architectural constraints, not naming suggestions:
|
||||
|
||||
* Cache contracts, memory backends, decorators, and proxies stay in `app/platform/cache.py`; Redis and filesystem implementations stay in `app/infrastructure/cache.py`. Startup registers concrete factories before decorated business modules are imported. Legacy `app.core.cache` resolves to the complete `app.sdk.cache` facade.
|
||||
* The complete logging runtime stays in `app/platform/log.py`: policy, console/plugin routing, async rotating file output, and shutdown. `app.platform.config` supplies the resolved settings and log path. `platform/log.py` remains a dependency leaf with no `app.*` imports. Plugins use `app.sdk.logging`; legacy `app.log` resolves to that SDK facade.
|
||||
* Recognition parsing stays pure in `app/domain/meta/` and `app/domain/metainfo.py`. `app/services/recognition.py` reads `SystemConfigOper`; `app/startup/domain_initializer.py` injects rules, extension policy, source defaults, TMDB image construction, and the optional Rust accelerator.
|
||||
* Cache contracts, memory backends, decorators, and proxies stay in `app/runtime/cache.py`; Redis and filesystem implementations stay in `app/adapters/cache/backends.py`. Startup registers concrete factories before decorated business modules are imported. Legacy `app.core.cache` resolves to the complete `app.sdk.cache` facade.
|
||||
* The complete logging runtime stays in `app/runtime/log.py`: policy, console/plugin routing, async rotating file output, and shutdown. `app.runtime.config` supplies the resolved settings and log path. `runtime/log.py` remains a dependency leaf with no `app.*` imports. Plugins use `app.sdk.logging`; legacy `app.log` resolves to that SDK facade.
|
||||
* Recognition parsing stays pure in `app/domain/meta/` and `app/domain/metainfo.py`. `app/application/recognition.py` reads `SystemConfigOper`; `app/startup/domain_initializer.py` injects rules, extension policy, source defaults, TMDB image construction, and the optional Rust accelerator.
|
||||
* Kodi-style NFO reading and metadata document generation are one domain capability and stay together in `app/domain/scraper.py`; a separate `domain/nfo.py` must not be recreated.
|
||||
* `app/services/mediaserver.py` is the single media-server service capability module. It owns configured service discovery together with Provider ID normalization and music-library matching, while reusing generic identity rules from `app/domain/media.py`.
|
||||
* Configured notification-service discovery belongs in `app/services/notification.py`. Web Push subscription and manual-send HTTP behavior stays in `app/api/endpoints/message.py`; it is not a reusable messaging capability module.
|
||||
* `app/infrastructure/resource.py` detects/downloads/installs resources and returns whether installation occurred. Only `app/startup/modules_initializer.py` may decide to restart the process afterward.
|
||||
* Process memory/GC policy belongs in `app/platform/gc.py`; external IP-location APIs belong in `app/integrations/location.py`.
|
||||
* Security implementation filenames use package-context nouns: `app/security/url.py` and `app/security/twofactor.py`. Historical `app.utils.security` and `app.helper.twofa` remain compatibility mappings only.
|
||||
* `app/application/mediaserver.py` is the single media-server service capability module. It owns configured service discovery together with Provider ID normalization and music-library matching, while reusing generic identity rules from `app/domain/media.py`.
|
||||
* Configured notification-service discovery belongs in `app/application/notification.py`. Web Push subscription and manual-send HTTP behavior stays in `app/api/endpoints/message.py`; it is not a reusable messaging capability module.
|
||||
* `app/adapters/system/resource.py` detects/downloads/installs resources and returns whether installation occurred. Only `app/startup/modules_initializer.py` may decide to restart the process afterward.
|
||||
* Process memory/GC policy belongs in `app/runtime/gc.py`; external IP-location APIs belong in `app/adapters/external/location.py`.
|
||||
* Security implementation filenames use package-context nouns: `app/application/security/url.py` and `app/application/security/twofactor.py`. Historical `app.utils.security` and `app.helper.twofa` remain compatibility mappings only.
|
||||
|
||||
Foundation modules do not emit runtime logs. They return documented fallback values or raise according to their public contract; application callers decide whether a failure is operationally relevant and log it from the owning upper layer.
|
||||
|
||||
Any ownership move must update canonical host imports, `app/compat/manifest.py`, curated SDK exports when applicable, `docs/rules/05-architecture.md`, and `tests/test_architecture_dependencies.py`. Run that architecture test before broader tests; it rejects physical legacy sources, forbidden upward dependencies, retired canonical filenames, and import cycles.
|
||||
Any ownership move must update canonical host imports, `app/runtime/compat/manifest.py`, curated SDK exports when applicable, `docs/rules/05-architecture.md`, and `tests/test_architecture_dependencies.py`. Run that architecture test before broader tests; it rejects physical legacy sources, forbidden upward dependencies, retired canonical filenames, and import cycles.
|
||||
|
||||
---
|
||||
|
||||
@@ -140,7 +144,7 @@ When modifying the following, you must also update the listed artifacts:
|
||||
| Database model schema | New Alembic migration under `database/versions/` |
|
||||
| User-visible config or init flow | Related docs, help text, setup/init flows, tests |
|
||||
| New skill | Follow `skills/<name>/SKILL.md` structure, keep YAML front matter |
|
||||
| Canonical module ownership or import path | `docs/rules/05-architecture.md`, `app/compat/manifest.py`, SDK exports when public, architecture/compatibility tests |
|
||||
| Canonical module ownership or import path | `docs/rules/05-architecture.md`, `app/runtime/compat/manifest.py`, SDK exports when public, architecture/compatibility tests |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import warnings
|
||||
|
||||
from app.compat.imports import install_legacy_import_hook
|
||||
from app.runtime.compat.imports import install_legacy_import_hook
|
||||
|
||||
|
||||
def _filter_third_party_startup_warnings() -> None:
|
||||
|
||||
1
app/adapters/__init__.py
Normal file
1
app/adapters/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""MoviePilot 技术与外部系统适配器。"""
|
||||
1
app/adapters/cache/__init__.py
vendored
Normal file
1
app/adapters/cache/__init__.py
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"""缓存持久化适配器。"""
|
||||
@@ -7,14 +7,14 @@ import aiofiles
|
||||
import aioshutil
|
||||
from anyio import Path as AsyncPath
|
||||
|
||||
from app.infrastructure.redis import AsyncRedisHelper, RedisHelper
|
||||
from app.platform.cache import (
|
||||
from app.adapters.cache.redis import AsyncRedisHelper, RedisHelper
|
||||
from app.runtime.cache import (
|
||||
AsyncCacheBackend,
|
||||
CacheBackend,
|
||||
DEFAULT_CACHE_REGION,
|
||||
configure_cache_factories,
|
||||
)
|
||||
from app.platform.config import settings
|
||||
from app.runtime.config import settings
|
||||
|
||||
|
||||
class RedisBackend(CacheBackend):
|
||||
@@ -9,9 +9,9 @@ import redis
|
||||
from redis.asyncio import BlockingConnectionPool as AsyncBlockingConnectionPool
|
||||
from redis.asyncio import Redis
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger
|
||||
from app.platform.reload import ConfigReloadMixin
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
from app.runtime.reload import ConfigReloadMixin
|
||||
from app.foundation.singleton import Singleton
|
||||
|
||||
# 类型缓存集合,针对非容器简单类型
|
||||
@@ -1,10 +1,10 @@
|
||||
import json
|
||||
from typing import Any, Dict, Tuple, Optional
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
from app.foundation.crypto import CryptoJsUtils, HashUtils
|
||||
from app.foundation.http import RequestUtils
|
||||
from app.adapters.network.http import RequestUtils
|
||||
from app.domain.string import StringUtils
|
||||
from app.foundation.url import UrlUtils
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from app.foundation.http import RequestUtils
|
||||
from app.adapters.network.http import RequestUtils
|
||||
|
||||
|
||||
class WebUtils:
|
||||
@@ -28,17 +28,17 @@ from packaging.version import Version, InvalidVersion
|
||||
from importlib.metadata import distributions
|
||||
from requests import Response
|
||||
|
||||
from app.platform.cache import cached, is_fresh
|
||||
from app.platform.config import settings
|
||||
from app.runtime.cache import cached, is_fresh
|
||||
from app.runtime.config import settings
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.infrastructure.package import PackageInstallRequest, build_package_install_strategies
|
||||
from app.platform.log import logger
|
||||
from app.adapters.system.package import PackageInstallRequest, build_package_install_strategies
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
from app.foundation.http import RequestUtils, AsyncRequestUtils
|
||||
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
|
||||
from app.foundation.singleton import WeakSingleton
|
||||
from app.domain.string import StringUtils
|
||||
from app.foundation.version import compare_version
|
||||
from app.infrastructure.system import SystemUtils
|
||||
from app.adapters.system.host import SystemUtils
|
||||
from app.foundation.url import UrlUtils
|
||||
from version import APP_VERSION
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import base64
|
||||
from typing import Optional
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.foundation.http import RequestUtils
|
||||
from app.runtime.config import settings
|
||||
from app.adapters.network.http import RequestUtils
|
||||
|
||||
|
||||
class OcrHelper:
|
||||
@@ -5,23 +5,23 @@ from threading import Thread
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from urllib.parse import parse_qs, quote, urlparse, urlsplit
|
||||
|
||||
from app.platform.cache import cached
|
||||
from app.platform.config import settings
|
||||
from app.runtime.cache import cached
|
||||
from app.runtime.config import settings
|
||||
from app.domain.context import MediaInfo, MusicInfo
|
||||
from app.domain.meta.metabase import MetaBase
|
||||
from app.db.subscribe_oper import SubscribeOper
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.db.workflow_oper import WorkflowOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import (
|
||||
MUSIC_ENTITY_RECORDING,
|
||||
MediaType,
|
||||
SystemConfigKey,
|
||||
media_type_to_agent,
|
||||
)
|
||||
from app.foundation.http import AsyncRequestUtils, RequestUtils
|
||||
from app.adapters.network.http import AsyncRequestUtils, RequestUtils
|
||||
from app.domain.media import normalize_music_type, resolve_media_identity
|
||||
from app.infrastructure.system import SystemUtils
|
||||
from app.adapters.system.host import SystemUtils
|
||||
from version import APP_VERSION, FRONTEND_VERSION
|
||||
|
||||
|
||||
1
app/adapters/network/__init__.py
Normal file
1
app/adapters/network/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""通用网络与 Web 协议适配器。"""
|
||||
@@ -7,9 +7,9 @@ from dataclasses import dataclass, field
|
||||
from typing import Any, Callable, Optional, Protocol
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger
|
||||
from app.foundation.http import RequestUtils, cookie_parse
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
from app.adapters.network.http import RequestUtils, cookie_parse
|
||||
|
||||
|
||||
class BrowserElement(Protocol):
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
|
||||
from pyquery import PyQuery
|
||||
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
CHALLENGE_TITLES = [
|
||||
# Cloudflare
|
||||
@@ -13,9 +13,9 @@ import urllib.request
|
||||
from threading import Lock
|
||||
from typing import Dict, Optional
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger
|
||||
from app.platform.reload import ConfigReloadMixin
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
from app.runtime.reload import ConfigReloadMixin
|
||||
from app.foundation.singleton import Singleton
|
||||
|
||||
# DoH 关闭时需要释放线程池;保持惰性创建可避免未启用 DoH 时占用进程级资源
|
||||
1
app/adapters/system/__init__.py
Normal file
1
app/adapters/system/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""操作系统、进程与运行资源适配器。"""
|
||||
@@ -1,8 +1,8 @@
|
||||
from pyvirtualdisplay import Display
|
||||
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.foundation.singleton import Singleton
|
||||
from app.infrastructure.system import SystemUtils
|
||||
from app.adapters.system.host import SystemUtils
|
||||
|
||||
import os
|
||||
|
||||
@@ -2,13 +2,30 @@ import json
|
||||
import platform
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Callable
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.infrastructure.sites import SitesHelper # noqa
|
||||
from app.platform.log import logger
|
||||
from app.foundation.http import RequestUtils
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
from app.adapters.network.http import RequestUtils
|
||||
from app.foundation.version import compare_version
|
||||
from app.infrastructure.system import SystemUtils
|
||||
from app.adapters.system.host import SystemUtils
|
||||
|
||||
|
||||
ResourceVersionProvider = Callable[[], tuple[str, str]]
|
||||
|
||||
|
||||
def _unavailable_resource_versions() -> tuple[str, str]:
|
||||
"""站点能力尚未装配时返回可安全比较的空版本。"""
|
||||
return "0", "0"
|
||||
|
||||
|
||||
_resource_version_provider: ResourceVersionProvider = _unavailable_resource_versions
|
||||
|
||||
|
||||
def configure_resource_version_provider(provider: ResourceVersionProvider) -> None:
|
||||
"""由组合根注入已加载的认证与索引版本,保持适配器不依赖应用层。"""
|
||||
global _resource_version_provider
|
||||
_resource_version_provider = provider
|
||||
|
||||
|
||||
class ResourceHelper:
|
||||
@@ -17,7 +34,7 @@ class ResourceHelper:
|
||||
"""
|
||||
|
||||
_base_dir: Path = settings.ROOT_PATH
|
||||
_resource_target = Path("app/infrastructure")
|
||||
_resource_target = Path("app/application/site")
|
||||
_version_flag = settings.RESOURCE_VERSION_FLAG
|
||||
_repo = (
|
||||
f"{settings.GITHUB_PROXY}https://raw.githubusercontent.com/"
|
||||
@@ -74,16 +91,29 @@ class ResourceHelper:
|
||||
).get_res(self._repo)
|
||||
return response if response and response.status_code == 200 else None
|
||||
|
||||
def check(self) -> bool:
|
||||
def check(
|
||||
self,
|
||||
*,
|
||||
auth_version: str | None = None,
|
||||
indexer_version: str | None = None,
|
||||
) -> bool:
|
||||
"""
|
||||
检测并安装当前平台的资源更新。
|
||||
|
||||
:param auth_version: 当前已加载的站点认证资源版本;省略时使用组合根注入值
|
||||
:param indexer_version: 当前已加载的站点索引资源版本;省略时使用组合根注入值
|
||||
:return: 是否成功安装了需要由上层处理重启的新资源
|
||||
"""
|
||||
if not settings.AUTO_UPDATE_RESOURCE:
|
||||
return False
|
||||
if SystemUtils.is_frozen():
|
||||
return False
|
||||
if auth_version is None or indexer_version is None:
|
||||
configured_auth_version, configured_indexer_version = (
|
||||
_resource_version_provider()
|
||||
)
|
||||
auth_version = auth_version or configured_auth_version
|
||||
indexer_version = indexer_version or configured_indexer_version
|
||||
logger.info("开始检测资源包版本...")
|
||||
res = self._load_resource_info()
|
||||
if res:
|
||||
@@ -107,10 +137,10 @@ class ResourceHelper:
|
||||
# 判断版本号
|
||||
if rtype == "auth":
|
||||
# 站点认证资源
|
||||
local_version = SitesHelper().auth_version
|
||||
local_version = auth_version
|
||||
elif rtype == "sites":
|
||||
# 站点索引资源
|
||||
local_version = SitesHelper().indexer_version
|
||||
local_version = indexer_version
|
||||
else:
|
||||
continue
|
||||
if compare_version(version, ">", local_version):
|
||||
@@ -2,8 +2,8 @@ import logging
|
||||
from functools import lru_cache
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger, log_settings
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger, log_settings
|
||||
|
||||
try:
|
||||
import moviepilot_rust as _moviepilot_rust
|
||||
@@ -6,7 +6,7 @@ from fastapi.concurrency import run_in_threadpool
|
||||
|
||||
from app.agent.policy import sanitize_for_host
|
||||
from app.chain import ChainBase
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas import Notification
|
||||
from app.schemas.message import (
|
||||
MessageResponse,
|
||||
|
||||
@@ -12,9 +12,9 @@ from pathlib import Path
|
||||
from typing import Any, Dict, Optional
|
||||
from uuid import uuid4
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger
|
||||
from app.foundation.http import RequestUtils
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
from app.adapters.network.http import RequestUtils
|
||||
|
||||
|
||||
class AgentCapabilityProvider(ABC):
|
||||
@@ -799,7 +799,7 @@ class AgentCapabilityManager:
|
||||
if not source:
|
||||
return False
|
||||
|
||||
from app.extensions.service_registry import ServiceConfigHelper
|
||||
from app.runtime.extensions.service_registry import ServiceConfigHelper
|
||||
|
||||
for config in ServiceConfigHelper.get_notification_configs():
|
||||
if config.name != source:
|
||||
|
||||
@@ -10,8 +10,8 @@ from urllib.parse import urlsplit
|
||||
|
||||
from langchain_core.messages import AIMessage, AIMessageChunk
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from app.agent.llm.server_tools import ServerToolResolution
|
||||
|
||||
@@ -20,9 +20,9 @@ import aiofiles
|
||||
import httpx
|
||||
import jwt
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.runtime.config import settings
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
from app.foundation.singleton import Singleton
|
||||
|
||||
|
||||
@@ -13,14 +13,14 @@ from typing import Any, Optional
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.agent import (
|
||||
AgentMcpServerConfig,
|
||||
AgentMcpServerTestResult,
|
||||
AgentMcpServerToolInfo,
|
||||
)
|
||||
from app.schemas.types import SystemConfigKey
|
||||
from app.foundation.http import AsyncRequestUtils
|
||||
from app.adapters.network.http import AsyncRequestUtils
|
||||
|
||||
MCP_PROTOCOL_VERSION = "2025-11-25"
|
||||
MCP_CLIENT_NAME = "MoviePilot Agent"
|
||||
|
||||
@@ -6,9 +6,9 @@ from typing import Dict, List, Optional
|
||||
|
||||
from langchain_core.messages import BaseMessage, messages_from_dict, messages_to_dict
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.runtime.config import settings
|
||||
from app.db.agentchat_oper import AgentChatOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.agent import ConversationMemory
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.middleware.utils import append_to_system_message
|
||||
from app.agent.policy import sanitize_for_host, summarize_error, summarize_result
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
# 活动日志保留天数
|
||||
DEFAULT_RETENTION_DAYS = 7
|
||||
|
||||
@@ -17,7 +17,7 @@ from langchain_core.runnables import RunnableConfig
|
||||
from langgraph.runtime import Runtime
|
||||
|
||||
from app.agent.middleware.utils import append_to_system_message
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
# JOB.md 文件最大限制为 1MB
|
||||
MAX_JOB_FILE_SIZE = 1 * 1024 * 1024
|
||||
|
||||
@@ -15,7 +15,7 @@ from langchain_core.runnables import RunnableConfig
|
||||
from langgraph.runtime import Runtime
|
||||
|
||||
from app.agent.middleware.utils import append_to_system_message
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
# 记忆文件最大限制为 100KB,防止单文件过大导致上下文溢出
|
||||
MAX_MEMORY_FILE_SIZE = 100 * 1024
|
||||
|
||||
@@ -31,7 +31,7 @@ from app.agent.skills.metadata import (
|
||||
SkillMetadata,
|
||||
parse_skill_metadata,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
# 模型返回上限独立于领域层的磁盘读取上限,避免异常内容撑爆上下文。
|
||||
MAX_SKILL_RESULT_CHARS = 64 * 1024
|
||||
|
||||
@@ -37,7 +37,7 @@ from app.agent.policy import (
|
||||
from app.agent.runtime import SubAgentDefinition, agent_runtime_manager
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.agent.tools.catalog import ToolCatalogSnapshot
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
SUBAGENT_TASK_TOOL_NAME = "task"
|
||||
|
||||
@@ -17,7 +17,7 @@ from langgraph.graph.message import REMOVE_ALL_MESSAGES
|
||||
from langgraph.types import Command
|
||||
|
||||
from app.agent.middleware.usage import UsageMiddleware
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
try:
|
||||
_internal_call_metadata = import_module(
|
||||
|
||||
@@ -28,7 +28,7 @@ from typing_extensions import TypedDict # noqa
|
||||
|
||||
from app.agent.llm import LLMHelper
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
MIN_SELECTED_TOOL_COUNT = 4
|
||||
RECENT_SELECTION_CONTEXT_MESSAGE_LIMIT = 6
|
||||
|
||||
@@ -11,7 +11,7 @@ from langchain.agents.middleware.types import (
|
||||
from langchain_core.messages import AIMessage
|
||||
from langchain_core.messages.utils import count_tokens_approximately
|
||||
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class UsageMiddleware(AgentMiddleware):
|
||||
|
||||
@@ -69,13 +69,13 @@ from app.agent.tools.impl.mcp import (
|
||||
)
|
||||
from app.agent.tools.impl.query_system_settings import QuerySystemSettingsTool
|
||||
from app.chain import ChainBase
|
||||
from app.platform.config import settings
|
||||
from app.platform.events import eventmanager
|
||||
from app.extensions.plugin_manager import PluginManager
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.events import eventmanager
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.db.agentchat_oper import AgentChatOper
|
||||
from app.db.agenttask_oper import AgentTaskOper
|
||||
from app.db.user_oper import UserOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas import AgentLLMProviderEventData, AgentTokensUsageEventData, Notification, NotificationType
|
||||
from app.schemas.message import ChannelCapabilityManager, ChannelCapability
|
||||
from app.schemas.types import ChainEventType, EventType, MessageChannel
|
||||
|
||||
@@ -25,7 +25,7 @@ from app.agent.policy.sanitizer import (
|
||||
summarize_input,
|
||||
summarize_result,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
_HookResult = TypeVar("_HookResult")
|
||||
|
||||
@@ -10,15 +10,15 @@ from typing import Any, Dict, Optional
|
||||
import yaml
|
||||
|
||||
from app.agent.llm.capability import AgentCapabilityManager
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
from app.schemas import (
|
||||
ChannelCapability,
|
||||
ChannelCapabilities,
|
||||
MessageChannel,
|
||||
ChannelCapabilityManager,
|
||||
)
|
||||
from app.infrastructure.system import SystemUtils
|
||||
from app.adapters.system.host import SystemUtils
|
||||
|
||||
SYSTEM_TASKS_FILE = "System Tasks.yaml"
|
||||
SYSTEM_TASKS_SCHEMA_VERSION = 2
|
||||
|
||||
@@ -12,8 +12,8 @@ from typing import Any, Iterable, Optional
|
||||
|
||||
import yaml
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
|
||||
CURRENT_PERSONA_FILE = "CURRENT_PERSONA.md"
|
||||
SYSTEM_RUNTIME_DIR = "runtime"
|
||||
|
||||
@@ -10,10 +10,10 @@ from typing import Dict, List, Optional, Tuple
|
||||
from urllib.parse import urlencode, urljoin, urlparse
|
||||
|
||||
from app.agent.skills.metadata import parse_skill_metadata
|
||||
from app.platform.cache import cached, fresh
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger
|
||||
from app.foundation.http import RequestUtils
|
||||
from app.runtime.cache import cached, fresh
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
from app.adapters.network.http import RequestUtils
|
||||
from app.foundation.singleton import WeakSingleton
|
||||
from app.foundation.url import UrlUtils
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ from app.agent.policy.sanitizer import (
|
||||
)
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain import ChainBase
|
||||
from app.platform.config import settings
|
||||
from app.messaging.agent import matches_channel_admin
|
||||
from app.extensions.service_registry import ServiceConfigHelper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.config import settings
|
||||
from app.application.messaging.agent import matches_channel_admin
|
||||
from app.runtime.extensions.service_registry import ServiceConfigHelper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas import Notification
|
||||
from app.schemas.types import MessageChannel, NotificationType
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ from app.agent.tools.impl.update_custom_identifiers import UpdateCustomIdentifie
|
||||
from app.agent.tools.impl.query_system_settings import QuerySystemSettingsTool
|
||||
from app.agent.tools.impl.update_system_settings import UpdateSystemSettingsTool
|
||||
from app.agent.llm.capability import AgentCapabilityManager
|
||||
from app.extensions.plugin_manager import PluginManager
|
||||
from app.platform.log import logger
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.message import ChannelCapabilityManager
|
||||
from app.schemas.types import MessageChannel
|
||||
from .base import MoviePilotTool
|
||||
|
||||
@@ -4,10 +4,10 @@ import copy
|
||||
import re
|
||||
from typing import Any, Dict, Iterable, Optional
|
||||
|
||||
from app.platform.events import eventmanager
|
||||
from app.runtime.events import eventmanager
|
||||
from app.db.subscribe_oper import SubscribeOper
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.services.filter import RuleHelper
|
||||
from app.application.filter import RuleHelper
|
||||
from app.modules.filter.RuleParser import RuleParser
|
||||
from app.modules.filter.builtin_rules import BUILTIN_RULE_SET
|
||||
from app.schemas import CustomRule, FilterRuleGroup
|
||||
|
||||
@@ -4,11 +4,11 @@ import json
|
||||
import shutil
|
||||
from typing import Any, Optional
|
||||
|
||||
from app.platform.config import settings
|
||||
from app.extensions.plugin_manager import PluginManager
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.integrations.server import MoviePilotServerHelper
|
||||
from app.integrations.market import PluginHelper
|
||||
from app.adapters.external.server import MoviePilotServerHelper
|
||||
from app.adapters.external.market import PluginHelper
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
# 默认只向智能体返回一个可读预览,避免超大插件数据挤爆上下文窗口。
|
||||
|
||||
@@ -4,7 +4,7 @@ from dataclasses import dataclass
|
||||
from typing import Any, Optional
|
||||
|
||||
from app.agent.policy.secret_fields import is_secret_setting_key
|
||||
from app.platform.config import Settings
|
||||
from app.runtime.config import Settings
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
|
||||
from app.agent.tools.impl._command_safety import validate_command_safety
|
||||
from app.platform.config import settings
|
||||
from app.platform.log import logger
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
|
||||
if os.name == "posix":
|
||||
import fcntl as _fcntl
|
||||
|
||||
@@ -13,7 +13,7 @@ from app.agent.tools.impl._filter_rule_utils import (
|
||||
save_system_config,
|
||||
serialize_custom_rule,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@ 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.platform.config import settings
|
||||
from app.runtime.config import settings
|
||||
from app.domain.context import Context
|
||||
from app.domain.metainfo import MetaInfo
|
||||
from app.db.site_oper import SiteOper
|
||||
from app.services.directory import DirectoryHelper, validate_download_save_path
|
||||
from app.platform.log import logger
|
||||
from app.application.directory import DirectoryHelper, validate_download_save_path
|
||||
from app.runtime.log import logger
|
||||
from app.schemas import FileURI
|
||||
from app.foundation.crypto import HashUtils
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ from app.agent.tools.impl._filter_rule_utils import (
|
||||
save_system_config,
|
||||
serialize_rule_group,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.subscribe import SubscribeChain
|
||||
from app.db.user_oper import UserOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import MUSIC_ENTITY_ALBUM, MediaSource, MediaType, MessageChannel
|
||||
from ._music_utils import normalize_music_type
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ from pydantic import BaseModel, Field, model_validator
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.messaging.interaction import (
|
||||
from app.application.messaging.interaction import (
|
||||
AgentInteractionOption,
|
||||
agent_interaction_manager,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas import Notification, NotificationType
|
||||
from app.schemas.message import ChannelCapabilityManager
|
||||
from app.schemas.types import MessageChannel
|
||||
|
||||
@@ -9,8 +9,8 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.infrastructure.browser import BrowserSessionHelper
|
||||
from app.platform.log import logger
|
||||
from app.adapters.network.browser import BrowserSessionHelper
|
||||
from app.runtime.log import logger
|
||||
|
||||
# 页面内容最大长度;保留在全局工具结果兜底上限以内。
|
||||
MAX_CONTENT_LENGTH = 12_000
|
||||
|
||||
@@ -7,10 +7,10 @@ from pydantic import BaseModel, Field, model_validator
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.platform.config import settings
|
||||
from app.runtime.config import settings
|
||||
from app.db.agentchat_oper import AgentChatOper
|
||||
from app.db.agenttask_oper import AgentTaskOper
|
||||
from app.platform.scheduling import TimerUtils
|
||||
from app.runtime.scheduling import TimerUtils
|
||||
|
||||
|
||||
class CreateAgentTaskInput(BaseModel):
|
||||
|
||||
@@ -13,7 +13,7 @@ from app.agent.tools.impl._filter_rule_utils import (
|
||||
get_rule_groups,
|
||||
save_system_config,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.downloadhistory_oper import DownloadHistoryOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class DeleteDownloadHistoryInput(BaseModel):
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.download import DownloadChain
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class DeleteDownloadTasksInput(BaseModel):
|
||||
|
||||
@@ -12,7 +12,7 @@ from app.agent.tools.impl._filter_rule_utils import (
|
||||
remove_rule_group_references,
|
||||
save_system_config,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.platform.events import eventmanager
|
||||
from app.runtime.events import eventmanager
|
||||
from app.db.subscribe_oper import SubscribeOper
|
||||
from app.integrations.server import MoviePilotServerHelper
|
||||
from app.platform.log import logger
|
||||
from app.adapters.external.server import MoviePilotServerHelper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import EventType
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.storage import StorageChain
|
||||
from app.db.transferhistory_oper import TransferHistoryOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas import FileItem
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from app.agent.tools.impl._file_write_utils import (
|
||||
calculate_file_sha256,
|
||||
)
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class EditFileInput(BaseModel):
|
||||
|
||||
@@ -23,7 +23,7 @@ from app.agent.tools.impl._terminal_session import (
|
||||
TERMINAL_WAIT_DEFAULT_MS,
|
||||
terminal_session_manager,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
DEFAULT_TIMEOUT_SECONDS = 60
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.recommend import RecommendChain
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.modules.listenbrainz import (
|
||||
LISTENBRAINZ_CHART_RANGES,
|
||||
LISTENBRAINZ_FRESH_MAX_DAYS,
|
||||
|
||||
@@ -9,7 +9,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.search import SearchChain
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from ._torrent_search_utils import (
|
||||
TORRENT_RESULT_LIMIT,
|
||||
build_filter_options,
|
||||
|
||||
@@ -13,7 +13,7 @@ from app.agent.tools.impl._plugin_tool_utils import (
|
||||
load_market_plugins,
|
||||
summarize_plugin,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class InstallPluginInput(BaseModel):
|
||||
|
||||
@@ -10,7 +10,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.storage import StorageChain
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.file import FileItem
|
||||
from app.domain.string import StringUtils
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class ListSlashCommandsInput(BaseModel):
|
||||
|
||||
@@ -5,7 +5,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.platform.config import settings
|
||||
from app.runtime.config import settings
|
||||
from app.db.agenttask_oper import AgentTaskOper
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from app.agent.tools.impl._filter_rule_utils import (
|
||||
serialize_builtin_rule,
|
||||
RULE_STRING_SYNTAX,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryBuiltinFilterRulesInput(BaseModel):
|
||||
|
||||
@@ -13,7 +13,7 @@ from app.agent.tools.impl._filter_rule_utils import (
|
||||
get_rule_groups,
|
||||
serialize_custom_rule,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryCustomFilterRulesInput(BaseModel):
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.services.directory import DirectoryHelper
|
||||
from app.platform.log import logger
|
||||
from app.application.directory import DirectoryHelper
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryDirectorySettingsInput(BaseModel):
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.doctor import run_doctor
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryDoctorReportInput(BaseModel):
|
||||
|
||||
@@ -9,7 +9,7 @@ from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.download import DownloadChain
|
||||
from app.db.downloadhistory_oper import DownloadHistoryOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas import DownloaderTorrent
|
||||
from app.schemas.types import MUSIC_ENTITY_RECORDING, TorrentQueryStatus, media_type_to_agent
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.tmdb import TmdbChain
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryEpisodeScheduleInput(BaseModel):
|
||||
|
||||
@@ -16,7 +16,7 @@ from app.agent.tools.impl._plugin_tool_utils import (
|
||||
summarize_candidates,
|
||||
summarize_plugin,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryInstalledPluginsInput(BaseModel):
|
||||
|
||||
@@ -10,8 +10,8 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.mediaserver import MediaServerChain
|
||||
from app.services.mediaserver import MediaServerHelper
|
||||
from app.platform.log import logger
|
||||
from app.application.mediaserver import MediaServerHelper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import (
|
||||
MUSIC_ENTITY_ALBUM,
|
||||
MediaSource,
|
||||
|
||||
@@ -9,8 +9,8 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.chain.mediaserver import MediaServerChain
|
||||
from app.extensions.service_registry import ServiceConfigHelper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.extensions.service_registry import ServiceConfigHelper
|
||||
from app.runtime.log import logger
|
||||
|
||||
PAGE_SIZE = 20
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from app.agent.tools.impl._plugin_tool_utils import (
|
||||
summarize_candidates,
|
||||
summarize_plugin,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryMarketPluginsInput(BaseModel):
|
||||
|
||||
@@ -9,7 +9,7 @@ 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.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import (
|
||||
MUSIC_ENTITY_ALBUM,
|
||||
MUSIC_ENTITY_ARTIST,
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.runtime import agent_runtime_manager
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryPersonasInput(BaseModel):
|
||||
|
||||
@@ -7,8 +7,8 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.extensions.plugin_manager import PluginManager
|
||||
from app.platform.log import logger
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryPluginCapabilitiesInput(BaseModel):
|
||||
|
||||
@@ -8,8 +8,8 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.agent.tools.impl._plugin_tool_utils import get_plugin_snapshot
|
||||
from app.extensions.plugin_manager import PluginManager
|
||||
from app.platform.log import logger
|
||||
from app.runtime.extensions.plugin_manager import PluginManager
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryPluginConfigInput(BaseModel):
|
||||
|
||||
@@ -13,7 +13,7 @@ from app.agent.tools.impl._plugin_tool_utils import (
|
||||
get_plugin_snapshot,
|
||||
)
|
||||
from app.db.plugindata_oper import PluginDataOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryPluginDataInput(BaseModel):
|
||||
|
||||
@@ -9,8 +9,8 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.domain.context import MediaInfo
|
||||
from app.integrations.server import MoviePilotServerHelper
|
||||
from app.platform.log import logger
|
||||
from app.adapters.external.server import MoviePilotServerHelper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import MUSIC_ENTITY_RECORDING, MediaType, media_type_to_agent
|
||||
from ._music_utils import normalize_music_type
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from app.agent.tools.impl._filter_rule_utils import (
|
||||
serialize_rule_group,
|
||||
RULE_STRING_SYNTAX,
|
||||
)
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryRuleGroupsInput(BaseModel):
|
||||
|
||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QuerySchedulersInput(BaseModel):
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.site_oper import SiteOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
SITE_USERDATA_DETAIL_PREVIEW_LIMIT = 10
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.site_oper import SiteOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QuerySitesInput(BaseModel):
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.subscribehistory_oper import SubscribeHistoryOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import MUSIC_ENTITY_RECORDING, MediaType, media_type_to_agent
|
||||
from ._music_utils import normalize_music_type
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.integrations.server import MoviePilotServerHelper
|
||||
from app.platform.log import logger
|
||||
from app.adapters.external.server import MoviePilotServerHelper
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import MUSIC_ENTITY_RECORDING, media_type_to_agent
|
||||
from ._music_utils import normalize_music_type
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.subscribe_oper import SubscribeOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.subscribe import Subscribe as SubscribeSchema
|
||||
from app.schemas.types import (
|
||||
MUSIC_ENTITY_RECORDING,
|
||||
|
||||
@@ -15,9 +15,9 @@ from app.agent.tools.impl._system_setting_utils import (
|
||||
resolve_setting_spec,
|
||||
should_redact_setting,
|
||||
)
|
||||
from app.platform.config import settings
|
||||
from app.runtime.config import settings
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QuerySystemSettingsInput(BaseModel):
|
||||
|
||||
@@ -8,9 +8,9 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.transferhistory_oper import TransferHistoryOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
from app.schemas.types import media_type_to_agent
|
||||
from app.foundation.jieba import cut as jieba_cut
|
||||
from app.foundation.text import cut as jieba_cut
|
||||
|
||||
|
||||
class QueryTransferHistoryInput(BaseModel):
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field
|
||||
from app.agent.tools.base import MoviePilotTool
|
||||
from app.agent.tools.tags import ToolTag
|
||||
from app.db.workflow_oper import WorkflowOper
|
||||
from app.platform.log import logger
|
||||
from app.runtime.log import logger
|
||||
|
||||
|
||||
class QueryWorkflowsInput(BaseModel):
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user