@messenger-box/tailwind-ui-inbox 10.0.3-alpha.73 → 10.0.3-alpha.74

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.
Files changed (145) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/lib/components/AIAgent/AIAgent.d.ts +7 -0
  3. package/lib/components/AIAgent/AIAgent.d.ts.map +1 -1
  4. package/lib/components/AIAgent/AIAgent.js +362 -615
  5. package/lib/components/AIAgent/AIAgent.js.map +1 -1
  6. package/lib/components/InboxMessage/InputComponent.d.ts.map +1 -1
  7. package/lib/components/InboxMessage/InputComponent.js +143 -140
  8. package/lib/components/InboxMessage/InputComponent.js.map +1 -1
  9. package/lib/components/InboxMessage/RightSidebarAi.d.ts +23 -0
  10. package/lib/components/InboxMessage/RightSidebarAi.d.ts.map +1 -0
  11. package/lib/components/InboxMessage/RightSidebarAi.js +9 -0
  12. package/lib/components/InboxMessage/RightSidebarAi.js.map +1 -0
  13. package/lib/components/InboxMessage/index.d.ts +1 -0
  14. package/lib/components/InboxMessage/index.d.ts.map +1 -1
  15. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.d.ts +11 -0
  16. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.d.ts.map +1 -0
  17. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.js +194 -0
  18. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.js.map +1 -0
  19. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts +5 -1
  20. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts.map +1 -1
  21. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js +308 -857
  22. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js.map +1 -1
  23. package/lib/components/ModelConfigPanel.d.ts +12 -0
  24. package/lib/components/ModelConfigPanel.d.ts.map +1 -0
  25. package/lib/components/ModelConfigPanel.js +304 -0
  26. package/lib/components/ModelConfigPanel.js.map +1 -0
  27. package/lib/components/filler-components/RightSiderBar.d.ts +24 -0
  28. package/lib/components/filler-components/RightSiderBar.d.ts.map +1 -0
  29. package/lib/components/filler-components/RightSiderBar.js +335 -0
  30. package/lib/components/filler-components/RightSiderBar.js.map +1 -0
  31. package/lib/components/index.d.ts +4 -2
  32. package/lib/components/index.d.ts.map +1 -1
  33. package/lib/components/live-code-editor/hybrid-live-editor.d.ts +20 -0
  34. package/lib/components/live-code-editor/hybrid-live-editor.d.ts.map +1 -0
  35. package/lib/components/live-code-editor/hybrid-live-editor.js +68 -0
  36. package/lib/components/live-code-editor/hybrid-live-editor.js.map +1 -0
  37. package/lib/components/live-code-editor/index.d.ts +4 -0
  38. package/lib/components/live-code-editor/index.d.ts.map +1 -0
  39. package/lib/components/live-code-editor/live-code-editor.d.ts +14 -0
  40. package/lib/components/live-code-editor/live-code-editor.d.ts.map +1 -0
  41. package/lib/components/live-code-editor/live-code-editor.js +207 -0
  42. package/lib/components/live-code-editor/live-code-editor.js.map +1 -0
  43. package/lib/components/slot-fill/chat-message-filler.js +1 -1
  44. package/lib/components/slot-fill/chat-message-filler.js.map +1 -1
  45. package/lib/components/slot-fill/index.d.ts +1 -0
  46. package/lib/components/slot-fill/index.d.ts.map +1 -1
  47. package/lib/components/slot-fill/right-sidebar-filler.d.ts +4 -0
  48. package/lib/components/slot-fill/right-sidebar-filler.d.ts.map +1 -0
  49. package/lib/components/slot-fill/right-sidebar-filler.js +13 -0
  50. package/lib/components/slot-fill/right-sidebar-filler.js.map +1 -0
  51. package/lib/components/ui/button.d.ts +9 -0
  52. package/lib/components/ui/button.d.ts.map +1 -0
  53. package/lib/compute.js +1 -2
  54. package/lib/container/AiInbox.d.ts.map +1 -1
  55. package/lib/container/AiLandingInput.d.ts.map +1 -1
  56. package/lib/container/AiLandingInput.js +46 -119
  57. package/lib/container/AiLandingInput.js.map +1 -1
  58. package/lib/container/Inbox.js +1 -1
  59. package/lib/container/Inbox.js.map +1 -1
  60. package/lib/container/InboxAiMessagesLoader.d.ts +0 -21
  61. package/lib/container/InboxAiMessagesLoader.d.ts.map +1 -1
  62. package/lib/container/InboxAiMessagesLoader.js +18 -32
  63. package/lib/container/InboxAiMessagesLoader.js.map +1 -1
  64. package/lib/container/ServiceInbox.js +1 -1
  65. package/lib/container/ServiceInbox.js.map +1 -1
  66. package/lib/container/ThreadMessages.js +1 -1
  67. package/lib/container/ThreadMessages.js.map +1 -1
  68. package/lib/container/ThreadMessagesInbox.js +1 -1
  69. package/lib/container/ThreadMessagesInbox.js.map +1 -1
  70. package/lib/container/Threads.js +1 -1
  71. package/lib/container/Threads.js.map +1 -1
  72. package/lib/container/index.d.ts +2 -1
  73. package/lib/container/index.d.ts.map +1 -1
  74. package/lib/enums/messenger-slot-fill-name-enum.d.ts +2 -1
  75. package/lib/enums/messenger-slot-fill-name-enum.d.ts.map +1 -1
  76. package/lib/enums/messenger-slot-fill-name-enum.js +1 -0
  77. package/lib/enums/messenger-slot-fill-name-enum.js.map +1 -1
  78. package/lib/hooks/index.d.ts +3 -0
  79. package/lib/hooks/index.d.ts.map +1 -0
  80. package/lib/hooks/use-file-sync.d.ts +16 -0
  81. package/lib/hooks/use-file-sync.d.ts.map +1 -0
  82. package/lib/hooks/use-file-sync.js +63 -0
  83. package/lib/hooks/use-file-sync.js.map +1 -0
  84. package/lib/hooks/usePersistentModelConfig.d.ts +15 -0
  85. package/lib/hooks/usePersistentModelConfig.d.ts.map +1 -0
  86. package/lib/hooks/usePersistentModelConfig.js +46 -0
  87. package/lib/hooks/usePersistentModelConfig.js.map +1 -0
  88. package/lib/index.d.ts +4 -2
  89. package/lib/index.d.ts.map +1 -1
  90. package/lib/index.js +1 -1
  91. package/lib/machines/aiAgentMachine.d.ts.map +1 -1
  92. package/lib/machines/aiAgentMachine.js +64 -21
  93. package/lib/machines/aiAgentMachine.js.map +1 -1
  94. package/lib/machines/aiAgentMachine.simple.d.ts +3 -0
  95. package/lib/machines/aiAgentMachine.simple.d.ts.map +1 -0
  96. package/lib/machines/aiAgentMachine.simple.js +108 -0
  97. package/lib/machines/aiAgentMachine.simple.js.map +1 -0
  98. package/lib/machines/index.d.ts +3 -0
  99. package/lib/machines/index.d.ts.map +1 -0
  100. package/lib/module.d.ts +2 -1
  101. package/lib/module.d.ts.map +1 -1
  102. package/lib/module.js +11 -3
  103. package/lib/module.js.map +1 -1
  104. package/lib/routes.json +1 -2
  105. package/lib/templates/InboxWithAi.d.ts.map +1 -1
  106. package/lib/templates/InboxWithAi.js +129 -70
  107. package/lib/templates/InboxWithAi.js.map +1 -1
  108. package/lib/templates/InboxWithAi.tsx +151 -90
  109. package/lib/utils/utils.d.ts +2 -0
  110. package/lib/utils/utils.d.ts.map +1 -0
  111. package/lib/utils/utils.js +3 -0
  112. package/lib/utils/utils.js.map +1 -0
  113. package/package.json +8 -5
  114. package/src/components/AIAgent/AIAgent.tsx +469 -731
  115. package/src/components/AIAgent/AIAgent.tsx.bk +1365 -0
  116. package/src/components/InboxMessage/InputComponent.tsx +2 -1
  117. package/src/components/InboxMessage/RightSidebarAi.tsx +37 -0
  118. package/src/components/InboxMessage/index.ts +1 -0
  119. package/src/components/InboxMessage/message-widgets/ErrorFixCard.tsx +240 -0
  120. package/src/components/InboxMessage/message-widgets/ModernMessageGroup.tsx +337 -1116
  121. package/src/components/ModelConfigPanel.tsx +334 -0
  122. package/src/components/filler-components/RightSiderBar.tsx +408 -0
  123. package/src/components/index.ts +4 -1
  124. package/src/components/live-code-editor/hybrid-live-editor.tsx +105 -0
  125. package/src/components/live-code-editor/index.ts +3 -0
  126. package/src/components/live-code-editor/live-code-editor.tsx +257 -0
  127. package/src/components/slot-fill/index.ts +1 -0
  128. package/src/components/slot-fill/right-sidebar-filler.tsx +39 -0
  129. package/src/components/ui/button.tsx +32 -0
  130. package/src/container/AiInbox.tsx +26 -3
  131. package/src/container/AiLandingInput.tsx +48 -22
  132. package/src/container/InboxAiMessagesLoader.tsx +17 -31
  133. package/src/container/index.ts +2 -0
  134. package/src/enums/messenger-slot-fill-name-enum.ts +1 -0
  135. package/src/hooks/index.ts +2 -0
  136. package/src/hooks/use-file-sync.ts +91 -0
  137. package/src/hooks/usePersistentModelConfig.ts +63 -0
  138. package/src/index.ts +7 -0
  139. package/src/machines/aiAgentMachine.simple.ts +89 -0
  140. package/src/machines/aiAgentMachine.ts +67 -19
  141. package/src/machines/aiAgentMachine.ts.bk +1296 -0
  142. package/src/machines/index.ts +2 -0
  143. package/src/module.tsx +10 -1
  144. package/src/templates/InboxWithAi.tsx +151 -90
  145. package/src/utils/utils.ts +3 -0
@@ -92,7 +92,8 @@ export const InputComponent = ({ handleSend: handleSendProp, placeholder }: Mess
92
92
  const hasContent = message.trim().length > 0;
93
93
 
94
94
  return (
95
- <div className="bg-gray-50 border-t border-gray-200">
95
+ // <div className="bg-gray-50 border-t border-gray-200">
96
+ <div className="bg-gray-50 border border-gray-200">
96
97
  {/* Toast notification */}
97
98
  {showToast && (
98
99
  <div className="fixed top-4 right-4 z-50 bg-orange-50 border border-orange-200 text-orange-800 px-4 py-3 rounded-lg shadow-lg animate-bounce">
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { Slot } from '@common-stack/components-pro';
3
+ import { IPost } from 'common';
4
+ import { MessengerSlotFillNameEnum } from '../../enums';
5
+
6
+ export interface IRightSidebarAi extends React.HTMLAttributes<HTMLDivElement> {
7
+ channelId: string;
8
+ detailSidebarOptions: {
9
+ isMobileView: boolean;
10
+ isSmallTabletView: boolean;
11
+ isTabletView: boolean;
12
+ isDesktopView: boolean;
13
+ isLargeDesktopView: boolean;
14
+ isSmallScreen: boolean;
15
+ [key: string]: any;
16
+ };
17
+ windowWidth: number;
18
+ windowHeight: number;
19
+ activeTab?: string;
20
+ setIsLoading?: (isLoading: boolean) => void;
21
+ isLoading?: boolean;
22
+ messages?: any[];
23
+ selectedPost?: any;
24
+ [key: string]: any;
25
+ }
26
+
27
+ export const RightSidebarAi = (props: IRightSidebarAi) => {
28
+ return (
29
+ <Slot
30
+ name={MessengerSlotFillNameEnum.INBOX_WITH_AI_RIGHT_SIDEBAR}
31
+ fillProps={{
32
+ active: true,
33
+ ...props,
34
+ }}
35
+ />
36
+ );
37
+ };
@@ -13,3 +13,4 @@ export * from './ServiceInboxItem';
13
13
  export * from './MessageInputComponent';
14
14
  export * from './InputComponent';
15
15
  export * from './MessagesBuilderUi';
16
+ export * from './RightSidebarAi';
@@ -0,0 +1,240 @@
1
+ import React, { useState } from 'react';
2
+ import { ISandboxError } from 'common';
3
+
4
+ const IconAlertTriangle: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
5
+ <svg
6
+ viewBox="0 0 24 24"
7
+ fill="none"
8
+ stroke="currentColor"
9
+ strokeWidth="2"
10
+ strokeLinecap="round"
11
+ strokeLinejoin="round"
12
+ {...props}
13
+ >
14
+ <path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" />
15
+ <line x1="12" y1="9" x2="12" y2="13" />
16
+ <line x1="12" y1="17" x2="12.01" y2="17" />
17
+ </svg>
18
+ );
19
+
20
+ const IconRefreshCw: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
21
+ <svg
22
+ viewBox="0 0 24 24"
23
+ fill="none"
24
+ stroke="currentColor"
25
+ strokeWidth="2"
26
+ strokeLinecap="round"
27
+ strokeLinejoin="round"
28
+ {...props}
29
+ >
30
+ <polyline points="23 4 23 10 17 10" />
31
+ <polyline points="1 20 1 14 7 14" />
32
+ <path d="M3.51 9a9 9 0 0114.13-3.36L23 10" />
33
+ <path d="M20.49 15a9 9 0 01-14.13 3.36L1 14" />
34
+ </svg>
35
+ );
36
+
37
+ const IconCode: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
38
+ <svg
39
+ viewBox="0 0 24 24"
40
+ fill="none"
41
+ stroke="currentColor"
42
+ strokeWidth="2"
43
+ strokeLinecap="round"
44
+ strokeLinejoin="round"
45
+ {...props}
46
+ >
47
+ <polyline points="16 18 22 12 16 6" />
48
+ <polyline points="8 6 2 12 8 18" />
49
+ </svg>
50
+ );
51
+
52
+ const IconExternalLink: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
53
+ <svg
54
+ viewBox="0 0 24 24"
55
+ fill="none"
56
+ stroke="currentColor"
57
+ strokeWidth="2"
58
+ strokeLinecap="round"
59
+ strokeLinejoin="round"
60
+ {...props}
61
+ >
62
+ <path d="M18 13v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
63
+ <polyline points="15 3 21 3 21 9" />
64
+ <line x1="10" y1="14" x2="21" y2="3" />
65
+ </svg>
66
+ );
67
+
68
+ interface ErrorFixCardProps {
69
+ error: ISandboxError;
70
+ onFixError: (errorMessage: string) => Promise<void>;
71
+ currentFiles?: Record<string, string>;
72
+ isFixing?: boolean;
73
+ }
74
+
75
+ export const ErrorFixCard: React.FC<ErrorFixCardProps> = ({ error, onFixError, currentFiles, isFixing = false }) => {
76
+ const [isExpanded, setIsExpanded] = useState(false);
77
+ const [isFixingError, setIsFixingError] = useState(false);
78
+
79
+ const handleFixError = async () => {
80
+ setIsFixingError(true);
81
+ try {
82
+ const errorContext = `
83
+ ERROR DETECTED IN SANDBOX:
84
+
85
+ Error Type: ${error.errorType}
86
+ Timestamp: ${error.timestamp}
87
+ Sandbox ID: ${error.sandboxId}
88
+
89
+ Error Message:
90
+ ${error.message}
91
+
92
+ ${error.stack ? `Stack Trace:\n${error.stack}` : ''}
93
+
94
+ ${
95
+ currentFiles && Object.keys(currentFiles).length > 0
96
+ ? `
97
+ Current Files in Project:
98
+ ${Object.entries(currentFiles)
99
+ .map(
100
+ ([path, content]) => `
101
+ --- ${path} ---
102
+ ${content}
103
+ `,
104
+ )
105
+ .join('\n')}
106
+ `
107
+ : ''
108
+ }
109
+
110
+ Please analyze this error and fix the code. Make sure to:
111
+ 1. Identify the root cause of the error
112
+ 2. Update the necessary files to resolve the issue
113
+ 3. Ensure the fix maintains the existing functionality
114
+ 4. Test that the solution compiles and runs correctly
115
+ `.trim();
116
+
117
+ await onFixError(errorContext);
118
+ } catch (error) {
119
+ console.error('Failed to trigger error fix:', error);
120
+ } finally {
121
+ setIsFixingError(false);
122
+ }
123
+ };
124
+
125
+ const getErrorTypeColor = (errorType: string) => {
126
+ switch (errorType) {
127
+ case 'COMPILATION_ERROR':
128
+ return 'text-red-600 bg-red-50 border-red-200';
129
+ case 'RUNTIME_ERROR':
130
+ return 'text-orange-600 bg-orange-50 border-orange-200';
131
+ case 'DEPENDENCY_ERROR':
132
+ return 'text-yellow-600 bg-yellow-50 border-yellow-200';
133
+ case 'SERVER_START_ERROR':
134
+ return 'text-purple-600 bg-purple-50 border-purple-200';
135
+ case 'SANDBOX_DISCONNECTED':
136
+ return 'text-gray-600 bg-gray-50 border-gray-200';
137
+ case 'TEST_ERROR':
138
+ return 'text-blue-600 bg-blue-50 border-blue-200';
139
+ default:
140
+ return 'text-red-600 bg-red-50 border-red-200';
141
+ }
142
+ };
143
+
144
+ const formatErrorType = (errorType: string) => {
145
+ return errorType
146
+ .replace(/_/g, ' ')
147
+ .toLowerCase()
148
+ .replace(/\b\w/g, (l) => l.toUpperCase());
149
+ };
150
+
151
+ return (
152
+ <div className="flex w-full justify-start mb-2">
153
+ <div
154
+ className={`rounded-lg p-2 border w-fit max-w-[75%] min-w-0 break-all overflow-hidden ${getErrorTypeColor(
155
+ error.errorType,
156
+ )}`}
157
+ >
158
+ <div className="flex items-start justify-between mb-1">
159
+ <div className="flex items-center space-x-1">
160
+ <IconAlertTriangle className="w-3 h-3 text-red-600 flex-shrink-0" />
161
+ <span className="font-semibold text-xs">{formatErrorType(error.errorType)}</span>
162
+ <span className="text-xs opacity-60">{new Date(error.timestamp).toLocaleTimeString()}</span>
163
+ {error.url && (
164
+ <a
165
+ href={error.url}
166
+ target="_blank"
167
+ rel="noopener noreferrer"
168
+ className="text-xs hover:underline flex items-center space-x-1"
169
+ >
170
+ <IconExternalLink className="w-3 h-3" />
171
+ <span>View Sandbox</span>
172
+ </a>
173
+ )}
174
+ </div>
175
+ </div>
176
+
177
+ <div className="text-sm mb-3">
178
+ <div
179
+ className="break-words whitespace-pre-wrap font-mono text-xs leading-relaxed overflow-hidden"
180
+ style={{
181
+ display: '-webkit-box',
182
+ WebkitLineClamp: isExpanded ? 'none' : 3,
183
+ WebkitBoxOrient: 'vertical',
184
+ maxHeight: isExpanded ? 'none' : '3.6em',
185
+ }}
186
+ >
187
+ {error.message}
188
+ </div>
189
+ {error.message.length > 150 && (
190
+ <button
191
+ onClick={() => setIsExpanded(!isExpanded)}
192
+ className="text-xs hover:underline mt-1 font-sans"
193
+ >
194
+ {isExpanded ? 'Show less' : 'Show more'}
195
+ </button>
196
+ )}
197
+ </div>
198
+
199
+ {isExpanded && error.stack && (
200
+ <div className="mt-3 p-3 bg-black bg-opacity-10 rounded text-xs font-mono">
201
+ <div className="flex items-center space-x-2 mb-2">
202
+ <IconCode className="w-3 h-3" />
203
+ <span className="font-semibold">Stack Trace</span>
204
+ </div>
205
+ <pre className="whitespace-pre-wrap text-xs break-all">{error.stack}</pre>
206
+ </div>
207
+ )}
208
+
209
+ {error.fixable && (
210
+ <div className="mt-4 flex justify-start">
211
+ <button
212
+ onClick={handleFixError}
213
+ disabled={isFixingError || isFixing}
214
+ className={`
215
+ flex items-center space-x-2 px-4 py-2 rounded-md text-sm font-medium
216
+ transition-colors duration-200
217
+ ${
218
+ isFixingError || isFixing
219
+ ? 'bg-gray-100 text-gray-400 cursor-not-allowed'
220
+ : 'bg-red-600 text-white hover:bg-red-700 shadow-sm hover:shadow-md'
221
+ }
222
+ `}
223
+ >
224
+ <IconRefreshCw className={`w-4 h-4 ${isFixingError || isFixing ? 'animate-spin' : ''}`} />
225
+ <span>{isFixingError || isFixing ? 'Fixing...' : 'Fix Error'}</span>
226
+ </button>
227
+ </div>
228
+ )}
229
+
230
+ {!error.fixable && (
231
+ <div className="mt-3 text-xs opacity-75">
232
+ This error may require manual intervention or environment changes.
233
+ </div>
234
+ )}
235
+ </div>
236
+ </div>
237
+ );
238
+ };
239
+
240
+ export default ErrorFixCard;