# ai/pending

> AI edits as a reviewable diff. A proposal is a valid but uncommitted transaction: the document is untouched until you accept.

AI edits as a reviewable diff (F-50…F-53). A proposal is a valid but uncommitted transaction: the document is untouched until you accept. Deleted words are painted over the real text with the Custom Highlight API; the proposal sits beside the block with its insertions highlighted. Accept or reject everything (⌘⏎ / Esc) or hunk by hunk; an accepted edit is one ordinary undo step.

```js
import { review } from 'verbal-editor/ai/pending';
```

| JS gzip | CSS gzip |
| --- | --- |
| 1.57 KB | 0.64 KB |

See it live on [AI review](#/examples/ai) — every example page on the landing is editable.

## Acceptance

| Feature | Acceptance | Budget |
| --- | --- | --- |
| F-50 · Pending transaction | Rejecting leaves the model byte-identical to before | ≤ 1KB |
| F-51 · Diff rendering | Insertions and deletions visually distinct; original text remains readable and selectable | ≤ 2KB |
| F-52 · Accept / reject | An accepted AI edit is undoable exactly like a typed one, with no special case | — |
| F-53 · Hunk-level control | Partial acceptance produces a valid document | ≤ 1KB |

## API

### `review(editor, changes)`

Proposes new text for blocks and shows it as a diff until accepted or rejected.

| Parameter | Type | Description |
| --- | --- | --- |
| `editor` | `object` | the Editor |
| `changes` | `Record<string, string>` | block id → proposed text |

Returns `{ done: Promise<void>, preview: () => Record<string, string>, accept: () => true, reject: () => true }`.
