Loading...
Loading...
C-ABI bindings over agent-desktop's PlatformAdapter. Consumers (Python ctypes, Swift, Node ffi-napi, Go cgo, C++, Ruby fiddle) link libagent_desktop_ffi.{dylib,so,dll} and call `ad_*` functions directly instead of spawning the CLI binary per call. The canonical observe-act workflow is: ad_init → ad_adapter_create[_with_session] → ad_snapshot → read qualified refs (@s8f3k2p9:e5) → ad_execute_by_ref → ad_free_string → ad_adapter_destroy.
npx skill4agent add vercel-labs/agent-desktop agent-desktop-ffirelease-fficargo build --profile release-ffi -p agent-desktop-ffitarget/release-ffi/libagent_desktop_ffi.dylib.soagent_desktop_ffi.dllcrates/ffi/include/agent_desktop.hreleasepanic = "abort"extern "C"SIGABRTrelease-ffipanic = "unwind"ad_init(AD_ABI_VERSION_MAJOR) // verify header ↔ dylib match
adapter = ad_adapter_create_with_session("s1") // or ad_adapter_create()
rc = ad_snapshot(adapter, "Finder", 0, 10, false, false, &json_out)
// parse json_out: locate snapshot-qualified refs in data.tree
ad_free_string(json_out)
// build action:
AdAction act = {0}; act.kind = AD_ACTION_KIND_CLICK;
rc = ad_execute_by_ref(adapter, "@s8f3k2p9:e5", &act, 0, &result_out)
ad_free_string(result_out)
ad_adapter_destroy(adapter)ad_snapshot{version, ok, command, data}data.treedata.completefalsead_snapshotapp--root@eNAD_RESULT_ERR_INVALID_ARGSad_init(AD_ABI_VERSION_MAJOR)AD_RESULT_ERR_INVALID_ARGSad_abi_version()ad_*libagent_desktop_ffiad_adapter_create_with_session("session-id")--session <id>-_ad_adapter_create()ad_last_error_*ad_execute_by_refSTALE_REFAMBIGUOUS_TARGETAD_RESULT_ERR_ACTION_FAILEDad_last_error_details()ad_execute_by_ref_timeouttimeout_ms-10PressKeyfocus_fallbackTypeTextheadlessAD_POLICY_KIND_FOCUS_FALLBACKAD_POLICY_KIND_HEADEDad_execute_ref_action_exact_with_policyAdExactRefEntryAdExactRefEntryAdExactWindowInfoad_list_windows_exactad_launch_app_exact*_exactAdRefEntryAdWindowInfoAdSurfaceInfoad_list_surfaces_exactidAD_EXACT_SURFACE_INFO_VERSIONAdExactSurfaceInfo.unclassifiedsheet,menusheetmenuad_resolve_element_exactad_find_exactAdNativeHandlead_execute_actionad_execute_action_with_policyad_free_handle(adapter, &handle)ad_adapter_destroyhandle.ptrAdActionResult.stepsstepsAdActionSteplabeloutcomemechanismAD_STEP_MECHANISM_SEMANTIC_APIAD_STEP_MECHANISM_PHYSICAL_SYNTHETIChas_mechanismverifiedhas_verifiedAdActionResult.dispositionad_last_error_delivery_semanticsad_free_action_result(&out)ad_list_displaysAdScreenshotTarget.screen_indexAdDisplayInfoad_display_list_freead_last_error_*ad_last_error_details()ACTION_FAILEDAMBIGUOUS_TARGETad_last_error_delivery_semanticsAD_RESULT_ERR_INVALID_ARGS--traceeventts_msseqtrace: onsession startad_adapter_create_with_session~/.agent-desktop/sessions/<id>/trace/<pid>-<procTs>.jsonlad_trace_showad_trace_exportlimit-1ad_set_log_callback(cb)tracingad_*cbint32_tconst char *msgNULL{"redacted":true}NULLad_wait(adapter, args, &out)waitmode.pauseAdOptionalU64mode.elementmode.windowmode.textmode.surfaces.menu.menu_closed.notificationpredicatepredicatevalueactioncountscope.timeout_msscope.app--event--window-idAdWaitArgsAD_WAIT_ARGS_SIZEad_wait_args_size(){version, ok, command, data}ad_free_stringad_waitscope.timeout_msad_adapter_destroyAD_ACTION_KIND_SET_VALUEAD_POLICY_KIND_HEADLESSad_get_tree_exactad_snapshotad_get_tree_exactad_free_treead_execute_by_refad_snapshot