feat(voice): add authenticated Phase 2 live lifecycle
Add cookie authentication, owned conversations, durable Live reservations, tool completion/replay fencing, revocation, and startup reconciliation. Introduce forward lifecycle/owner-chain migrations and the temporary Gemini adapter while preserving the existing OpenAI Realtime adapter. Include the executable audio client, regression coverage, configuration, API/database documentation, and recorded acceptance evidence. Validation: focused review suite 82 passed; Python/TOML parsing, JavaScript syntax, and whitespace checks passed. Full PostgreSQL/provider-free results are recorded in the repair report; real-provider/browser acceptance is unrun. Follow-up work remains for configurable OpenAI/Gemini selection, transport admission, authority diagnostics, playback message bounds, and client replay identity after ambiguous creation responses.
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
# RAG Assistant — Phase 1 API Catalog
|
||||
|
||||
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).
|
||||
|
||||
Version 1.3 · 2026-10-07 · Current Live document MVP contract; planned endpoints are not claimed operational.
|
||||
|
||||
Companions: `RAG-Phase1-Implementation-Guide.md`, `RAG-Phase1-Database-Design.md`, `RAG-Phase1-MVP-Scenarios.md`. Scope follows `RAG-AI-Phase1-Delivery-Plan.md`. No document versioning is implemented: every upload is a new document; there is no version-upload route, model selector, mixed conversation or SSE in Phase 1.
|
||||
@@ -265,9 +276,15 @@ Scope key `(conversation_id,client_request_id)`. Changed message under same key:
|
||||
|
||||
Path uses the original client request UUID, allowing recovery even if the POST response was lost. 200 returns T01 shape, including running/failed. 404 if no committed turn exists. If 404 after an ambiguous client timeout, retry the SAME POST/key; uniqueness handles races. Never generate a new key merely because a response was lost.
|
||||
|
||||
## 7. Voice contract — OpenAI Realtime; frozen application audio/events
|
||||
## 7. Voice contract — Gemini Live temporarily; frozen application audio/events
|
||||
|
||||
The initial provider is direct OpenAI Realtime managed by the backend. This replaces revision 1.1's provisional SDP contract before frontend implementation. HTTP creation/poll/close, application WSS audio/events and internal model tools are separate contracts. None is verified as implemented. Phase 0 freezes the application audio/event fields below; implementation remains pending. These are application names, not provider-native event names. Provider events, response/item/call IDs, session objects and credentials remain private to the adapter; tool_call_id is an application correlation ID.
|
||||
The current provider is Gemini Live managed by the backend. Earlier OpenAI-specific
|
||||
provider mechanisms below describe the retained Realtime adapter; the Gemini
|
||||
adapter uses native setupComplete, voiceActivity, toolCall/toolResponse and
|
||||
transcription. Missing verified input boundaries fail safely. Interruption
|
||||
requiring unheard-audio context repair closes the session rather than inventing
|
||||
a cancellation/truncation acknowledgement. The browser still uses 24 kHz mono
|
||||
PCM16LE; Gemini input conversion to 16 kHz occurs inside the adapter. This replaces revision 1.1's provisional SDP contract before frontend implementation. HTTP creation/poll/close, application WSS audio/events and internal model tools are separate contracts. None is verified as implemented. Phase 0 freezes the application audio/event fields below; implementation remains pending. These are application names, not provider-native event names. Provider events, response/item/call IDs, session objects and credentials remain private to the adapter; tool_call_id is an application correlation ID.
|
||||
|
||||
### V01 — Create session (HTTP)
|
||||
|
||||
@@ -531,3 +548,12 @@ Inside persisted jobs/sessions/tool calls, normalized codes include PROVIDER_TIM
|
||||
Prove real native audio/tools early. Build A01/A03, bounded upload/polling, D06/D07 review and D04 resume, selection, C01 voice creation, V01-V04/WSS and read-only F01 capabilities. Full T01/T02/messages and settings editing are deferred. Display request progress and state rather than a fake percentage. Disable selection on non-ready documents. On stale conversation explain that sources changed and offer New Conversation. Do not automatically copy revoked context.
|
||||
|
||||
Out of scope: file-version API, raw downloads for ordinary users, document text editing, search HTTP endpoint, model selector, raw audio recording, streamed chat, mixed-mode history, full event replay. Sources needed by normal users are supplied in authorized message/session responses.
|
||||
|
||||
Current temporary Gemini capability failures before reservation are 503
|
||||
`LIVE_PROVIDER_UNAVAILABLE` for missing voice credentials/profile access and
|
||||
`CALIBRATION_REQUIRED` for a missing/invalid/incompatible measured report.
|
||||
A configured profile is a prerequisite, not proof of provider access. These
|
||||
safe codes never return keys or native provider errors. HTTP authentication
|
||||
failures normalize to `AUTH_REQUIRED`, CSRF to `CSRF_INVALID`, hidden resources
|
||||
to `NOT_FOUND`, admission throttling to `RATE_LIMITED` with Retry-After, and
|
||||
unexpected dependency failures to `DEPENDENCY_UNAVAILABLE`.
|
||||
|
||||
Reference in New Issue
Block a user