Update: 将子项目从 submodule 转为完整内容

- 移除 GovAI, nomifun-tauri, 算力盒子 的 submodule 引用
- 添加所有子项目的完整源代码
- 保留原始 .git 为 .git.bak 备份
This commit is contained in:
freedak
2026-07-04 19:20:46 +08:00
parent 54d6465fa7
commit f7a720204a
3360 changed files with 802660 additions and 3 deletions
@@ -0,0 +1,25 @@
# Linux a11y dev/CI image for nomi-a11y.
#
# Purpose: develop + verify the Linux (AT-SPI2) backend from a non-Linux host.
# - Native Rust build inside the container (no cross-linker needed).
# - Headless AT-SPI test harness: Xvfb (virtual X11 display) + a private D-Bus
# session + at-spi2-core (the a11y bus) + a real accessible GTK app
# (gtk3-widget-factory) to `observe` and `do_action` against.
#
# Build: docker build -t nomi-a11y-linux:dev -f crates/agent/nomi-a11y/dev/Dockerfile.linux-a11y .
# Use: see crates/agent/nomi-a11y/dev/run-linux-a11y.sh
#
# The `atspi`/`zbus` crates are pure Rust (no C deps), so nomi-a11y itself needs
# no system libs to compile; the X11/dbus dev libs below are only so the wider
# computer-use chain (xcap/enigo) can also be built for Linux if desired.
FROM rust:1-bookworm
RUN apt-get update && apt-get install -y --no-install-recommends \
at-spi2-core \
xvfb dbus dbus-x11 x11-utils \
gtk-3-examples \
libx11-dev libxtst-dev libxi-dev libxcb1-dev libxkbcommon-dev \
libdbus-1-dev pkg-config ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /work
@@ -0,0 +1,85 @@
# Linux Accessibility Backend Validation
This directory contains helper assets for validating the Linux AT-SPI backend
from `nomi-a11y`.
Use the lightest path that proves the behavior you are changing.
## Path A: Type And API Check
This catches most portability issues without linking or running Linux binaries.
```bash
rustup target add x86_64-unknown-linux-gnu
cargo check --target x86_64-unknown-linux-gnu \
-p nomi-a11y --examples --tests
```
## Path B: Docker
The Dockerfile installs Rust, AT-SPI, Xvfb, D-Bus, and GTK example widgets so
the smoke test can run headlessly.
```bash
docker build -t nomi-a11y-linux:dev \
-f crates/agent/nomi-a11y/dev/Dockerfile.linux-a11y .
crates/agent/nomi-a11y/dev/run-linux-a11y.sh test
crates/agent/nomi-a11y/dev/run-linux-a11y.sh smoke
```
If the environment cannot pull base images, run the same commands inside any
Linux VM with the dependencies below installed.
## Path C: Native Linux VM
Install the runtime dependencies:
```bash
sudo apt-get update
sudo apt-get install -y \
at-spi2-core gtk-3-examples xvfb dbus-x11 \
build-essential pkg-config
```
Build the smoke example with a VM-local target directory so host builds do not
share artifacts:
```bash
CARGO_TARGET_DIR="$HOME/nomi-a11y-target" \
CARGO_BUILD_BUILD_DIR="$HOME/nomi-a11y-build" \
cargo build -p nomi-a11y --example linux_smoke
```
Run the smoke test under Xvfb and a private D-Bus session:
```bash
export DISPLAY=:99
Xvfb :99 -screen 0 1280x900x24 -nolisten tcp >/tmp/xvfb.log 2>&1 &
dbus-run-session -- bash -uc '
export QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
export GTK_MODULES=atk-bridge
export NO_AT_BRIDGE=0
export DISPLAY=:99
gtk3-widget-factory >/tmp/app.log 2>&1 &
sleep 4
./target/debug/examples/linux_smoke
'
```
Set `NOMI_A11Y_CLICK=<substring>` to ask `linux_smoke` to invoke the first
matching element action.
## Coverage Notes
- The smoke test validates an X11 session. Wayland support can legitimately
degrade for synthetic pixel input while semantic actions remain available;
check the reported `capabilities`.
- KDE/Qt apps may require `QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1`.
- Electron apps often require `--force-renderer-accessibility`.
- Sandboxed apps such as Flatpak may not expose a complete accessibility tree.
`atspi` / `zbus` are pure Rust dependencies, so cross-checking the Linux backend
from a non-Linux host is practical. Behavior validation still needs a Linux
runtime.
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Build / test / smoke the nomi-a11y Linux backend inside the dev container.
# Native Linux build (no cross-linker). Named volumes cache target + registry
# so incremental builds are fast across runs.
#
# ./run-linux-a11y.sh build # cargo build -p nomi-a11y
# ./run-linux-a11y.sh test # cargo test -p nomi-a11y
# ./run-linux-a11y.sh check-chain # cargo check -p nomi-agent --features computer-use
# ./run-linux-a11y.sh smoke # headless AT-SPI behavioral run (Xvfb+dbus+gtk app)
# ./run-linux-a11y.sh shell # interactive shell in the container
set -euo pipefail
REPO="$(cd "$(dirname "$0")/../../../.." && pwd)"
IMG=nomi-a11y-linux:dev
COMMON=(--rm -v "$REPO":/work -w /work
-v nomi-a11y-target:/target -e CARGO_TARGET_DIR=/target
-v nomi-a11y-cargo-registry:/usr/local/cargo/registry)
case "${1:-test}" in
build) docker run "${COMMON[@]}" "$IMG" cargo build -p nomi-a11y ;;
test) docker run "${COMMON[@]}" "$IMG" cargo test -p nomi-a11y ;;
check-chain) docker run "${COMMON[@]}" "$IMG" cargo check -p nomi-agent --features computer-use ;;
smoke) docker run "${COMMON[@]}" "$IMG" bash crates/agent/nomi-a11y/dev/smoke.sh ;;
shell) docker run -it "${COMMON[@]}" "$IMG" bash ;;
*) echo "usage: $0 {build|test|check-chain|smoke|shell}" >&2; exit 1 ;;
esac
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Headless AT-SPI behavioral harness (runs INSIDE the dev container):
# Xvfb virtual display + private D-Bus session + at-spi2 a11y bus + a real
# accessible GTK app, then run the nomi-a11y `linux_smoke` example against it.
set -uo pipefail
export DISPLAY=:99
Xvfb :99 -screen 0 1280x900x24 -nolisten tcp >/tmp/xvfb.log 2>&1 &
XVFB_PID=$!
sleep 1
dbus-run-session -- bash -u -c '
export QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
export GTK_MODULES="${GTK_MODULES:-}:atk-bridge"
export NO_AT_BRIDGE=0
# Launch the AT-SPI registry/bus (path differs across Debian versions; try both).
for d in /usr/libexec /usr/lib/at-spi2-core /usr/lib/at-spi2; do
[ -x "$d/at-spi-bus-launcher" ] && ( "$d/at-spi-bus-launcher" --launch-immediately >/tmp/atspi-bus.log 2>&1 & )
[ -x "$d/at-spi2-registryd" ] && ( "$d/at-spi2-registryd" >/tmp/atspi-reg.log 2>&1 & )
done
sleep 1
gtk3-widget-factory >/tmp/app.log 2>&1 &
APP_PID=$!
sleep 3
echo "=== AT-SPI bus address: ${AT_SPI_BUS_ADDRESS:-<unset>} ==="
echo "=== running nomi-a11y linux_smoke example ==="
CARGO_TARGET_DIR=/target cargo run -p nomi-a11y --example linux_smoke
rc=$?
kill "$APP_PID" 2>/dev/null || true
exit $rc
'
rc=$?
kill "$XVFB_PID" 2>/dev/null || true
exit $rc