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:
@@ -0,0 +1,24 @@
|
||||
"""Bounded blocking work; timed-out workers retain admission until actual completion."""
|
||||
import asyncio
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from threading import BoundedSemaphore
|
||||
|
||||
_POOL = None
|
||||
_SLOTS = BoundedSemaphore(8)
|
||||
|
||||
async def blocking(function, *args, **kwargs):
|
||||
global _POOL
|
||||
if _POOL is None:
|
||||
_POOL = ThreadPoolExecutor(max_workers=8, thread_name_prefix="live-db")
|
||||
if not _SLOTS.acquire(blocking=False):
|
||||
raise ValueError('SERVICE_BUSY')
|
||||
loop = asyncio.get_running_loop()
|
||||
future = _POOL.submit(function, *args, **kwargs)
|
||||
future.add_done_callback(lambda _: _SLOTS.release())
|
||||
return await asyncio.wait_for(asyncio.shield(asyncio.wrap_future(future, loop=loop)), 6)
|
||||
|
||||
def shutdown_pool():
|
||||
global _POOL
|
||||
if _POOL is not None:
|
||||
_POOL.shutdown(wait=False, cancel_futures=True)
|
||||
_POOL = None
|
||||
Reference in New Issue
Block a user