Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,41 @@ it shipped into a `## [x.y.z] - date` section of their own; the tag's

### Added

- **Tesseract setup helpers.** `find_tesseract_cmd()` (`$TESSERACT_CMD`,
`PATH`, then the installers' default folders), `set_tessdata_dir(path)`
(sets `TESSDATA_PREFIX`; `None` clears it), `ocr_languages()` (sorted
codes; `[]` when the engine has no language data, `None` when it cannot be
asked) and `ocr_status()`, an `OCRStatus(ok, reason)` tuple whose reason is
`ready`, `missing_package`, `missing_engine`, `engine_unusable` or
`no_language_data`. `TesseractBackend` gained `cmd`, `version()` and
`languages()`. Commands `AC_ocr_status` / `AC_ocr_languages`, MCP tools
`ac_ocr_status` / `ac_ocr_languages`.
- **`click_mouse(..., clicks=1, interval=0.0)`.** `clicks=2` double-clicks
in one call: the clicks land on one point, `interval` seconds apart.
Defaults keep the single click, and a single click records the same
action as before. `AC_click_mouse`, the `ac_click_mouse` MCP tool and the
Script Builder take both parameters. On macOS the clicks still arrive as
separate single clicks (`Progress.md`).
- **Drag pacing: `tween_drag` / `drag_path` take `step_delay_s` and
`settle_s`** (seconds, default 0). `step_delay_s` rests after each move;
`settle_s` rests on the start before the press, after the press and before
the release, for apps that tell a drag from a click by the pointer's
motion. Both must be finite and non-negative (`ValueError` otherwise,
before anything is sent). `AC_tween_drag`, `AC_drag_path`, their MCP tools
and the Script Builder take both.
- **Windows key names.** The OEM keys (`oem_1` .. `oem_8`, `oem_102`,
`oem_plus`, `oem_comma`, `oem_minus`, `oem_period`, `oem_clear`),
`browser_home`, a lower-case `launch_app2` (`LAUNCH_APP2` stays) and
common aliases: `ctrl` / `lctrl` / `rctrl`, `alt` / `lalt` / `ralt`,
`enter`, `esc`, `win` / `super` / `cmd` / `meta`, `backspace` / `bksp`,
`del`, `ins`, `pgup` / `pageup`, `pgdn` / `pagedown`, `caps` /
`capslock`, `printscreen` / `prtsc` / `prtscr`, `scrolllock`,
`numpad0` .. `numpad9`, and `plus` / `comma` / `minus` / `period` for the
four OEM keys that are the same on every layout. Aliases are listed in
`platform_wrapper.keyboard_key_aliases` (empty on other platforms).
- **`keyboard_key_name(keycode)`** returns a code's canonical name and never
an alias, so a recorder's output does not change when an alias is added;
`None` when the table has no name for the code.
- `cua_action.resolve_key_name` / `split_key_combo`, and
`compile_postcondition(before=...)`.
- `pii_text.luhn_valid` and `normalize_text(strip_format=...)`.
Expand Down Expand Up @@ -54,6 +89,12 @@ it shipped into a `## [x.y.z] - date` section of their own; the tag's

### Changed

- **Windows `keyboard_keys_table` lists its aliases after the canonical
names**, `ctrl` included (it moved from beside `control` into
`keyboard_key_aliases`; same code). A reverse lookup that takes the
shortest name from the raw table now meets aliases such as `esc` or
`prtsc`; skip the names in `keyboard_key_aliases`, or call
`keyboard_key_name`, to keep getting the canonical ones.
- **Golden-image capture (`take_golden` / `compare_to_golden`) reads its
region in mouse coordinates**, like every other capture; region goldens
taken on a scaled display need re-taking.
Expand Down Expand Up @@ -295,6 +336,11 @@ it shipped into a `## [x.y.z] - date` section of their own; the tag's

### Fixed

- **An aborted `tween_drag` / `drag_path` lets go where the pointer stopped.**
When a step raised, the button was released at the end of the path, which
completed a drop the drag never reached; it is now released in a `finally`
at the last point the pointer reached, and a failing cleanup release is
logged instead of replacing the original error.
- **Emergency stop on Linux / macOS**: the stop key wakes a sleeping or
waiting main thread there too (SIGINT is sent to the main thread).
- **Image analysis and packaging**: colour-vision simulation uses Machado
Expand Down
8 changes: 8 additions & 0 deletions Progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ pip install --dry-run --only-binary=:all: --platform win_arm64 --python-version

---

## macOS 上 `click_mouse(clicks=2)` 不是雙擊

`TODO` — `wrapper/auto_control_mouse.py` 的 `click_mouse` 在同一點連點 `clicks` 次。Windows 與 X11 依兩次點擊的時間差與位移判定雙擊,所以這樣就夠;macOS 的應用程式讀的是事件上的點擊次數欄位(`kCGMouseEventClickState`),`osx/mouse/osx_mouse.py` 的 `mouse_event` 從不設定它(一律是 1),所以 macOS 收到的是兩次單擊。文件(`docs/source/API/wrapper/mouse.rst`、`docs/source/{Eng,Zh}/doc/mouse/mouse_doc.rst`、`click_mouse` 的 docstring)照實寫了這個限制。

做法:讓 osx 後端的按下/放開帶點擊次數(第 n 次點擊設成 n),wrapper 在 macOS 分支把序號傳下去;要在 macOS 上實測(`quality.yml` 的 `macos-14` 可以跑 CI,但雙擊是否被應用程式認得要真機看),完成後把文件裡的限制拿掉。

---

## RBAC 還沒接到 REST API 與 MCP server

`DECIDE` — 要不要把 `utils/rbac` 接上兩個伺服器,以及現有單一共用 token 怎麼過渡(維護者拍板)
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ from JSON files / CLI / servers, and a **GUI tab**. Nothing is GUI-only.

- **One API, seven platforms.** `wrapper/platform_wrapper.py` picks the backend at import
time; your script does not change between Windows, macOS, X11, and Wayland.
- **Scriptable without Python.** 774 `AC_*` commands cover the whole feature set, so a
- **Scriptable without Python.** 776 `AC_*` commands cover the whole feature set, so a
JSON file can do anything the library can — including loops, branches, try/catch,
macros, and variables.
- **Headless by default.** `import je_auto_control` never loads Qt. The GUI is an
Expand Down Expand Up @@ -73,7 +73,10 @@ sudo apt-get install cmake libssl-dev
```

OCR, VLM, and LLM backends (`pytesseract`, `easyocr`, `paddleocr`, `anthropic`,
`openai`) are loaded on demand — install whichever you actually use.
`openai`) are loaded on demand — install whichever you actually use. For Tesseract,
`find_tesseract_cmd()` locates the executable (`$TESSERACT_CMD`, then `PATH`, then the
installers' default folders), `set_tessdata_dir()` points it at a language-data folder,
and `ocr_status()` / `ocr_languages()` say what is missing before the first OCR call.

**Log file:** the library logs to `~/.je_auto_control/logs/AutoControlGUI.log`,
created on the first record (importing alone writes nothing) and shared by every
Expand Down Expand Up @@ -142,19 +145,19 @@ desktop app; tab commands live in the window's **Actions** menu.

| Capability | Python API | `AC_*` command | GUI tab |
|---|---|---|---|
| Mouse | `click_mouse`, `set_mouse_position`, `mouse_scroll` | `AC_click_mouse` | Auto Click |
| Keyboard | `write`, `hotkey`, `type_keyboard` | `AC_write`, `AC_hotkey` | Auto Click |
| Mouse | `click_mouse` (`clicks=2` double-clicks), `set_mouse_position`, `mouse_scroll`, `tween_drag` / `drag_path` (paced by `step_delay_s`, `settle_s`) | `AC_click_mouse`, `AC_tween_drag`, `AC_drag_path` | Auto Click |
| Keyboard | `write`, `hotkey`, `type_keyboard`, `keyboard_key_name` (code → canonical name; Windows also takes aliases such as `ctrl`, `esc`, `enter`) | `AC_write`, `AC_hotkey` | Auto Click |
| Screen & pixels | `screenshot`, `screen_size`, `get_pixel` | `AC_screenshot` | Screenshot |
| Image matching | `locate_image_center`, `locate_and_click` | `AC_locate_and_click` | Image Detect |
| OCR text | `click_text`, `wait_for_text`, `read_text_in_region` | `AC_click_text`, `AC_wait_text` | OCR Reader |
| OCR text | `click_text`, `wait_for_text`, `read_text_in_region`, `ocr_status` | `AC_click_text`, `AC_wait_text`, `AC_ocr_status` | OCR Reader |
| Accessibility tree | `find_accessibility_element`, `click_accessibility_element` | `AC_a11y_find`, `AC_a11y_click` | Accessibility |
| Vision-model locator | `locate_by_description`, `click_by_description` | `AC_vlm_locate`, `AC_vlm_click` | VLM |
| Anchor locator | — | `AC_anchor_click`, `AC_anchor_locate` | — |
| Self-healing locators | `self_heal_click`, `self_heal_locate` | `AC_self_heal_click` | Self-Healing |
| Natural-language planner | `plan_actions`, `run_from_description` | `AC_llm_plan` | LLM Planner |
| Computer-use agent | `AgentLoop`, `run_agent` | `AC_run_agent` | Computer Use |
| Record & replay | `record`, `stop_record` | `AC_record`, `AC_stop_record` | Record |
| JSON scripting | `execute_action`, `execute_files` | all 774 commands | Script, Script Builder |
| JSON scripting | `execute_action`, `execute_files` | all 776 commands | Script, Script Builder |
| Variables & flow control | `execute_action_with_vars` | `AC_set_var`, `AC_loop`, `AC_for_each`, `AC_try`, `AC_retry` | Variables |
| Data-driven runs | — | `AC_for_each_row` (CSV / JSON / SQLite / Excel) | Data Sources |
| Assertions | `assert_text`, `assert_image` | `AC_assert_text` + 20 more | Assertions |
Expand Down Expand Up @@ -206,7 +209,7 @@ still goes on to the end), so a CI step fails with it. The legacy

| Surface | Start it with | Notes |
|---|---|---|
| **MCP server** | `je_auto_control_mcp` (stdio) or `AC_start_mcp_http_server` | 677 tools for Claude Desktop / Claude Code / custom tool loops. Bearer auth, TLS, audit log, rate limit, plugin hot-reload, CI fake backend. |
| **MCP server** | `je_auto_control_mcp` (stdio) or `AC_start_mcp_http_server` | 679 tools for Claude Desktop / Claude Code / custom tool loops. Bearer auth, TLS, audit log, rate limit, plugin hot-reload, CI fake backend. |
| **REST API** | `je_auto_control start-rest` | Bearer token, per-IP rate limit + lockout, SQLite audit hook, `/metrics`, `/openapi.json`, `/docs` Swagger UI, `/dashboard`. |
| **TCP socket server** | `je_auto_control start-server` | Newline-framed JSON action lists. Binds `127.0.0.1` by default. |
| **pytest plugin** | installed automatically | Fixtures plus a Gherkin step library for pytest-bdd / behave. |
Expand Down
16 changes: 9 additions & 7 deletions README/README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

- **一套 API,七个平台。** `wrapper/platform_wrapper.py` 在导入时挑选后端;同一份脚本在
Windows、macOS、X11 与 Wayland 上都不需要改写。
- **不写 Python 也能脚本化。** 774 个 `AC_*` 命令覆盖全部功能,因此一个 JSON 文件能做到库
- **不写 Python 也能脚本化。** 776 个 `AC_*` 命令覆盖全部功能,因此一个 JSON 文件能做到库
能做的任何事——包含循环、分支、try/catch、宏与变量。
- **默认无头运行。** `import je_auto_control` 绝不会加载 Qt。GUI 是可选包,包在同一个无头内核之外。
- **四种定位方式。** 模板匹配、OCR、无障碍树、视觉语言模型——可通过锚点定位器与自愈回退串接组合。
Expand Down Expand Up @@ -63,7 +63,9 @@ sudo apt-get install cmake libssl-dev
```

OCR、VLM 与 LLM 后端(`pytesseract`、`easyocr`、`paddleocr`、`anthropic`、`openai`)
都是按需加载——只装你实际会用到的。
都是按需加载——只装你实际会用到的。Tesseract 方面,`find_tesseract_cmd()` 找出可执行文件
(依次是 `$TESSERACT_CMD`、`PATH`、安装程序的默认文件夹),`set_tessdata_dir()` 把它指向
语言数据文件夹,`ocr_status()`/`ocr_languages()` 在第一次 OCR 之前就说出缺了什么。

**日志文件:** 库写到 `~/.je_auto_control/logs/AutoControlGUI.log`,第一条记录时
才创建(只 import 不会写任何文件),同一个账户的所有进程共用(追加写入、每行带进程 ID,
Expand Down Expand Up @@ -130,19 +132,19 @@ python -c "import je_auto_control; je_auto_control.start_autocontrol_gui()"

| 能力 | Python API | `AC_*` 命令 | GUI 标签页 |
|---|---|---|---|
| 鼠标 | `click_mouse`、`set_mouse_position`、`mouse_scroll` | `AC_click_mouse` | Auto Click |
| 键盘 | `write`、`hotkey`、`type_keyboard` | `AC_write`、`AC_hotkey` | Auto Click |
| 鼠标 | `click_mouse`(`clicks=2` 即双击)、`set_mouse_position`、`mouse_scroll`、`tween_drag`/`drag_path`(以 `step_delay_s`、`settle_s` 控制节奏) | `AC_click_mouse`、`AC_tween_drag`、`AC_drag_path` | Auto Click |
| 键盘 | `write`、`hotkey`、`type_keyboard`、`keyboard_key_name`(键码 → 标准键名;Windows 也接受 `ctrl`、`esc`、`enter` 等别名) | `AC_write`、`AC_hotkey` | Auto Click |
| 屏幕与像素 | `screenshot`、`screen_size`、`get_pixel` | `AC_screenshot` | Screenshot |
| 图像匹配 | `locate_image_center`、`locate_and_click` | `AC_locate_and_click` | Image Detect |
| OCR 文字 | `click_text`、`wait_for_text`、`read_text_in_region` | `AC_click_text`、`AC_wait_text` | OCR Reader |
| OCR 文字 | `click_text`、`wait_for_text`、`read_text_in_region`、`ocr_status` | `AC_click_text`、`AC_wait_text`、`AC_ocr_status` | OCR Reader |
| 无障碍树 | `find_accessibility_element`、`click_accessibility_element` | `AC_a11y_find`、`AC_a11y_click` | Accessibility |
| 视觉模型定位 | `locate_by_description`、`click_by_description` | `AC_vlm_locate`、`AC_vlm_click` | VLM |
| 锚点定位 | — | `AC_anchor_click`、`AC_anchor_locate` | — |
| 自愈定位器 | `self_heal_click`、`self_heal_locate` | `AC_self_heal_click` | Self-Healing |
| 自然语言规划 | `plan_actions`、`run_from_description` | `AC_llm_plan` | LLM Planner |
| Computer-use agent | `AgentLoop`、`run_agent` | `AC_run_agent` | Computer Use |
| 录制与回放 | `record`、`stop_record` | `AC_record`、`AC_stop_record` | Record |
| JSON 脚本 | `execute_action`、`execute_files` | 全部 774 个命令 | Script、Script Builder |
| JSON 脚本 | `execute_action`、`execute_files` | 全部 776 个命令 | Script、Script Builder |
| 变量与流程控制 | `execute_action_with_vars` | `AC_set_var`、`AC_loop`、`AC_for_each`、`AC_try`、`AC_retry` | Variables |
| 数据驱动执行 | — | `AC_for_each_row`(CSV/JSON/SQLite/Excel) | Data Sources |
| 断言 | `assert_text`、`assert_image` | `AC_assert_text` 等 21 个 | Assertions |
Expand Down Expand Up @@ -191,7 +193,7 @@ je_auto_control version

| 接口 | 启动方式 | 说明 |
|---|---|---|
| **MCP 服务器** | `je_auto_control_mcp`(stdio)或 `AC_start_mcp_http_server` | 677 个工具,供 Claude Desktop/Claude Code/自定义 tool loop 使用。Bearer 认证、TLS、审计日志、限流、插件热重载、CI 假后端。 |
| **MCP 服务器** | `je_auto_control_mcp`(stdio)或 `AC_start_mcp_http_server` | 679 个工具,供 Claude Desktop/Claude Code/自定义 tool loop 使用。Bearer 认证、TLS、审计日志、限流、插件热重载、CI 假后端。 |
| **REST API** | `je_auto_control start-rest` | Bearer token、按 IP 限流与锁定、SQLite 审计 hook、`/metrics`、`/openapi.json`、`/docs` Swagger UI、`/dashboard`。 |
| **TCP socket 服务器** | `je_auto_control start-server` | 以换行分隔的 JSON 动作列表。默认绑定 `127.0.0.1`。 |
| **pytest 插件** | 安装后自动生效 | 提供 fixture 与供 pytest-bdd/behave 使用的 Gherkin step library。 |
Expand Down
16 changes: 9 additions & 7 deletions README/README_zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

- **一套 API,七個平台。** `wrapper/platform_wrapper.py` 在匯入時挑選後端;同一份腳本在
Windows、macOS、X11 與 Wayland 上都不需要改寫。
- **不寫 Python 也能腳本化。** 774 個 `AC_*` 指令涵蓋全部功能,因此一個 JSON 檔能做到函式庫
- **不寫 Python 也能腳本化。** 776 個 `AC_*` 指令涵蓋全部功能,因此一個 JSON 檔能做到函式庫
能做的任何事——包含迴圈、分支、try/catch、巨集與變數。
- **預設無頭執行。** `import je_auto_control` 絕不會載入 Qt。GUI 是選用套件,包在同一個無頭核心之外。
- **四種定位方式。** 樣板比對、OCR、無障礙樹、視覺語言模型——可透過錨點定位器與自癒後備串接組合。
Expand Down Expand Up @@ -63,7 +63,9 @@ sudo apt-get install cmake libssl-dev
```

OCR、VLM 與 LLM 後端(`pytesseract`、`easyocr`、`paddleocr`、`anthropic`、`openai`)
都是按需載入——只裝你實際會用到的。
都是按需載入——只裝你實際會用到的。Tesseract 的部分,`find_tesseract_cmd()` 找出執行檔
(依序是 `$TESSERACT_CMD`、`PATH`、安裝程式的預設資料夾),`set_tessdata_dir()` 把它指到
語言資料夾,`ocr_status()`/`ocr_languages()` 在第一次 OCR 之前就說出缺了什麼。

**記錄檔:** 函式庫寫到 `~/.je_auto_control/logs/AutoControlGUI.log`,第一筆記錄時
才建立(只 import 不會寫任何檔),同一個帳號的所有行程共用(附加寫入、每行帶行程 ID,
Expand Down Expand Up @@ -130,19 +132,19 @@ python -c "import je_auto_control; je_auto_control.start_autocontrol_gui()"

| 能力 | Python API | `AC_*` 指令 | GUI 分頁 |
|---|---|---|---|
| 滑鼠 | `click_mouse`、`set_mouse_position`、`mouse_scroll` | `AC_click_mouse` | Auto Click |
| 鍵盤 | `write`、`hotkey`、`type_keyboard` | `AC_write`、`AC_hotkey` | Auto Click |
| 滑鼠 | `click_mouse`(`clicks=2` 就是雙擊)、`set_mouse_position`、`mouse_scroll`、`tween_drag`/`drag_path`(以 `step_delay_s`、`settle_s` 控制節奏) | `AC_click_mouse`、`AC_tween_drag`、`AC_drag_path` | Auto Click |
| 鍵盤 | `write`、`hotkey`、`type_keyboard`、`keyboard_key_name`(鍵碼 → 標準鍵名;Windows 也收 `ctrl`、`esc`、`enter` 等別名) | `AC_write`、`AC_hotkey` | Auto Click |
| 螢幕與像素 | `screenshot`、`screen_size`、`get_pixel` | `AC_screenshot` | Screenshot |
| 影像比對 | `locate_image_center`、`locate_and_click` | `AC_locate_and_click` | Image Detect |
| OCR 文字 | `click_text`、`wait_for_text`、`read_text_in_region` | `AC_click_text`、`AC_wait_text` | OCR Reader |
| OCR 文字 | `click_text`、`wait_for_text`、`read_text_in_region`、`ocr_status` | `AC_click_text`、`AC_wait_text`、`AC_ocr_status` | OCR Reader |
| 無障礙樹 | `find_accessibility_element`、`click_accessibility_element` | `AC_a11y_find`、`AC_a11y_click` | Accessibility |
| 視覺模型定位 | `locate_by_description`、`click_by_description` | `AC_vlm_locate`、`AC_vlm_click` | VLM |
| 錨點定位 | — | `AC_anchor_click`、`AC_anchor_locate` | — |
| 自癒定位器 | `self_heal_click`、`self_heal_locate` | `AC_self_heal_click` | Self-Healing |
| 自然語言規劃 | `plan_actions`、`run_from_description` | `AC_llm_plan` | LLM Planner |
| Computer-use agent | `AgentLoop`、`run_agent` | `AC_run_agent` | Computer Use |
| 錄製與重播 | `record`、`stop_record` | `AC_record`、`AC_stop_record` | Record |
| JSON 腳本 | `execute_action`、`execute_files` | 全部 774 個指令 | Script、Script Builder |
| JSON 腳本 | `execute_action`、`execute_files` | 全部 776 個指令 | Script、Script Builder |
| 變數與流程控制 | `execute_action_with_vars` | `AC_set_var`、`AC_loop`、`AC_for_each`、`AC_try`、`AC_retry` | Variables |
| 資料驅動執行 | — | `AC_for_each_row`(CSV/JSON/SQLite/Excel) | Data Sources |
| 斷言 | `assert_text`、`assert_image` | `AC_assert_text` 等 21 個 | Assertions |
Expand Down Expand Up @@ -191,7 +193,7 @@ je_auto_control version

| 介面 | 啟動方式 | 說明 |
|---|---|---|
| **MCP 伺服器** | `je_auto_control_mcp`(stdio)或 `AC_start_mcp_http_server` | 677 個工具,供 Claude Desktop/Claude Code/自訂 tool loop 使用。Bearer 驗證、TLS、稽核記錄、限流、外掛熱重載、CI 假後端。 |
| **MCP 伺服器** | `je_auto_control_mcp`(stdio)或 `AC_start_mcp_http_server` | 679 個工具,供 Claude Desktop/Claude Code/自訂 tool loop 使用。Bearer 驗證、TLS、稽核記錄、限流、外掛熱重載、CI 假後端。 |
| **REST API** | `je_auto_control start-rest` | Bearer token、逐 IP 限流與鎖定、SQLite 稽核 hook、`/metrics`、`/openapi.json`、`/docs` Swagger UI、`/dashboard`。 |
| **TCP socket 伺服器** | `je_auto_control start-server` | 以換行分隔的 JSON 動作清單。預設綁 `127.0.0.1`。 |
| **pytest 外掛** | 安裝後自動生效 | 提供 fixture 與供 pytest-bdd/behave 使用的 Gherkin step library。 |
Expand Down
Loading
Loading