@bytexbyte/nxtlinq-ai-agent-sdk 1.5.1 → 1.5.2
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,
|
|
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');
|
|
@@ -941,23 +942,70 @@ requireWalletIDVVerification = true }) => {
|
|
|
941
942
|
const isToolAllowed = await hasPermission(toolUse.name, true, () => {
|
|
942
943
|
wasAutoConnected = true;
|
|
943
944
|
});
|
|
945
|
+
if (wasAutoConnected) {
|
|
946
|
+
setIsLoading(false);
|
|
947
|
+
setMessages(prev => [...prev, {
|
|
948
|
+
id: Date.now().toString(),
|
|
949
|
+
content: 'Click button to continue tool',
|
|
950
|
+
role: 'assistant',
|
|
951
|
+
timestamp: new Date().toISOString(),
|
|
952
|
+
button: 'continue'
|
|
953
|
+
}]);
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
944
956
|
// If currentPermissions does not include toolName and availablePermissionLabels includes toolName, it means AIT permission is missing
|
|
945
957
|
if (!isToolAllowed && !permissions.includes(toolUse.name) && availablePermissions.map(p => p.label).includes(toolUse.name)) {
|
|
946
958
|
permissionDenied = true;
|
|
947
959
|
}
|
|
948
960
|
if (!isToolAllowed) {
|
|
949
|
-
|
|
950
|
-
if (permissionDenied)
|
|
961
|
+
// If permission denied due to missing AIT permission return
|
|
962
|
+
if (permissionDenied) {
|
|
963
|
+
setIsLoading(false);
|
|
951
964
|
return;
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
965
|
+
}
|
|
966
|
+
// Only retry for auto-connect/auto-sign-in scenarios
|
|
967
|
+
if (wasAutoConnected && retryCount < 1) {
|
|
968
|
+
console.log('Auto-connected, retrying message...');
|
|
969
|
+
// Clear loading state and retry immediately
|
|
970
|
+
setIsLoading(false);
|
|
971
|
+
// Check if wallet is already signed in
|
|
972
|
+
const currentToken = nxtlinqAITServiceAccessTokenRef.current;
|
|
973
|
+
if (!currentToken) {
|
|
974
|
+
// If not signed in, directly retry the message without waiting for AIT
|
|
975
|
+
console.log('Wallet connected but not signed in, retrying message directly');
|
|
976
|
+
setTimeout(() => {
|
|
977
|
+
sendMessage(content, retryCount + 1, isPresetMessage);
|
|
978
|
+
}, 2000);
|
|
979
|
+
}
|
|
980
|
+
else {
|
|
981
|
+
// If already signed in, wait for AIT to be fully loaded before retrying
|
|
982
|
+
setTimeout(async () => {
|
|
983
|
+
// Wait for AIT to be loaded if needed
|
|
984
|
+
if (!aitRef.current && nxtlinqAITServiceAccessTokenRef.current) {
|
|
985
|
+
await refreshAIT();
|
|
986
|
+
}
|
|
987
|
+
// Wait for AIT to be fully loaded with polling
|
|
988
|
+
let attempts = 0;
|
|
989
|
+
const maxAttempts = 5; // Wait up to 10 seconds (5 * 2000ms)
|
|
990
|
+
while (!aitRef.current && attempts < maxAttempts) {
|
|
991
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
992
|
+
attempts++;
|
|
993
|
+
}
|
|
994
|
+
// Only retry if AIT is actually loaded
|
|
995
|
+
if (aitRef.current) {
|
|
996
|
+
console.log('AIT loaded successfully, retrying message');
|
|
997
|
+
// Wait a bit more to ensure permissions are also loaded
|
|
998
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
999
|
+
sendMessage(content, retryCount + 1, isPresetMessage);
|
|
1000
|
+
}
|
|
1001
|
+
else {
|
|
1002
|
+
console.log('AIT failed to load, not retrying');
|
|
1003
|
+
}
|
|
1004
|
+
}, 2000);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
else {
|
|
1008
|
+
console.log('Permission denied, not retrying. wasAutoConnected:', wasAutoConnected, 'retryCount:', retryCount);
|
|
961
1009
|
}
|
|
962
1010
|
return;
|
|
963
1011
|
}
|
package/package.json
CHANGED