Files
rag-technical-docs-assistant/tests/support/local_s2s_runtime.py
11linear11 a94b8cd3ea feat(voice): implement local S2S retained history and provider selection
Add pinned CPU engine dependencies, retained interrupted-response history, provider admission, offline evaluation and isolated browser tooling.

Record Phase 2 acceptance and Phase 3/4 preparation, bounded paid-test accounting and interruption incident findings. Human interruption acceptance, paired OpenAI evaluation and rollback remain pending.
2026-10-16 17:09:27 -04:00

25 lines
1.3 KiB
Python

"""Shared runtime with local adapter and explicitly simulated native setup I/O."""
from uuid import uuid4
from app.infrastructure.local_s2s import LocalS2SAdapter
from app.modules.voice.runtime import VoiceRuntime
from app.modules.voice.settings import RuntimeSettings
from tests.unit.test_local_s2s_phase2 import local_config, confirmed
from tests.unit.test_realtime_phase1 import Transport, commands, until
async def make_local(service, runner, persisted):
wire, output = Transport(), []
adapter = LocalS2SAdapter(wire, config=local_config(local_s2s_retain_interrupted_answers=True),
settings=RuntimeSettings(_env_file=None))
async def emit(event):output.append(event)
async def authority(execution):
return persisted['enabled'] and execution.capture(
dict(id=execution.user_id,organization_id='fixture',role='user'),persisted['epoch'])
runtime = VoiceRuntime(adapter,service,runner,uuid4(),emit,authority_check=authority)
await runtime.start()
await until(lambda:commands(wire,'session.update'))
session=confirmed(adapter);session['id']='fixture-native-session'
await runtime.handle(dict(type='session.updated',session=session))
await until(lambda:runtime.ready)
return runtime,wire,output