@bytexbyte/nxtlinq-ai-agent-sdk 1.2.3 → 1.2.5

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,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useChatBot } from '../context/ChatBotContext';
4
+ import { AI_MODEL_MAP } from '../types/ChatBotTypes';
4
5
  export const MessageList = () => {
5
- const { messages, isLoading, connectWallet, signInWallet, hitAddress, ait, setShowPermissionForm, isWalletLoading } = useChatBot();
6
+ const { messages, isLoading, connectWallet, signInWallet, hitAddress, ait, setShowPermissionForm, isWalletLoading, isNeedSignInWithWallet } = useChatBot();
6
7
  const messagesEndRef = React.useRef(null);
7
8
  const scrollToBottom = () => {
8
9
  messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
@@ -18,6 +19,11 @@ export const MessageList = () => {
18
19
  signInWallet(true);
19
20
  }
20
21
  };
22
+ const getModelDisplayName = (modelValue) => {
23
+ if (!modelValue)
24
+ return '';
25
+ return AI_MODEL_MAP[modelValue] || modelValue;
26
+ };
21
27
  return (_jsxs("div", { style: {
22
28
  flex: 1,
23
29
  padding: '15px',
@@ -27,23 +33,53 @@ export const MessageList = () => {
27
33
  gap: '10px'
28
34
  }, children: [messages.map((message) => (_jsxs("div", { style: {
29
35
  alignSelf: message.role === 'user' ? 'flex-end' : 'flex-start',
30
- backgroundColor: message.role === 'user' ? '#007bff' : '#f1f1f1',
31
- color: message.role === 'user' ? 'white' : '#333',
32
- padding: '10px 15px',
33
- borderRadius: '15px',
34
36
  maxWidth: '80%',
35
- marginBottom: '10px',
36
- wordWrap: 'break-word'
37
- }, children: [message.content, message.button && (_jsx("div", { style: { marginTop: '10px' }, children: _jsx("button", { onClick: () => handleButtonClick(message.button), style: {
38
- padding: '8px 16px',
39
- backgroundColor: message.role === 'user' ? 'rgba(255, 255, 255, 0.2)' : '#007bff',
40
- color: message.role === 'user' ? 'white' : 'white',
41
- border: 'none',
42
- borderRadius: '5px',
43
- cursor: 'pointer',
44
- fontSize: '14px'
45
- }, children: message.button === 'connect' ? 'Connect Wallet' :
46
- message.button === 'signIn' ? 'Sign In' : message.button }) }))] }, message.id))), isLoading && (_jsx("div", { style: {
37
+ marginBottom: '10px'
38
+ }, children: [_jsxs("div", { style: {
39
+ backgroundColor: message.role === 'user' ? '#007bff' : '#f1f1f1',
40
+ color: message.role === 'user' ? 'white' : '#333',
41
+ padding: '10px 15px',
42
+ borderRadius: '15px',
43
+ wordWrap: 'break-word',
44
+ position: 'relative'
45
+ }, children: [message.content, message.button && (_jsx("div", { style: { marginTop: '10px' }, children: _jsx("button", { onClick: () => handleButtonClick(message.button), disabled: (message.button === 'connect' && Boolean(hitAddress)) ||
46
+ (message.button === 'signIn' && !isNeedSignInWithWallet), style: {
47
+ padding: '8px 16px',
48
+ backgroundColor: message.role === 'user' ? 'rgba(255, 255, 255, 0.2)' :
49
+ (message.button === 'connect' && Boolean(hitAddress)) ? '#28a745' :
50
+ (message.button === 'signIn' && !isNeedSignInWithWallet) ? '#28a745' : '#007bff',
51
+ color: message.role === 'user' ? 'white' : 'white',
52
+ border: 'none',
53
+ borderRadius: '5px',
54
+ cursor: ((message.button === 'connect' && Boolean(hitAddress)) ||
55
+ (message.button === 'signIn' && !isNeedSignInWithWallet)) ? 'not-allowed' : 'pointer',
56
+ fontSize: '14px',
57
+ opacity: ((message.button === 'connect' && Boolean(hitAddress)) ||
58
+ (message.button === 'signIn' && !isNeedSignInWithWallet)) ? 0.8 : 1
59
+ }, children: message.button === 'connect' ? (Boolean(hitAddress) ? 'Connected' : 'Connect Wallet') :
60
+ message.button === 'signIn' ? (!isNeedSignInWithWallet ? 'Signed In' : 'Sign In') : message.button }) }))] }), message.role === 'assistant' && message.metadata?.model && (_jsx("div", { style: {
61
+ display: 'flex',
62
+ alignItems: 'center',
63
+ marginTop: '4px',
64
+ marginLeft: '8px'
65
+ }, children: _jsxs("div", { style: {
66
+ backgroundColor: '#e3f2fd',
67
+ color: '#1976d2',
68
+ padding: '2px 8px',
69
+ borderRadius: '10px',
70
+ fontSize: '10px',
71
+ fontWeight: '500',
72
+ border: '1px solid #bbdefb',
73
+ display: 'flex',
74
+ alignItems: 'center',
75
+ gap: '4px'
76
+ }, children: [_jsx("span", { style: {
77
+ width: '6px',
78
+ height: '6px',
79
+ backgroundColor: '#1976d2',
80
+ borderRadius: '50%',
81
+ display: 'inline-block'
82
+ } }), getModelDisplayName(message.metadata.model)] }) }))] }, message.id))), isLoading && (_jsx("div", { style: {
47
83
  alignSelf: 'flex-start',
48
84
  backgroundColor: '#f1f1f1',
49
85
  color: '#333',
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ export declare const ModelSelector: React.FC;
3
+ //# sourceMappingURL=ModelSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelSelector.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ModelSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAkHjC,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { useChatBot } from '../context/ChatBotContext';
4
+ export const ModelSelector = () => {
5
+ const { availableModels, selectedModelIndex, showModelSelector, handleModelChange } = useChatBot();
6
+ const [anchorEl, setAnchorEl] = React.useState(null);
7
+ const open = Boolean(anchorEl);
8
+ const handleClick = (event) => {
9
+ setAnchorEl(event.currentTarget);
10
+ };
11
+ const handleMenuItemClick = (event, index) => {
12
+ handleModelChange(index);
13
+ setAnchorEl(null);
14
+ };
15
+ const handleClose = () => {
16
+ setAnchorEl(null);
17
+ };
18
+ if (!showModelSelector) {
19
+ return null;
20
+ }
21
+ return (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsxs("div", { style: {
22
+ display: 'flex',
23
+ alignItems: 'center',
24
+ cursor: 'pointer',
25
+ padding: '4px 8px',
26
+ borderRadius: '4px',
27
+ backgroundColor: 'rgba(255, 255, 255, 0.1)',
28
+ transition: 'background-color 0.2s',
29
+ fontSize: '12px',
30
+ fontWeight: '500'
31
+ }, onClick: handleClick, onMouseOver: (e) => e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.2)', onMouseOut: (e) => e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.1)', title: "Change AI Model", children: [_jsx("span", { style: { marginRight: '4px' }, children: availableModels[selectedModelIndex]?.label || 'Nova' }), _jsx("span", { style: { fontSize: '10px' }, children: "\u25BC" })] }), open && (_jsx("div", { style: {
32
+ position: 'absolute',
33
+ top: '100%',
34
+ left: '0',
35
+ backgroundColor: 'white',
36
+ border: '1px solid #ddd',
37
+ borderRadius: '4px',
38
+ boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
39
+ zIndex: 1000,
40
+ minWidth: '120px',
41
+ marginTop: '4px'
42
+ }, children: availableModels.map((model, index) => (_jsx("div", { style: {
43
+ padding: '8px 12px',
44
+ cursor: 'pointer',
45
+ backgroundColor: index === selectedModelIndex ? '#f0f0f0' : 'transparent',
46
+ color: index === selectedModelIndex ? '#007bff' : '#333',
47
+ fontSize: '12px',
48
+ borderBottom: index < availableModels.length - 1 ? '1px solid #eee' : 'none'
49
+ }, onClick: (event) => handleMenuItemClick(event, index), onMouseOver: (e) => {
50
+ if (index !== selectedModelIndex) {
51
+ e.currentTarget.style.backgroundColor = '#f8f9fa';
52
+ }
53
+ }, onMouseOut: (e) => {
54
+ if (index !== selectedModelIndex) {
55
+ e.currentTarget.style.backgroundColor = 'transparent';
56
+ }
57
+ }, children: model.label }, model.value))) })), open && (_jsx("div", { style: {
58
+ position: 'fixed',
59
+ top: 0,
60
+ left: 0,
61
+ right: 0,
62
+ bottom: 0,
63
+ zIndex: 999
64
+ }, onClick: handleClose }))] }));
65
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAwcxD,CAAC"}
1
+ {"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAifxD,CAAC"}
@@ -5,6 +5,11 @@ export const PermissionForm = ({ onClose, onOpen }) => {
5
5
  const { hitAddress, permissions, setPermissions, setIsDisabled, onSave, onConnectWallet, onSignIn, isNeedSignInWithWallet, walletInfo, onVerifyWallet, serviceId, nxtlinqApi, permissionGroup, isAITLoading, isWalletLoading = false } = useChatBot();
6
6
  const [availablePermissions, setAvailablePermissions] = React.useState([]);
7
7
  const [isSaving, setIsSaving] = React.useState(false);
8
+ const [tempPermissions, setTempPermissions] = React.useState(permissions);
9
+ // Update temp permissions when permissions change
10
+ React.useEffect(() => {
11
+ setTempPermissions(permissions);
12
+ }, [permissions]);
8
13
  const fetchAvailablePermissions = async () => {
9
14
  if (!serviceId)
10
15
  return;
@@ -30,12 +35,26 @@ export const PermissionForm = ({ onClose, onOpen }) => {
30
35
  const handleSave = async () => {
31
36
  setIsSaving(true);
32
37
  try {
33
- await onSave();
38
+ // Update the actual permissions with temp permissions
39
+ setPermissions(tempPermissions);
40
+ await onSave(tempPermissions);
34
41
  }
35
42
  finally {
36
43
  setIsSaving(false);
37
44
  }
38
45
  };
46
+ const handleCancel = () => {
47
+ // Reset temp permissions to original permissions
48
+ setTempPermissions(permissions);
49
+ onClose();
50
+ };
51
+ // Check if permissions have changed
52
+ const hasPermissionChanges = () => {
53
+ if (tempPermissions.length !== permissions.length)
54
+ return true;
55
+ return tempPermissions.some(p => !permissions.includes(p)) ||
56
+ permissions.some(p => !tempPermissions.includes(p));
57
+ };
39
58
  // Show loading state while checking wallet status
40
59
  if (isWalletLoading) {
41
60
  return (_jsxs("div", { style: {
@@ -132,17 +151,26 @@ export const PermissionForm = ({ onClose, onOpen }) => {
132
151
  marginBottom: '24px',
133
152
  fontSize: '16px',
134
153
  color: '#666'
135
- }, children: "Please connect your wallet first" }), _jsx("button", { onClick: onConnectWallet, style: {
154
+ }, children: "Please connect your wallet first" }), _jsx("button", { onClick: onConnectWallet, disabled: Boolean(hitAddress), style: {
136
155
  padding: '12px 24px',
137
- backgroundColor: '#007bff',
156
+ backgroundColor: Boolean(hitAddress) ? '#28a745' : '#007bff',
138
157
  color: 'white',
139
158
  border: 'none',
140
159
  borderRadius: '8px',
141
- cursor: 'pointer',
160
+ cursor: Boolean(hitAddress) ? 'not-allowed' : 'pointer',
142
161
  fontSize: '16px',
143
162
  fontWeight: '500',
144
- transition: 'background-color 0.2s'
145
- }, onMouseOver: (e) => e.currentTarget.style.backgroundColor = '#0056b3', onMouseOut: (e) => e.currentTarget.style.backgroundColor = '#007bff', children: "Connect Wallet" })] })) : isNeedSignInWithWallet ? (_jsxs("div", { style: { textAlign: 'center', padding: '32px 0' }, children: [_jsxs("div", { style: { marginBottom: '24px' }, children: [_jsx("h4", { style: {
163
+ transition: 'background-color 0.2s',
164
+ opacity: Boolean(hitAddress) ? 0.8 : 1
165
+ }, onMouseOver: (e) => {
166
+ if (!Boolean(hitAddress)) {
167
+ e.currentTarget.style.backgroundColor = '#0056b3';
168
+ }
169
+ }, onMouseOut: (e) => {
170
+ if (!Boolean(hitAddress)) {
171
+ e.currentTarget.style.backgroundColor = '#007bff';
172
+ }
173
+ }, children: Boolean(hitAddress) ? 'Connected' : 'Connect Wallet' })] })) : isNeedSignInWithWallet ? (_jsxs("div", { style: { textAlign: 'center', padding: '32px 0' }, children: [_jsxs("div", { style: { marginBottom: '24px' }, children: [_jsx("h4", { style: {
146
174
  marginBottom: '12px',
147
175
  fontSize: '16px',
148
176
  color: '#666'
@@ -158,17 +186,26 @@ export const PermissionForm = ({ onClose, onOpen }) => {
158
186
  marginBottom: '24px',
159
187
  fontSize: '16px',
160
188
  color: '#666'
161
- }, children: "Please sign in to continue" }), _jsx("button", { onClick: onSignIn, style: {
189
+ }, children: "Please sign in to continue" }), _jsx("button", { onClick: onSignIn, disabled: !isNeedSignInWithWallet, style: {
162
190
  padding: '12px 24px',
163
- backgroundColor: '#007bff',
191
+ backgroundColor: !isNeedSignInWithWallet ? '#28a745' : '#007bff',
164
192
  color: 'white',
165
193
  border: 'none',
166
194
  borderRadius: '8px',
167
- cursor: 'pointer',
195
+ cursor: !isNeedSignInWithWallet ? 'not-allowed' : 'pointer',
168
196
  fontSize: '16px',
169
197
  fontWeight: '500',
170
- transition: 'background-color 0.2s'
171
- }, onMouseOver: (e) => e.currentTarget.style.backgroundColor = '#0056b3', onMouseOut: (e) => e.currentTarget.style.backgroundColor = '#007bff', children: "Sign In" })] })) : !isWalletVerified ? (_jsxs("div", { style: { textAlign: 'center', padding: '32px 0' }, children: [_jsxs("div", { style: { marginBottom: '24px' }, children: [_jsx("h4", { style: {
198
+ transition: 'background-color 0.2s',
199
+ opacity: !isNeedSignInWithWallet ? 0.8 : 1
200
+ }, onMouseOver: (e) => {
201
+ if (isNeedSignInWithWallet) {
202
+ e.currentTarget.style.backgroundColor = '#0056b3';
203
+ }
204
+ }, onMouseOut: (e) => {
205
+ if (isNeedSignInWithWallet) {
206
+ e.currentTarget.style.backgroundColor = '#007bff';
207
+ }
208
+ }, children: !isNeedSignInWithWallet ? 'Signed In' : 'Sign In' })] })) : !isWalletVerified ? (_jsxs("div", { style: { textAlign: 'center', padding: '32px 0' }, children: [_jsxs("div", { style: { marginBottom: '24px' }, children: [_jsx("h4", { style: {
172
209
  marginBottom: '12px',
173
210
  fontSize: '16px',
174
211
  color: '#666'
@@ -239,12 +276,12 @@ export const PermissionForm = ({ onClose, onOpen }) => {
239
276
  if (!isAITLoading) {
240
277
  e.currentTarget.style.backgroundColor = 'transparent';
241
278
  }
242
- }, children: [_jsx("input", { type: "checkbox", checked: permissions.includes(permission.label), onChange: () => {
279
+ }, children: [_jsx("input", { type: "checkbox", checked: tempPermissions.includes(permission.label), onChange: () => {
243
280
  if (!isAITLoading) {
244
- const newPermissions = permissions.includes(permission.label)
245
- ? permissions.filter(p => p !== permission.label)
246
- : [...permissions, permission.label].sort();
247
- setPermissions(newPermissions);
281
+ const newPermissions = tempPermissions.includes(permission.label)
282
+ ? tempPermissions.filter(p => p !== permission.label)
283
+ : [...tempPermissions, permission.label].sort();
284
+ setTempPermissions(newPermissions);
248
285
  setIsDisabled(false);
249
286
  }
250
287
  }, disabled: isAITLoading, style: {
@@ -261,7 +298,7 @@ export const PermissionForm = ({ onClose, onOpen }) => {
261
298
  gap: '12px',
262
299
  borderTop: '1px solid #e9ecef',
263
300
  paddingTop: '24px'
264
- }, children: [_jsx("button", { onClick: onClose, style: {
301
+ }, children: [_jsx("button", { onClick: handleCancel, style: {
265
302
  padding: '10px 20px',
266
303
  backgroundColor: '#f8f9fa',
267
304
  color: '#666',
@@ -277,22 +314,22 @@ export const PermissionForm = ({ onClose, onOpen }) => {
277
314
  }, onMouseOut: (e) => {
278
315
  e.currentTarget.style.backgroundColor = '#f8f9fa';
279
316
  e.currentTarget.style.borderColor = '#dee2e6';
280
- }, children: "Cancel" }), _jsx("button", { onClick: handleSave, disabled: permissions.length === 0 || isSaving || isAITLoading, style: {
317
+ }, children: "Cancel" }), _jsx("button", { onClick: handleSave, disabled: !hasPermissionChanges() || isSaving || isAITLoading, style: {
281
318
  padding: '10px 20px',
282
- backgroundColor: permissions.length === 0 || isSaving || isAITLoading ? '#e9ecef' : '#007bff',
283
- color: permissions.length === 0 || isSaving || isAITLoading ? '#6c757d' : 'white',
319
+ backgroundColor: !hasPermissionChanges() || isSaving || isAITLoading ? '#e9ecef' : '#007bff',
320
+ color: !hasPermissionChanges() || isSaving || isAITLoading ? '#6c757d' : 'white',
284
321
  border: 'none',
285
322
  borderRadius: '8px',
286
- cursor: permissions.length === 0 || isSaving || isAITLoading ? 'not-allowed' : 'pointer',
323
+ cursor: !hasPermissionChanges() || isSaving || isAITLoading ? 'not-allowed' : 'pointer',
287
324
  fontSize: '14px',
288
325
  fontWeight: '500',
289
326
  transition: 'background-color 0.2s'
290
327
  }, onMouseOver: (e) => {
291
- if (permissions.length > 0 && !isSaving && !isAITLoading) {
328
+ if (hasPermissionChanges() && !isSaving && !isAITLoading) {
292
329
  e.currentTarget.style.backgroundColor = '#0056b3';
293
330
  }
294
331
  }, onMouseOut: (e) => {
295
- if (permissions.length > 0 && !isSaving && !isAITLoading) {
332
+ if (hasPermissionChanges() && !isSaving && !isAITLoading) {
296
333
  e.currentTarget.style.backgroundColor = '#007bff';
297
334
  }
298
335
  }, children: isSaving ? 'Saving...' : 'Save' })] })] }))] }));
package/dist/index.d.ts CHANGED
@@ -6,7 +6,9 @@ export { MessageInput } from './components/ui/MessageInput';
6
6
  export { PresetMessages } from './components/ui/PresetMessages';
7
7
  export { PermissionForm } from './components/ui/PermissionForm';
8
8
  export { NotificationModal } from './components/ui/NotificationModal';
9
- export type { ChatBotProps, ChatBotContextType, PresetMessage, ToolUse, ToolCall, NovaResponse, NovaError, AITMetadata } from './components/types/ChatBotTypes';
9
+ export { ModelSelector } from './components/ui/ModelSelector';
10
+ export type { ChatBotProps, ChatBotContextType, PresetMessage, ToolUse, ToolCall, NovaResponse, NovaError, AITMetadata, AIModel } from './components/types/ChatBotTypes';
11
+ export { DEFAULT_AI_MODELS, AI_MODEL_MAP } from './components/types/ChatBotTypes';
10
12
  export { connectWallet, disconnectWallet, validateToken } from './core/utils/walletUtils';
11
13
  export { generateAITId, createAITMetadata, prepareAITCreation } from './core/utils/aitUtils';
12
14
  export { createNotification, getNotificationIcon } from './core/utils/notificationUtils';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAGtE,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,WAAW,EACZ,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EACV,OAAO,EACP,GAAG,EACH,iBAAiB,EACjB,MAAM,EACP,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,WAAW,EAEX,OAAO,EACR,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACb,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EACV,OAAO,EACP,GAAG,EACH,iBAAiB,EACjB,MAAM,EACP,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -9,6 +9,9 @@ export { MessageInput } from './components/ui/MessageInput';
9
9
  export { PresetMessages } from './components/ui/PresetMessages';
10
10
  export { PermissionForm } from './components/ui/PermissionForm';
11
11
  export { NotificationModal } from './components/ui/NotificationModal';
12
+ export { ModelSelector } from './components/ui/ModelSelector';
13
+ // AI Model constants
14
+ export { DEFAULT_AI_MODELS, AI_MODEL_MAP } from './components/types/ChatBotTypes';
12
15
  // Utility functions
13
16
  export { connectWallet, disconnectWallet, validateToken } from './core/utils/walletUtils';
14
17
  export { generateAITId, createAITMetadata, prepareAITCreation } from './core/utils/aitUtils';
@@ -5,6 +5,15 @@ export interface Message {
5
5
  timestamp: string;
6
6
  button?: string;
7
7
  error?: string;
8
+ metadata?: {
9
+ model?: string;
10
+ permissions?: string[];
11
+ issuedBy?: string;
12
+ toolUse?: {
13
+ name: string;
14
+ input: Record<string, any>;
15
+ };
16
+ };
8
17
  }
9
18
  export interface AIT {
10
19
  aitId: string;
@@ -129,8 +138,30 @@ export interface AITApi {
129
138
  message: string;
130
139
  apiKey: string;
131
140
  apiSecret: string;
141
+ model?: string;
142
+ context?: Array<{
143
+ role: string;
144
+ text: string;
145
+ }>;
132
146
  }) => Promise<{
133
- reply: string;
147
+ reply: string | Array<{
148
+ text: string;
149
+ }>;
150
+ toolCall?: {
151
+ toolUse: {
152
+ name: string;
153
+ input: Record<string, any>;
154
+ };
155
+ };
156
+ fullResponse?: {
157
+ output?: {
158
+ message?: {
159
+ content?: Array<{
160
+ text: string;
161
+ }>;
162
+ };
163
+ };
164
+ };
134
165
  } | {
135
166
  error: string;
136
167
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"ait-api.d.ts","sourceRoot":"","sources":["../../src/types/ait-api.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB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AAC;YAAE,WAAW,EAAE,iBAAiB,EAAE,CAAA;SAAE,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACjJ,CAAC;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/nxtlinq-ai-agent-sdk",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
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",