feat: implement robust multi-tier text input architecture and ADB diagnostics
- Android Text Input & IME Normalization:
- Implement progressive 3-tier input architecture in AndroidAdbDriver and AndroidDeviceController:
- Tier 1 (Primary): Zero-dependency clipboard injection + KEYCODE_PASTE (immune to IME Pinyin interception, full Unicode/Emoji support, preserves multiline formatting).
- Tier 2 (Broadcast): Base64 broadcast injection when ADBKeyboard is active.
- Tier 3 (Fallback): Native ADB physical keyevent fallback.
- Add literal newline normalization (\r\n, \n, \r) to prevent JSON escape string corruption (e.g. '10086\n' -> '10086、n').
- Add set_clipboard method to UIAutomatorClient without auxiliary APK requirements.
- Diagnostics & System Probes:
- Add adb_keys diagnostics probe for ADB key auth checks.
- Integrate diagnostics into CLI doctor command.
- Admin Console & Showcase UI:
- Improve model service and system router in admin console.
- Enhance workspace stream view and session state in showcase UI.
This commit is contained in:
1 parent
42b8988661
commit
ea3708a98f
19 files changed
+785
-89
No files matched your search
@@ -22,18 +22,27 @@ import sys
|
||||
from rich.console import Console
|
||||
from rich.panel import Panel
|
||||
from rich.table import Table
|
||||
import typer
|
||||
|
||||
from artemis.config import (
|
||||
parse_llm_config,
|
||||
settings,
|
||||
)
|
||||
from artemis.config.paths import ROOT_DIR
|
||||
from artemis.core.diagnostics.adb_keys import heal_adb_keys, inspect_adb_keys
|
||||
from artemis.platform import OSType, platform
|
||||
from artemis.toolchain import toolchain
|
||||
from artemis.utils.ocr_api import is_ocr_configured
|
||||
|
||||
|
||||
def doctor_command() -> None:
|
||||
def doctor_command(
|
||||
fix: bool = typer.Option(
|
||||
False,
|
||||
"--fix",
|
||||
"-f",
|
||||
help="Automatically repair fixable environment issues (such as corrupted ADB authentication keys).",
|
||||
),
|
||||
) -> None:
|
||||
"""Run diagnostics to inspect system dependencies, device connectivity, and configuration."""
|
||||
console = Console()
|
||||
console.print()
|
||||
@@ -103,6 +112,44 @@ def doctor_command() -> None:
|
||||
f"adb not found in PATH or Android SDK. {hint}",
|
||||
)
|
||||
|
||||
# 2b. ADB Authentication RSA Keys Check
|
||||
key_status = inspect_adb_keys()
|
||||
if key_status.is_corrupted:
|
||||
if fix:
|
||||
heal_result = heal_adb_keys(adb_path=adb_path)
|
||||
if heal_result.get("success"):
|
||||
table.add_row(
|
||||
"ADB Auth Keys",
|
||||
"[bold green]✔ Repaired[/bold green]",
|
||||
"Corrupted RSA keys detected and automatically regenerated.",
|
||||
)
|
||||
else:
|
||||
all_passed = False
|
||||
table.add_row(
|
||||
"ADB Auth Keys",
|
||||
"[bold red]✖ Error[/bold red]",
|
||||
f"Failed to auto-heal keys: {heal_result.get('message')}",
|
||||
)
|
||||
else:
|
||||
all_passed = False
|
||||
table.add_row(
|
||||
"ADB Auth Keys",
|
||||
"[bold red]✖ Corrupted[/bold red]",
|
||||
f"{key_status.error_reason} Run [bold cyan]artemis doctor --fix[/bold cyan] to auto-repair.",
|
||||
)
|
||||
elif key_status.exists:
|
||||
table.add_row(
|
||||
"ADB Auth Keys",
|
||||
"[bold green]✔ OK[/bold green]",
|
||||
f"{key_status.key_path} ({key_status.key_size_bytes} bytes RSA)",
|
||||
)
|
||||
else:
|
||||
table.add_row(
|
||||
"ADB Auth Keys",
|
||||
"[bold cyan]○ Ready[/bold cyan]",
|
||||
"Keys will be generated automatically on first device connection.",
|
||||
)
|
||||
|
||||
# 3. Connected Android Devices
|
||||
devices_info: list[tuple[str, str, str]] = []
|
||||
if adb_path:
|
||||
|
||||
Reference in new issue
Block a user