docs(12-filled-document-preview): create phase 12 plan

Two-plan wave structure for PREV-01: preview API route + modal (Plan 01,
Wave 1) then PreparePanel/FieldPlacer wiring + human verification (Plan 02,
Wave 2). Send button gated on previewToken staleness detection.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Chandler Copeland
2026-03-21 15:25:48 -06:00
parent 06b96cd3c2
commit 10d4eb738a
3 changed files with 562 additions and 2 deletions

View File

@@ -255,7 +255,7 @@ Plans:
2. The Send button is disabled until the agent has generated at least one preview of the current field state
3. If the agent changes any fields after previewing, the Send button is re-disabled until a fresh preview is generated (staleness detection)
4. The preview PDF uses a versioned path and does not overwrite the final prepared PDF (legal integrity of prepared document is preserved)
**Plans**: TBD
**Plans**: 2 plans
Plans:
- [ ] 12-01-PLAN.md — POST /api/documents/[id]/preview route (reuses preparePdf in preview mode, versioned path, staleness token), PreviewModal component with react-pdf rendering + ArrayBuffer copy
@@ -270,7 +270,7 @@ Plans:
2. AI-placed text fields are pre-filled with client name, property address, and signing date where those values are available from the client profile
3. AI placement produces correct field positions on a full 20-page Utah REPC — coordinates convert correctly from percentage-based AI output to PDF user-space points (Y-axis inversion verified by unit test)
4. Agent can review, adjust, or delete any AI-placed field before proceeding to prepare — AI placement is a starting point, not a lock
**Plans**: TBD
**Plans**: 4 plans
Plans:
- [ ] 13-01-PLAN.md — lib/ai/extract-text.ts (pdfjs-dist legacy build, server-only), lib/ai/field-placement.ts (GPT-4o-mini structured output, manual JSON schema, server-only guard), aiCoordsToPagePdfSpace() utility + unit test