@agent-native/toolkit 0.14.2 → 0.15.0
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.
- package/dist/composer/ComposerPlusMenu.d.ts.map +1 -1
- package/dist/composer/ComposerPlusMenu.js +131 -35
- package/dist/composer/ComposerPlusMenu.js.map +1 -1
- package/dist/composer/MentionPopover.d.ts.map +1 -1
- package/dist/composer/MentionPopover.js +40 -5
- package/dist/composer/MentionPopover.js.map +1 -1
- package/dist/composer/PastedTextChip.d.ts.map +1 -1
- package/dist/composer/PastedTextChip.js +26 -2
- package/dist/composer/PastedTextChip.js.map +1 -1
- package/dist/composer/PastedTextChip.spec.d.ts +2 -0
- package/dist/composer/PastedTextChip.spec.d.ts.map +1 -0
- package/dist/composer/PastedTextChip.spec.js +42 -0
- package/dist/composer/PastedTextChip.spec.js.map +1 -0
- package/dist/composer/PromptComposer.d.ts.map +1 -1
- package/dist/composer/PromptComposer.js +26 -5
- package/dist/composer/PromptComposer.js.map +1 -1
- package/dist/composer/TiptapComposer.d.ts +5 -3
- package/dist/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/composer/TiptapComposer.js +291 -80
- package/dist/composer/TiptapComposer.js.map +1 -1
- package/dist/composer/TiptapComposer.spec.js +60 -3
- package/dist/composer/TiptapComposer.spec.js.map +1 -1
- package/dist/composer/VoiceButton.d.ts.map +1 -1
- package/dist/composer/VoiceButton.js +24 -5
- package/dist/composer/VoiceButton.js.map +1 -1
- package/dist/composer/runtime-adapters.d.ts +1 -0
- package/dist/composer/runtime-adapters.d.ts.map +1 -1
- package/dist/composer/runtime-adapters.js +8 -1
- package/dist/composer/runtime-adapters.js.map +1 -1
- package/dist/composer/runtime-adapters.spec.js +15 -0
- package/dist/composer/runtime-adapters.spec.js.map +1 -1
- package/dist/composer/useRealtimeVoiceMode.d.ts.map +1 -1
- package/dist/composer/useRealtimeVoiceMode.js +204 -68
- package/dist/composer/useRealtimeVoiceMode.js.map +1 -1
- package/dist/composer/useRealtimeVoiceMode.spec.js +27 -1
- package/dist/composer/useRealtimeVoiceMode.spec.js.map +1 -1
- package/dist/context-ui/ContextMeter.d.ts +3 -2
- package/dist/context-ui/ContextMeter.d.ts.map +1 -1
- package/dist/context-ui/ContextMeter.js +23 -3
- package/dist/context-ui/ContextMeter.js.map +1 -1
- package/dist/context-ui/ContextMeter.spec.d.ts +2 -0
- package/dist/context-ui/ContextMeter.spec.d.ts.map +1 -0
- package/dist/context-ui/ContextMeter.spec.js +52 -0
- package/dist/context-ui/ContextMeter.spec.js.map +1 -0
- package/dist/context-ui/ContextSegmentRow.d.ts +5 -3
- package/dist/context-ui/ContextSegmentRow.d.ts.map +1 -1
- package/dist/context-ui/ContextSegmentRow.js +74 -7
- package/dist/context-ui/ContextSegmentRow.js.map +1 -1
- package/dist/context-ui/ContextTreemap.d.ts +3 -2
- package/dist/context-ui/ContextTreemap.d.ts.map +1 -1
- package/dist/context-ui/ContextTreemap.js +5 -2
- package/dist/context-ui/ContextTreemap.js.map +1 -1
- package/dist/context-ui/ContextXRayPanel.d.ts +3 -2
- package/dist/context-ui/ContextXRayPanel.d.ts.map +1 -1
- package/dist/context-ui/ContextXRayPanel.js +112 -23
- package/dist/context-ui/ContextXRayPanel.js.map +1 -1
- package/dist/context-ui/types.d.ts +2 -0
- package/dist/context-ui/types.d.ts.map +1 -1
- package/dist/context-ui/types.js +7 -1
- package/dist/context-ui/types.js.map +1 -1
- package/package.json +2 -2
- package/src/composer/ComposerPlusMenu.tsx +170 -52
- package/src/composer/MentionPopover.tsx +43 -7
- package/src/composer/PastedTextChip.spec.tsx +58 -0
- package/src/composer/PastedTextChip.tsx +35 -7
- package/src/composer/PromptComposer.tsx +28 -7
- package/src/composer/TiptapComposer.spec.ts +90 -3
- package/src/composer/TiptapComposer.tsx +341 -82
- package/src/composer/VoiceButton.tsx +36 -11
- package/src/composer/runtime-adapters.spec.tsx +19 -0
- package/src/composer/runtime-adapters.tsx +12 -2
- package/src/composer/useRealtimeVoiceMode.spec.ts +34 -0
- package/src/composer/useRealtimeVoiceMode.tsx +219 -69
- package/src/context-ui/ContextMeter.spec.tsx +73 -0
- package/src/context-ui/ContextMeter.tsx +34 -4
- package/src/context-ui/ContextSegmentRow.tsx +111 -22
- package/src/context-ui/ContextTreemap.tsx +7 -1
- package/src/context-ui/ContextXRayPanel.tsx +138 -24
- package/src/context-ui/types.ts +14 -0
|
@@ -4,7 +4,7 @@ import { createPortal } from "react-dom";
|
|
|
4
4
|
import { createRealtimeVoiceAudioLevelStore, normalizeRealtimeVoiceRms, smoothRealtimeVoiceLevel, } from "./realtime-voice-audio-level.js";
|
|
5
5
|
import { realtimeVoiceTranscriptRegistry } from "./realtime-voice-transcript.js";
|
|
6
6
|
import { RealtimeVoiceModeDock, } from "./RealtimeVoiceMode.js";
|
|
7
|
-
import { useComposerRuntimeAdapters } from "./runtime-adapters.js";
|
|
7
|
+
import { useComposerRuntimeAdapters, } from "./runtime-adapters.js";
|
|
8
8
|
const REALTIME_VOICE_STATE_KEY = "realtime-voice-session";
|
|
9
9
|
const REALTIME_VOICE_PREFERENCES_KEY = "realtime-voice-prefs";
|
|
10
10
|
const REALTIME_VOICE_REQUEST_SOURCE = "realtime-voice";
|
|
@@ -818,75 +818,189 @@ export function listenForRealtimeVoicePageHide(cleanup) {
|
|
|
818
818
|
}
|
|
819
819
|
function voiceCopy(t) {
|
|
820
820
|
return {
|
|
821
|
-
entryButtonLabel: t("
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
821
|
+
entryButtonLabel: t("agentChat.voiceMode.entryButtonLabel", {
|
|
822
|
+
defaultValue: "Use microphone",
|
|
823
|
+
}),
|
|
824
|
+
promptTitle: t("agentChat.voiceMode.promptTitle", {
|
|
825
|
+
defaultValue: "Use your voice",
|
|
826
|
+
}),
|
|
827
|
+
promptDescription: t("agentChat.voiceMode.promptDescription", {
|
|
828
|
+
defaultValue: "Voice mode keeps listening while the agent navigates and takes actions.",
|
|
829
|
+
}),
|
|
830
|
+
setupTitle: t("agentChat.voiceMode.setupTitle", {
|
|
831
|
+
defaultValue: "Set up voice mode",
|
|
832
|
+
}),
|
|
833
|
+
setupDescription: t("agentChat.voiceMode.setupDescription", {
|
|
834
|
+
defaultValue: "Connect Builder.io to use managed voice with free credits, or add your own keys.",
|
|
835
|
+
}),
|
|
836
|
+
connectBuilder: t("agentChat.voiceMode.connectBuilder", {
|
|
837
|
+
defaultValue: "Connect Builder.io",
|
|
838
|
+
}),
|
|
839
|
+
useOpenAiKey: t("agentChat.voiceMode.useOpenAiKey", {
|
|
840
|
+
defaultValue: "Add your own keys",
|
|
841
|
+
}),
|
|
842
|
+
startWithOpenAiKey: t("agentChat.voiceMode.startWithOpenAiKey", {
|
|
843
|
+
defaultValue: "Start with OpenAI key",
|
|
844
|
+
}),
|
|
845
|
+
startVoiceMode: t("agentChat.voiceMode.start", {
|
|
846
|
+
defaultValue: "Real-time voice",
|
|
847
|
+
}),
|
|
848
|
+
keepDictating: t("agentChat.voiceMode.keepDictating", {
|
|
849
|
+
defaultValue: "Dictate",
|
|
850
|
+
}),
|
|
851
|
+
rememberPreference: t("agentChat.voiceMode.rememberPreference", {
|
|
852
|
+
defaultValue: "Remember my preference",
|
|
853
|
+
}),
|
|
854
|
+
showChat: t("agentChat.voiceMode.showChat", {
|
|
855
|
+
defaultValue: "Show chat",
|
|
856
|
+
}),
|
|
857
|
+
hideChat: t("agentChat.voiceMode.hideChat", {
|
|
858
|
+
defaultValue: "Hide chat",
|
|
859
|
+
}),
|
|
860
|
+
endVoiceMode: t("agentChat.voiceMode.end", {
|
|
861
|
+
defaultValue: "End voice mode",
|
|
862
|
+
}),
|
|
863
|
+
voiceSettings: t("agentChat.voiceMode.voiceSettings", {
|
|
864
|
+
defaultValue: "Voice settings",
|
|
865
|
+
}),
|
|
836
866
|
settings: {
|
|
837
|
-
language: t("
|
|
838
|
-
|
|
867
|
+
language: t("agentChat.voiceMode.settings.language", {
|
|
868
|
+
defaultValue: "Language",
|
|
869
|
+
}),
|
|
870
|
+
autoLanguage: t("agentChat.voiceMode.settings.autoLanguage", {
|
|
871
|
+
defaultValue: "Auto",
|
|
872
|
+
}),
|
|
839
873
|
languages: {
|
|
840
|
-
en: t("
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
874
|
+
en: t("agentChat.voiceMode.settings.languages.en", {
|
|
875
|
+
defaultValue: "English",
|
|
876
|
+
}),
|
|
877
|
+
es: t("agentChat.voiceMode.settings.languages.es", {
|
|
878
|
+
defaultValue: "Spanish",
|
|
879
|
+
}),
|
|
880
|
+
fr: t("agentChat.voiceMode.settings.languages.fr", {
|
|
881
|
+
defaultValue: "French",
|
|
882
|
+
}),
|
|
883
|
+
de: t("agentChat.voiceMode.settings.languages.de", {
|
|
884
|
+
defaultValue: "German",
|
|
885
|
+
}),
|
|
886
|
+
it: t("agentChat.voiceMode.settings.languages.it", {
|
|
887
|
+
defaultValue: "Italian",
|
|
888
|
+
}),
|
|
889
|
+
pt: t("agentChat.voiceMode.settings.languages.pt", {
|
|
890
|
+
defaultValue: "Portuguese",
|
|
891
|
+
}),
|
|
892
|
+
ja: t("agentChat.voiceMode.settings.languages.ja", {
|
|
893
|
+
defaultValue: "Japanese",
|
|
894
|
+
}),
|
|
895
|
+
ko: t("agentChat.voiceMode.settings.languages.ko", {
|
|
896
|
+
defaultValue: "Korean",
|
|
897
|
+
}),
|
|
898
|
+
zh: t("agentChat.voiceMode.settings.languages.zh", {
|
|
899
|
+
defaultValue: "Chinese",
|
|
900
|
+
}),
|
|
849
901
|
},
|
|
850
|
-
intelligence: t("
|
|
902
|
+
intelligence: t("agentChat.voiceMode.settings.intelligence", {
|
|
903
|
+
defaultValue: "Intelligence",
|
|
904
|
+
}),
|
|
851
905
|
intelligenceLevels: {
|
|
852
|
-
instant: t("
|
|
853
|
-
|
|
854
|
-
|
|
906
|
+
instant: t("agentChat.voiceMode.settings.intelligenceLevels.instant", {
|
|
907
|
+
defaultValue: "Instant",
|
|
908
|
+
}),
|
|
909
|
+
balanced: t("agentChat.voiceMode.settings.intelligenceLevels.balanced", { defaultValue: "Balanced" }),
|
|
910
|
+
deep: t("agentChat.voiceMode.settings.intelligenceLevels.deep", {
|
|
911
|
+
defaultValue: "Deep",
|
|
912
|
+
}),
|
|
855
913
|
},
|
|
856
|
-
voiceStyle: t("
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
914
|
+
voiceStyle: t("agentChat.voiceMode.settings.voiceStyle", {
|
|
915
|
+
defaultValue: "Voice style",
|
|
916
|
+
}),
|
|
917
|
+
microphone: t("agentChat.voiceMode.settings.microphone", {
|
|
918
|
+
defaultValue: "Microphone",
|
|
919
|
+
}),
|
|
920
|
+
defaultMicrophone: t("agentChat.voiceMode.settings.defaultMicrophone", {
|
|
921
|
+
defaultValue: "System default",
|
|
922
|
+
}),
|
|
923
|
+
microphoneSwitchFailed: t("agentChat.voiceMode.settings.microphoneSwitchFailed", {
|
|
924
|
+
defaultValue: "Could not switch microphones. Your current microphone is still active.",
|
|
925
|
+
}),
|
|
926
|
+
voiceChangePending: t("agentChat.voiceMode.settings.voiceChangePending", {
|
|
927
|
+
defaultValue: "Your new voice will apply next time you start voice mode.",
|
|
928
|
+
}),
|
|
861
929
|
voiceDescriptions: {
|
|
862
|
-
marin: t("
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
930
|
+
marin: t("agentChat.voiceMode.settings.voiceDescriptions.marin", {
|
|
931
|
+
defaultValue: "Warm and natural",
|
|
932
|
+
}),
|
|
933
|
+
cedar: t("agentChat.voiceMode.settings.voiceDescriptions.cedar", {
|
|
934
|
+
defaultValue: "Clear and grounded",
|
|
935
|
+
}),
|
|
936
|
+
coral: t("agentChat.voiceMode.settings.voiceDescriptions.coral", {
|
|
937
|
+
defaultValue: "Friendly and bright",
|
|
938
|
+
}),
|
|
939
|
+
sage: t("agentChat.voiceMode.settings.voiceDescriptions.sage", {
|
|
940
|
+
defaultValue: "Calm and thoughtful",
|
|
941
|
+
}),
|
|
942
|
+
verse: t("agentChat.voiceMode.settings.voiceDescriptions.verse", {
|
|
943
|
+
defaultValue: "Expressive and versatile",
|
|
944
|
+
}),
|
|
945
|
+
alloy: t("agentChat.voiceMode.settings.voiceDescriptions.alloy", {
|
|
946
|
+
defaultValue: "Balanced and neutral",
|
|
947
|
+
}),
|
|
948
|
+
ash: t("agentChat.voiceMode.settings.voiceDescriptions.ash", {
|
|
949
|
+
defaultValue: "Smooth and confident",
|
|
950
|
+
}),
|
|
951
|
+
ballad: t("agentChat.voiceMode.settings.voiceDescriptions.ballad", {
|
|
952
|
+
defaultValue: "Warm and expressive",
|
|
953
|
+
}),
|
|
954
|
+
echo: t("agentChat.voiceMode.settings.voiceDescriptions.echo", {
|
|
955
|
+
defaultValue: "Clear and direct",
|
|
956
|
+
}),
|
|
957
|
+
shimmer: t("agentChat.voiceMode.settings.voiceDescriptions.shimmer", {
|
|
958
|
+
defaultValue: "Light and upbeat",
|
|
959
|
+
}),
|
|
872
960
|
},
|
|
873
961
|
},
|
|
874
962
|
status: {
|
|
875
|
-
connecting: t("
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
963
|
+
connecting: t("agentChat.voiceMode.status.connecting", {
|
|
964
|
+
defaultValue: "Connecting",
|
|
965
|
+
}),
|
|
966
|
+
listening: t("agentChat.voiceMode.status.listening", {
|
|
967
|
+
defaultValue: "Listening",
|
|
968
|
+
}),
|
|
969
|
+
speaking: t("agentChat.voiceMode.status.speaking", {
|
|
970
|
+
defaultValue: "Speaking",
|
|
971
|
+
}),
|
|
972
|
+
working: t("agentChat.voiceMode.status.working", {
|
|
973
|
+
defaultValue: "Working",
|
|
974
|
+
}),
|
|
975
|
+
error: t("agentChat.voiceMode.status.error", {
|
|
976
|
+
defaultValue: "Voice mode needs attention",
|
|
977
|
+
}),
|
|
978
|
+
ending: t("agentChat.voiceMode.status.ending", {
|
|
979
|
+
defaultValue: "Ending voice mode",
|
|
980
|
+
}),
|
|
881
981
|
},
|
|
882
982
|
errors: {
|
|
883
|
-
unsupported: t("
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
983
|
+
unsupported: t("agentChat.voiceMode.errors.unsupported", {
|
|
984
|
+
defaultValue: "This browser does not support realtime voice conversations.",
|
|
985
|
+
}),
|
|
986
|
+
responseFailed: t("agentChat.voiceMode.errors.responseFailed", {
|
|
987
|
+
defaultValue: "OpenAI could not complete the voice response.",
|
|
988
|
+
}),
|
|
989
|
+
sessionFailed: t("agentChat.voiceMode.errors.sessionFailed", {
|
|
990
|
+
defaultValue: "The realtime voice session encountered an error.",
|
|
991
|
+
}),
|
|
992
|
+
channelDisconnected: t("agentChat.voiceMode.errors.channelDisconnected", {
|
|
993
|
+
defaultValue: "The realtime voice control channel disconnected.",
|
|
994
|
+
}),
|
|
995
|
+
connectionTimedOut: t("agentChat.voiceMode.errors.connectionTimedOut", {
|
|
996
|
+
defaultValue: "The realtime voice connection timed out. Try again after the app finishes loading.",
|
|
997
|
+
}),
|
|
998
|
+
connectionFailed: t("agentChat.voiceMode.errors.connectionFailed", {
|
|
999
|
+
defaultValue: "The realtime voice connection failed.",
|
|
1000
|
+
}),
|
|
1001
|
+
offerFailed: t("agentChat.voiceMode.errors.offerFailed", {
|
|
1002
|
+
defaultValue: "The browser did not create an audio offer.",
|
|
1003
|
+
}),
|
|
890
1004
|
},
|
|
891
1005
|
};
|
|
892
1006
|
}
|
|
@@ -896,6 +1010,7 @@ export function useRealtimeVoiceModeCopy() {
|
|
|
896
1010
|
}
|
|
897
1011
|
function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
898
1012
|
const adapters = useComposerRuntimeAdapters();
|
|
1013
|
+
const t = adapters.translate;
|
|
899
1014
|
const [state, setState] = useState("idle");
|
|
900
1015
|
const [error, setError] = useState(null);
|
|
901
1016
|
const [chatVisible, setChatVisible] = useState(false);
|
|
@@ -1045,7 +1160,11 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1045
1160
|
device.deviceId !== "communications")
|
|
1046
1161
|
.map((device, index) => ({
|
|
1047
1162
|
deviceId: device.deviceId,
|
|
1048
|
-
label: device.label ||
|
|
1163
|
+
label: device.label ||
|
|
1164
|
+
t("agentChat.voiceMode.settings.microphoneNumber", {
|
|
1165
|
+
number: index + 1,
|
|
1166
|
+
defaultValue: `Microphone ${index + 1}`,
|
|
1167
|
+
}),
|
|
1049
1168
|
}));
|
|
1050
1169
|
setMicrophones(inputs);
|
|
1051
1170
|
return inputs;
|
|
@@ -1054,7 +1173,7 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1054
1173
|
// Enumeration is progressive enhancement; system default remains usable.
|
|
1055
1174
|
return null;
|
|
1056
1175
|
}
|
|
1057
|
-
}, []);
|
|
1176
|
+
}, [t]);
|
|
1058
1177
|
const startMeterLoop = useCallback(() => {
|
|
1059
1178
|
if (meterFrameRef.current !== null)
|
|
1060
1179
|
return;
|
|
@@ -1145,7 +1264,9 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1145
1264
|
}
|
|
1146
1265
|
catch {
|
|
1147
1266
|
setMicrophoneError(copy?.settings.microphoneSwitchFailed ??
|
|
1148
|
-
"
|
|
1267
|
+
t("agentChat.voiceMode.settings.microphoneSwitchFailed", {
|
|
1268
|
+
defaultValue: "Could not switch microphones. Your current microphone is still active.",
|
|
1269
|
+
}));
|
|
1149
1270
|
}
|
|
1150
1271
|
finally {
|
|
1151
1272
|
setMicrophoneSwitching(false);
|
|
@@ -1156,6 +1277,7 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1156
1277
|
microphoneDeviceId,
|
|
1157
1278
|
microphoneSwitching,
|
|
1158
1279
|
refreshMicrophones,
|
|
1280
|
+
t,
|
|
1159
1281
|
]);
|
|
1160
1282
|
switchMicrophoneRef.current = setMicrophone;
|
|
1161
1283
|
const cleanupTransport = useCallback(() => {
|
|
@@ -1354,7 +1476,9 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1354
1476
|
}
|
|
1355
1477
|
fail(message ||
|
|
1356
1478
|
copy?.errors.sessionFailed ||
|
|
1357
|
-
"
|
|
1479
|
+
t("agentChat.voiceMode.errors.sessionFailed", {
|
|
1480
|
+
defaultValue: "The realtime voice session encountered an error.",
|
|
1481
|
+
}));
|
|
1358
1482
|
return;
|
|
1359
1483
|
}
|
|
1360
1484
|
const calls = extractRealtimeVoiceFunctionCalls(event);
|
|
@@ -1369,6 +1493,7 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1369
1493
|
greetingStarter,
|
|
1370
1494
|
handleFunctionCall,
|
|
1371
1495
|
syncAppState,
|
|
1496
|
+
t,
|
|
1372
1497
|
transcriptSequencer,
|
|
1373
1498
|
transition,
|
|
1374
1499
|
responseCoordinator,
|
|
@@ -1381,7 +1506,9 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1381
1506
|
if (typeof RTCPeerConnection === "undefined" ||
|
|
1382
1507
|
!navigator.mediaDevices?.getUserMedia) {
|
|
1383
1508
|
fail(copy?.errors.unsupported ??
|
|
1384
|
-
"
|
|
1509
|
+
t("agentChat.voiceMode.errors.unsupported", {
|
|
1510
|
+
defaultValue: "This browser does not support realtime voice conversations.",
|
|
1511
|
+
}));
|
|
1385
1512
|
return;
|
|
1386
1513
|
}
|
|
1387
1514
|
setError(null);
|
|
@@ -1409,7 +1536,9 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1409
1536
|
if (!isCurrentAttempt())
|
|
1410
1537
|
return;
|
|
1411
1538
|
fail(copy?.errors.connectionTimedOut ??
|
|
1412
|
-
"
|
|
1539
|
+
t("agentChat.voiceMode.errors.connectionTimedOut", {
|
|
1540
|
+
defaultValue: "The realtime voice connection timed out.",
|
|
1541
|
+
}));
|
|
1413
1542
|
});
|
|
1414
1543
|
connectionGateRef.current = connectionGate;
|
|
1415
1544
|
try {
|
|
@@ -1470,7 +1599,9 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1470
1599
|
if (!isCurrentAttempt())
|
|
1471
1600
|
return;
|
|
1472
1601
|
fail(copy?.errors.channelDisconnected ??
|
|
1473
|
-
"
|
|
1602
|
+
t("agentChat.voiceMode.errors.channelDisconnected", {
|
|
1603
|
+
defaultValue: "The realtime voice control channel disconnected.",
|
|
1604
|
+
}));
|
|
1474
1605
|
};
|
|
1475
1606
|
peer.onconnectionstatechange = () => {
|
|
1476
1607
|
if (!isCurrentAttempt())
|
|
@@ -1480,7 +1611,9 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1480
1611
|
}
|
|
1481
1612
|
if (peer.connectionState === "failed") {
|
|
1482
1613
|
fail(copy?.errors.connectionFailed ??
|
|
1483
|
-
"
|
|
1614
|
+
t("agentChat.voiceMode.errors.connectionFailed", {
|
|
1615
|
+
defaultValue: "The realtime voice connection failed.",
|
|
1616
|
+
}));
|
|
1484
1617
|
}
|
|
1485
1618
|
};
|
|
1486
1619
|
const offer = await peer.createOffer();
|
|
@@ -1491,7 +1624,9 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1491
1624
|
return;
|
|
1492
1625
|
if (!offer.sdp) {
|
|
1493
1626
|
throw new Error(copy?.errors.offerFailed ??
|
|
1494
|
-
"
|
|
1627
|
+
t("agentChat.voiceMode.errors.offerFailed", {
|
|
1628
|
+
defaultValue: "The browser did not create an audio offer.",
|
|
1629
|
+
}));
|
|
1495
1630
|
}
|
|
1496
1631
|
const answer = await createRealtimeVoiceSessionWithCapability(offer.sdp, {
|
|
1497
1632
|
browserTabId,
|
|
@@ -1542,6 +1677,7 @@ function useRealtimeVoiceModeController(browserTabId, copy) {
|
|
|
1542
1677
|
handleServerEvent,
|
|
1543
1678
|
hydratePreferences,
|
|
1544
1679
|
refreshMicrophones,
|
|
1680
|
+
t,
|
|
1545
1681
|
transcriptSequencer,
|
|
1546
1682
|
transition,
|
|
1547
1683
|
]);
|