Outcome
Give the one visible Flect agent typed, bounded tools to inspect the running frontend, understand the source and runtime state that produced it, repair failures, and continue the same conversation without exposing an IDE, shell, or internal agent role to the user.
Dependencies
Builds on the live canvas in #32, canonical workspace in #33, Git-backed checkpoints in #25, and selection/source targeting in #35. Every tool path must satisfy the performance budgets in #20.
Required behavior
- Inspect a bounded semantic DOM snapshot, accessibility information, computed layout and styles, active viewport, focus, and the currently selected element without exposing unrelated page or host data.
- Map rendered elements and runtime failures back to attributable source locations in the canonical workspace.
- Read, list, search, and patch approved workspace files through typed contracts with path, size, count, and revision bounds.
- Run approved build, typecheck, test, preview-health, and diagnostic operations through the workspace runtime rather than the UI main thread.
- Return compiler, source-map, runtime, console, preview, and capability failures as bounded structured diagnostics the agent can act on.
- Require the workspace revision for every read and write result. Reject stale tool results before they can change source or canvas state.
- Keep tool activity visible as concise progress in the same conversation while internal App, Shaper, and Guardian trust domains remain hidden.
- Acquire shell, compiler, package, sandbox, Worker, and Wasm implementations only when the typed operation requires them; cancellation and Effect scopes own cleanup.
- Route outside effects through the capability broker. Source inspection or local UI repair never implies product, credential, network, native, or ambient filesystem authority.
- Preserve the last-known-good running canvas while tools, builds, or repairs fail.
Acceptance criteria
- Given a source-located compile failure, the same visible agent can inspect diagnostics, patch the correct file, rebuild, and restore the live canvas without mode switching or Keep/Reject.
- Given a selected visible element, the agent receives its semantic identity, source mapping, computed state, and viewport context and can make a targeted edit.
- Given a runtime exception, the agent receives a bounded sanitized stack and source mapping without gaining access to credentials, host APIs, or unrelated application state.
- Stale reads, stale patches, oversized output, unsupported paths, denied capabilities, timeouts, and cancellation fail with typed actionable errors and leave the current canvas untouched.
- Production Chromium and packaged macOS tests cover inspect, patch, build, failure, repair, cancel, reload, and 50 consecutive edit cycles.
- No ordinary repair loads optional execution substrates before their first required tool call.
- Tool timelines remain understandable to a non-developer and do not expose raw command noise by default.
Non-goals
- Ambient host shell, system Bun, unrestricted filesystem, arbitrary network, provider credentials, or native process access.
- Turning the default agent rail into DevTools, a terminal, or a source editor.
- Allowing generated code or model output to grant itself capabilities.
- Replacing deterministic validation, revision checks, or last-known-good recovery.
Outcome
Give the one visible Flect agent typed, bounded tools to inspect the running frontend, understand the source and runtime state that produced it, repair failures, and continue the same conversation without exposing an IDE, shell, or internal agent role to the user.
Dependencies
Builds on the live canvas in #32, canonical workspace in #33, Git-backed checkpoints in #25, and selection/source targeting in #35. Every tool path must satisfy the performance budgets in #20.
Required behavior
Acceptance criteria
Non-goals