mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 17:47:06 +08:00
bwrap.py: - Improve property accessors with better error handling - Add RuntimeError checks for unavailable components before boot shipyard.py & shipyard_neo.py: - Add type annotations and improve code quality browser.py, fs.py, neo_skills.py, python.py: - Improve type annotations computer_tool_provider.py: - Add type annotations
47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
"""
|
|
Browser automation component
|
|
"""
|
|
|
|
from typing import Any, Protocol
|
|
|
|
|
|
class BrowserComponent(Protocol):
|
|
"""Browser operations component"""
|
|
|
|
async def exec(
|
|
self,
|
|
cmd: str,
|
|
timeout_seconds: int = 30,
|
|
description: str | None = None,
|
|
tags: str | None = None,
|
|
learn: bool = False,
|
|
include_trace: bool = False,
|
|
) -> dict[str, Any]:
|
|
"""Execute a browser automation command"""
|
|
...
|
|
|
|
async def exec_batch(
|
|
self,
|
|
commands: list[str],
|
|
timeout_seconds: int = 60,
|
|
stop_on_error: bool = True,
|
|
description: str | None = None,
|
|
tags: str | None = None,
|
|
learn: bool = False,
|
|
include_trace: bool = False,
|
|
) -> dict[str, Any]:
|
|
"""Execute a browser automation command batch"""
|
|
...
|
|
|
|
async def run_skill(
|
|
self,
|
|
skill_key: str,
|
|
timeout_seconds: int = 60,
|
|
stop_on_error: bool = True,
|
|
include_trace: bool = False,
|
|
description: str | None = None,
|
|
tags: str | None = None,
|
|
) -> dict[str, Any]:
|
|
"""Run a browser skill by skill key"""
|
|
...
|