From 048c511b18fefdf62573676546241dd70c2f7575 Mon Sep 17 00:00:00 2001 From: zenfun Date: Fri, 13 Mar 2026 01:14:23 +0800 Subject: [PATCH] fix: align browser property with base class and remove dead env writes - shipyard_neo: browser property now returns None when not initialized instead of raising RuntimeError, matching ComputerBooter base contract - computer_tool_provider: remove dead os.environ writes for shipyard (SHIPYARD_ENDPOINT / SHIPYARD_ACCESS_TOKEN are never read anywhere) and remove unused os import --- astrbot/core/computer/booters/shipyard_neo.py | 4 +--- astrbot/core/computer/computer_tool_provider.py | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/astrbot/core/computer/booters/shipyard_neo.py b/astrbot/core/computer/booters/shipyard_neo.py index 431d21391..9db855430 100644 --- a/astrbot/core/computer/booters/shipyard_neo.py +++ b/astrbot/core/computer/booters/shipyard_neo.py @@ -474,9 +474,7 @@ class ShipyardNeoBooter(ComputerBooter): return self._shell @property - def browser(self) -> BrowserComponent: - if self._browser is None: - raise RuntimeError("ShipyardNeoBooter is not initialized.") + def browser(self) -> BrowserComponent | None: return self._browser async def upload_file(self, path: str, file_name: str) -> dict: diff --git a/astrbot/core/computer/computer_tool_provider.py b/astrbot/core/computer/computer_tool_provider.py index 7a2952dc5..dedb3c019 100644 --- a/astrbot/core/computer/computer_tool_provider.py +++ b/astrbot/core/computer/computer_tool_provider.py @@ -12,7 +12,6 @@ does not require changes here. from __future__ import annotations -import os import platform from functools import cache from typing import TYPE_CHECKING @@ -202,8 +201,6 @@ class ComputerToolProvider: if not ep or not at: logger.error("Shipyard sandbox configuration is incomplete.") return [] - os.environ["SHIPYARD_ENDPOINT"] = ep - os.environ["SHIPYARD_ACCESS_TOKEN"] = at # Always return the full tool set for schema stability return get_default_sandbox_tools(ctx.sandbox_cfg)