From d4dcc6430f30288a42764b14bfcae6b851aed142 Mon Sep 17 00:00:00 2001 From: zenfun Date: Wed, 11 Feb 2026 17:34:07 +0800 Subject: [PATCH] chore: apply pre-commit formatting fixes for neo integration --- astrbot/core/computer/booters/shipyard_neo.py | 4 +--- astrbot/core/computer/olayer/__init__.py | 7 ++++++- astrbot/core/computer/tools/neo_skills.py | 8 ++++---- astrbot/core/skills/neo_skill_sync.py | 8 ++++++-- astrbot/dashboard/routes/skills.py | 8 ++++++-- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/astrbot/core/computer/booters/shipyard_neo.py b/astrbot/core/computer/booters/shipyard_neo.py index 66b72479a..1021c6df6 100644 --- a/astrbot/core/computer/booters/shipyard_neo.py +++ b/astrbot/core/computer/booters/shipyard_neo.py @@ -95,9 +95,7 @@ class NeoShellComponent(ShellComponent): run_command = f"{env_prefix} {run_command}" if background: - run_command = ( - f"nohup sh -lc {shlex.quote(run_command)} >/tmp/astrbot_bg.log 2>&1 & echo $!" - ) + run_command = f"nohup sh -lc {shlex.quote(run_command)} >/tmp/astrbot_bg.log 2>&1 & echo $!" result = await self._sandbox.shell.exec( run_command, diff --git a/astrbot/core/computer/olayer/__init__.py b/astrbot/core/computer/olayer/__init__.py index 08225d260..e2348671e 100644 --- a/astrbot/core/computer/olayer/__init__.py +++ b/astrbot/core/computer/olayer/__init__.py @@ -3,4 +3,9 @@ from .filesystem import FileSystemComponent from .python import PythonComponent from .shell import ShellComponent -__all__ = ["PythonComponent", "ShellComponent", "FileSystemComponent", "BrowserComponent"] +__all__ = [ + "PythonComponent", + "ShellComponent", + "FileSystemComponent", + "BrowserComponent", +] diff --git a/astrbot/core/computer/tools/neo_skills.py b/astrbot/core/computer/tools/neo_skills.py index fdff07a50..440538451 100644 --- a/astrbot/core/computer/tools/neo_skills.py +++ b/astrbot/core/computer/tools/neo_skills.py @@ -27,13 +27,13 @@ def _to_json_text(data: Any) -> str: def _ensure_admin(context: ContextWrapper[AstrAgentContext]) -> str | None: if context.context.event.role != "admin": - return ( - "error: Permission denied. Skill lifecycle tools are only allowed for admin users." - ) + return "error: Permission denied. Skill lifecycle tools are only allowed for admin users." return None -async def _get_neo_context(context: ContextWrapper[AstrAgentContext]) -> tuple[Any, Any]: +async def _get_neo_context( + context: ContextWrapper[AstrAgentContext], +) -> tuple[Any, Any]: booter = await get_booter( context.context.context, context.context.event.unified_msg_origin, diff --git a/astrbot/core/skills/neo_skill_sync.py b/astrbot/core/skills/neo_skill_sync.py index 7b544054d..8e6c65aa4 100644 --- a/astrbot/core/skills/neo_skill_sync.py +++ b/astrbot/core/skills/neo_skill_sync.py @@ -136,7 +136,9 @@ class NeoSkillSyncManager: page_json = _to_jsonable(page) items = page_json.get("items", []) if not isinstance(items, list) or not items: - raise ValueError(f"No active stable release found for skill_key: {skill_key}") + raise ValueError( + f"No active stable release found for skill_key: {skill_key}" + ) if not isinstance(items[0], dict): raise ValueError("Unexpected release payload format.") return items[0] @@ -152,7 +154,9 @@ class NeoSkillSyncManager: if release_id: release = await self._find_release(client, release_id=release_id) elif skill_key: - release = await self._find_active_stable_release(client, skill_key=skill_key) + release = await self._find_active_stable_release( + client, skill_key=skill_key + ) else: raise ValueError("release_id or skill_key is required for sync.") diff --git a/astrbot/dashboard/routes/skills.py b/astrbot/dashboard/routes/skills.py index 4b3441d55..e525539dd 100644 --- a/astrbot/dashboard/routes/skills.py +++ b/astrbot/dashboard/routes/skills.py @@ -296,7 +296,9 @@ class SkillsRoute(Route): endpoint_url=endpoint, access_token=access_token, ) as client: - release = await client.skills.promote_candidate(candidate_id, stage=stage) + release = await client.skills.promote_candidate( + candidate_id, stage=stage + ) release_json = _to_jsonable(release) sync_json = None @@ -337,7 +339,9 @@ class SkillsRoute(Route): except Exception: logger.warning("Failed to sync skills to active sandboxes.") - return Response().ok({"release": release_json, "sync": sync_json}).__dict__ + return ( + Response().ok({"release": release_json, "sync": sync_json}).__dict__ + ) except Exception as e: logger.error(traceback.format_exc()) return Response().error(str(e)).__dict__