Skip to content

Commit 1a7ad4c

Browse files
committed
Expose passive input and capture capabilities across automation surfaces
1 parent 0e49883 commit 1a7ad4c

37 files changed

Lines changed: 1256 additions & 79 deletions

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ it shipped into a `## [x.y.z] - date` section of their own; the tag's
1313

1414
## Unreleased
1515

16+
- Add passive input/capture capability snapshots to both SDK namespaces,
17+
AC_probe_capabilities, read-only MCP, Builder and Diagnostics Actions.
18+
Prerequisites remain unverified; local native state is not refreshed or
19+
treated as a permission grant. XWayland scope is explicit, provider
20+
refusals cannot imply CLI fallback, and default results omit environment
21+
values, executable paths, command arguments and native error strings.
22+
1623
- Diagnostics opens in a localized not-run state. Only its explicit Actions
1724
command starts the existing active checks; opening or retranslating the tab
1825
cannot implicitly capture the screen or request portal consent. Existing

‎Progress.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
`TODO` — 真機與付費 API 驗收暫緩,待明確恢復後執行;相關項目保留待驗證。
1414

1515
`WIP` — 改版仍缺以下內容;原生平台與正式環境驗收缺口另列於後。
16-
計畫 D 仍缺 `wrapper/capabilities.py` 的無副作用公開探測、獨立輸入/擷取診斷與
17-
SDK/AC/MCP/Diagnostics GUI 介面,以及 portal 關閉/恢復與合成器重啟驗收。
16+
計畫 D1 仍缺 portal session 關閉/恢復、compositor 重啟的狀態與原生驗收、
17+
擷取結果與擁有者 context 的接合,以及主動診斷與原生 session 的重試/取消/停止控制。
18+
原生指標超出 EIS 區域的拒絕仍被誤分類為選用依賴缺失,須停止隱含的 CLI 備援。
1819
D2 的原生 EI 釋放驗證與 D3 的錄製/全域停止/Windows 原生崩潰證據仍缺,詳見計畫與下方生命週期待辦。
1920
計畫 E(Android/iOS)、G(MCP 逐步揭露)、H(型別深化與總驗收)尚未開始。F 還缺:
2021

‎README.md‎

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ from JSON files / CLI / servers, and a **GUI tab**. Nothing is GUI-only.
1818

1919
- **One API, seven platforms.** `wrapper/platform_wrapper.py` picks the backend at import
2020
time; your script does not change between Windows, macOS, X11, and Wayland.
21-
- **Scriptable without Python.** 809 `AC_*` commands cover the whole feature set, so a
21+
- **Scriptable without Python.** 810 `AC_*` commands cover the whole feature set, so a
2222
JSON file can do anything the library can — including loops, branches, try/catch,
2323
macros, and variables.
2424
- **Headless by default.** `import je_auto_control` never loads Qt. The GUI is an
@@ -233,7 +233,7 @@ desktop app; tab commands live in the window's **Actions** menu.
233233
| Natural-language planner | `plan_actions`, `run_from_description` | `AC_llm_plan` | LLM Planner |
234234
| Computer-use agent | `AgentLoop`, `run_agent` | `AC_run_agent` | Computer Use |
235235
| Record & replay | `record`, `stop_record` | `AC_record`, `AC_stop_record` | Record |
236-
| JSON scripting | `execute_action`, `execute_files` | all 809 commands | Script, Script Builder |
236+
| JSON scripting | `execute_action`, `execute_files` | all 810 commands | Script, Script Builder |
237237
| Variables & flow control | `execute_action_with_vars` | `AC_set_var`, `AC_loop`, `AC_for_each`, `AC_try`, `AC_retry` | Variables |
238238
| Data-driven runs | — | `AC_for_each_row` (CSV / JSON / SQLite / Excel) | Data Sources |
239239
| Assertions | `assert_text`, `assert_image` | `AC_assert_text` + 20 more | Assertions |
@@ -338,7 +338,7 @@ under a relative name are written below that directory.
338338

339339
| Surface | Start it with | Notes |
340340
|---|---|---|
341-
| **MCP server** | `je_auto_control_mcp` (stdio) or `AC_start_mcp_http_server` | 709 tools for Claude Desktop / Claude Code / custom tool loops: the full `ac_*` surface plus short model-friendly aliases for common GUI actions. Speaks the stateless MCP 2026-07-28 beside the `initialize`-based revisions. Bearer auth, TLS, audit log, rate limit, plugin hot-reload, CI fake backend. |
341+
| **MCP server** | `je_auto_control_mcp` (stdio) or `AC_start_mcp_http_server` | 710 tools for Claude Desktop / Claude Code / custom tool loops: the full `ac_*` surface plus short model-friendly aliases for common GUI actions. Speaks the stateless MCP 2026-07-28 beside the `initialize`-based revisions. Bearer auth, TLS, audit log, rate limit, plugin hot-reload, CI fake backend. |
342342
| **REST API** | `je_auto_control start-rest` | Bearer token, per-IP rate limit + lockout, SQLite audit hook, `/metrics`, `/openapi.json`, `/docs` Swagger UI, `/dashboard`. |
343343
| **TCP socket server** | `je_auto_control start-server` | Newline-framed JSON action lists. Binds `127.0.0.1` by default. |
344344
| **pytest plugin** | installed automatically | Fixtures plus a Gherkin step library for pytest-bdd / behave. |
@@ -473,12 +473,45 @@ returning the blank XWayland root. The `screen_capture` check in
473473
`je_auto_control.api.run_diagnostics()` (and the GUI Diagnostics tab) reports
474474
which tier is in use.
475475

476+
Passive **input/capture capabilities** use `BackendContext`, `CapabilityStatus`,
477+
`CapabilitySnapshot` and `probe_capabilities` from `je_auto_control.api` (also
478+
exported at the package root). Call
479+
`probe_capabilities(BackendContext.current()).to_dict()`, use no-argument
480+
`AC_probe_capabilities` / read-only `ac_probe_capabilities`, or choose
481+
**Diagnostics → Actions → Inspect input and capture capabilities**. Builder
482+
provides the same no-argument command. `python -m examples.capabilities` prints
483+
live prerequisites and a deterministic XWayland scope example without desktop operations.
484+
485+
Input describes key/pointer events; the existing wtype text path is separate.
486+
The probe reads environment/PATH and nonblocking cached native state; it never
487+
loads optional native libraries, connects, polls events, captures or requests
488+
permission. Installed tools or a bus address mean `unverified`, not readiness.
489+
Cached libei readiness requires a completed handshake and active keyboard,
490+
absolute pointer, button and scroll families. A partial grant remains
491+
unverified; paused families and removed required devices report paused/revoked.
492+
The eight states are `available`, `unverified`, `needs_permission`,
493+
`needs_dependency`, `unsupported`, `paused`, `revoked` and `failed`.
494+
`available` is only the last local observation and may be stale; every real
495+
operation rechecks authority. XWayland always has `desktop_wide=False` and cannot
496+
cover native Wayland windows. Other scope flags remain subject to granted
497+
regions/permissions and do not verify every monitor.
498+
499+
Contexts detach environment/executable facts and may carry an owner's inert
500+
input/capture observations. They grant no authority. Default live results omit
501+
environment values, command arguments, executable paths and native error text;
502+
AC/MCP accept no supplied observations. Explicit CLI configuration remains
503+
distinct from automatic fallback after observed optional native absence;
504+
permission/pause/revocation/failure metadata cannot imply CLI fallback.
505+
Capture helper and portal selection are diagnosed independently. Rendering and
506+
language changes reuse the snapshot without probing. Native portal restore,
507+
compositor restart, capture-result/context integration and cancelable active
508+
diagnostics remain in `Progress.md`.
509+
476510
Opening Diagnostics displays a localized not-run state and performs no checks.
477511
Choose **Actions → Run diagnostics** to start the existing active checks, which
478512
can capture the screen or require portal consent. Changing the display language
479513
does not start checks. The explicit `run_diagnostics`, `AC_diagnose` and MCP
480-
diagnostic calls retain their active behavior; passive capability probing is
481-
still pending in `Progress.md`.
514+
diagnostic calls retain their active behavior. Passive capability inspection is a separate action below.
482515

483516
Abandoned screenshot portal requests attempt `Request.Close` on the originating
484517
bus before disconnect, using a separate 0.25-second D-Bus I/O budget. A returned
@@ -523,7 +556,7 @@ ignore synthetic input, and fall back silently when the driver is absent.
523556

524557
| Resource | What's in it |
525558
|---|---|
526-
| [`examples/`](examples/) | 41 self-contained scripts: screenshot + click, OCR, scheduler, remote desktop, agent loop, observability, recording, variables, hotkeys, triggers, reports, MCP, REST, secrets, plugins, computer use, Wayland, cross-host DAGs, chat-ops, pytest/BDD, anchor locators, action journals. |
559+
| [`examples/`](examples/) | 42 self-contained scripts: screenshot + click, OCR, scheduler, remote desktop, agent loop, observability, recording, variables, hotkeys, triggers, reports, MCP, REST, secrets, plugins, computer use, Wayland, cross-host DAGs, chat-ops, pytest/BDD, anchor locators, action journals. |
527560
| [Read the Docs](https://autocontrol.readthedocs.io/en/latest/) | Full API reference, English and 中文. |
528561
| [architecture_explore.md](architecture_explore.md) | Every module's responsibility, layer by layer. |
529562
| [docs/CAPABILITY_MATRIX.md](docs/CAPABILITY_MATRIX.md) | Capability × platform matrix. |

‎README/README_zh-CN.md‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
- **一套 API,七个平台。** `wrapper/platform_wrapper.py` 在导入时挑选后端;同一份脚本在
2121
Windows、macOS、X11 与 Wayland 上都不需要改写。
22-
- **不写 Python 也能脚本化。** 809 个 `AC_*` 命令覆盖全部功能,因此一个 JSON 文件能做到库
22+
- **不写 Python 也能脚本化。** 810 个 `AC_*` 命令覆盖全部功能,因此一个 JSON 文件能做到库
2323
能做的任何事——包含循环、分支、try/catch、宏与变量。
2424
- **默认无头运行。** `import je_auto_control` 绝不会加载 Qt。GUI 是可选包,包在同一个无头内核之外。
2525
- **四种定位方式。** 模板匹配、OCR、无障碍树、视觉语言模型——可通过锚点定位器与自愈回退串接组合。
@@ -221,7 +221,7 @@ python -c "import je_auto_control; je_auto_control.start_autocontrol_gui()"
221221
| 自然语言规划 | `plan_actions`、`run_from_description` | `AC_llm_plan` | LLM Planner |
222222
| Computer-use agent | `AgentLoop`、`run_agent` | `AC_run_agent` | Computer Use |
223223
| 录制与回放 | `record`、`stop_record` | `AC_record`、`AC_stop_record` | Record |
224-
| JSON 脚本 | `execute_action`、`execute_files` | 全部 809 个命令 | Script、Script Builder |
224+
| JSON 脚本 | `execute_action`、`execute_files` | 全部 810 个命令 | Script、Script Builder |
225225
| 变量与流程控制 | `execute_action_with_vars` | `AC_set_var`、`AC_loop`、`AC_for_each`、`AC_try`、`AC_retry` | Variables |
226226
| 数据驱动执行 | — | `AC_for_each_row`(CSV/JSON/SQLite/Excel) | Data Sources |
227227
| 断言 | `assert_text`、`assert_image` | `AC_assert_text` 等 21 个 | Assertions |
@@ -319,7 +319,7 @@ je_auto_control version
319319

320320
| 接口 | 启动方式 | 说明 |
321321
|---|---|---|
322-
| **MCP 服务器** | `je_auto_control_mcp`(stdio)或 `AC_start_mcp_http_server` | 709 个工具,供 Claude Desktop/Claude Code/自定义 tool loop 使用:完整的 `ac_*` 工具接口,以及常用 GUI 操作的短名称 alias。除了以 `initialize` 握手的各版协议,也支持无状态的 MCP 2026-07-28。Bearer 认证、TLS、审计日志、限流、插件热重载、CI 假后端。 |
322+
| **MCP 服务器** | `je_auto_control_mcp`(stdio)或 `AC_start_mcp_http_server` | 710 个工具,供 Claude Desktop/Claude Code/自定义 tool loop 使用:完整的 `ac_*` 工具接口,以及常用 GUI 操作的短名称 alias。除了以 `initialize` 握手的各版协议,也支持无状态的 MCP 2026-07-28。Bearer 认证、TLS、审计日志、限流、插件热重载、CI 假后端。 |
323323
| **REST API** | `je_auto_control start-rest` | Bearer token、按 IP 限流与锁定、SQLite 审计 hook、`/metrics`、`/openapi.json`、`/docs` Swagger UI、`/dashboard`。 |
324324
| **TCP socket 服务器** | `je_auto_control start-server` | 以换行分隔的 JSON 动作列表。默认绑定 `127.0.0.1`。 |
325325
| **pytest 插件** | 安装后自动生效 | 提供 fixture 与供 pytest-bdd/behave 使用的 Gherkin step library。 |
@@ -438,10 +438,31 @@ Wayland 的屏幕截取需要合成器对应的工具,因为没有单一工具
438438
`je_auto_control.api.run_diagnostics()`(以及 GUI 的 Diagnostics 标签页)的 `screen_capture`
439439
检查会报告当前使用的是哪一层。
440440

441+
**输入/截取能力**提供 `je_auto_control.api`(也由包根目录导出)的
442+
`BackendContext`、`CapabilityStatus`、`CapabilitySnapshot` 与 `probe_capabilities`。
443+
调用 `probe_capabilities(BackendContext.current()).to_dict()`、无参数的
444+
`AC_probe_capabilities`/只读 `ac_probe_capabilities`,或选择
445+
**Diagnostics → Actions → 查看输入与截取能力**;Builder 提供相同无参数命令。
446+
`python -m examples.capabilities` 显示本机前置条件与确定性的 XWayland 范围示例,不操作桌面。
447+
448+
输入项描述按键/指针事件;现有 wtype 文字路径独立。探测只读环境、PATH 与不等待锁的现有原生状态,
449+
不加载可选原生库、不连接、不读取事件、不截取或请求授权。找到工具或 bus 地址只代表
450+
`unverified`,不等于可用。缓存 libei 须完成握手,且键盘、绝对指针、按钮与滚轮事件种类都在运行才报告可用;
451+
部分授权保持未验证,事件种类暂停或必要设备移除则报告暂停/撤销。八种状态为 `available`、`unverified`、`needs_permission`、
452+
`needs_dependency`、`unsupported`、`paused`、`revoked`、`failed`。
453+
`available` 仅是最近的本机观察,可能过时;实际操作仍重新验证权限。XWayland 一律
454+
`desktop_wide=False`,无法覆盖原生 Wayland 窗口;其他范围标记仍受授权区域限制,不代表已验证每个屏幕。
455+
456+
Context 会复制环境/工具数据,可由拥有者提供无原生对象的输入/截取观察,但不授予权限。
457+
默认本机结果不含环境值、命令参数、可执行文件路径或原生错误文字;AC/MCP 不接受外部提供观察。
458+
显式选择 CLI 与观察到可选原生依赖缺失后的自动备用分开;拒绝、暂停、撤销与失败不表示改走 CLI。
459+
截取工具/portal 选择独立诊断,重绘与切换语言只使用现有快照。原生 portal 恢复、compositor 重启、
460+
截取结果与 context 的接合,以及可取消的主动诊断仍列于 `Progress.md`。
461+
441462
打开 Diagnostics 只显示已翻译的「尚未运行」状态,不执行检查。
442463
选择 **Actions → 运行诊断** 才会启动现有主动检查,可能截取屏幕或需要 portal 同意;
443464
切换语言不启动检查。显式的 `run_diagnostics`、`AC_diagnose` 与 MCP 诊断调用保持主动行为;
444-
无副作用的能力探测仍列于 `Progress.md`。
465+
无副作用的能力查看使用下方独立操作。
445466

446467
未完成的 screenshot portal 请求会在断开原始 bus 前尝试 `Request.Close`,
447468
使用独立的 0.25 秒 D-Bus I/O 预算。服务器返回替代 handle 时会跟随该 handle;
@@ -478,7 +499,7 @@ Windows、macOS(pyobjc)与 X11(含 XWayland);纯 Wayland 会话的协
478499

479500
| 资源 | 内容 |
480501
|---|---|
481-
| [`examples/`](../examples/) | 41 个自包含脚本:截图点击、OCR、调度器、远程桌面、agent loop、可观测性、录制、变量、热键、触发器、报表、MCP、REST、密钥、插件、computer use、Wayland、跨主机 DAG、chat-ops、pytest/BDD、锚点定位、动作日志。 |
502+
| [`examples/`](../examples/) | 42 个自包含脚本:截图点击、OCR、调度器、远程桌面、agent loop、可观测性、录制、变量、热键、触发器、报表、MCP、REST、密钥、插件、computer use、Wayland、跨主机 DAG、chat-ops、pytest/BDD、锚点定位、动作日志。 |
482503
| [Read the Docs](https://autocontrol.readthedocs.io/en/latest/) | 完整 API 参考,含英文与中文。 |
483504
| [architecture_explore.md](../architecture_explore.md) | 逐层记录每个模块的职责。 |
484505
| [docs/CAPABILITY_MATRIX.md](../docs/CAPABILITY_MATRIX.md) | 能力 × 平台对照矩阵。 |

0 commit comments

Comments
 (0)