Background
Agentation is useful in a designer–coding-agent workflow where each PR has a deployed Preview environment and reviewers annotate the rendered interface directly. The feedback needs to identify the original component so the coding agent can apply the next change.
Source attribution is currently reliable mainly in local development builds. In a production-optimized Preview build, an annotation may report a generated bundle location such as:
_next/static/chunks/<hash>.js:63:5578
instead of the original source location:
src/components/Banner.tsx:16:6
Root cause
In React production builds:
- React Fiber normally no longer exposes
_debugSource.
- The
Error.stack fallback points to bundled and minified chunks.
- Browser source maps do not automatically remap the
Error.stack value available to runtime JavaScript.
Enabling browser source maps alone therefore does not make original source locations available to Agentation at runtime.
Proposed approach
Provide an opt-in build-time integration that:
- adds a short
data-agentation-id to JSX that renders to the DOM;
- generates a compact manifest mapping each ID to a repository-relative
file:line:column location; and
- lets the Agentation runtime resolve the selected DOM element through that manifest before falling back to React internals.
The manifest should contain relative paths and position mappings only, never source content.
Initial scope
- A separately installable first-party build plugin.
- Production-only instrumentation by default, with explicit opt-in for development.
- Next.js 16 with Turbopack.
- Vite 7 with React.
- Single-project repositories and monorepos.
- Intrinsic JSX plus
next/link and next/image.
- Preserve existing Next.js and Turbopack configuration.
- Do not inject unknown DOM attributes into arbitrary custom components.
- Include tests and integration documentation.
Because the manifest exposes relative source paths to clients, applications should explicitly install the plugin and decide which Preview or staging deployments enable it.
Background
Agentation is useful in a designer–coding-agent workflow where each PR has a deployed Preview environment and reviewers annotate the rendered interface directly. The feedback needs to identify the original component so the coding agent can apply the next change.
Source attribution is currently reliable mainly in local development builds. In a production-optimized Preview build, an annotation may report a generated bundle location such as:
instead of the original source location:
Root cause
In React production builds:
_debugSource.Error.stackfallback points to bundled and minified chunks.Error.stackvalue available to runtime JavaScript.Enabling browser source maps alone therefore does not make original source locations available to Agentation at runtime.
Proposed approach
Provide an opt-in build-time integration that:
data-agentation-idto JSX that renders to the DOM;file:line:columnlocation; andThe manifest should contain relative paths and position mappings only, never source content.
Initial scope
next/linkandnext/image.Because the manifest exposes relative source paths to clients, applications should explicitly install the plugin and decide which Preview or staging deployments enable it.