thepopebot 1.1.2 → 1.2.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.
Files changed (143) hide show
  1. package/README.md +1 -1
  2. package/api/index.js +72 -165
  3. package/bin/cli.js +36 -6
  4. package/bin/local.sh +31 -0
  5. package/bin/postinstall.js +6 -2
  6. package/config/index.js +2 -11
  7. package/config/instrumentation.js +17 -5
  8. package/lib/actions.js +7 -6
  9. package/lib/ai/agent.js +36 -0
  10. package/lib/ai/index.js +274 -0
  11. package/lib/ai/model.js +67 -0
  12. package/lib/ai/tools.js +49 -0
  13. package/lib/auth/actions.js +28 -0
  14. package/lib/auth/config.js +45 -0
  15. package/lib/auth/index.js +27 -0
  16. package/lib/auth/middleware.js +30 -0
  17. package/lib/channels/base.js +56 -0
  18. package/lib/channels/index.js +15 -0
  19. package/lib/channels/telegram.js +146 -0
  20. package/lib/chat/actions.js +239 -0
  21. package/lib/chat/api.js +103 -0
  22. package/lib/chat/components/app-sidebar.js +161 -0
  23. package/lib/chat/components/app-sidebar.jsx +214 -0
  24. package/lib/chat/components/chat-header.js +9 -0
  25. package/lib/chat/components/chat-header.jsx +14 -0
  26. package/lib/chat/components/chat-input.js +230 -0
  27. package/lib/chat/components/chat-input.jsx +232 -0
  28. package/lib/chat/components/chat-nav-context.js +11 -0
  29. package/lib/chat/components/chat-nav-context.jsx +11 -0
  30. package/lib/chat/components/chat-page.js +70 -0
  31. package/lib/chat/components/chat-page.jsx +89 -0
  32. package/lib/chat/components/chat.js +78 -0
  33. package/lib/chat/components/chat.jsx +91 -0
  34. package/lib/chat/components/chats-page.js +170 -0
  35. package/lib/chat/components/chats-page.jsx +203 -0
  36. package/lib/chat/components/crons-page.js +144 -0
  37. package/lib/chat/components/crons-page.jsx +204 -0
  38. package/lib/chat/components/greeting.js +11 -0
  39. package/lib/chat/components/greeting.jsx +14 -0
  40. package/lib/chat/components/icons.js +518 -0
  41. package/lib/chat/components/icons.jsx +482 -0
  42. package/lib/chat/components/index.js +19 -0
  43. package/lib/chat/components/message.js +66 -0
  44. package/lib/chat/components/message.jsx +92 -0
  45. package/lib/chat/components/messages.js +63 -0
  46. package/lib/chat/components/messages.jsx +72 -0
  47. package/lib/chat/components/notifications-page.js +54 -0
  48. package/lib/chat/components/notifications-page.jsx +83 -0
  49. package/lib/chat/components/page-layout.js +21 -0
  50. package/lib/chat/components/page-layout.jsx +28 -0
  51. package/lib/chat/components/settings-layout.js +37 -0
  52. package/lib/chat/components/settings-layout.jsx +51 -0
  53. package/lib/chat/components/settings-secrets-page.js +216 -0
  54. package/lib/chat/components/settings-secrets-page.jsx +264 -0
  55. package/lib/chat/components/sidebar-history-item.js +54 -0
  56. package/lib/chat/components/sidebar-history-item.jsx +50 -0
  57. package/lib/chat/components/sidebar-history.js +92 -0
  58. package/lib/chat/components/sidebar-history.jsx +132 -0
  59. package/lib/chat/components/sidebar-user-nav.js +59 -0
  60. package/lib/chat/components/sidebar-user-nav.jsx +69 -0
  61. package/lib/chat/components/swarm-page.js +250 -0
  62. package/lib/chat/components/swarm-page.jsx +356 -0
  63. package/lib/chat/components/triggers-page.js +121 -0
  64. package/lib/chat/components/triggers-page.jsx +177 -0
  65. package/lib/chat/components/ui/dropdown-menu.js +98 -0
  66. package/lib/chat/components/ui/dropdown-menu.jsx +116 -0
  67. package/lib/chat/components/ui/scroll-area.js +13 -0
  68. package/lib/chat/components/ui/scroll-area.jsx +17 -0
  69. package/lib/chat/components/ui/separator.js +21 -0
  70. package/lib/chat/components/ui/separator.jsx +18 -0
  71. package/lib/chat/components/ui/sheet.js +75 -0
  72. package/lib/chat/components/ui/sheet.jsx +95 -0
  73. package/lib/chat/components/ui/sidebar.js +227 -0
  74. package/lib/chat/components/ui/sidebar.jsx +245 -0
  75. package/lib/chat/components/ui/tooltip.js +56 -0
  76. package/lib/chat/components/ui/tooltip.jsx +66 -0
  77. package/lib/chat/utils.js +11 -0
  78. package/lib/cron.js +7 -8
  79. package/lib/db/api-keys.js +160 -0
  80. package/lib/db/chats.js +129 -0
  81. package/lib/db/index.js +106 -0
  82. package/lib/db/notifications.js +99 -0
  83. package/lib/db/schema.js +51 -0
  84. package/lib/db/users.js +89 -0
  85. package/lib/paths.js +23 -17
  86. package/lib/tools/create-job.js +3 -3
  87. package/lib/tools/github.js +145 -1
  88. package/lib/tools/openai.js +1 -1
  89. package/lib/tools/telegram.js +4 -3
  90. package/lib/triggers.js +6 -7
  91. package/lib/utils/render-md.js +6 -6
  92. package/package.json +43 -6
  93. package/setup/lib/auth.mjs +22 -9
  94. package/setup/lib/prerequisites.mjs +10 -3
  95. package/setup/lib/telegram-verify.mjs +3 -16
  96. package/setup/setup-telegram.mjs +31 -62
  97. package/setup/setup.mjs +58 -98
  98. package/templates/.dockerignore +5 -0
  99. package/templates/.env.example +18 -2
  100. package/templates/.github/workflows/auto-merge.yml +1 -1
  101. package/templates/.github/workflows/build-image.yml +6 -4
  102. package/templates/.github/workflows/notify-job-failed.yml +2 -2
  103. package/templates/.github/workflows/notify-pr-complete.yml +2 -2
  104. package/templates/.github/workflows/run-job.yml +24 -10
  105. package/templates/CLAUDE.md +5 -3
  106. package/templates/app/api/auth/[...nextauth]/route.js +1 -0
  107. package/templates/app/api/chat/route.js +1 -0
  108. package/templates/app/chat/[chatId]/page.js +8 -0
  109. package/templates/app/chats/page.js +7 -0
  110. package/templates/app/components/ascii-logo.jsx +10 -0
  111. package/templates/app/components/login-form.jsx +81 -0
  112. package/templates/app/components/setup-form.jsx +82 -0
  113. package/templates/app/components/theme-provider.jsx +11 -0
  114. package/templates/app/components/theme-toggle.jsx +38 -0
  115. package/templates/app/components/ui/button.jsx +21 -0
  116. package/templates/app/components/ui/card.jsx +23 -0
  117. package/templates/app/components/ui/input.jsx +10 -0
  118. package/templates/app/components/ui/label.jsx +10 -0
  119. package/templates/app/crons/page.js +7 -0
  120. package/templates/app/globals.css +66 -0
  121. package/templates/app/layout.js +9 -2
  122. package/templates/app/login/page.js +15 -0
  123. package/templates/app/notifications/page.js +7 -0
  124. package/templates/app/page.js +6 -30
  125. package/templates/app/settings/layout.js +7 -0
  126. package/templates/app/settings/page.js +5 -0
  127. package/templates/app/settings/secrets/page.js +5 -0
  128. package/templates/app/swarm/page.js +7 -0
  129. package/templates/app/triggers/page.js +7 -0
  130. package/templates/config/CRONS.json +2 -2
  131. package/templates/config/TRIGGERS.json +2 -2
  132. package/templates/docker/event_handler/Dockerfile +19 -0
  133. package/templates/docker/{entrypoint.sh → job/entrypoint.sh} +4 -4
  134. package/templates/docker/runner/Dockerfile +38 -0
  135. package/templates/docker/runner/entrypoint.sh +41 -0
  136. package/templates/docker-compose.yml +52 -0
  137. package/templates/instrumentation.js +6 -1
  138. package/templates/middleware.js +1 -0
  139. package/templates/postcss.config.mjs +5 -0
  140. package/lib/claude/conversation.js +0 -76
  141. package/lib/claude/index.js +0 -142
  142. package/lib/claude/tools.js +0 -54
  143. /package/templates/docker/{Dockerfile → job/Dockerfile} +0 -0
@@ -0,0 +1,482 @@
1
+ 'use client';
2
+
3
+ export function PlusIcon({ size = 16 }) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeWidth={2}
11
+ strokeLinecap="round"
12
+ strokeLinejoin="round"
13
+ width={size}
14
+ height={size}
15
+ >
16
+ <path d="M5 12h14" />
17
+ <path d="M12 5v14" />
18
+ </svg>
19
+ );
20
+ }
21
+
22
+ export function TrashIcon({ size = 16 }) {
23
+ return (
24
+ <svg
25
+ xmlns="http://www.w3.org/2000/svg"
26
+ viewBox="0 0 24 24"
27
+ fill="none"
28
+ stroke="currentColor"
29
+ strokeWidth={2}
30
+ strokeLinecap="round"
31
+ strokeLinejoin="round"
32
+ width={size}
33
+ height={size}
34
+ >
35
+ <path d="M3 6h18" />
36
+ <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" />
37
+ <path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" />
38
+ </svg>
39
+ );
40
+ }
41
+
42
+ export function SendIcon({ size = 16 }) {
43
+ return (
44
+ <svg
45
+ xmlns="http://www.w3.org/2000/svg"
46
+ viewBox="0 0 24 24"
47
+ fill="none"
48
+ stroke="currentColor"
49
+ strokeWidth={2}
50
+ strokeLinecap="round"
51
+ strokeLinejoin="round"
52
+ width={size}
53
+ height={size}
54
+ >
55
+ <path d="m5 12 7-7 7 7" />
56
+ <path d="M12 19V5" />
57
+ </svg>
58
+ );
59
+ }
60
+
61
+ export function StopIcon({ size = 16 }) {
62
+ return (
63
+ <svg
64
+ xmlns="http://www.w3.org/2000/svg"
65
+ viewBox="0 0 24 24"
66
+ fill="currentColor"
67
+ width={size}
68
+ height={size}
69
+ >
70
+ <rect x="6" y="6" width="12" height="12" rx="1" />
71
+ </svg>
72
+ );
73
+ }
74
+
75
+ export function MessageIcon({ size = 16 }) {
76
+ return (
77
+ <svg
78
+ xmlns="http://www.w3.org/2000/svg"
79
+ viewBox="0 0 24 24"
80
+ fill="none"
81
+ stroke="currentColor"
82
+ strokeWidth={2}
83
+ strokeLinecap="round"
84
+ strokeLinejoin="round"
85
+ width={size}
86
+ height={size}
87
+ >
88
+ <path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z" />
89
+ </svg>
90
+ );
91
+ }
92
+
93
+ export function SquarePenIcon({ size = 16 }) {
94
+ return (
95
+ <svg
96
+ xmlns="http://www.w3.org/2000/svg"
97
+ viewBox="0 0 24 24"
98
+ fill="none"
99
+ stroke="currentColor"
100
+ strokeWidth={2}
101
+ strokeLinecap="round"
102
+ strokeLinejoin="round"
103
+ width={size}
104
+ height={size}
105
+ >
106
+ <path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
107
+ <path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z" />
108
+ </svg>
109
+ );
110
+ }
111
+
112
+ export function PanelLeftIcon({ size = 16 }) {
113
+ return (
114
+ <svg
115
+ xmlns="http://www.w3.org/2000/svg"
116
+ viewBox="0 0 24 24"
117
+ fill="none"
118
+ stroke="currentColor"
119
+ strokeWidth={2}
120
+ strokeLinecap="round"
121
+ strokeLinejoin="round"
122
+ width={size}
123
+ height={size}
124
+ >
125
+ <rect width="18" height="18" x="3" y="3" rx="2" />
126
+ <path d="M9 3v18" />
127
+ </svg>
128
+ );
129
+ }
130
+
131
+ export function SearchIcon({ size = 16 }) {
132
+ return (
133
+ <svg
134
+ xmlns="http://www.w3.org/2000/svg"
135
+ viewBox="0 0 24 24"
136
+ fill="none"
137
+ stroke="currentColor"
138
+ strokeWidth={2}
139
+ strokeLinecap="round"
140
+ strokeLinejoin="round"
141
+ width={size}
142
+ height={size}
143
+ >
144
+ <circle cx="11" cy="11" r="8" />
145
+ <path d="m21 21-4.35-4.35" />
146
+ </svg>
147
+ );
148
+ }
149
+
150
+ export function BellIcon({ size = 16 }) {
151
+ return (
152
+ <svg
153
+ xmlns="http://www.w3.org/2000/svg"
154
+ viewBox="0 0 24 24"
155
+ fill="none"
156
+ stroke="currentColor"
157
+ strokeWidth={2}
158
+ strokeLinecap="round"
159
+ strokeLinejoin="round"
160
+ width={size}
161
+ height={size}
162
+ >
163
+ <path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" />
164
+ <path d="M10.3 21a1.94 1.94 0 0 0 3.4 0" />
165
+ </svg>
166
+ );
167
+ }
168
+
169
+ export function SwarmIcon({ size = 16 }) {
170
+ return (
171
+ <svg
172
+ xmlns="http://www.w3.org/2000/svg"
173
+ viewBox="0 0 24 24"
174
+ fill="none"
175
+ stroke="currentColor"
176
+ strokeWidth={2}
177
+ strokeLinecap="round"
178
+ strokeLinejoin="round"
179
+ width={size}
180
+ height={size}
181
+ >
182
+ {/* Three hexagons in a triangular cluster */}
183
+ <path d="M9.5 2L12 4.5L9.5 7L5 7L2.5 4.5L5 2Z" />
184
+ <path d="M19 2L21.5 4.5L19 7L14.5 7L12 4.5L14.5 2Z" />
185
+ <path d="M14.25 7L16.75 9.5L14.25 12L9.75 12L7.25 9.5L9.75 7Z" />
186
+ </svg>
187
+ );
188
+ }
189
+
190
+ export function PaperclipIcon({ size = 16 }) {
191
+ return (
192
+ <svg
193
+ xmlns="http://www.w3.org/2000/svg"
194
+ viewBox="0 0 24 24"
195
+ fill="none"
196
+ stroke="currentColor"
197
+ strokeWidth={2}
198
+ strokeLinecap="round"
199
+ strokeLinejoin="round"
200
+ width={size}
201
+ height={size}
202
+ >
203
+ <path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" />
204
+ </svg>
205
+ );
206
+ }
207
+
208
+ export function XIcon({ size = 16 }) {
209
+ return (
210
+ <svg
211
+ xmlns="http://www.w3.org/2000/svg"
212
+ viewBox="0 0 24 24"
213
+ fill="none"
214
+ stroke="currentColor"
215
+ strokeWidth={2}
216
+ strokeLinecap="round"
217
+ strokeLinejoin="round"
218
+ width={size}
219
+ height={size}
220
+ >
221
+ <path d="M18 6 6 18" />
222
+ <path d="m6 6 12 12" />
223
+ </svg>
224
+ );
225
+ }
226
+
227
+ export function FileTextIcon({ size = 16 }) {
228
+ return (
229
+ <svg
230
+ xmlns="http://www.w3.org/2000/svg"
231
+ viewBox="0 0 24 24"
232
+ fill="none"
233
+ stroke="currentColor"
234
+ strokeWidth={2}
235
+ strokeLinecap="round"
236
+ strokeLinejoin="round"
237
+ width={size}
238
+ height={size}
239
+ >
240
+ <path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" />
241
+ <path d="M14 2v4a2 2 0 0 0 2 2h4" />
242
+ <path d="M10 9H8" />
243
+ <path d="M16 13H8" />
244
+ <path d="M16 17H8" />
245
+ </svg>
246
+ );
247
+ }
248
+
249
+ export function ClockIcon({ size = 16 }) {
250
+ return (
251
+ <svg
252
+ xmlns="http://www.w3.org/2000/svg"
253
+ viewBox="0 0 24 24"
254
+ fill="none"
255
+ stroke="currentColor"
256
+ strokeWidth={2}
257
+ strokeLinecap="round"
258
+ strokeLinejoin="round"
259
+ width={size}
260
+ height={size}
261
+ >
262
+ <circle cx="12" cy="12" r="10" />
263
+ <polyline points="12 6 12 12 16 14" />
264
+ </svg>
265
+ );
266
+ }
267
+
268
+ export function ZapIcon({ size = 16 }) {
269
+ return (
270
+ <svg
271
+ xmlns="http://www.w3.org/2000/svg"
272
+ viewBox="0 0 24 24"
273
+ fill="none"
274
+ stroke="currentColor"
275
+ strokeWidth={2}
276
+ strokeLinecap="round"
277
+ strokeLinejoin="round"
278
+ width={size}
279
+ height={size}
280
+ >
281
+ <path d="M13 2 3 14h9l-1 10 10-12h-9l1-10z" />
282
+ </svg>
283
+ );
284
+ }
285
+
286
+ export function RefreshIcon({ size = 16 }) {
287
+ return (
288
+ <svg
289
+ xmlns="http://www.w3.org/2000/svg"
290
+ viewBox="0 0 24 24"
291
+ fill="none"
292
+ stroke="currentColor"
293
+ strokeWidth={2}
294
+ strokeLinecap="round"
295
+ strokeLinejoin="round"
296
+ width={size}
297
+ height={size}
298
+ >
299
+ <path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
300
+ <path d="M21 3v5h-5" />
301
+ <path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
302
+ <path d="M8 16H3v5" />
303
+ </svg>
304
+ );
305
+ }
306
+
307
+ export function ChevronDownIcon({ size = 16 }) {
308
+ return (
309
+ <svg
310
+ xmlns="http://www.w3.org/2000/svg"
311
+ viewBox="0 0 24 24"
312
+ fill="none"
313
+ stroke="currentColor"
314
+ strokeWidth={2}
315
+ strokeLinecap="round"
316
+ strokeLinejoin="round"
317
+ width={size}
318
+ height={size}
319
+ >
320
+ <path d="m6 9 6 6 6-6" />
321
+ </svg>
322
+ );
323
+ }
324
+
325
+ export function SettingsIcon({ size = 16 }) {
326
+ return (
327
+ <svg
328
+ xmlns="http://www.w3.org/2000/svg"
329
+ viewBox="0 0 24 24"
330
+ fill="none"
331
+ stroke="currentColor"
332
+ strokeWidth={2}
333
+ strokeLinecap="round"
334
+ strokeLinejoin="round"
335
+ width={size}
336
+ height={size}
337
+ >
338
+ <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
339
+ <circle cx="12" cy="12" r="3" />
340
+ </svg>
341
+ );
342
+ }
343
+
344
+ export function KeyIcon({ size = 16 }) {
345
+ return (
346
+ <svg
347
+ xmlns="http://www.w3.org/2000/svg"
348
+ viewBox="0 0 24 24"
349
+ fill="none"
350
+ stroke="currentColor"
351
+ strokeWidth={2}
352
+ strokeLinecap="round"
353
+ strokeLinejoin="round"
354
+ width={size}
355
+ height={size}
356
+ >
357
+ <path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4" />
358
+ <path d="m21 2-9.6 9.6" />
359
+ <circle cx="7.5" cy="15.5" r="5.5" />
360
+ </svg>
361
+ );
362
+ }
363
+
364
+ export function CopyIcon({ size = 16 }) {
365
+ return (
366
+ <svg
367
+ xmlns="http://www.w3.org/2000/svg"
368
+ viewBox="0 0 24 24"
369
+ fill="none"
370
+ stroke="currentColor"
371
+ strokeWidth={2}
372
+ strokeLinecap="round"
373
+ strokeLinejoin="round"
374
+ width={size}
375
+ height={size}
376
+ >
377
+ <rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
378
+ <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
379
+ </svg>
380
+ );
381
+ }
382
+
383
+ export function CheckIcon({ size = 16 }) {
384
+ return (
385
+ <svg
386
+ xmlns="http://www.w3.org/2000/svg"
387
+ viewBox="0 0 24 24"
388
+ fill="none"
389
+ stroke="currentColor"
390
+ strokeWidth={2}
391
+ strokeLinecap="round"
392
+ strokeLinejoin="round"
393
+ width={size}
394
+ height={size}
395
+ >
396
+ <path d="M20 6 9 17l-5-5" />
397
+ </svg>
398
+ );
399
+ }
400
+
401
+ export function SpinnerIcon({ size = 16, className = '' }) {
402
+ return (
403
+ <svg
404
+ xmlns="http://www.w3.org/2000/svg"
405
+ viewBox="0 0 24 24"
406
+ fill="none"
407
+ stroke="currentColor"
408
+ strokeWidth={2}
409
+ strokeLinecap="round"
410
+ strokeLinejoin="round"
411
+ width={size}
412
+ height={size}
413
+ className={`animate-spin ${className}`}
414
+ >
415
+ <path d="M21 12a9 9 0 1 1-6.219-8.56" />
416
+ </svg>
417
+ );
418
+ }
419
+
420
+ export function SunIcon({ size = 16 }) {
421
+ return (
422
+ <svg
423
+ xmlns="http://www.w3.org/2000/svg"
424
+ viewBox="0 0 24 24"
425
+ fill="none"
426
+ stroke="currentColor"
427
+ strokeWidth={2}
428
+ strokeLinecap="round"
429
+ strokeLinejoin="round"
430
+ width={size}
431
+ height={size}
432
+ >
433
+ <circle cx="12" cy="12" r="4" />
434
+ <path d="M12 2v2" />
435
+ <path d="M12 20v2" />
436
+ <path d="m4.93 4.93 1.41 1.41" />
437
+ <path d="m17.66 17.66 1.41 1.41" />
438
+ <path d="M2 12h2" />
439
+ <path d="M20 12h2" />
440
+ <path d="m6.34 17.66-1.41 1.41" />
441
+ <path d="m19.07 4.93-1.41 1.41" />
442
+ </svg>
443
+ );
444
+ }
445
+
446
+ export function MoonIcon({ size = 16 }) {
447
+ return (
448
+ <svg
449
+ xmlns="http://www.w3.org/2000/svg"
450
+ viewBox="0 0 24 24"
451
+ fill="none"
452
+ stroke="currentColor"
453
+ strokeWidth={2}
454
+ strokeLinecap="round"
455
+ strokeLinejoin="round"
456
+ width={size}
457
+ height={size}
458
+ >
459
+ <path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" />
460
+ </svg>
461
+ );
462
+ }
463
+
464
+ export function LogOutIcon({ size = 16 }) {
465
+ return (
466
+ <svg
467
+ xmlns="http://www.w3.org/2000/svg"
468
+ viewBox="0 0 24 24"
469
+ fill="none"
470
+ stroke="currentColor"
471
+ strokeWidth={2}
472
+ strokeLinecap="round"
473
+ strokeLinejoin="round"
474
+ width={size}
475
+ height={size}
476
+ >
477
+ <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
478
+ <polyline points="16 17 21 12 16 7" />
479
+ <line x1="21" x2="9" y1="12" y2="12" />
480
+ </svg>
481
+ );
482
+ }
@@ -0,0 +1,19 @@
1
+ export { ChatPage } from './chat-page.js';
2
+ export { ChatsPage } from './chats-page.js';
3
+ export { NotificationsPage } from './notifications-page.js';
4
+ export { SwarmPage } from './swarm-page.js';
5
+ export { CronsPage } from './crons-page.js';
6
+ export { TriggersPage } from './triggers-page.js';
7
+ export { PageLayout } from './page-layout.js';
8
+ export { SettingsLayout } from './settings-layout.js';
9
+ export { SettingsSecretsPage } from './settings-secrets-page.js';
10
+ export { AppSidebar } from './app-sidebar.js';
11
+ export { SidebarHistory } from './sidebar-history.js';
12
+ export { SidebarHistoryItem } from './sidebar-history-item.js';
13
+ export { SidebarUserNav } from './sidebar-user-nav.js';
14
+ export { Chat } from './chat.js';
15
+ export { Messages } from './messages.js';
16
+ export { PreviewMessage, ThinkingMessage } from './message.js';
17
+ export { ChatInput } from './chat-input.js';
18
+ export { ChatHeader } from './chat-header.js';
19
+ export { Greeting } from './greeting.js';
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Streamdown } from "streamdown";
4
+ import { cn } from "../utils.js";
5
+ import { SpinnerIcon, FileTextIcon } from "./icons.js";
6
+ function PreviewMessage({ message, isLoading }) {
7
+ const isUser = message.role === "user";
8
+ const text = message.parts?.filter((p) => p.type === "text").map((p) => p.text).join("\n") || message.content || "";
9
+ const fileParts = message.parts?.filter((p) => p.type === "file") || [];
10
+ const imageParts = fileParts.filter((p) => p.mediaType?.startsWith("image/"));
11
+ const otherFileParts = fileParts.filter((p) => !p.mediaType?.startsWith("image/"));
12
+ return /* @__PURE__ */ jsx(
13
+ "div",
14
+ {
15
+ className: cn(
16
+ "flex gap-4 w-full",
17
+ isUser ? "justify-end" : "justify-start"
18
+ ),
19
+ children: /* @__PURE__ */ jsxs(
20
+ "div",
21
+ {
22
+ className: cn(
23
+ "max-w-[85%] rounded-xl px-4 py-3 text-sm leading-relaxed",
24
+ isUser ? "bg-primary text-primary-foreground" : "bg-muted text-foreground"
25
+ ),
26
+ children: [
27
+ imageParts.length > 0 && /* @__PURE__ */ jsx("div", { className: "mb-2 flex flex-wrap gap-2", children: imageParts.map((part, i) => /* @__PURE__ */ jsx(
28
+ "img",
29
+ {
30
+ src: part.url,
31
+ alt: "attachment",
32
+ className: "max-h-64 max-w-full rounded-lg object-contain"
33
+ },
34
+ i
35
+ )) }),
36
+ otherFileParts.length > 0 && /* @__PURE__ */ jsx("div", { className: "mb-2 flex flex-wrap gap-2", children: otherFileParts.map((part, i) => /* @__PURE__ */ jsxs(
37
+ "div",
38
+ {
39
+ className: cn(
40
+ "inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs",
41
+ isUser ? "bg-primary-foreground/20" : "bg-foreground/10"
42
+ ),
43
+ children: [
44
+ /* @__PURE__ */ jsx(FileTextIcon, { size: 12 }),
45
+ /* @__PURE__ */ jsx("span", { className: "max-w-[150px] truncate", children: part.name || part.mediaType || "file" })
46
+ ]
47
+ },
48
+ i
49
+ )) }),
50
+ text ? isUser ? /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap break-words", children: text }) : /* @__PURE__ */ jsx(Streamdown, { mode: isLoading ? "streaming" : "static", children: text }) : null
51
+ ]
52
+ }
53
+ )
54
+ }
55
+ );
56
+ }
57
+ function ThinkingMessage() {
58
+ return /* @__PURE__ */ jsx("div", { className: "flex gap-4 w-full justify-start", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-xl bg-muted px-4 py-3 text-sm text-muted-foreground", children: [
59
+ /* @__PURE__ */ jsx(SpinnerIcon, { size: 14 }),
60
+ /* @__PURE__ */ jsx("span", { children: "Thinking..." })
61
+ ] }) });
62
+ }
63
+ export {
64
+ PreviewMessage,
65
+ ThinkingMessage
66
+ };
@@ -0,0 +1,92 @@
1
+ 'use client';
2
+
3
+ import { Streamdown } from 'streamdown';
4
+ import { cn } from '../utils.js';
5
+ import { SpinnerIcon, FileTextIcon } from './icons.js';
6
+
7
+ export function PreviewMessage({ message, isLoading }) {
8
+ const isUser = message.role === 'user';
9
+
10
+ // Extract text from parts (AI SDK v5+) or fall back to content
11
+ const text =
12
+ message.parts
13
+ ?.filter((p) => p.type === 'text')
14
+ .map((p) => p.text)
15
+ .join('\n') ||
16
+ message.content ||
17
+ '';
18
+
19
+ // Extract file parts
20
+ const fileParts = message.parts?.filter((p) => p.type === 'file') || [];
21
+ const imageParts = fileParts.filter((p) => p.mediaType?.startsWith('image/'));
22
+ const otherFileParts = fileParts.filter((p) => !p.mediaType?.startsWith('image/'));
23
+
24
+ return (
25
+ <div
26
+ className={cn(
27
+ 'flex gap-4 w-full',
28
+ isUser ? 'justify-end' : 'justify-start'
29
+ )}
30
+ >
31
+ <div
32
+ className={cn(
33
+ 'max-w-[85%] rounded-xl px-4 py-3 text-sm leading-relaxed',
34
+ isUser
35
+ ? 'bg-primary text-primary-foreground'
36
+ : 'bg-muted text-foreground'
37
+ )}
38
+ >
39
+ {imageParts.length > 0 && (
40
+ <div className="mb-2 flex flex-wrap gap-2">
41
+ {imageParts.map((part, i) => (
42
+ <img
43
+ key={i}
44
+ src={part.url}
45
+ alt="attachment"
46
+ className="max-h-64 max-w-full rounded-lg object-contain"
47
+ />
48
+ ))}
49
+ </div>
50
+ )}
51
+ {otherFileParts.length > 0 && (
52
+ <div className="mb-2 flex flex-wrap gap-2">
53
+ {otherFileParts.map((part, i) => (
54
+ <div
55
+ key={i}
56
+ className={cn(
57
+ 'inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs',
58
+ isUser
59
+ ? 'bg-primary-foreground/20'
60
+ : 'bg-foreground/10'
61
+ )}
62
+ >
63
+ <FileTextIcon size={12} />
64
+ <span className="max-w-[150px] truncate">
65
+ {part.name || part.mediaType || 'file'}
66
+ </span>
67
+ </div>
68
+ ))}
69
+ </div>
70
+ )}
71
+ {text ? (
72
+ isUser ? (
73
+ <div className="whitespace-pre-wrap break-words">{text}</div>
74
+ ) : (
75
+ <Streamdown mode={isLoading ? 'streaming' : 'static'}>{text}</Streamdown>
76
+ )
77
+ ) : null}
78
+ </div>
79
+ </div>
80
+ );
81
+ }
82
+
83
+ export function ThinkingMessage() {
84
+ return (
85
+ <div className="flex gap-4 w-full justify-start">
86
+ <div className="flex items-center gap-2 rounded-xl bg-muted px-4 py-3 text-sm text-muted-foreground">
87
+ <SpinnerIcon size={14} />
88
+ <span>Thinking...</span>
89
+ </div>
90
+ </div>
91
+ );
92
+ }