chore: apply pre-commit formatting fixes for neo integration

This commit is contained in:
zenfun
2026-02-11 17:34:07 +08:00
parent a8cc995633
commit d4dcc6430f
5 changed files with 23 additions and 12 deletions
@@ -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,
+6 -1
View File
@@ -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",
]
+4 -4
View File
@@ -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,
+6 -2
View File
@@ -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.")
+6 -2
View File
@@ -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__