Agent-readable docs index: /effect-swiftui/llms.txt. Full docs in one file: /effect-swiftui/llms-full.txt. Download /effect-swiftui/docs.zip to grep all markdown files locally.

AppKit 0.2.x: Inspect a native app with Effect UI DevTools

AppKit 0.2.x archive. The SwiftUI renderer does not include this integration. The embedded panel shown below requires the later AppKit source checkout, not the 0.2.1 release.
This integration connects the native renderer to @effect/ui-devtools, the inspector for Effect UI component messages and models. It is not a general-purpose Effect fiber debugger or a SwiftUI view inspector. Start in read-only mode; you don’t need an MCP client to see the timeline.

Pick a control in Travel Notebook

From a checkout containing the embedded panel (not the published 0.2.1), run bun run devtools in one terminal and EFFECT_APPKIT_DEVTOOLS=inspect bun run demo:workspace in another. The server defaults to 127.0.0.1:4774. No dispatch permission is needed.
  1. In the notebook, click Open Effect UI DevTools, then click Pick in the panel. Hover over a native control to see its Effect owner. Press Escape to cancel, or click to select it without activating it.
  2. Pick Reserve a bunk near Courmayeur in the queue. The path is /TravelNotebook/TaskQueue[]/TaskRow[hut]. Pick the same checkbox in the itinerary and its parent is DocumentReader[] instead.
  3. Click a checkbox normally. Both copies change. Select the row’s ToggledTask entry and open Message for taskID: "hut". Picked native control describes the control at pick time; pick again to refresh it.
Travel Notebook and its embedded official inspector. Follow a native checklist interaction into its component tree and timeline.

Use the picker in your own app

Link EffectAppKit, bundle your component with the matching effect-appkit adapter, and mount it using EffectAppKitView or EffectAppKitSurface. Start the matching DevTools server (this repo’s bun run devtools starts the pinned version). In Xcode, set EFFECT_APPKIT_DEVTOOLS=inspect in the Debug Run scheme. The library adds the launcher and resolves the picked control to its mounted Effect instance; the app does not register a second inspector or draw its own panel.
The tree reflects Effect components, not every private SwiftUI view. Use a stable key for each repeated child and a message name that describes the action. Use a native container when Swift lays out Effect-owned children. A native leaf can still expose a checkbox’s accessibility label and checked state, but picking it selects the nearest Effect owner. Swift-only drafts don’t become Effect models.
For the MCP version of the checklist example, see Test the running app with an agent.

Watch one update

Use a checkout whose root package.json includes the devtools script. The server requires Node (the project’s CI uses Node 24). From the repository root, not docs/, start the server:
bun install --frozen-lockfile --ignore-scripts bun run devtools
Leave it running. In a second terminal in the same AppKit checkout, build the counter and launch it with inspection enabled:
bun run bundle:counter EFFECT_APPKIT_DEVTOOLS=inspect swift run EffectCounter dist/counter.js
Open the panel from the app or visit the standalone timeline, then click Count: 0 in the Mac window. Look for the Count message and the model’s count changing from 0 to 1. Only the embedded panel can point at controls in the Mac window. Read-only MCP clients can also use list_sessions, list_instances, and get_state at http://127.0.0.1:4774/mcp.

Send a message from an MCP client

Dispatch runs the component’s real update and effects. Use a trusted local machine and test data: the server has no authentication, and logs can contain model and message values. Both processes must opt in. Stop the previous server and close the counter so the next run starts at zero.
# Terminal 1 bun run devtools --dispatch
# Terminal 2, using the counter bundle built above EFFECT_APPKIT_DEVTOOLS=dispatch swift run EffectCounter dist/counter.js
Connect your client using HTTP MCP at http://127.0.0.1:4774/mcp (the URL without /mcp is the human-readable timeline).
  1. Call list_sessions and choose the connected, controllable Counter session. Pass its session to list_instances; use the numeric instance at path /Counter. Don’t reuse IDs from an earlier launch.
  2. Call get_message_schema with that session and instance. This is the root component’s message schema, not a list of native controls.
  3. Call dispatch with the same identifiers and this messages array:
[ { "_tag": "ChangeStep", "position": 1 }, { "_tag": "ChangeDirection", "down": true }, { "_tag": "Count" } ]
  1. Call get_state on the same instance. Its model should be { "count": -10, "step": 10, "down": true }, and the native button should read Count: -10. A slider position of 1 selects the maximum step of 10. No simulated clicks or Accessibility permission are involved.

Your own app and connection problems

  • Embedding in Xcode: Set EFFECT_APPKIT_DEVTOOLS under Edit Scheme → Run → Arguments → Environment Variables for the Debug app. A sandboxed app needs Outgoing Connections (Client) even for loopback. No component changes are required; rebuild the app’s JavaScript bundle with the DevTools-capable renderer.
  • Interrupted timeline: The native transport reconnects both sockets as a pair with capped backoff. Look in the app console for connection loss, overflow, or history eviction. On reconnect it sends a fresh hello and up to 256 retained encoded log frames (also bounded by size), not queued actions or replies. Older history and unacknowledged updates may be unavailable; read current state before deciding whether to dispatch again. A disconnect resumes a paused surface and clears its recording filters.
  • Wrong port: Start the server with --port 4880, set EFFECT_APPKIT_DEVTOOLS_PORT=4880 alongside the app’s mode, and update the timeline and MCP URLs to match. The native client connects only to 127.0.0.1.
  • State visible, control unavailable: Inspection is working. Check for --dispatch on the server and EFFECT_APPKIT_DEVTOOLS=dispatch on the app. Release builds install no inspector. Rebuild Swift and the JS bundle together.
  • Swift-local state is absent: Typing in the travel notebook's custom SwiftUI popover isn't an Effect message until its action is submitted.

Native controls versus model messages

In a dispatch-enabled session, get_message_schema and dispatch resolve the live instance number, including a keyed child. A removed child is rejected, never redirected to a sibling or root. Every message in a batch is decoded before the first is sent. Dispatch can run real commands; it does not type or click.
find_instances accepts a native element tag (button), *, #identifier, label=Step size or text=Count: 0. Matches are exact, within this surface, in render order. text= checks displayed button titles and noneditable labels only. Replies include at most 20 matches and their instance metadata, never the displayed text. CSS selectors and SwiftUI's internal view tree are not supported. To pick locally, Option–Shift–click a rendered control. get_picked identifies its owning instance without activating it. A native subview inside a custom leaf identifies the leaf's Effect owner, not a SwiftUI component.
show_entry displays an inert native drawing for a retained completed render. Look for History #… above it. The live model and commands continue behind it; resume or Resume live view reveals their latest result. This does not rewind effects or restore focus, unsaved text, scroll offsets or Swift-local state from history. The drawing preserves text, titles, checkbox/slider values and structural containers (stack, row, grid, split, scroll and material). A desktop draws its content without installing window chrome. Fields, collections and custom widgets are labeled and reported in skipped, not recreated from private state. At most 64 semantic drawings (1 MiB total) are retained locally; oversized trees and intermediate entries in one flush have no drawing. No screen frames are recorded or sent.
set_recording filters future entries by message tag on server 82a1750; the dec1ca9 request additionally accepts a component and/or an instance subtree. Criteria in a rule are ANDed. This is a timeline filter, not a privacy control: subsequent models include their current data. Use Schema.Redacted, and don't put secrets in paths, subscription keys or exception strings. Recording choices apply to this connection only.
A secureField masks what AppKit draws; it does not automatically redact an application's message or model schema. Wrap the edit in Redacted.make(value) at the handler, use Schema.Redacted(Schema.String) in both schemas, and unwrap only when supplying the native field's value. find_instances can locate the field by identifier or accessible label, never by its contents.
Both upstream revisions use wire v1. Its hello has no macOS host value (the surface appears as terminal); controllable describes the socket, not browser/pixel/AX automation. Child control uses the same live find and dispatch hooks as the pinned BrowserHost; generic Renderer.Root doesn't publicly type those hooks. Missing hooks disable controls, not logging. The browser-only DOM paint and picker aren't used.

Test actual native input in-process

Add .product(name: "EffectAppKitTesting", package: "effect-appkit") to the Swift test target, mount a real bundle in an EffectAppKitView attached to an NSWindow, and run on the main actor:
let driver = NativeTestDriver(root: surface) try driver.press(.init(role: .button, label: "Count: 0")) let next = NativeLocator(role: .button, label: "Count: 1") try await driver.waitFor(next) let buttonFrame = try driver.frameInWindow(of: next) // points in the NSWindow let controlPNG = try driver.screenshotPNG(of: next) // native view, not the desktop
Use focus, isFocused and insertText(_:into:) to work with the real first responder and field editor. id accepts an accessibility identifier or NSView.identifier. Locators require a unique visible match. For a TypeScript-authored test plan, import nativeFixture from effect-appkit/testing, emit its JSON at build time, then try await driver.runFixture(data) in the host test. See Tests/counter.native.ts and NativeDriverTests. This is native target/action and text-system input, not hardware injection, screen recording, model dispatch, or a remote execution API; no DevTools connection is needed.