Lifecycle
Stop, abort, retry, and stale responses
Stop pending announcements when a response is cancelled, and ignore late updates from an older retry.
Stopping a response clears pending text
Send response.interrupted when your app stops a response. Core discards waiting text and prepares a short status update. Adapters do not treat a generic ready state as proof that someone stopped a response.
Tell the runtime when a retry starts
response.retrying cancels the current attempt. Keep one responseId for the logical answer and give each attempt a new responseInstanceId. Core ignores late updates from older attempts.
typescript
runtime.dispatch({
type: "response.retrying",
responseId: "report",
responseInstanceId: "attempt-1",
nextResponseInstanceId: "attempt-2",
attempt: 2,
});How this code works
- 01Identify the replaced attempt
responseInstanceIdnames the active attempt that is being cancelled. - 02Name the new attempt
nextResponseInstanceIdbecomes the accepted attempt for later text and final events. - 03Keep the response ID
responseIdstays the same so the app can treat both attempts as one logical answer.