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
+3 -9
View File
@@ -1,4 +1,4 @@
"""Operator-only diagnostic Gemini/search smoke; no HTTP/text-chat route."""
"""Operator-only diagnostic selected-provider/search smoke; no HTTP/text-chat route."""
import argparse
import asyncio
from dataclasses import asdict
@@ -19,6 +19,7 @@ from app.modules.voice.settings import RuntimeSettings
from app.modules.voice.serialization import bounded_json
from app.modules.voice.configuration import VoiceSettings
from app.infrastructure.voice_provider import create_adapter
def preflight(engine, settings, actor, cutoff):
if cutoff.profile != asdict(settings.embedding_profile):
@@ -50,13 +51,6 @@ async def run(service, runner, actor, config, query, seconds, max_calls):
print(json.dumps(dict(error=dict(code="SMOKE_TIMEOUT"))), file=sys.stderr)
return 1
async def create_adapter(config, limits):
from app.infrastructure.gemini_live import GeminiLiveAdapter, connect_gemini
config.require_voice()
transport = await connect_gemini(config.gemini_api_key.get_secret_value(), config.gemini_model, config.gemini_proxy, limits)
adapter = GeminiLiveAdapter(transport, model=config.gemini_model, voice=config.gemini_voice, settings=limits)
return adapter
async def _run(service, runner, actor, config, query, max_calls, limits):
adapter = await create_adapter(config, limits)
async def emit(event):
@@ -129,7 +123,7 @@ def main(argv=None):
parser.add_argument("--user-id", type=UUID, required=True)
parser.add_argument("--query", required=True)
parser.add_argument("--allow-provider-calls", action="store_true", required=True,
help="Authorize Gemini Live plus up to --max-tool-calls query embeddings")
help="Authorize the selected voice provider plus up to --max-tool-calls query embeddings")
parser.add_argument("--seconds", type=int, choices=range(1, 601), default=90, metavar="1..600")
parser.add_argument("--max-tool-calls", type=int, choices=range(1, 11), default=4, metavar="1..10")
args = parser.parse_args(argv)