feat(backend): deliver Phase 3 document and voice integration

Add authenticated upload, review, retry and knowledge-selection HTTP flows with bounded JSON processing and frozen OCR policy.

Preserve Gemini/OpenAI provider selection and fenced lifecycle semantics; retain FAQ preambles and uncertain vision candidates, and expose opt-in uncalibrated voice transport diagnostics.

Include frontend integration examples, aligned contracts and deterministic regressions. Validation: 1767 provider-free tests passed; all 404 PostgreSQL scenarios have passing evidence across the documented runs.
This commit is contained in:
11linear11
2026-10-09 17:43:52 -04:00
parent 9be47191d6
commit a73a496c54
67 changed files with 5988 additions and 234 deletions
+30 -10
View File
@@ -1,15 +1,18 @@
# OpenAI Realtime Agent — Fast MVP Implementation Plan
Current voice decision (2026-10-09): **Gemini Live is temporarily the sole voice
provider because an OpenAI Realtime voice key is unavailable.** The validated
backend Gemini model/voice configuration is shared by reservation, stream and
operator smoke. No OpenAI voice key is required. Extraction/embedding providers,
frozen profiles, measured calibration and canonical search are unchanged.
The provider-independent browser audio/events, direct document/chunk identities
and durable owner/replay/revocation rules remain authoritative. Historical
OpenAI checkpoints below remain historical. Gemini interruption closes safely
where native sample-level context truncation cannot be verified; seamless
barge-in is not certified. See [Phase 2 repair report](../guides/realtime-agent-phase2-repair.md).
Current voice configuration (2026-10-09): **VOICE_PROVIDER=gemini|openai selects
one backend adapter. Gemini remains the temporary default because an OpenAI
Realtime voice key is unavailable.** Reservation, authenticated stream and
operator smoke share the selected model/voice/profile. Only the selected voice
key is required; there is no fallback or frontend provider selector. Legacy
PROVIDER and existing GEMINI_* settings remain supported; conflicting provider
aliases fail configuration. Dedicated OPENAI_REALTIME_* settings do not change
embedding credentials. Browser PCM16LE remains mono 24 kHz in both directions.
Pinned reservations cannot switch providers on connection or replay. Gemini
interruption requiring unverified context truncation closes safely; OpenAI keeps
its existing native cancellation/truncation contract. Canonical search, original
documents, frozen profiles and owner/replay/revocation rules remain unchanged.
See [Phase 2 repair report](../guides/realtime-agent-phase2-repair.md).
## 1. Goal and implementation decisions
@@ -518,3 +521,20 @@ existing 50 ms test remain preserved. Historical results above remain distinct.
Real provider/speech/browser and isolated PostgreSQL acceptance remain unrun,
subject to authorization/calibrated actor/corpus prerequisites and fail-closed
calibration/cancellation classification. Scope remains Phase 1.
## Phase 3 implementation checkpoint (2026-10-09)
The authenticated document/review/retry/selection/read-only configuration surface
and frontend developer handoff are implemented. Existing intake, review/resume,
fenced publication and atomic selection are reused; there is no new migration,
worker replacement, public search/text route, settings editor or production UI.
The two remaining Phase 2 transport findings are repaired. See the
[Phase 3 handoff and validation](../guides/realtime-agent-phase3-handoff.md).
The additional authorized backend OCR supervisor setting defaults to true and is
frozen in new jobs. False admits only clean automatically validated OCR; legacy
profiles, factual authority, non-OCR review, integrity and explicit selection
remain protected. Mixed extraction uses partially_reviewed rather than claiming
human inspection of automatically admitted pages. Provider selection and all
other Phase 2 repairs remain unchanged. Backend contract acceptance does not
certify real-provider/Persian quality, frontend implementation or browser hardware.