AstrBot-Desktop/docs/reports/wgc-s0-target-binding-2026-07-27.md
YokiiroBW dfc26aa37e
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
feat(awareness): probe WGC capture targets
2026-07-27 14:46:27 +08:00

28 行
1.9 KiB
Markdown

# WGC S0.1 Target-Binding Spike — 2026-07-27
## Purpose
Establish the narrowest possible evidence that the Windows client can bind explicit capture targets through Windows.Graphics.Capture (WGC), without starting capture or processing screen content. This is an S0 sub-step, not a delivered screen-awareness feature.
## Implemented boundary
- `wgc_spike_support_status` reports only whether WGC is supported and the current attached-display count.
- `wgc_spike_probe_authorized_window` reuses the existing `CapturePolicy::inspect` gate and creates a WGC item only for an already authorized window.
- `wgc_spike_probe_displays` creates WGC items for the displays attached at call time.
- Each successful probe returns target kind plus width and height. Invalid or non-positive dimensions are rejected.
No command creates a `GraphicsCaptureSession`, retrieves a frame, reads text, consumes capture budget, writes raw content, encodes an image, schedules an observation, or calls AstrBot.
## Validation
- `cargo fmt --all`: passed.
- With `CARGO_TARGET_DIR=src-tauri/.tmp/wgc-check`, `cargo check -p astrbot-desktop --lib`: passed.
- With the same isolated target, `cargo test -p astrbot-desktop --lib`: 117 passed, 0 failed.
The isolated target is required in this workspace because the default Cargo target resolves generated Tauri permissions through the mapped UNC path and can fail with Windows access denied (`os error 5`).
## Non-evidence and next gate
S0.1 provides no proof that WGC returns useful pixels. It does not validate DirectX/Vulkan games, minimized targets, display topology changes, lock screens, protected content, sensitive-application filtering, quality thresholds, or AstrBot visual understanding.
S0.2 must create a bounded D3D11 WGC frame path, copy one frame to a staging texture, convert BGRA to RGBA, detect black/transparent/empty results, and record manual Windows evidence before any screen frame can progress to a local privacy or network path.