android-llm-bridge
View on GitHub在 GitHub 查看
Mockup · Placeholder data 设计预览 · 假数据

What the Web UI will look like. Web UI 会长这样。

This page is a static preview — every widget is filled with fake data so you can walk through the full scope before we start wiring up the backend. Scroll through the six modules below, tell us what to cut, keep, or add, and the real Web tier ships on top of this shape. 这是一份静态设计稿 —— 所有控件都用占位数据填好,让你在后端动工前先把完整范围过一遍。把下面六个模块翻完,告诉我们要砍什么、留什么、加什么,真实 Web 层就照这个形状来做。

1 · Chat (Agent)1 · Chat 对话

Backend ready后端已就位

Talk to an LLM that can drive the device. Streaming tokens, expandable tool calls, inline artifacts. Cancel mid-flight, edit and re-run, fork from any turn. 和能操作设备的 LLM 对话。token 流式、tool 调用可折叠、产物内联预览。中途可取消、上条可编辑重跑、任意轮可 fork。

WS /chat/ws POST /chat ChatSession JSONL artifacts registry
Pull the last boot's logcat errors and tell me what crashed. 把最近一次开机的 logcat 错误拉出来,告诉我什么崩了。
alb_logcat completed · 618 lines · 72 KB 完成 · 618 行 · 72 KB
{ level: "E", since: "boot", max_lines: 2000 } → workspace/devices/ABC123/logcat/2026-04-23T10-14-02.log
Found 3 distinct crash signatures. The loudest one (47 hits) is SurfaceFlinger timing out on the HWC composer — first occurrence 4.2 s after boot. Two other signatures look downstream of that. Want me to pull the matching dmesg window and check GPU driver init? 找到 3 类不同崩溃。最多的一类(47 次)是 SurfaceFlinger 在 HWC 合成器上超时,第一次出现在开机后 4.2 秒。另外两类看上去是它的下游。要不要我把对应时间窗口的 dmesg 拉出来,顺便看看 GPU 驱动初始化?
📄 logcat-errors.log · 72 KB 📊 crash-summary.json · 1.2 KB
Yes, pull dmesg from 4.0 s to 5.0 s. 好,拉 4.0 秒到 5.0 秒的 dmesg。
alb_dmesg running运行中
{ time_range: "4.0s-5.0s" }

2 · Terminal2 · Terminal 终端

New新增

Direct adb / serial shell in the browser — xterm.js over a WebSocket PTY. For the times you know exactly what to type. Dangerous commands hit a Human-in-the-Loop modal before they reach the device. 浏览器里直通 adb / 串口 shell —— xterm.js 接 WebSocket PTY。你知道要敲什么时直接敲。危险命令在到达设备前先过一道人工确认。

WS /terminal/<device>/ws transport.interactive_shell() command denylist matcher session.terminal JSONL
adb shell · device ABC123XYZ · read+write Read-only只读
device:/ $ getprop ro.build.version.release 14 device:/ $ uname -a Linux localhost 6.1.75-android14 #1 SMP PREEMPT aarch64 Toybox device:/ $ df -h /data Filesystem Size Used Avail Use% Mounted on /dev/block/dm-6 103G 47G 56G 46% /data device:/ $ logcat -b crash -d | tail -5 04-23 10:14:06.812 F DEBUG : *** *** *** *** *** *** *** 04-23 10:14:06.813 F DEBUG : Build fingerprint: 'Android/aosp/generic:14/UP1A.231005.007' 04-23 10:14:06.813 F DEBUG : pid: 1142, tid: 1160, name: Binder:1142_2 >>> /system/bin/surfaceflinger 04-23 10:14:06.814 F DEBUG : signal 6 (SIGABRT), code -1 (SI_QUEUE) 04-23 10:14:06.814 F DEBUG : #00 pc 00000000000a0f8c /apex/com.android.runtime/lib64/bionic/libc.so device:/ $ rm -rf /system/priv-app/
Human-in-the-Loop required需人工确认
rm -rf /system/priv-app/
Pattern matched: rm -rf targeting a system partition. This will brick a verified-boot device and is not auto-allowed. 命中策略:rm -rf 指向系统分区。这会让 verified-boot 设备变砖,不自动放行。

Every command lands in the session JSONL. Select any output block → right-click → “Ask LLM about this” to hand it over to the Chat tab. 每条命令都落到 session JSONL。选中任意输出 → 右键「让 LLM 分析这段」即可丢给 Chat 面板。

3 · Model Playground3 · 模型调试台

New新增

Raw chat, bypassing the agent loop. Tune every parameter of a local model — temperature, top-p, top-k, context window, seed, stop sequences, think toggle, system prompt — and watch tokens/second, eval duration, and prompt eval duration in real time. Compare two parameter sets side by side. 绕过 agent loop 的直聊。把本地模型的每个参数调一遍 —— temperature / top-p / top-k / 上下文长度 / seed / stop / think 开关 / system prompt —— 实时看 tokens/s、eval 时长、prompt eval 时长。两套参数可并排对比。

POST /playground/chat WS /playground/chat/ws GET /backends/<id>/models metrics in stream done event
Model模型
Sampling采样
0.70
0.90
rand
1.10
Context上下文
tok
Behavior行为
System prompt系统提示
Explain dm-verity in three sentences. 用三句话解释 dm-verity。
dm-verity is a device-mapper target that provides transparent integrity checking of a block device using a Merkle hash tree. The bootloader verifies the tree's root hash against a signed vbmeta image, and every read from the verified partition recomputes the block's hash on the fly. A hash mismatch triggers either a panic or a read error depending on the configured mode (enforcing, logging, or ignore_zero_blocks). dm-verity 是一个 device-mapper target,用一棵 Merkle hash 树给块设备做透明完整性校验。bootloader 拿树的 root hash 去对签过名的 vbmeta 映像做验证,之后每次从这个分区读数据都会现算块的哈希。哈希不匹配时,按配置的模式触发 panic 或返回读错误(enforcing / logging / ignore_zero_blocks)。
throughput吞吐 142 tok/s
eval duration生成时长 3.24 s
prompt evalprompt 处理 0.41 s
total总计 4.13 s
ctx used上下文用量 2341/8192
tokens out输出 token 460

4 · Devices Dashboard4 · 设备看板

Partial backend后端部分就位

Every connected device at a glance — adb USB, adb over Wi-Fi, UART bridge. Tunnel status lights, live Windows probe output for COM ports and USB PID/VID. 所有连上的设备一眼看完 —— USB adb、Wi-Fi adb、UART 桥。隧道状态灯 + Windows 探针实时上报 COM 口和 USB PID/VID。

GET /devices WS /devices/live GET /tunnels alb-probe-win (reverse tunnel)
ABC123XYZ adb · usb
Android 14 · userdebug · Cortex-A76/A55 Android 14 · userdebug · Cortex-A76/A55
8G LPDDR5 · 128G UFS 3.1
last: 2 s ago · logcat 618 E/min · batt 74% · 38.2°C
DEF456UVW adb · wifi
Android 13 · user · Cortex-A78 Android 13 · user · Cortex-A78
board.lan:5555 · RTT 18 ms
last: 12 s ago · idle · batt 92% · charging
UART bridgeUART 桥 serial
1 500 000 baud · shell_root 1 500 000 波特率 · shell_root
COM27 → localhost:19001
last: 1 s ago · prompt stable · 0 printk since probe
adb tunnel 5037adb 隧道 5037 12.4 MB ↓ · 0.3 MB ↑
UART bridge 19001UART 桥 19001 3.1 MB ↓ · 120 B ↑
Windows probe 19002Windows 探针 19002 waiting reconnect…等待重连…
Windows probe snapshot · 2 s ago Windows 探针快照 · 2 秒前
COM27 · 1500000 baud · in use by alb-serial-bridge.py (pid 14820)
COM4 · free
USB · VID 18d1 · PID 4ee7 · “Android Composite ADB Interface” → ABC123XYZ
USB · VID 0403 · PID 6001 · “USB Serial Converter”

5 · System Info5 · 系统信息

New capability新能力

One screen, full picture. Eleven panels cover everything from Android build fingerprint down to DDR type, partition usage, SELinux state, and Verified Boot chain — sourced from getprop, /proc, /sys, and dumpsys. 一屏看完整机软硬件。11 个面板覆盖从 Android 构建指纹到 DDR 类型、分区用量、SELinux 状态、Verified Boot 链 —— 数据来自 getprop / /proc / /sys / dumpsys

alb info system alb info cpu --watch alb info storage alb info battery alb info security +6 more

🔭 Overview总览

Android
14 · API 34
Build构建
userdebug · keys=test
Fingerprint指纹
Android/aosp/generic:14/UP1A.231005.007/eng
Security patch安全补丁
2026-03-05
RootRoot
adbd with root

Kernel & Bootloader内核 & Bootloader

Kernel
6.1.75-android14-11-g3a8f0e
Arch
aarch64 · armv8.2-A
SELinux
enforcing
Bootloader
u-boot 2023.10-genericboard
Baseband
N/A
Slot
_a · success

🧠 CPU

SoC
Generic Octa-core ARM通用 8 核 ARM
Config
4× A76 @ 2.2 GHz + 4× A55 @ 1.8 GHz
Governor
schedutil
Current当前频率
2.2 / 2.2 / 2.2 / 2.2 / 1.8 / 1.8 / 1.8 / 1.8
Thermal温度
52.1°C cpu-big · 49.3°C cpu-little

🎨 GPU

Model
Mali-G610 MC4
Driver
r40p0 · OpenGL ES 3.2
Vulkan
1.3.231
Freq
800 MHz / 1000 MHz max
Util
37%

💾 Memory内存

Total
7 892 MB
Used
4 137 MB · 52%
Free
621 MB
Buff/Cache
3 134 MB
Swap
2048 MB (zram) · 412 used

🪙 DDR & UFS

DDR type
LPDDR5 · 6400 MT/s
Channels
2
Storage
UFS 3.1 · 128 GB
Seq read顺序读
2.1 GB/s
Seq write顺序写
1.4 GB/s

🗂 Partitions分区

system_a
3.4 / 4 G
vendor_a
610 / 1 G
boot_a
58 / 64 M
userdata
47 / 103 G
metadata
2 / 16 M

📁 Filesystems文件系统

/ → erofs ro
/vendor → erofs ro
/data → f2fs rw
/metadata → ext4 rw
/sdcard → sdcardfs rw
/dev/cpuset → cgroup rw
/sys/fs/bpf → bpf rw

🌐 Network网络

wlan0
board.lan · up · -52 dBm
SSID
lab-2.4G
eth0
down
rndis0
board-usb.lan · up
DNS
dns.lan, 1.1.1.1

🔋 Battery电池

Level
74%
Status
charging (AC)充电中 (AC)
Voltage
4.12 V
Current
+1824 mA
Temp
38.2°C
Health健康
good · 412 cycles

🛡 Security安全

Verified Boot
GREEN · AVB v1.2
dm-verity
enforcing
FBE
aes-256-xts
SELinux policy
v33 · 2026-02-14 build
OEM unlock
enabled
adb secure
1

6 · Real-time Charts6 · 实时图表

New capability新能力

1 Hz sampling by default, 60-second sliding window, pause / zoom / CSV export. Always visible at the top of the app so you notice thermal throttle or memory pressure before the LLM does. 默认 1 Hz 采样,60 秒滑窗,可暂停 / 缩放 / 导 CSV。常驻顶栏,让你比 LLM 更早发现降频或内存压力。

WS /metrics/stream ring buffer 300s µPlot / Chart.js

CPU utilization 占用

47%

Memory used内存占用

4.1GB

Battery temperature电池温度

38.2°C

Disk IO磁盘 IO

82MB/s

Network网络吞吐

1.2MB/s

GPU utilizationGPU 占用

37%

Coming next — batch 2后续批次 — batch 2

Pending review等你过稿

We will mock these six after you sign off on batch 1 above. Each will get the same walk-through treatment before any backend work starts. 上面 6 块你过稿后,这 6 块再按同样方式出静态稿 —— 全部定稿了再开后端。

🪵 Logcat / dmesg streamLogcat / dmesg 流

Level colors, tag / PID / regex filters, pause / export, trigger rules (“on FATAL: auto bugreport + screenshot”), ANR timeline markers. 级别着色、tag / PID / 正则过滤、暂停 / 导出、触发规则("FATAL 时自动抓 bugreport + 截图")、ANR 时间轴标记。

🔍 UI InspectorUI 检查器

Screenshot with bounds overlay on hover, searchable view tree, selected-node details. No tap / swipe — diagnosis only. 截图上悬浮高亮控件 bounds、控件树可搜索、选中控件详情。不做 tap / swipe —— 只诊断。

📦 Artifacts browser产物浏览器

Tree by session, type filters, inline preview of PNG / JSON / logcat / XML, quota bar, zip & download. 按 session 树形、类型筛选、PNG / JSON / logcat / XML 在线预览、配额进度条、打包下载。

SessionsSession 会话

List, open, replay with a timeline scrubber, diff two runs, fork from any turn, tag & star. 列表、打开、按时间轴 scrubber 回放、两次 run 对比、任意轮 fork、打标签收藏。

🚦 HITL approvalsHITL 审批

Queue of pending dangerous tool calls, approve / deny / edit-then-approve, session-scoped allowlist, full audit trail. 危险 tool 调用审批队列、允许 / 拒绝 / 改后放行、session 内白名单、完整审计。

🩺 Doctor & SettingsDoctor & 设置

Red / yellow / green health check over tunnels, adb, serial, MCP, config, env. Backend config form, workspace quota, theme, language. 隧道 / adb / 串口 / MCP / config / env 的红黄绿体检。后端配置表单、workspace 配额、主题、语言。

→ Walk through, then cut. → 先过一遍,再砍。

Open an issue or send a note with what to remove, keep, or add from this preview. Once batch 1 stabilizes, we freeze the schema and start wiring the FastAPI endpoints / WebSocket channels behind each widget. 在 issue 里留言或直接反馈:这份 preview 里要删什么、留什么、加什么。batch 1 定稿后,我们冻结 schema,再按每个控件接上 FastAPI / WebSocket。