Widget error reporting and startAgent connect-failure contract
The voice-agent widget now reports real failure codes on widget.error instead of always-unknown, and startAgent() connect failures arrive on the promise rejection rather than duplicating across onError and the rejection channel.
widget.error used to always carry errorCode: "unknown" and show visitors the same generic message regardless of the actual failure. The cause was two bundles each inlining their own WidgetError constructor, so the per-code message table was dead at runtime.
That is fixed. Every widget failure now reports its real code — mic_denied, insecure_context, session_rejected, connection_lost and the rest — with a message written for the failure that happened. Visitors see “Microphone access was blocked. Allow it in your browser settings to talk.” instead of “Something went wrong starting the call.”
Worth knowing if you plan to branch on this: the widget’s code and the platform’s error code are separate fields. A refused session mint is always code: "session_rejected", with the specific reason — spend_budget_exceeded, say — on serverCode. The full table is in the embed guide.
Separately, startAgent() no longer sends connect failures through two channels. Previously a refused mic, a failed session mint, or a transport that never came up was delivered to onError and also threw — so one visitor-visible failure was reported twice and inflated widget.error on the class most likely to be actioned. These now arrive on the promise rejection only.
The <speechify-agent> element is unaffected — it still raises its event for both categories.
See the docs changelog for the full details.