AiHumanDraftEditor
MoleculeThe AI's draft beside the human's text, diffed by words, with accept and reject per change and accept all, drawn with the same DOM as kui-react. The text stays the human's until they accept. A badge says the draft is AI-generated. Changes are marked by shape (strike and underline) and a number shown in both panels, and every button names its change. The server draws both panels as they read; a small idempotent script (`modules/ui/AiHumanDraftEditor/scripts/draft-editor.js`, inlined once per page after `draft-model.js` and `draft-view.js`) keeps the state in the browser: accept, reject, reconsider, keep mine, accept all, the edit toggle and its textarea, the hover and focus highlight and the polite announcements. React's callbacks are bubbling DOM events on the root: `kui:draft-accept-hunk` { hunk }, `kui:draft-reject-hunk` { hunk }, `kui:draft-accept-all`, `kui:draft-change` { value } and `kui:draft-rejected-change` { keys } (the last two are cancelable: call `preventDefault()` to refuse the change and answer with `KuiAiHumanDraftEditor.setValue(root, text)` / `setRejected(root, keys)`). A `rejected` local is controlled as in React; `defaultRejected` starts uncontrolled. `value` is applied by the script itself, where React's is always controlled.