Protocol-first WeChat Desktop semantic tools for app-control clients.
Project description
wechat-desktop-tool
Protocol-first WeChat Desktop semantic operations.
This package knows the WeChat Desktop workflow shape, but delegates all desktop actions to a compatible app-control client. It does not own macOS permission subjects, business authorization, task lifecycle, UI projection, confirmation storage, or caller audit systems.
Quick Start
from computer_use_macos import ComputerUseClient
from wechat_desktop_tool import build_wechat_tool, send_message
app_control = ComputerUseClient.from_config("app-control.toml")
wechat = build_wechat_tool(app_control)
result = wechat.focus_contact("File Transfer")
print(result.to_dict())
After the caller has completed its own authorization and confirmation policy, the convenience flow is also available:
result = send_message(
wechat,
contact="File Transfer",
message="hello",
)
The lower-level protocol entry is also available through command builders:
from wechat_desktop_tool import draft_message_command
result = wechat.run_command(draft_message_command("hello"))
Use wechat_command(...) when you need to construct a custom command envelope
while keeping the stable wechat.desktop tool name.
run_command(..., observer=...) and run_stream(...) use the shared
app_control_protocol.ToolObserver event surface.
Operations
open_wechat: open or focus WeChat Desktop, then verify the foreground window withobserve; a reported non-WeChat foreground identity returnswechat_not_ready. Successful observations includewechatEnvironmentdiagnostics with configured and observed app identity plusappVersionwhen the backend reports it.focus_contact: open WeChat, verify the foreground window, open search, type a contact, select it, and verify the selected chat window withobserve; a verified mismatched chat title returnscontact_not_found, while a verified non-WeChat foreground window returnswechat_not_ready.observe_current_chat: ask the app-control backend for the current chat state and map visible messages into semantic chat fields after checking any reported foreground app identity.read_visible_messages: map visible text or message payloads into typed message observations;textExtractis split into line-based messages with best-effort direction and timestamp prefixes.draft_message: type bounded message text without submitting.submit_draft: press the configured submit key.send_message: convenience flow for focus, draft, and submit. SetverifyAfterSubmitto read visible messages after submission and returnsend_unverifiedif the text is not observed inmessagesortextExtract.
CLI Examples
Dry-run the app-control commands without touching the desktop:
wechat-desktop-tool examples send-message \
--contact "File Transfer" \
--message "hello" \
--dry-run
Run against a local app-control service. Without --submit, the example only
focuses the contact and drafts the message:
wechat-desktop-tool examples send-message \
--contact "File Transfer" \
--message "hello" \
--socket-path /tmp/app-control.sock \
--token-file ./app-control.token
Submitting is explicit:
wechat-desktop-tool examples send-message \
--contact "File Transfer" \
--message "hello" \
--socket-path /tmp/app-control.sock \
--token-file ./app-control.token \
--submit
The CLI example does not provide business authorization. The caller must only run it for contacts and messages they are allowed to control.
Manual Smoke
WECHAT_TOOL_CONTACT="File Transfer" \
WECHAT_TOOL_MESSAGE="hello from wechat-desktop-tool smoke" \
WECHAT_TOOL_DRY_RUN=1 \
python -m wechat_desktop_tool.examples.wechat_smoke
For a real focus/draft smoke, start computer-use-macos serve and provide
WECHAT_TOOL_SOCKET_PATH. The smoke submits only when
WECHAT_TOOL_ALLOW_SEND=1 is set. WECHAT_TOOL_ALLOW_SUBMIT=1 is accepted as
a compatibility alias.
Configuration
The package consumes the shared AppControlConfig wechat section:
[wechat]
app_name = "WeChat"
bundle_id = "com.tencent.xinWeChat"
app_control_tool = "macos.computer_use"
search_hotkey = ["Command", "F"]
search_clear_hotkey = ["Command", "A"]
clear_key = "Delete"
submit_key = "Return"
max_message_chars = 2000
default_timeout_ms = 30000
Failure Kinds
Import WECHAT_FAILURE_KINDS when callers need stable routing for
package-owned semantic failures such as contact_not_found, draft_failed,
input_not_focused, submit_failed, submit_unknown, and send_unverified.
Package Boundary
wechat-desktop-tool depends on app-control-protocol and a client that
implements run_command(command) -> ToolObservation. It must not import
macos_computer_use, Plato, Taskweavn, or any LLM provider SDK.
Developer-facing module entrypoints are available as commands,
observations, errors, adapter, and recipes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wechat_desktop_tool-0.1.0.tar.gz.
File metadata
- Download URL: wechat_desktop_tool-0.1.0.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7b39931771edc49ab8537d742d2e532b18dc90a289d761511bb4bbb104803e1
|
|
| MD5 |
be89be73de523c6a518a923dcc76236a
|
|
| BLAKE2b-256 |
f90d63d53b933082840086a01b4f90eb9614ec57e9bc04de7936f633c9ab3f00
|
File details
Details for the file wechat_desktop_tool-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wechat_desktop_tool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0687cdc62b5eedc22ec84337ae21922dea40db2501d92f30f3ce1842e983998
|
|
| MD5 |
59e83532c5558071091bb01b7e007bea
|
|
| BLAKE2b-256 |
0071963303c440a51fc5bc515f4df420e9054600ebacbf44b2a68c1f11415f9a
|