feat(vela): start mocked response flow after push-to-talk commit

This commit is contained in:
2026-04-08 21:20:17 +02:00
parent 98bcc543f5
commit 28712443cc
8 changed files with 284 additions and 25 deletions

View File

@@ -63,7 +63,7 @@ type ClientEvent =
- a mocked turn emits deterministic `transcript.final`, `response.text.delta`, `response.completed`, and `session.state` events in protocol-valid order
- `input_audio.append` updates the ephemeral session record and moves the session to `listening`
- each accepted `input_audio.append` emits one deterministic `transcript.partial` for the current placeholder turn
- `input_audio.commit` emits exactly one deterministic `transcript.final`, resets the minimal buffered state, and returns the session to `idle`
- `input_audio.commit` emits exactly one deterministic `transcript.final` and then starts the same deterministic mocked assistant response stream used by `mocked.turn.trigger`
- after a completed placeholder input cycle, the same socket can still send `mocked.turn.trigger`
- `response.cancel` is safe to send even when no mocked turn is active
- `response.cancel` stops any still-pending mocked turn events for the active turn and resets the minimal session state back to `idle`
@@ -92,7 +92,7 @@ Notes:
- the UI disables the mic control while disconnected, before `session.ready`, or while a mocked turn is already in flight
- pressing the mic control sends one placeholder `input_audio.append` chunk and releasing it sends `input_audio.commit`
- while a placeholder push-to-talk turn is in progress, the UI renders the latest `transcript.partial`
- after placeholder commit, the UI renders the `transcript.final` and clears the partial-only display
- after placeholder commit, the UI renders the `transcript.final`, clears the partial-only display, and streams the mocked assistant text from the downstream response events
- the UI copy explicitly labels the mic button as a control shell and not real microphone capture
- the UI shows a cancel control and enables it only while a mocked turn is active
- after cancel returns the gateway to `idle`, the UI clears the active-turn indicator but keeps any transcript or response text that was already rendered
@@ -147,9 +147,9 @@ Notes:
- no audio, STT, LLM, TTS, or external providers participate in this flow
- `response.cancel` can stop the mocked turn early, suppress any later mocked response events for that turn, and return the session to `idle`
### Deterministic placeholder push-to-talk transcript sequence
### Deterministic placeholder push-to-talk transcript and mocked response sequence
For this increment, the existing mic-control shell still sends placeholder `input_audio.append` on press and `input_audio.commit` on release. The gateway now translates that shell flow into deterministic mocked transcript events only:
For this increment, the existing mic-control shell still sends placeholder `input_audio.append` on press and `input_audio.commit` on release. The gateway now translates that shell flow into deterministic mocked transcript events and then reuses the existing mocked response stream:
```text
input_audio.append #1
@@ -161,6 +161,11 @@ input_audio.append #N (N > 1)
input_audio.commit after N appends
→ transcript.final("[mocked final] Placeholder push-to-talk transcript completed from N appended chunk(s).")
→ session.state(thinking)
→ session.state(speaking)
→ response.text.delta("[mocked assistant] ")
→ response.text.delta("This is a deterministic mocked response from the gateway vertical slice.")
→ response.completed
→ session.state(idle)
```
@@ -168,7 +173,8 @@ Safe deterministic edge cases for this mocked placeholder flow:
- commit without any prior append is accepted and emits `transcript.final("[mocked final] Placeholder push-to-talk transcript completed without appended audio.")`
- repeated appends during one placeholder turn are accepted and each append replaces the latest partial transcript with a chunk-count-based deterministic value
- placeholder commit does not automatically start assistant thinking, response streaming, or audio playback
- after the final transcript, placeholder commit follows the same mocked `thinking → speaking response.text.delta* → response.completed → idle` path as `mocked.turn.trigger`
- `response.cancel` can interrupt this mocked post-commit response path the same way it interrupts `mocked.turn.trigger`; already-rendered transcript or assistant text is not retracted
## Contract Scope for This Increment
@@ -200,6 +206,7 @@ Current mocked-pipeline behavior:
- during an active mocked turn, `response.cancel` returns the session to `idle` immediately
- any mocked turn timers that have not fired yet are dropped, so no later `response.text.delta` or `response.completed` events are emitted for the cancelled turn
- the same cancellation behavior applies when a mocked turn was started by `input_audio.commit`
- once `idle` is restored, the same WebSocket session can start another mocked turn without reconnecting
More general future-state expectations: