# @smithers-orchestrator/react-reconciler — src

The custom React reconciler behind Smithers workflows. `reconciler.js` defines
the mutation-mode host config plus `SmithersRenderer`, which renders
`<smithers:*>` host elements into a mutable `HostContainer` tree and then
extracts a `WorkflowGraph` via the peer `@smithers-orchestrator/graph`.
`core-peer.js` resolves that package's `extractGraph`, with an in-repo dev
fallback to `packages/graph/src`.

Entry points map 1:1 to `package.json` exports:

- `index.js` — main export (`SmithersRenderer`, `ReactWorkflowDriver`, context).
- `context.js` — `SmithersContext` + `createSmithersContext` (`./context`).
- `driver.js` — `ReactWorkflowDriver`, a `WorkflowDriver` with a default
  `SmithersRenderer` (`./driver`).
- `jsx-runtime.js` — re-exports React's jsx runtime (`./jsx-runtime`).
- `dom/renderer.js` — compat re-export of `reconciler.js`, used by
  engine/components/smithers via the `./*` export glob.
- `devtools/` — React adapter for Smithers DevTools (see its README).

Do not move or rename these files: `package.json` exports and
`scripts/check-docs.mjs` pin the paths.

The `.ts` files (`HostContainer`, `OutputSnapshot`, `SmithersCtxOptions`,
`SmithersRendererOptions`) are type-only sidecars for the JSDoc-typed `.js`
implementations. `index.d.ts` is generated by `pnpm build` (tsup `--dts-only`)
— never edit it by hand.

Gotchas: importing `reconciler.js` has side effects — it installs the React
DevTools hook and calls `injectIntoDevTools` (declared in `package.json`
`sideEffects`). Blocks between `@smithers-type-exports-begin/end` are
tool-managed; preserve them byte-for-byte. Uncaught render errors are captured
synchronously so `SmithersRenderer.render()` rejects instead of returning a
stale graph.
