@fonoster/autopilot 0.22.12 → 0.22.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,19 @@ const interruptPlayback = async ({ context }) => {
25
25
  logger.verbose("called the interruptPlayback action", {
26
26
  mediaSessionRef: context.mediaSessionRef
27
27
  });
28
- await context.voice.stopSpeech();
28
+ try {
29
+ await context.voice.stopSpeech();
30
+ }
31
+ catch (error) {
32
+ // The call may have hung up (or the session otherwise ended) right as we
33
+ // asked it to stop speaking, so the underlying verb never gets a
34
+ // response and rejects. There's nothing left to interrupt at that point,
35
+ // so this is expected and must not escape as an unhandled rejection —
36
+ // this action isn't awaited by the state machine.
37
+ logger.verbose("stopSpeech failed while interrupting playback", {
38
+ mediaSessionRef: context.mediaSessionRef,
39
+ error
40
+ });
41
+ }
29
42
  };
30
43
  exports.interruptPlayback = interruptPlayback;
@@ -28,8 +28,19 @@ exports.doProcessUserRequest = (0, xstate_1.fromPromise)(async ({ input }) => {
28
28
  speechBuffer: context.speechBuffer,
29
29
  hasLateSpeech: context.hasLateSpeech
30
30
  });
31
- // Stop any speech that might be playing
32
- await context.voice.stopSpeech();
31
+ // Stop any speech that might be playing. The call may have already hung
32
+ // up, in which case the underlying verb rejects because it never gets a
33
+ // response - there's nothing left to interrupt, so we swallow it rather
34
+ // than let it fail the whole actor.
35
+ try {
36
+ await context.voice.stopSpeech();
37
+ }
38
+ catch (error) {
39
+ logger.verbose("stopSpeech failed while processing user request", {
40
+ mediaSessionRef: context.mediaSessionRef,
41
+ error
42
+ });
43
+ }
33
44
  const languageModel = context.languageModel;
34
45
  const speech = context.speechBuffer.trim();
35
46
  const response = await languageModel.invoke(speech, context.hasLateSpeech);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/autopilot",
3
- "version": "0.22.12",
3
+ "version": "0.22.14",
4
4
  "description": "Voice AI for the Fonoster platform",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -59,5 +59,5 @@
59
59
  "xstate": "^5.17.3",
60
60
  "zod": "^3.25.76"
61
61
  },
62
- "gitHead": "facc2ea4a1d403afe29ce62f8f8dab3eaedbf015"
62
+ "gitHead": "25916a2a734e3e04dbc6c9b116df5e78bfc31ddb"
63
63
  }