agent_appkit
The macOS GUI backend for the agent surface: it binds the framework-agnostic agent_core rules to a live AppKit window.
open(window)walks the live NSView tree into aSurface— the controllable model an agent sees.describe_uireturns a snapshot of the exposed nodes (Vec[UiNode]). A node is exposed by giving it an agent id withset_agent_id.- Authorized actions —
click,set_text, andscroll_torun through theagent_coreauthorization brain. Text edits use optimistic-concurrency versioning, so a stale edit is rejected. - Events — AppKit notifications are translated into verbs and delivered as
the bubbling events
agent_coredefines. - Main-thread safe —
click/set_text/scroll_tomarshal onto the main thread when called off it, so an MCP bridge driven on a background connection can never message AppKit off-main. It is closure-free (a[NSThread isMainThread]fast path overperformSelectorOnMainThread:), andon_main_thread()is public if you need the same check. - Layout diagnostics —
Surface::layout_diagnosticsreports per-node Auto Layout health (uses_autolayout,has_ambiguous_layout), so an agent can catch a broken generated layout without taking a screenshot.
Pair it with agent_mcp to expose the surface to an
external agent. AppKit agent surface documents
the checked docs/examples/recipes/appkit_agent recipe from the C+ source tree:
describe the tagged UI, act on a real AppKit button, reject stale text edits,
and refuse requests through a closed consent gate.