← 返回 Skills 市场
lahfir

Agent Desktop Ffi

作者 lahfir · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
68
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install agent-desktop-ffi
功能描述
C-ABI bindings over agent-desktop's PlatformAdapter. Consumers (Python ctypes, Swift, Node ffi-napi, Go cgo, C++, Ruby fiddle) link libagent_desktop_ffi.{dyl...
使用说明 (SKILL.md)

agent-desktop-ffi

Direct C-ABI access to every PlatformAdapter operation. Build the cdylib with the workspace's release-ffi profile:

cargo build --profile release-ffi -p agent-desktop-ffi

The output is target/release-ffi/libagent_desktop_ffi.dylib (.so on Linux, .dll on Windows) plus a committed C header at crates/ffi/include/agent_desktop.h.

Four reference topics, loaded as needed:

  • ownership.md — who allocates / who frees, for every *mut T the FFI hands back to the caller.
  • error-handling.md — errno-style last-error contract, enum validation, panic boundary.
  • threading.md — macOS main-thread rule, AXIsProcessTrusted inheritance when Python/Node dlopens the cdylib, and the single-owner handle invariant.
  • build-and-link.md — minimum working example for Python ctypes and a C program that links the dylib.

⚠ Core constraints before you integrate

  • Main thread only (macOS). Call every adapter-touching entrypoint (ad_get_tree, ad_resolve_element, ad_execute_action, ad_screenshot, clipboard, launch/close, window ops, observation, notifications, etc.) from the process's main thread. The FFI enforces this at runtime in every build profile — a worker-thread call returns AD_RESULT_ERR_INTERNAL with a diagnostic last-error. On non-macOS platforms the check is a compile-time true; there is no runtime cost.

  • Release profile. cargo build --release produces panic = "abort" — any Rust panic inside an extern "C" fn will SIGABRT the host. Use --profile release-ffi to get the correct panic = "unwind" profile. CI enforces this.

  • Last-error lifetime. Pointers returned by ad_last_error_* remain valid across any number of subsequent successful FFI calls on the same thread. Only the next failing call rotates them. Cache the pointer once, read it as many times as you need.

  • Handle release. Every ad_resolve_element result must be released with ad_free_handle(adapter, handle) on the same adapter that produced it. On macOS this balances the internal CFRetain; on Windows/Linux the call is a no-op but safe to issue.

  • Enum discriminants. Every #[repr(i32)] enum field is validated at the C boundary — invalid discriminants return AD_RESULT_ERR_INVALID_ARGS instead of undefined behavior.

  • ABI is unstable before 1.0. The header lists the exact current shapes. Anything added or reordered in a later patch is a breaking change; pin the version of libagent_desktop_ffi you link against.

  • ad_get_tree returns a raw adapter tree, not the CLI snapshot. Ref IDs are always null, no skeleton/drill-down pipeline is wired through, and interactive_only / compact follow adapter semantics which may diverge slightly from the CLI's post-processed shape. Use ad_find + ad_get / ad_is for point lookups, or invoke the CLI if you need CLI-parity JSON snapshots.

安全使用建议
This skill is an on-disk FFI usage and build guide rather than executable code fetched at install time, and its requirements are reasonable for that purpose. Before integrating: build the cdylib locally with the documented --profile release-ffi to preserve panic/unwind guarantees; pin the library version you link against because the ABI is unstable before 1.0; follow the ownership/free rules exactly to avoid memory errors; and on macOS be aware that granting Accessibility (AXIsProcessTrusted) is granted to the hosting interpreter (python/node/etc.) — granting it to one process that dlopens this library effectively grants it to other code using the same interpreter. If you need higher assurance, inspect the built binary and the committed header in your own repo rather than relying on an external binary.
功能分析
Type: OpenClaw Skill Name: agent-desktop-ffi Version: 1.0.0 The agent-desktop-ffi skill bundle provides a legitimate C-ABI interface for desktop automation, allowing various programming languages to interact with the agent-desktop PlatformAdapter. The documentation (SKILL.md and the references directory) is exceptionally thorough, covering memory ownership, thread-local error handling, and macOS-specific threading constraints. While the skill facilitates high-privilege actions like UI automation and screenshot capture, these are the stated purpose of the tool, and the documentation explicitly warns about security implications such as AXIsProcessTrusted permission inheritance in hosting processes (threading.md).
能力评估
Purpose & Capability
Name/description claim C-ABI bindings and the included docs explain building, linking, ownership, threading, and error handling. There are no unrelated env vars, binaries, or installs requested — everything asked for (cargo build, header, linking) fits the stated purpose.
Instruction Scope
SKILL.md and reference files limit runtime instructions to local build/link steps and safe usage patterns (main-thread rule, allocation/free contracts, last-error semantics). No instructions to read unrelated files, send data externally, or access unrelated credentials. The docs explicitly call out a macOS permission inheritance concern (AXIsProcessTrusted) as a warning.
Install Mechanism
No install spec or external downloads are present; the skill is instruction-only and expects consumers to build the cdylib locally via cargo. This is low risk and proportionate to the task.
Credentials
No environment variables, credentials, or config paths are required. The references explain runtime constraints but do not request secrets or unrelated tokens.
Persistence & Privilege
always is false and the skill does not request persistent system presence or modify other skills' configs. Autonomous invocation defaults are unchanged and no elevated privilege is requested.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-desktop-ffi
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-desktop-ffi 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of agent-desktop-ffi. - Provides direct C-ABI bindings to agent-desktop's PlatformAdapter for use in Python, Swift, Node, Go, C++, and Ruby. - Distributes a shared library (`libagent_desktop_ffi.{dylib, so, dll}`) and C header for integration. - Enforces core constraints, including main-thread-only execution on macOS and safe enum handling. - Documents error handling, handle ownership, threading, and build/linking procedures. - ABI is marked unstable pre-1.0; breaking changes may occur between minor versions.
元数据
Slug agent-desktop-ffi
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Agent Desktop Ffi 是什么?

C-ABI bindings over agent-desktop's PlatformAdapter. Consumers (Python ctypes, Swift, Node ffi-napi, Go cgo, C++, Ruby fiddle) link libagent_desktop_ffi.{dyl... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 68 次。

如何安装 Agent Desktop Ffi?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agent-desktop-ffi」即可一键安装,无需额外配置。

Agent Desktop Ffi 是免费的吗?

是的,Agent Desktop Ffi 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Agent Desktop Ffi 支持哪些平台?

Agent Desktop Ffi 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Agent Desktop Ffi?

由 lahfir(@lahfir)开发并维护,当前版本 v1.0.0。

💬 留言讨论