feat(vela): support end-to-end mocked turn cancelation
This commit is contained in:
@@ -41,7 +41,7 @@ Prove the end-to-end interaction model with mocked or stubbed providers.
|
||||
- implement mocked STT flow for partial transcript events
|
||||
- implement mocked LLM response streaming beyond the fixed deterministic slice
|
||||
- implement stubbed audio playback or placeholder TTS output
|
||||
- implement interrupt handling across the mocked pipeline
|
||||
- [x] implement interrupt handling across the mocked pipeline
|
||||
|
||||
### Exit Criteria
|
||||
|
||||
@@ -188,5 +188,7 @@ Polish the system after the core voice loop is reliable.
|
||||
- `apps/vela-gateway` now boots as a minimal Fastify app with `/` and `/health` endpoints
|
||||
- `apps/vela-gateway` now exposes a minimal `/ws` WebSocket session skeleton with ephemeral in-memory sessions and defensive message handling
|
||||
- `apps/vela-gateway` now accepts `mocked.turn.trigger` and emits protocol-valid mocked transcript/response events with one in-flight mocked turn per session
|
||||
- `apps/vela-ui` now exposes a cancel control for active mocked turns and keeps already-rendered transcript/response text visible after cancellation
|
||||
- `apps/vela-gateway` now honors `response.cancel` during mocked turns by stopping pending mocked response events, returning the session to `idle`, and allowing a new mocked turn on the same socket
|
||||
- `apps/vela-protocol` now provides the shared WebSocket event contract for the UI and gateway
|
||||
- backend framework choice is now concrete: Fastify
|
||||
|
||||
@@ -62,7 +62,8 @@ 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`
|
||||
- `input_audio.commit` resets the minimal buffered state and returns the session to `idle`
|
||||
- `response.cancel` resets the minimal session state back to `idle`
|
||||
- `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`
|
||||
- a second mocked-turn trigger during an active mocked turn produces `error` with code `mocked_turn_in_flight`
|
||||
- malformed JSON produces `error` with code `invalid_json`
|
||||
- invalid envelopes or unsupported client event names produce `error` with code `invalid_message`
|
||||
@@ -85,6 +86,8 @@ Notes:
|
||||
- this UI state is transport-oriented and is separate from the shared gateway `session.state` payload
|
||||
- `session.state` currently reflects the gateway session phase (`idle`, `listening`, `thinking`, `speaking`)
|
||||
- the UI disables the mocked-turn control until `session.ready` arrives, while disconnected, or while a mocked turn is already in flight
|
||||
- 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
|
||||
- the UI treats malformed server messages, browser WebSocket errors, and gateway `error` events as safe error states instead of throwing
|
||||
|
||||
### Server → Client
|
||||
@@ -134,7 +137,7 @@ Notes:
|
||||
|
||||
- the content is intentionally fixed and obviously mocked
|
||||
- no audio, STT, LLM, TTS, or external providers participate in this flow
|
||||
- `response.cancel` can stop the mocked turn early and return the session to `idle`
|
||||
- `response.cancel` can stop the mocked turn early, suppress any later mocked response events for that turn, and return the session to `idle`
|
||||
|
||||
## Contract Scope for This Increment
|
||||
|
||||
@@ -162,6 +165,14 @@ idle
|
||||
→ idle
|
||||
```
|
||||
|
||||
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
|
||||
- once `idle` is restored, the same WebSocket session can start another mocked turn without reconnecting
|
||||
|
||||
More general future-state expectations:
|
||||
|
||||
`response.cancel` can occur at:
|
||||
|
||||
- listening → restart
|
||||
|
||||
Reference in New Issue
Block a user