@bytexbyte/nxtlinq-ai-agent-sdk 1.5.1 → 1.5.3

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,EACL,kBAAkB,EAClB,YAAY,EAGb,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAwtDlD,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,EACL,kBAAkB,EAClB,YAAY,EAGb,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA2wDlD,CAAC"}
@@ -869,6 +869,7 @@ requireWalletIDVVerification = true }) => {
869
869
  timestamp: new Date().toISOString(),
870
870
  button: 'continue'
871
871
  }]);
872
+ return;
872
873
  }
873
874
  catch (signInError) {
874
875
  console.log('Auto sign-in failed, showing error message');
@@ -946,19 +947,66 @@ requireWalletIDVVerification = true }) => {
946
947
  permissionDenied = true;
947
948
  }
948
949
  if (!isToolAllowed) {
949
- setIsLoading(false);
950
- if (permissionDenied)
950
+ // If permission denied due to missing AIT permission return
951
+ if (permissionDenied) {
952
+ setIsLoading(false);
951
953
  return;
952
- if (wasAutoConnected) {
953
- // ✅ 不自動重試,改成丟出一顆 Continue
954
- setMessages(prev => [...prev, {
955
- id: Date.now().toString(),
956
- content: 'Click button to continue tool',
957
- role: 'assistant',
958
- timestamp: new Date().toISOString(),
959
- button: 'continue'
960
- }]);
961
954
  }
955
+ // Only retry for auto-connect/auto-sign-in scenarios
956
+ if (wasAutoConnected && retryCount < 1) {
957
+ console.log('Auto-connected, retrying message...');
958
+ // Clear loading state and retry immediately
959
+ setIsLoading(false);
960
+ // Check if wallet is already signed in
961
+ const currentToken = nxtlinqAITServiceAccessTokenRef.current;
962
+ if (!currentToken) {
963
+ // If not signed in, directly retry the message without waiting for AIT
964
+ console.log('Wallet connected but not signed in, retrying message directly');
965
+ setTimeout(() => {
966
+ sendMessage(content, retryCount + 1, isPresetMessage);
967
+ }, 2000);
968
+ }
969
+ else {
970
+ // If already signed in, wait for AIT to be fully loaded before retrying
971
+ setTimeout(async () => {
972
+ // Wait for AIT to be loaded if needed
973
+ if (!aitRef.current && nxtlinqAITServiceAccessTokenRef.current) {
974
+ await refreshAIT();
975
+ }
976
+ // Wait for AIT to be fully loaded with polling
977
+ let attempts = 0;
978
+ const maxAttempts = 5; // Wait up to 10 seconds (5 * 2000ms)
979
+ while (!aitRef.current && attempts < maxAttempts) {
980
+ await new Promise(resolve => setTimeout(resolve, 2000));
981
+ attempts++;
982
+ }
983
+ // Only retry if AIT is actually loaded
984
+ if (aitRef.current) {
985
+ console.log('AIT loaded successfully, retrying message');
986
+ // Wait a bit more to ensure permissions are also loaded
987
+ await new Promise(resolve => setTimeout(resolve, 3000));
988
+ sendMessage(content, retryCount + 1, isPresetMessage);
989
+ }
990
+ else {
991
+ console.log('AIT failed to load, not retrying');
992
+ }
993
+ }, 2000);
994
+ }
995
+ }
996
+ else {
997
+ console.log('Permission denied, not retrying. wasAutoConnected:', wasAutoConnected, 'retryCount:', retryCount);
998
+ }
999
+ return;
1000
+ }
1001
+ if (wasAutoConnected) {
1002
+ setIsLoading(false);
1003
+ setMessages(prev => [...prev, {
1004
+ id: Date.now().toString(),
1005
+ content: 'Click button to continue tool',
1006
+ role: 'assistant',
1007
+ timestamp: new Date().toISOString(),
1008
+ button: 'continue'
1009
+ }]);
962
1010
  return;
963
1011
  }
964
1012
  const toolResult = await onToolUse(toolUse);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/nxtlinq-ai-agent-sdk",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
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",