Skip to content

Commit aa192dd

Browse files
committed
Update READMEs to reflect completed USB passthrough subsystem
Refresh the EN / zh-TW / zh-CN feature bullets, architecture diagram node, and directory tree: passthrough is no longer "deferred" — all backends, resolved open questions (HMAC ACL, LIST, fragmentation, resume), the in-process loopback, WebRTC wiring, AnyDesk GUI panel, and the five driving surfaces (GUI / AC_usb_* / REST / MCP / Python) are documented.
1 parent 46065c9 commit aa192dd

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ sense) a Qt GUI tab. Full reference page:
143143
- **Multi-Host Admin Console** — register N AutoControl REST endpoints in one address book, poll them in parallel for health/sessions/jobs, broadcast actions to all of them. Persisted to `~/.je_auto_control/admin_hosts.json` (mode 0600 on POSIX). Bad-token hosts surface as unhealthy with the actual HTTP error
144144
- **Tamper-Evident Audit Log** — SQLite events table with SHA-256 hash chain (`prev_hash` + `row_hash` per row); editing any past row breaks the chain. `verify_chain()` walks rows top-down and reports the first broken link. Legacy tables get backfilled at startup ("trust on first use")
145145
- **WebRTC Packet Inspector** — process-global rolling window of `StatsSnapshot` samples (default 600 / ~10 min @ 1Hz) fed by the existing WebRTC stats pollers. Per-metric `last/min/max/avg/p95` for RTT, FPS, bitrate, packet loss, jitter
146-
- **USB Device Enumeration** — read-only cross-platform device listing. Tries pyusb (libusb) first; falls back to platform-specific (Windows `Get-PnpDevice`, macOS `system_profiler`, Linux `/sys/bus/usb/devices`). Phase 2 (passthrough) intentionally deferred pending design review
146+
- **USB Device Enumeration** — read-only cross-platform device listing. Tries pyusb (libusb) first; falls back to platform-specific (Windows `Get-PnpDevice`, macOS `system_profiler`, Linux `/sys/bus/usb/devices`). Phase 2 passthrough builds on this (see below)
147147
- **System Diagnostics** — single-command "is everything OK?" probe across platform, optional deps, executor command count, audit chain, screenshot, mouse, disk space, REST registry. CLI exits 0 if all green / 1 otherwise; REST `/diagnose`; severity-tagged GUI tab
148148
- **USB Hotplug Events** — polling-based hotplug watcher (`UsbHotplugWatcher`) with bounded ring buffer + sequence-numbered events; `GET /usb/events?since=N` lets late subscribers catch up. GUI auto-refresh toggle on the USB tab.
149149
- **OpenAPI 3.1 + Swagger UI**`GET /openapi.json` (auth-gated, generated from the live route table) + `GET /docs` (browser Swagger UI with bearer token bar). Drift test in CI catches new routes added without metadata.
150150
- **Configuration Bundle** — single-file JSON export/import of user config (admin hosts, address book, trusted viewers, known hosts, host service, IDs). Atomic write with `<name>.bak.<timestamp>` backups; CLI `python -m je_auto_control.utils.config_bundle export|import`; `POST /config/{export,import}`; GUI buttons on the REST API tab.
151-
- **USB Passthrough (experimental, opt-in)** — wire-level protocol over a WebRTC `usb` DataChannel (10 opcodes, CREDIT-based flow control, 16 KiB payload cap). Host-side `UsbPassthroughSession` end-to-end on the Linux libusb backend; Windows `WinUSB` backend with full ctypes wiring (hardware-unverified); macOS `IOKit` skeleton. Viewer-side blocking client (`UsbPassthroughClient``ClientHandle.control_transfer / bulk_transfer / interrupt_transfer`). Persistent ACL (`~/.je_auto_control/usb_acl.json`, default deny, mode 0600) with host-side prompt QDialog and tamper-evident audit-log integration. Default off — opt-in via `enable_usb_passthrough(True)` or `JE_AUTOCONTROL_USB_PASSTHROUGH=1`. Phase 2e external security review checklist included; default-on requires sign-off.
151+
- **USB Passthrough (opt-in)** — let a remote viewer use a USB device physically attached to the host, over a WebRTC `usb` DataChannel. Wire-level protocol (11 opcodes incl. `RESUME`, CREDIT-based flow control, 16 KiB payload cap with EOF fragmentation for oversize transfers). All eight original open questions resolved: reliable-ordered channel, LIST-over-channel (ACL-filtered), per-claim credits, Linux kernel-driver detach/reattach, and ACL **HMAC-SHA256 integrity** (fail-closed on tamper; pluggable key — Windows DPAPI or passphrase vault). **Backends:** `LibusbBackend` (production), `WinusbBackend` (ctypes) and `IokitBackend` (native IOKit enumeration + libusb transfers) — Windows/macOS *hardware-unverified*; `default_passthrough_backend()` picks per-OS. Viewer-side blocking client (`control/bulk/interrupt_transfer`, `list_devices`, `resume`); in-process `UsbLoopback` so one machine can share + use a device through the full stack. **Wired into WebRTC** host/viewer (`viewer.usb_client()`) plus claim **resume tokens** that survive a reconnect. Persistent ACL (default deny, mode 0600) with host-side prompt dialog, abuse **rate-limit / lockout**, and tamper-evident audit integration. Five driving surfaces: AnyDesk-style **GUI panel** (share + ACL allow/block + local/remote use), `AC_usb_*` executor commands (JSON / socket / scheduler), **REST** `/usb/...`, first-class **MCP** `ac_usb_*` tools, and the Python API. Default off — opt-in via `enable_usb_passthrough(True)` or `JE_AUTOCONTROL_USB_PASSTHROUGH=1`; default-on still pending Phase 2e external security sign-off + real-hardware verification.
152152
- **Observability (Prometheus + OpenTelemetry)** — stdlib-only `Counter` / `Gauge` / `Histogram` registry with a tiny built-in HTTP exporter on `/metrics`, plus an OpenTelemetry-compatible tracer that upgrades to real OTel spans when the SDK is installed. The executor and agent loop emit `autocontrol_action_calls_total{action,outcome}`, `autocontrol_action_duration_seconds`, and `autocontrol_agent_steps_total{tool,outcome}` automatically — drop the URL into a Prometheus scrape config and you have a Grafana dashboard with zero per-script wiring.
153153

154154
---
@@ -217,7 +217,7 @@ flowchart LR
217217
subgraph USB["USB"]
218218
direction TB
219219
UsbEnum["usb/<br/>list + hotplug events"]
220-
UsbPass["usb/passthrough/<br/>session · client · ACL ·<br/>libusb · WinUSB · IOKit"]
220+
UsbPass["usb/passthrough/<br/>session · client · ACL(HMAC) ·<br/>libusb · WinUSB · IOKit ·<br/>loopback · webrtc channel · commands"]
221221
end
222222
223223
subgraph Remote["Remote Desktop (utils/remote_desktop/)"]
@@ -317,7 +317,7 @@ je_auto_control/
317317
├── admin/ # Multi-host AdminConsoleClient (poll + broadcast)
318318
├── diagnostics/ # System self-test runner + CLI
319319
├── config_bundle/ # Single-file user-config export / import
320-
├── usb/ # Cross-platform enumeration, hotplug events, passthrough/{protocol, session, viewer client, ACL, libusb / WinUSB / IOKit}
320+
├── usb/ # Cross-platform enumeration, hotplug events, passthrough/{protocol, session, viewer client, loopback, webrtc channel, ACL+HMAC, descriptor, key providers, commands, libusb / WinUSB / IOKit}
321321
├── remote_desktop/ # WebRTC host + viewer, signalling, multi-viewer, file/clipboard/audio sync, audit log (hash chain), trust list, TURN config, mDNS discovery, WebRTC stats inspector
322322
├── plugin_loader/ # Dynamic AC_* plugin discovery
323323
├── socket_server/ # TCP socket server for remote automation

README/README_zh-CN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@
141141
- **多主机管理控制台** — 在一份通讯录中注册 N 个远程 AutoControl REST 端点,并行轮询 health/sessions/jobs,把同一份动作清单广播给全部主机。储存于 `~/.je_auto_control/admin_hosts.json`(POSIX 上模式 0600)。Token 错误的主机会以实际 HTTP 错误显示为不健康
142142
- **可检测篡改的审计日志** — SQLite events 表加上 SHA-256 哈希链(每条记录含 `prev_hash` + `row_hash`);修改任何过去记录都会打断哈希链。`verify_chain()` 自顶向下走访并报告第一个断点。既有数据表会在启动时回填("初次使用即信任")
143143
- **WebRTC 包监测** — 由既有 WebRTC stats 轮询喂入的进程级 `StatsSnapshot` 滚动窗口(默认 600 条 / 1 Hz 约 10 分钟)。对 RTT、FPS、bitrate、丢包率、jitter 各回 `last/min/max/avg/p95`
144-
- **USB 设备列举** — 只读的跨平台 USB 设备列举。优先尝试 pyusb(libusb);若无则退回平台特定命令(Windows `Get-PnpDevice`、macOS `system_profiler`、Linux `/sys/bus/usb/devices`)。第二阶段passthrough)刻意延后待设计审查
144+
- **USB 设备列举** — 只读的跨平台 USB 设备列举。优先尝试 pyusb(libusb);若无则退回平台特定命令(Windows `Get-PnpDevice`、macOS `system_profiler`、Linux `/sys/bus/usb/devices`)。第二阶段 passthrough 构建于此(见下)
145145
- **系统诊断** — 一键"目前正常吗?"探测:平台、可选依赖包、executor 命令数、审计链、截图、鼠标、磁盘空间、REST registry。CLI 全绿 exit 0/否则 1;REST `/diagnose`;按严重度上色的 GUI 分页
146146
- **USB Hotplug 事件** — 轮询式 hotplug 监测(`UsbHotplugWatcher`),含 bounded ring buffer 与带序号的事件;`GET /usb/events?since=N` 让晚加入的订阅者补上进度。USB 分页有自动刷新切换钮。
147147
- **OpenAPI 3.1 + Swagger UI**`GET /openapi.json`(auth-gated,从活的路由表生成)+ `GET /docs`(浏览器版 Swagger UI 含 bearer token 栏)。CI 上有 drift 测试,新加路由忘记写 metadata 会被拦下。
148148
- **配置包导出/导入** — 单一 JSON 文件,导出/导入用户配置(admin hosts、address book、trusted viewers、known hosts、host service、IDs)。原子写入加 `<name>.bak.<时间戳>` 备份;CLI `python -m je_auto_control.utils.config_bundle export|import``POST /config/{export,import}`;REST API 分页有按钮。
149-
- **USB Passthrough(实验性、需主动启用)** — wire-level 协议走 WebRTC `usb` DataChannel(10 个 opcode、CREDIT 流量控制、16 KiB payload 上限)。Host 端 `UsbPassthroughSession` 在 Linux libusb backend 上端到端运行;Windows `WinUSB` backend 含完整 ctypes 接线(硬件未验证);macOS `IOKit` 为骨架。Viewer 端阻塞式 client(`UsbPassthroughClient``ClientHandle.control_transfer / bulk_transfer / interrupt_transfer`)。持久化 ACL(`~/.je_auto_control/usb_acl.json`,默认 deny,POSIX mode 0600),含 host 端 prompt QDialog 与可检测篡改审计日志整合。默认 off — 用 `enable_usb_passthrough(True)``JE_AUTOCONTROL_USB_PASSTHROUGH=1` 启用。Phase 2e 外部安全审查清单已附;默认启用前需要签核。
149+
- **USB Passthrough(需主动启用)** — 让远端 viewer 使用实体插在 host 上的 USB 设备,走 WebRTC `usb` DataChannel。Wire-level 协议(11 个 opcode 含 `RESUME`、CREDIT 流量控制、16 KiB payload 上限,超量传输以 EOF 分片)。八个原始未决问题全部解决:可靠有序 channel、LIST 走 channel(ACL 过滤)、per-claim credit、Linux kernel driver detach/reattach、ACL **HMAC-SHA256 完整性**(篡改 fail-closed;密钥可插拔 — Windows DPAPI 或 passphrase vault)。**Backend:**`LibusbBackend`(production)、`WinusbBackend`(ctypes)、`IokitBackend`(原生 IOKit 列举 + libusb 传输)— Windows/macOS *硬件未验证*;`default_passthrough_backend()` 依 OS 自动挑。Viewer 端阻塞式 client(`control/bulk/interrupt_transfer`、`list_devices`、`resume`);in-process `UsbLoopback` 让同机可走完整堆栈 share+use。**已接入 WebRTC** host/viewer(`viewer.usb_client()`)并含断线可续租的 **resume token**。持久化 ACL(默认 deny、mode 0600),含 host 端 prompt 对话框、滥用 **rate-limit / lockout** 与可检测篡改审计整合。五个驱动面:AnyDesk 风 **GUI 面板**(分享 + ACL 允许/封锁 + 本机/远端使用)、`AC_usb_*` executor 命令(JSON / socket / 调度器)、**REST** `/usb/...`、一级 **MCP** `ac_usb_*` 工具、以及 Python API。默认 off — 用 `enable_usb_passthrough(True)` 或 `JE_AUTOCONTROL_USB_PASSTHROUGH=1` 启用;默认启用仍待 Phase 2e 外部安全签核 + 实机硬件验证。
150150

151151
---
152152

@@ -213,7 +213,7 @@ flowchart LR
213213
subgraph USB["USB"]
214214
direction TB
215215
UsbEnum["usb/<br/>列举 + hotplug"]
216-
UsbPass["usb/passthrough/<br/>session · client · ACL ·<br/>libusb · WinUSB · IOKit"]
216+
UsbPass["usb/passthrough/<br/>session · client · ACL(HMAC) ·<br/>libusb · WinUSB · IOKit ·<br/>loopback · webrtc channel · commands"]
217217
end
218218
219219
subgraph Remote["远程桌面 (utils/remote_desktop/)"]
@@ -313,7 +313,7 @@ je_auto_control/
313313
├── admin/ # 多主机 AdminConsoleClient(轮询 + 广播)
314314
├── diagnostics/ # 系统自我诊断 + CLI
315315
├── config_bundle/ # 单文件用户配置导出/导入
316-
├── usb/ # 跨平台列举、hotplug 事件、passthrough/{protocol, session, viewer client, ACL, libusb / WinUSB / IOKit}
316+
├── usb/ # 跨平台列举、hotplug 事件、passthrough/{protocol, session, viewer client, loopback, webrtc channel, ACL+HMAC, descriptor, key providers, commands, libusb / WinUSB / IOKit}
317317
├── remote_desktop/ # WebRTC host + viewer、signalling、multi-viewer、文件/剪贴板/音频同步、审计日志(哈希链)、信任列表、TURN 配置、mDNS 发现、WebRTC stats inspector
318318
├── plugin_loader/ # 动态 AC_* 插件搜索与注册
319319
├── socket_server/ # TCP Socket 服务器(远程自动化)

README/README_zh-TW.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@
141141
- **多主機管理主控台** — 在一份通訊錄中註冊 N 個遠端 AutoControl REST 端點,並行輪詢 health/sessions/jobs,把同一份動作清單廣播給全部主機。儲存於 `~/.je_auto_control/admin_hosts.json`(POSIX 上模式 0600)。Token 錯誤的主機會以實際 HTTP 錯誤呈現為不健康
142142
- **可偵測竄改的稽核紀錄** — SQLite events 表加上 SHA-256 雜湊鏈(每筆紀錄含 `prev_hash` + `row_hash`);修改任何過去紀錄都會打斷雜湊鏈。`verify_chain()` 由上往下走訪並回報第一個斷點。既有資料表會在啟動時回填(「初次使用即信任」)
143143
- **WebRTC 封包監測** — 由既有 WebRTC stats 輪詢餵入的程序級 `StatsSnapshot` 滾動視窗(預設 600 筆 / 1 Hz 約 10 分鐘)。對 RTT、FPS、bitrate、封包遺失、jitter 各回 `last/min/max/avg/p95`
144-
- **USB 裝置列舉** — 唯讀的跨平台 USB 裝置列舉。優先嘗試 pyusb(libusb);若無則退回平台特定指令(Windows `Get-PnpDevice`、macOS `system_profiler`、Linux `/sys/bus/usb/devices`)。第二階段passthrough)刻意延後待設計審查
144+
- **USB 裝置列舉** — 唯讀的跨平台 USB 裝置列舉。優先嘗試 pyusb(libusb);若無則退回平台特定指令(Windows `Get-PnpDevice`、macOS `system_profiler`、Linux `/sys/bus/usb/devices`)。第二階段 passthrough 建構於此(見下)
145145
- **系統診斷** — 一鍵「目前正常嗎?」探測:平台、選用相依套件、executor 指令數、稽核鏈、截圖、滑鼠、硬碟空間、REST registry。CLI 全綠 exit 0/否則 1;REST `/diagnose`;依嚴重度上色的 GUI 分頁
146146
- **USB Hotplug 事件** — 輪詢式 hotplug 監測(`UsbHotplugWatcher`),含 bounded ring buffer 與帶序號的事件;`GET /usb/events?since=N` 讓晚加入的訂閱者補上進度。USB 分頁有自動更新切換鈕。
147147
- **OpenAPI 3.1 + Swagger UI**`GET /openapi.json`(auth-gated,從活的路由表生成)+ `GET /docs`(瀏覽器版 Swagger UI 含 bearer token 列)。CI 上有 drift 測試,新加路由忘記寫 metadata 會被擋下。
148148
- **設定包匯出/匯入** — 單一 JSON 檔,匯出/匯入使用者設定(admin hosts、address book、trusted viewers、known hosts、host service、IDs)。原子寫入加 `<name>.bak.<時間戳>` 備份;CLI `python -m je_auto_control.utils.config_bundle export|import``POST /config/{export,import}`;REST API 分頁有按鈕。
149-
- **USB Passthrough(實驗中、需主動啟用)** — wire-level 協定走 WebRTC `usb` DataChannel(10 個 opcode、CREDIT 流量控制、16 KiB payload 上限)。Host 端 `UsbPassthroughSession` 在 Linux libusb backend 上端到端運作;Windows `WinUSB` backend 含完整 ctypes 接線(硬體未驗證);macOS `IOKit` 為骨架。Viewer 端阻塞式 client(`UsbPassthroughClient``ClientHandle.control_transfer / bulk_transfer / interrupt_transfer`)。持久化 ACL(`~/.je_auto_control/usb_acl.json`,預設 deny,POSIX mode 0600),含 host 端 prompt QDialog 與可偵測竄改稽核紀錄整合。預設 off — 用 `enable_usb_passthrough(True)``JE_AUTOCONTROL_USB_PASSTHROUGH=1` 開啟。Phase 2e 外部安全審查清單已附;預設啟用前需要簽核。
149+
- **USB Passthrough(需主動啟用)** — 讓遠端 viewer 使用實體插在 host 上的 USB 裝置,走 WebRTC `usb` DataChannel。Wire-level 協定(11 個 opcode 含 `RESUME`、CREDIT 流量控制、16 KiB payload 上限,超量傳輸以 EOF 分片)。八個原始未決問題全部解決:可靠有序 channel、LIST 走 channel(ACL 過濾)、per-claim credit、Linux kernel driver detach/reattach、ACL **HMAC-SHA256 完整性**(竄改 fail-closed;金鑰可插拔 — Windows DPAPI 或 passphrase vault)。**Backend:**`LibusbBackend`(production)、`WinusbBackend`(ctypes)、`IokitBackend`(原生 IOKit 列舉 + libusb 傳輸)— Windows/macOS *硬體未驗證*;`default_passthrough_backend()` 依 OS 自動挑。Viewer 端阻塞式 client(`control/bulk/interrupt_transfer`、`list_devices`、`resume`);in-process `UsbLoopback` 讓同機可走完整堆疊 share+use。**已接入 WebRTC** host/viewer(`viewer.usb_client()`)並含斷線可續租的 **resume token**。持久化 ACL(預設 deny、mode 0600),含 host 端 prompt 對話框、濫用 **rate-limit / lockout** 與可偵測竄改稽核整合。五個驅動面:AnyDesk 風 **GUI 面板**(分享 + ACL 允許/封鎖 + 本機/遠端使用)、`AC_usb_*` executor 指令(JSON / socket / 排程器)、**REST** `/usb/...`、一級 **MCP** `ac_usb_*` 工具、以及 Python API。預設 off — 用 `enable_usb_passthrough(True)` 或 `JE_AUTOCONTROL_USB_PASSTHROUGH=1` 開啟;預設啟用仍待 Phase 2e 外部安全簽核 + 實機硬體驗證。
150150

151151
---
152152

@@ -213,7 +213,7 @@ flowchart LR
213213
subgraph USB["USB"]
214214
direction TB
215215
UsbEnum["usb/<br/>列舉 + hotplug"]
216-
UsbPass["usb/passthrough/<br/>session · client · ACL ·<br/>libusb · WinUSB · IOKit"]
216+
UsbPass["usb/passthrough/<br/>session · client · ACL(HMAC) ·<br/>libusb · WinUSB · IOKit ·<br/>loopback · webrtc channel · commands"]
217217
end
218218
219219
subgraph Remote["遠端桌面 (utils/remote_desktop/)"]
@@ -313,7 +313,7 @@ je_auto_control/
313313
├── admin/ # 多主機 AdminConsoleClient(輪詢 + 廣播)
314314
├── diagnostics/ # 系統自我診斷 + CLI
315315
├── config_bundle/ # 單檔使用者設定匯出/匯入
316-
├── usb/ # 跨平台列舉、hotplug 事件、passthrough/{protocol, session, viewer client, ACL, libusb / WinUSB / IOKit}
316+
├── usb/ # 跨平台列舉、hotplug 事件、passthrough/{protocol, session, viewer client, loopback, webrtc channel, ACL+HMAC, descriptor, key providers, commands, libusb / WinUSB / IOKit}
317317
├── remote_desktop/ # WebRTC host + viewer、signalling、multi-viewer、檔案/剪貼簿/音訊同步、稽核紀錄(雜湊鏈)、信任清單、TURN 設定、mDNS 發現、WebRTC stats inspector
318318
├── plugin_loader/ # 動態 AC_* 外掛搜尋與註冊
319319
├── socket_server/ # TCP Socket 伺服器(遠端自動化)

0 commit comments

Comments
 (0)