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:
@@ -158,6 +158,15 @@ def selection_replace(engine, administrator_id, expected_revision, document_ids)
|
||||
UPDATE organization_settings SET knowledge_revision=:revision,access_epoch=:epoch,
|
||||
updated_by=:actor,updated_at=now() WHERE organization_id=:org
|
||||
"""), dict(org=org, actor=current["id"], revision=revision, epoch=epoch))
|
||||
if removed:
|
||||
conn.execute(text("""UPDATE conversations SET status='stale',updated_at=now() WHERE organization_id=:org AND access_epoch<:epoch AND status='active'"""), {'org': org, 'epoch': epoch})
|
||||
conn.execute(text("""
|
||||
UPDATE live_sessions
|
||||
SET status = 'closed', closed_at = now(), close_reason = 'epoch_invalidated', updated_at = now()
|
||||
WHERE organization_id = :org AND access_epoch < :epoch AND status IN ('creating', 'connecting', 'connected')
|
||||
"""), {"org": org, "epoch": epoch})
|
||||
conn.execute(text("""UPDATE tool_calls SET status='failed',completed_at=now(),error_code='CONTEXT_REVOKED'
|
||||
WHERE organization_id=:org AND access_epoch<:epoch AND status='running'"""), {'org': org, 'epoch': epoch})
|
||||
conn.execute(text("""
|
||||
INSERT INTO audit_events(id,organization_id,actor_user_id,action,metadata)
|
||||
VALUES (:id,:org,:actor,'selection_changed',CAST(:metadata AS jsonb))
|
||||
@@ -165,7 +174,10 @@ def selection_replace(engine, administrator_id, expected_revision, document_ids)
|
||||
metadata=json.dumps(dict(knowledge_revision=revision, access_epoch=epoch,
|
||||
added_document_ids=[str(v) for v in sorted(wanted - old)],
|
||||
removed_document_ids=[str(v) for v in sorted(old - wanted)]))))
|
||||
return result
|
||||
if changed and removed:
|
||||
from app.modules.voice.registry import notify
|
||||
notify(organization_id=org, new_epoch=epoch)
|
||||
return result
|
||||
|
||||
|
||||
class SearchService:
|
||||
|
||||
Reference in New Issue
Block a user