mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
refactor: normalize capability module paths
This commit is contained in:
@@ -56,6 +56,24 @@ MODULE_ALIASES: Dict[str, ModuleAlias] = {
|
||||
introduced="v3.0.0",
|
||||
owner="application",
|
||||
),
|
||||
"app.application.chain.durable_events": ModuleAlias(
|
||||
target="app.application.chain.events",
|
||||
replacement="app.application.chain.events",
|
||||
introduced="v3.0.0",
|
||||
owner="application",
|
||||
),
|
||||
"app.application.transfer_execution": ModuleAlias(
|
||||
target="app.application.transfer.execution",
|
||||
replacement="app.application.transfer.execution",
|
||||
introduced="v3.0.0",
|
||||
owner="application",
|
||||
),
|
||||
"app.runtime.managed_resources": ModuleAlias(
|
||||
target="app.runtime.resources",
|
||||
replacement="app.runtime.resources",
|
||||
introduced="v3.0.0",
|
||||
owner="runtime",
|
||||
),
|
||||
"app.db.agentchat_oper": ModuleAlias(
|
||||
target="app.db.oper.agentchat",
|
||||
replacement="app.db.oper.agentchat",
|
||||
@@ -136,7 +154,7 @@ MODULE_ALIASES: Dict[str, ModuleAlias] = {
|
||||
),
|
||||
"app.db.transferpending_oper": ModuleAlias(
|
||||
target="app.sdk._legacy.transferpending",
|
||||
replacement="app.application.transfer",
|
||||
replacement="app.application.transfer.workflow",
|
||||
introduced="v3.0.0",
|
||||
owner="sdk",
|
||||
),
|
||||
@@ -756,6 +774,14 @@ _MESSAGE_NOTIFICATION_SYMBOL_ALIASES: Dict[str, SymbolAlias] = {
|
||||
}
|
||||
|
||||
SYMBOL_ALIASES: Dict[str, Dict[str, SymbolAlias]] = {
|
||||
"app.application.transfer": {
|
||||
name: SymbolAlias(
|
||||
target_module="app.sdk._legacy.transfer",
|
||||
target_name=name,
|
||||
replacement=f"app.application.transfer.workflow.{name}",
|
||||
)
|
||||
for name in ("TransferTask", "TransferQueue")
|
||||
},
|
||||
"app.agent.orchestrator": {
|
||||
"AgentChain": SymbolAlias(
|
||||
target_module="app.chain.agent",
|
||||
@@ -806,7 +832,7 @@ SYMBOL_ALIASES: Dict[str, Dict[str, SymbolAlias]] = {
|
||||
name: SymbolAlias(
|
||||
target_module="app.sdk._legacy.transfer",
|
||||
target_name=name,
|
||||
replacement=f"app.application.transfer.{name}",
|
||||
replacement=f"app.application.transfer.workflow.{name}",
|
||||
)
|
||||
for name in ("TransferTask", "TransferQueue")
|
||||
},
|
||||
@@ -817,7 +843,7 @@ SYMBOL_ALIASES: Dict[str, Dict[str, SymbolAlias]] = {
|
||||
name: SymbolAlias(
|
||||
target_module="app.sdk._legacy.transfer",
|
||||
target_name=name,
|
||||
replacement=f"app.application.transfer.{name}",
|
||||
replacement=f"app.application.transfer.workflow.{name}",
|
||||
)
|
||||
for name in ("TransferTask", "TransferQueue")
|
||||
},
|
||||
|
||||
+1
-2
@@ -15,12 +15,11 @@ from app.runtime.capabilities.model import (
|
||||
CapabilitySpec,
|
||||
)
|
||||
from app.runtime.capabilities.registry import CapabilityRegistry
|
||||
from app.runtime.managed_resources import (
|
||||
from app.runtime.resources import (
|
||||
MANAGED_RESOURCE_ASYNC_KIND,
|
||||
MANAGED_RESOURCE_SYNC_KIND,
|
||||
)
|
||||
|
||||
|
||||
_DEFAULT_RESOURCE_ROOT = Path(__file__).resolve().parents[2] / "adapters"
|
||||
_RESOURCE_KINDS = {MANAGED_RESOURCE_SYNC_KIND, MANAGED_RESOURCE_ASYNC_KIND}
|
||||
|
||||
@@ -4,8 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import threading
|
||||
from typing import Any, Optional, Protocol
|
||||
|
||||
from typing import Any, Literal, Optional, Protocol, overload
|
||||
|
||||
MANAGED_RESOURCE_SYNC_KIND = "managed_resource.sync"
|
||||
MANAGED_RESOURCE_ASYNC_KIND = "managed_resource.async"
|
||||
@@ -65,6 +64,14 @@ def configure_managed_resource_runtime(runtime: ManagedResourceRuntime) -> None:
|
||||
_managed_resource_runtime = runtime
|
||||
|
||||
|
||||
@overload
|
||||
def _runtime(*, required: Literal[True]) -> ManagedResourceRuntime: ...
|
||||
|
||||
|
||||
@overload
|
||||
def _runtime(*, required: Literal[False]) -> Optional[ManagedResourceRuntime]: ...
|
||||
|
||||
|
||||
def _runtime(*, required: bool) -> Optional[ManagedResourceRuntime]:
|
||||
"""读取当前 Runtime;资源使用路径要求启动组合已经完成装配。"""
|
||||
with _runtime_lock:
|
||||
Reference in New Issue
Block a user