@bytexbyte/nxtlinq-ai-agent-sdk 1.5.0 → 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,CAovDlD,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"}
@@ -858,10 +858,18 @@ requireWalletIDVVerification = true }) => {
858
858
  // Try to sign in wallet
859
859
  await signInWallet(false); // Don't show success message yet
860
860
  console.log('Auto sign-in successful, retrying message...');
861
- // Wait a bit for everything to settle
862
- await new Promise(resolve => setTimeout(resolve, 2000));
863
- // Retry the message
864
- sendMessage(content, retryCount + 1, isPresetMessage);
861
+ // // Wait a bit for everything to settle
862
+ // await new Promise(resolve => setTimeout(resolve, 2000));
863
+ // // Retry the message
864
+ // sendMessage(content, retryCount + 1, isPresetMessage);
865
+ setMessages(prev => [...prev, {
866
+ id: Date.now().toString(),
867
+ content: 'Click button to continue tool',
868
+ role: 'assistant',
869
+ timestamp: new Date().toISOString(),
870
+ button: 'continue'
871
+ }]);
872
+ return;
865
873
  }
866
874
  catch (signInError) {
867
875
  console.log('Auto sign-in failed, showing error message');
@@ -934,6 +942,17 @@ requireWalletIDVVerification = true }) => {
934
942
  const isToolAllowed = await hasPermission(toolUse.name, true, () => {
935
943
  wasAutoConnected = true;
936
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
+ }
937
956
  // If currentPermissions does not include toolName and availablePermissionLabels includes toolName, it means AIT permission is missing
938
957
  if (!isToolAllowed && !permissions.includes(toolUse.name) && availablePermissions.map(p => p.label).includes(toolUse.name)) {
939
958
  permissionDenied = true;
@@ -1 +1 @@
1
- {"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EA+L/B,CAAC"}
1
+ {"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAyM/B,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
+ import { convertUrlsToLinks } from '../../core/utils/urlUtils';
3
4
  import { useChatBot } from '../context/ChatBotContext';
4
5
  import { AI_MODEL_MAP } from '../types/ChatBotTypes';
5
- import { convertUrlsToLinks } from '../../core/utils/urlUtils';
6
6
  export const MessageList = () => {
7
7
  const { messages, isLoading, connectWallet, signInWallet, hitAddress, ait, setShowPermissionForm, isWalletLoading, isAutoConnecting, isNeedSignInWithWallet, enableAIT, isAITLoading, isAITEnabling, sendMessage, permissions } = useChatBot();
8
8
  const messagesEndRef = React.useRef(null);
@@ -33,6 +33,13 @@ export const MessageList = () => {
33
33
  }
34
34
  }
35
35
  }
36
+ else if (buttonType === 'continue') {
37
+ const lastUserMsg = [...messages].reverse().find(m => m.role === 'user');
38
+ if (lastUserMsg && lastUserMsg.content) {
39
+ // Re-execute the previous user message
40
+ await sendMessage(lastUserMsg.content);
41
+ }
42
+ }
36
43
  };
37
44
  const getModelDisplayName = (modelValue) => {
38
45
  if (!modelValue)
@@ -74,30 +81,34 @@ export const MessageList = () => {
74
81
  isAutoConnecting ? '#6c757d' :
75
82
  (message.button === 'connectWallet' && Boolean(hitAddress)) ? '#28a745' :
76
83
  (message.button === 'signIn' && !isNeedSignInWithWallet) ? '#28a745' :
77
- (message.button === 'enableAIT' && (isAITLoading || isAITEnabling ||
78
- (message.metadata?.toolName && permissions.includes(message.metadata.toolName)))) ?
79
- ((message.metadata?.toolName && permissions.includes(message.metadata.toolName)) ? '#28a745' : '#6c757d') : '#007bff',
84
+ (message.button === 'continue') ? '#28a745' :
85
+ (message.button === 'enableAIT' && (isAITLoading || isAITEnabling ||
86
+ (message.metadata?.toolName && permissions.includes(message.metadata.toolName)))) ?
87
+ ((message.metadata?.toolName && permissions.includes(message.metadata.toolName)) ? '#28a745' : '#6c757d') : '#007bff',
80
88
  color: message.role === 'user' ? 'white' : 'white',
81
89
  border: 'none',
82
90
  borderRadius: '5px',
83
91
  cursor: (isAutoConnecting ||
84
92
  (message.button === 'connectWallet' && Boolean(hitAddress)) ||
85
93
  (message.button === 'signIn' && !isNeedSignInWithWallet) ||
94
+ (message.button === 'continue') ||
86
95
  (message.button === 'enableAIT' && (isAITLoading || isAITEnabling ||
87
96
  (message.metadata?.toolName && permissions.includes(message.metadata.toolName))))) ? 'not-allowed' : 'pointer',
88
97
  fontSize: '14px',
89
98
  opacity: (isAutoConnecting ||
90
99
  (message.button === 'connectWallet' && Boolean(hitAddress)) ||
91
100
  (message.button === 'signIn' && !isNeedSignInWithWallet) ||
101
+ (message.button === 'continue') ||
92
102
  (message.button === 'enableAIT' && (isAITLoading || isAITEnabling ||
93
103
  (message.metadata?.toolName && permissions.includes(message.metadata.toolName))))) ? 0.8 : 1
94
104
  }, children: isAutoConnecting ? 'Connecting...' :
95
105
  message.button === 'connectWallet' ? (Boolean(hitAddress) ? 'Connected' : 'Connect Wallet') :
96
106
  message.button === 'signIn' ? (!isNeedSignInWithWallet ? 'Signed In' : 'Sign In') :
97
- message.button === 'enableAIT' ?
98
- ((isAITLoading || isAITEnabling) ? 'Enabling...' :
99
- (message.metadata?.toolName && permissions.includes(message.metadata.toolName)) ? 'AIT Enabled' : 'Enable AIT Permissions') :
100
- message.button }) }))] }), message.role === 'assistant' && message.metadata?.model && (_jsx("div", { style: {
107
+ message.button === 'continue' ? 'Continue' :
108
+ message.button === 'enableAIT' ?
109
+ ((isAITLoading || isAITEnabling) ? 'Enabling...' :
110
+ (message.metadata?.toolName && permissions.includes(message.metadata.toolName)) ? 'AIT Enabled' : 'Enable AIT Permissions') :
111
+ message.button }) }))] }), message.role === 'assistant' && message.metadata?.model && (_jsx("div", { style: {
101
112
  display: 'flex',
102
113
  alignItems: 'center',
103
114
  marginTop: '4px',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/nxtlinq-ai-agent-sdk",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
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",
@@ -59,4 +59,4 @@
59
59
  "universal-cookie": "^8.0.1",
60
60
  "uuid": "^11.1.0"
61
61
  }
62
- }
62
+ }
@@ -1,5 +0,0 @@
1
- /**
2
- * Tests for URL utility functions
3
- */
4
- export {};
5
- //# sourceMappingURL=urlUtils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"urlUtils.test.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__tests__/urlUtils.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -1,57 +0,0 @@
1
- /**
2
- * Tests for URL utility functions
3
- */
4
- import { containsUrls, convertUrlsToLinks, convertUrlsToHtml } from '../urlUtils';
5
- describe('URL Utils', () => {
6
- describe('containsUrls', () => {
7
- it('should detect URLs with http protocol', () => {
8
- expect(containsUrls('Visit https://example.com for more info')).toBe(true);
9
- expect(containsUrls('Check out http://test.org')).toBe(true);
10
- });
11
- it('should detect URLs with www', () => {
12
- expect(containsUrls('Go to www.google.com')).toBe(true);
13
- expect(containsUrls('Visit www.example.org')).toBe(true);
14
- });
15
- it('should detect domain names', () => {
16
- expect(containsUrls('Contact us at support@company.com')).toBe(false);
17
- expect(containsUrls('Visit company.com for details')).toBe(true);
18
- });
19
- it('should return false for text without URLs', () => {
20
- expect(containsUrls('This is just plain text')).toBe(false);
21
- expect(containsUrls('No URLs here')).toBe(false);
22
- });
23
- });
24
- describe('convertUrlsToHtml', () => {
25
- it('should convert URLs to HTML anchor tags', () => {
26
- const text = 'Visit https://example.com for more info';
27
- const result = convertUrlsToHtml(text);
28
- expect(result).toContain('<a href="https://example.com"');
29
- expect(result).toContain('target="_blank"');
30
- expect(result).toContain('rel="noopener noreferrer"');
31
- });
32
- it('should handle www URLs', () => {
33
- const text = 'Go to www.google.com';
34
- const result = convertUrlsToHtml(text);
35
- expect(result).toContain('<a href="https://www.google.com"');
36
- });
37
- it('should handle multiple URLs', () => {
38
- const text = 'Visit https://example.com and www.google.com';
39
- const result = convertUrlsToHtml(text);
40
- expect(result).toContain('https://example.com');
41
- expect(result).toContain('https://www.google.com');
42
- });
43
- });
44
- describe('convertUrlsToLinks', () => {
45
- it('should return array with mixed content', () => {
46
- const text = 'Visit https://example.com for more info';
47
- const result = convertUrlsToLinks(text);
48
- expect(Array.isArray(result)).toBe(true);
49
- expect(result.length).toBeGreaterThan(0);
50
- });
51
- it('should handle text without URLs', () => {
52
- const text = 'This is just plain text';
53
- const result = convertUrlsToLinks(text);
54
- expect(result).toEqual([text]);
55
- });
56
- });
57
- });
@@ -1,2 +0,0 @@
1
- import '@testing-library/jest-dom';
2
- //# sourceMappingURL=setupTests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupTests.d.ts","sourceRoot":"","sources":["../src/setupTests.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAC"}
@@ -1,16 +0,0 @@
1
- // Test setup file for Jest
2
- import '@testing-library/jest-dom';
3
- // Mock window.open for URL tests
4
- Object.defineProperty(window, 'open', {
5
- writable: true,
6
- value: jest.fn(),
7
- });
8
- // Mock console methods to avoid noise in tests
9
- global.console = {
10
- ...console,
11
- log: jest.fn(),
12
- debug: jest.fn(),
13
- info: jest.fn(),
14
- warn: jest.fn(),
15
- error: jest.fn(),
16
- };