From 3f368c5764720b8630ff67549e1e285b9caa04ed Mon Sep 17 00:00:00 2001 From: youhuanghe <1051233107@qq.com> Date: Tue, 24 Mar 2026 05:07:14 +0000 Subject: [PATCH] refactor(types): remove quoted annotations under postponed evaluation --- src/langbot/pkg/box/connector.py | 4 ++-- src/langbot/pkg/box/service.py | 8 ++++---- src/langbot/pkg/provider/runner.py | 8 ++++---- src/langbot/pkg/provider/tools/loader.py | 4 ++-- src/langbot/pkg/provider/tools/toolmgr.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/langbot/pkg/box/connector.py b/src/langbot/pkg/box/connector.py index 04cc697a..557a85b4 100644 --- a/src/langbot/pkg/box/connector.py +++ b/src/langbot/pkg/box/connector.py @@ -25,7 +25,7 @@ def _get_box_config(ap) -> dict: return config_data.get('box', {}) -def resolve_box_ws_relay_url(ap: 'core_app.Application') -> str: +def resolve_box_ws_relay_url(ap: core_app.Application) -> str: """Derive the ws relay base URL used for managed-process attach.""" runtime_url = str(_get_box_config(ap).get('runtime_url', '')).strip() if runtime_url: @@ -39,7 +39,7 @@ def resolve_box_ws_relay_url(ap: 'core_app.Application') -> str: class BoxRuntimeConnector: """Connect to the Box runtime via action RPC (stdio or ws).""" - def __init__(self, ap: 'core_app.Application'): + def __init__(self, ap: core_app.Application): self.ap = ap self.configured_runtime_url = self._load_configured_runtime_url() self.manages_local_runtime = self._should_manage_local_runtime() diff --git a/src/langbot/pkg/box/service.py b/src/langbot/pkg/box/service.py index df4291b0..87ce94f8 100644 --- a/src/langbot/pkg/box/service.py +++ b/src/langbot/pkg/box/service.py @@ -39,7 +39,7 @@ if TYPE_CHECKING: class BoxService: def __init__( self, - ap: 'core_app.Application', + ap: core_app.Application, client: BoxRuntimeClient | None = None, output_limit_chars: int = 4000, ): @@ -77,7 +77,7 @@ class BoxService: async def execute_spec_payload( self, spec_payload: dict, - query: 'pipeline_query.Query', + query: pipeline_query.Query, *, skip_host_mount_validation: bool = False, ) -> dict: @@ -105,7 +105,7 @@ class BoxService: ) return self._serialize_result(result) - async def execute_sandbox_tool(self, parameters: dict, query: 'pipeline_query.Query') -> dict: + async def execute_sandbox_tool(self, parameters: dict, query: pipeline_query.Query) -> dict: spec_payload = dict(parameters) spec_payload.setdefault('session_id', str(query.query_id)) return await self.execute_spec_payload(spec_payload, query) @@ -365,7 +365,7 @@ class BoxService: # ── Observability ───────────────────────────────────────────────── - def _record_error(self, exc: Exception, query: 'pipeline_query.Query'): + def _record_error(self, exc: Exception, query: pipeline_query.Query): self._recent_errors.append( { 'timestamp': _dt.datetime.now(_UTC).isoformat(), diff --git a/src/langbot/pkg/provider/runner.py b/src/langbot/pkg/provider/runner.py index 042c2d11..987b3a0e 100644 --- a/src/langbot/pkg/provider/runner.py +++ b/src/langbot/pkg/provider/runner.py @@ -29,17 +29,17 @@ class RequestRunner(abc.ABC): name: str = None - ap: 'app.Application' + ap: app.Application pipeline_config: dict - def __init__(self, ap: 'app.Application', pipeline_config: dict): + def __init__(self, ap: app.Application, pipeline_config: dict): self.ap = ap self.pipeline_config = pipeline_config @abc.abstractmethod async def run( - self, query: 'pipeline_query.Query' - ) -> typing.AsyncGenerator['provider_message.Message | provider_message.MessageChunk', None]: + self, query: pipeline_query.Query + ) -> typing.AsyncGenerator[provider_message.Message | provider_message.MessageChunk, None]: """运行请求""" pass diff --git a/src/langbot/pkg/provider/tools/loader.py b/src/langbot/pkg/provider/tools/loader.py index 00940b56..e90f07b3 100644 --- a/src/langbot/pkg/provider/tools/loader.py +++ b/src/langbot/pkg/provider/tools/loader.py @@ -30,9 +30,9 @@ class ToolLoader(abc.ABC): name: str = None - ap: 'app.Application' + ap: app.Application - def __init__(self, ap: 'app.Application'): + def __init__(self, ap: app.Application): self.ap = ap async def initialize(self): diff --git a/src/langbot/pkg/provider/tools/toolmgr.py b/src/langbot/pkg/provider/tools/toolmgr.py index 2152b79d..b819180a 100644 --- a/src/langbot/pkg/provider/tools/toolmgr.py +++ b/src/langbot/pkg/provider/tools/toolmgr.py @@ -18,13 +18,13 @@ importutil.import_modules_in_pkg(loaders) class ToolManager: """LLM工具管理器""" - ap: 'app.Application' + ap: app.Application native_tool_loader: native_loader.NativeToolLoader plugin_tool_loader: plugin_loader.PluginToolLoader mcp_tool_loader: mcp_loader.MCPLoader - def __init__(self, ap: 'app.Application'): + def __init__(self, ap: app.Application): self.ap = ap async def initialize(self):