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,31 @@
|
||||
"""Enforce the Live owner chain without rewriting applied revision 0004."""
|
||||
from alembic import op
|
||||
revision = '0005_live_owner_chain'
|
||||
down_revision = '0004_live_lifecycle'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
def upgrade(**kwargs):
|
||||
op.execute('''
|
||||
ALTER TABLE conversations ADD CONSTRAINT uq_conversation_owner UNIQUE (organization_id, owner_user_id, id);
|
||||
ALTER TABLE auth_sessions ADD CONSTRAINT uq_auth_owner UNIQUE (organization_id, user_id, id);
|
||||
ALTER TABLE live_sessions ADD CONSTRAINT fk_live_conversation_owner
|
||||
FOREIGN KEY (organization_id, owner_user_id, conversation_id)
|
||||
REFERENCES conversations (organization_id, owner_user_id, id) ON DELETE CASCADE;
|
||||
ALTER TABLE live_sessions ADD CONSTRAINT fk_live_auth_owner
|
||||
FOREIGN KEY (organization_id, owner_user_id, auth_session_id)
|
||||
REFERENCES auth_sessions (organization_id, user_id, id) ON DELETE CASCADE;
|
||||
ALTER TABLE tool_calls ADD COLUMN public_ref uuid;
|
||||
UPDATE tool_calls SET public_ref=id;
|
||||
ALTER TABLE tool_calls ALTER COLUMN public_ref SET NOT NULL;
|
||||
ALTER TABLE tool_calls ADD CONSTRAINT uq_tool_public_ref UNIQUE (public_ref);
|
||||
''')
|
||||
|
||||
def downgrade(**kwargs):
|
||||
op.execute('''
|
||||
ALTER TABLE tool_calls DROP COLUMN public_ref;
|
||||
ALTER TABLE live_sessions DROP CONSTRAINT fk_live_auth_owner;
|
||||
ALTER TABLE live_sessions DROP CONSTRAINT fk_live_conversation_owner;
|
||||
ALTER TABLE auth_sessions DROP CONSTRAINT uq_auth_owner;
|
||||
ALTER TABLE conversations DROP CONSTRAINT uq_conversation_owner;
|
||||
''')
|
||||
Reference in New Issue
Block a user