@bytexbyte/nxtlinq-ai-agent-sdk 1.6.17 → 1.6.19

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAovElD,CAAC"}
1
+ {"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAwvElD,CAAC"}
@@ -71,7 +71,7 @@ isStopRecordingOnSend = false, }) => {
71
71
  : React.useState(presetMessages);
72
72
  const [isAITEnabling, setIsAITEnabling] = React.useState(false);
73
73
  const [isAwaitingMicGesture, setIsAwaitingMicGesture] = React.useState(false);
74
- const [autoSendEnabled, setAutoSendEnabled] = React.useState(false);
74
+ const [autoSendEnabled, setAutoSendEnabled] = useLocalStorage('chatbot-auto-send-enabled', true);
75
75
  // Use refs to get latest state values in hasPermission function
76
76
  const hitAddressRef = React.useRef(hitAddress);
77
77
  const aitRef = React.useRef(ait);
@@ -201,10 +201,13 @@ isStopRecordingOnSend = false, }) => {
201
201
  // Reset auto-sent transcript ref when starting new recording
202
202
  if (isMicEnabled) {
203
203
  lastAutoSentTranscriptRef.current = '';
204
- }
205
- else {
206
- // Reset auto send when mic is disabled
207
- setAutoSendEnabled(false);
204
+ // Hide gesture prompt once mic is actually enabled
205
+ setIsAwaitingMicGesture(false);
206
+ // Remove any pending gesture listeners
207
+ if (autoStartGestureCleanupRef.current) {
208
+ autoStartGestureCleanupRef.current();
209
+ autoStartGestureCleanupRef.current = null;
210
+ }
208
211
  }
209
212
  }, [isMicEnabled]);
210
213
  React.useEffect(() => {
@@ -340,7 +343,7 @@ isStopRecordingOnSend = false, }) => {
340
343
  // Check mic status after a short delay
341
344
  await new Promise(resolve => setTimeout(resolve, 300));
342
345
  // If mic started successfully, hide the prompt
343
- if (isMicEnabled) {
346
+ if (isMicEnabledRef.current) {
344
347
  pendingMicAutoStartRef.current = false;
345
348
  setIsAwaitingMicGesture(false);
346
349
  cleanupAutoStartListeners();
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/lib/useSpeechToTextFromMic/index.ts"],"names":[],"mappings":"AAIA,UAAU,KAAK;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,KAAK,4BAA4B,GAAG;IAClC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,SAAS,EACT,mBAA0B,GAC3B,EAAE,KAAK,GAAG,4BAA4B,CA4EtC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/lib/useSpeechToTextFromMic/index.ts"],"names":[],"mappings":"AAIA,UAAU,KAAK;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,KAAK,4BAA4B,GAAG;IAClC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,SAAS,EACT,mBAA0B,GAC3B,EAAE,KAAK,GAAG,4BAA4B,CAsGtC"}
@@ -48,6 +48,30 @@ export function useSpeechToTextFromMic({ apiKey, apiSecret, autoClearTranscript
48
48
  setIsMicEnabled(false);
49
49
  setRecognizer(undefined);
50
50
  }, [recognizer, setRecognizer]);
51
+ // Keep UI state in sync if recognizer stops or gets canceled by the SDK/browser
52
+ useEffect(() => {
53
+ if (!recognizer)
54
+ return;
55
+ const prevCanceled = recognizer.canceled;
56
+ const prevSessionStopped = recognizer.sessionStopped;
57
+ recognizer.canceled = (s, e) => {
58
+ setIsMicEnabled(false);
59
+ if (prevCanceled)
60
+ prevCanceled(s, e);
61
+ };
62
+ recognizer.sessionStopped = (s, e) => {
63
+ setIsMicEnabled(false);
64
+ if (prevSessionStopped)
65
+ prevSessionStopped(s, e);
66
+ };
67
+ return () => {
68
+ // No explicit detach API; restoring previous handlers to avoid leaks
69
+ if (recognizer) {
70
+ recognizer.canceled = prevCanceled;
71
+ recognizer.sessionStopped = prevSessionStopped;
72
+ }
73
+ };
74
+ }, [recognizer]);
51
75
  useEffect(() => {
52
76
  if (autoClearTranscript && transcriptArray.length > 0) {
53
77
  const timer = setTimeout(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/nxtlinq-ai-agent-sdk",
3
- "version": "1.6.17",
3
+ "version": "1.6.19",
4
4
  "description": "Nxtlinq AI Agent SDK - Proprietary Software with enhanced async operation handling",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",