Skip to content

docs(024): add AI agent devtools spec - #28

Merged
Chris Anderson (codemonkeychris) merged 1 commit into
mainfrom
docs/024-ai-agent-devtools
Apr 18, 2026
Merged

Chris Anderson (codemonkeychris) merged 1 commit into
mainfrom
docs/024-ai-agent-devtools

Conversation

@codemonkeychris

Copy link
Copy Markdown
Collaborator

Summary

  • New spec docs/specs/024-ai-agent-devtools.md designing the MCP-based devtools surface that closes the AI-agent perception gap tracked in Give the AI agent 'eyes': make build → view → iterate efficient for AI-driven development #16.
  • Renames --preview → --devtools with deprecated aliases; keeps the VS Code preview panel working unchanged.
  • Ships an in-process MCP server per Reactor app, fine atomic tools (tree, screenshot, click, type, waitFor, fire, reload, …), a rendered WinUI visual tree (post-layout bounds, templated parts, sparse Reactor source backrefs), UIA-driven automation with a documented Reactor-event-injection escape hatch, and an explicit reactor.reload lifecycle instead of dotnet watch.
  • Multi-window supported from v1: ids encode their window (r:main/Counter.btn-inc); top-level Window only (ContentDialog/Popup/Flyout are nodes inside their owner).

Key decisions captured in §16

  • HTTP (not stdio) for v1 transport — survives process replacement on a pinned port.
  • dotnet run + agent-driven reactor.reload, not dotnet watch — process replacement is an explicit, agent-visible event.
  • Full predicate-object waitFor.
  • $schema pinned on every tree payload.
  • reactor.snapshot / reactor.diff deferred past v1 — agent caches/diffs in its own turn context.
  • Wire names are unprefixed (tree, click, …); the MCP plugin name carries the namespace.

Test plan

  • Design review on the MCP tool inventory (§8) and tree schema (§9) before any code lands.
  • Confirm multi-window addressing model (§6) with one real two-window sample app on paper.
  • Confirm reactor.reload lifecycle (§11) is implementable given current ReactorApp.Run shutdown path.
  • Cross-check against spec 010 (source mapping) once it lands — sparse Reactor backrefs depend on it.

🤖 Generated with Claude Code

Designs the MCP-based devtools surface that gives an AI agent the
observability and automation it needs to iterate on a Reactor app
without a human in the middle. Renames --preview to --devtools,
exposes a real WinUI visual tree with rendered bounds, UIA-driven
verbs plus a reactor.fire escape hatch, and an explicit
reactor.reload lifecycle instead of dotnet watch. Tracks
#16.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@codemonkeychris
Chris Anderson (codemonkeychris) merged commit ddf956a into main Apr 18, 2026
3 checks passed
@codemonkeychris
Chris Anderson (codemonkeychris) deleted the docs/024-ai-agent-devtools branch May 28, 2026 19:11
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Jun 26, 2026
Reduces redundant WinRT/COM-RCW boundary crossings and per-element
allocations on the diff/reconcile/patch hot path (data-grid stress
workload, StocksGrid). Targets the dominant Reconcile gap.

Reconciler.cs / Update.cs / Mount.cs:
- #16 UnmountRecursive: read ReactorAttached.State once (was 5x GetValue).
- #17 UnmountAndCollect: read element tag once (was 5x GetElementTag).
- #14 Update: coalesce repeated `is FrameworkElement` RCW type-tests to one.
- #15 Cache the component rerender delegate on ComponentNode; recreate
  only when the requestRerender identity changes.
- #18 UpdateDefaultAutomationName: ref/ordinal short-circuit before the
  AutomationProperties.GetName COM read.
- #19 ApplyModifiers accepts null = clear-all (no fresh ElementModifiers).
- #20 PopulateDirtyAncestorPath iterates a tracked self-triggered set
  instead of the whole _componentNodes dict.
- #21 UnmountAndPool reuses a borrowed scratch list (reentrant calls fall
  back to a fresh list).
- #22 RefreshRealizedContainers reuses a cleared field list.
- #23 ApplyStyleToElement ref-equal + ActualTheme guard; ApplyThemeBindings
  gated on the ShallowEquals fast path.
- #24 BuildCacheKey: thread-static StringBuilder + pair buffer, single pass.
- #25 HasConsumedContextChanged compares via Context<T>/EqualityComparer<T>
  (no boxing of value-type context).
- #26 ApplyResourceOverrides: no ToHashSet/ToArray, ref-equal fast path.
- #27 WireReferenceListEdge: static loop, no per-edge List/closures.
- #28 ApplyStaggerDelays: hoisted static animation-key array.
- #29 PushContextDisposable: single-pair push overload, pooled PopOnDispose.

Reconciler.KeyedItemsBinding.cs:
- #39 ref-equality cache; only realloc + SetItemViewSource on change.

Reconciler.Mount.cs:
- #40 LayoutFootgunDetector gated by GridElement pre-filter.

AccessibilityScanner.cs (debug-only scan path):
- #62 compute GetChildren once in Walk, pass into Push.
- #63 cache sibling-text array in ScanContext, invalidate on Push.
- #64 BuildContext single-pass with pooled scratch (no LINQ chains).
- #65 IsLikelyEmoji explicit span loop (no LINQ).
- #66 CheckTabIndexGaps sorts a rented buffer (no OrderBy/ToList).

Behavior preserved exactly: coalesced COM reads observe the same values
at the same times; unmount/cleanup ordering unchanged; scanner emits
identical findings. AOT/trim clean (no new reflection).

Adds tests/Reactor.Tests/ReconcilerInteropPerfTests.cs (11 tests:
rerender-delegate caching, context-change compare, cache-key reuse,
single-pair context push, scanner output parity).

Closes #654

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant