@d34dman/flowdrop 0.0.30 → 0.0.31
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.
- package/dist/components/App.svelte +54 -6
- package/dist/components/NodeSidebar.svelte +1 -1
- package/dist/components/SchemaForm.svelte +14 -14
- package/dist/components/SchemaForm.svelte.d.ts +1 -1
- package/dist/components/form/FormFieldLight.svelte +66 -66
- package/dist/components/form/FormFieldLight.svelte.d.ts +1 -1
- package/dist/components/form/types.d.ts +1 -1
- package/dist/components/playground/ChatPanel.svelte +523 -0
- package/dist/components/playground/ChatPanel.svelte.d.ts +20 -0
- package/dist/components/playground/ExecutionLogs.svelte +486 -0
- package/dist/components/playground/ExecutionLogs.svelte.d.ts +14 -0
- package/dist/components/playground/InputCollector.svelte +444 -0
- package/dist/components/playground/InputCollector.svelte.d.ts +16 -0
- package/dist/components/playground/MessageBubble.svelte +398 -0
- package/dist/components/playground/MessageBubble.svelte.d.ts +15 -0
- package/dist/components/playground/Playground.svelte +851 -0
- package/dist/components/playground/Playground.svelte.d.ts +25 -0
- package/dist/components/playground/SessionManager.svelte +537 -0
- package/dist/components/playground/SessionManager.svelte.d.ts +20 -0
- package/dist/config/endpoints.d.ts +16 -0
- package/dist/config/endpoints.js +9 -0
- package/dist/core/index.d.ts +25 -23
- package/dist/core/index.js +13 -12
- package/dist/display/index.d.ts +2 -2
- package/dist/display/index.js +2 -2
- package/dist/editor/index.d.ts +57 -49
- package/dist/editor/index.js +52 -42
- package/dist/form/code.d.ts +4 -4
- package/dist/form/code.js +11 -11
- package/dist/form/fieldRegistry.d.ts +2 -2
- package/dist/form/fieldRegistry.js +8 -10
- package/dist/form/full.d.ts +5 -5
- package/dist/form/full.js +7 -7
- package/dist/form/index.d.ts +16 -16
- package/dist/form/index.js +14 -14
- package/dist/form/markdown.d.ts +3 -3
- package/dist/form/markdown.js +6 -6
- package/dist/index.d.ts +6 -4
- package/dist/index.js +9 -4
- package/dist/playground/index.d.ts +92 -0
- package/dist/playground/index.js +114 -0
- package/dist/playground/mount.d.ts +183 -0
- package/dist/playground/mount.js +178 -0
- package/dist/services/playgroundService.d.ts +129 -0
- package/dist/services/playgroundService.js +317 -0
- package/dist/stores/playgroundStore.d.ts +199 -0
- package/dist/stores/playgroundStore.js +350 -0
- package/dist/types/playground.d.ts +230 -0
- package/dist/types/playground.js +28 -0
- package/dist/utils/colors.js +4 -4
- package/package.json +6 -1
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
MessageBubble Component
|
|
3
|
+
|
|
4
|
+
Renders individual messages in the playground chat interface.
|
|
5
|
+
Supports different message roles with distinct styling.
|
|
6
|
+
Styled with BEM syntax.
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import Icon from '@iconify/svelte';
|
|
11
|
+
import type { PlaygroundMessage, PlaygroundMessageRole } from '../../types/playground.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Component props
|
|
15
|
+
*/
|
|
16
|
+
interface Props {
|
|
17
|
+
/** The message to display */
|
|
18
|
+
message: PlaygroundMessage;
|
|
19
|
+
/** Whether to show the timestamp */
|
|
20
|
+
showTimestamp?: boolean;
|
|
21
|
+
/** Whether this is the last message (affects styling) */
|
|
22
|
+
isLast?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let { message, showTimestamp = true, isLast = false }: Props = $props();
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get the icon for the message role
|
|
29
|
+
*
|
|
30
|
+
* @param role - The message role
|
|
31
|
+
* @returns Iconify icon string
|
|
32
|
+
*/
|
|
33
|
+
function getRoleIcon(role: PlaygroundMessageRole): string {
|
|
34
|
+
switch (role) {
|
|
35
|
+
case 'user':
|
|
36
|
+
return 'mdi:account';
|
|
37
|
+
case 'assistant':
|
|
38
|
+
return 'mdi:robot';
|
|
39
|
+
case 'system':
|
|
40
|
+
return 'mdi:cog';
|
|
41
|
+
case 'log':
|
|
42
|
+
return 'mdi:console';
|
|
43
|
+
default:
|
|
44
|
+
return 'mdi:message';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the display label for the message role
|
|
50
|
+
*
|
|
51
|
+
* @param role - The message role
|
|
52
|
+
* @returns Display label
|
|
53
|
+
*/
|
|
54
|
+
function getRoleLabel(role: PlaygroundMessageRole): string {
|
|
55
|
+
switch (role) {
|
|
56
|
+
case 'user':
|
|
57
|
+
return 'You';
|
|
58
|
+
case 'assistant':
|
|
59
|
+
return 'Assistant';
|
|
60
|
+
case 'system':
|
|
61
|
+
return 'System';
|
|
62
|
+
case 'log':
|
|
63
|
+
return message.metadata?.nodeLabel ?? 'Log';
|
|
64
|
+
default:
|
|
65
|
+
return 'Message';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Format timestamp for display
|
|
71
|
+
*
|
|
72
|
+
* @param timestamp - ISO 8601 timestamp
|
|
73
|
+
* @returns Formatted time string
|
|
74
|
+
*/
|
|
75
|
+
function formatTimestamp(timestamp: string): string {
|
|
76
|
+
const date = new Date(timestamp);
|
|
77
|
+
return date.toLocaleTimeString('en-US', {
|
|
78
|
+
hour12: false,
|
|
79
|
+
hour: '2-digit',
|
|
80
|
+
minute: '2-digit',
|
|
81
|
+
second: '2-digit'
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get log level icon
|
|
87
|
+
*/
|
|
88
|
+
function getLogLevelIcon(): string {
|
|
89
|
+
const level = message.metadata?.level;
|
|
90
|
+
switch (level) {
|
|
91
|
+
case 'error':
|
|
92
|
+
return 'mdi:alert-circle';
|
|
93
|
+
case 'warning':
|
|
94
|
+
return 'mdi:alert';
|
|
95
|
+
case 'debug':
|
|
96
|
+
return 'mdi:bug';
|
|
97
|
+
default:
|
|
98
|
+
return 'mdi:information';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Format duration for display
|
|
104
|
+
*/
|
|
105
|
+
function formatDuration(ms: number): string {
|
|
106
|
+
if (ms < 1000) {
|
|
107
|
+
return `${ms}ms`;
|
|
108
|
+
}
|
|
109
|
+
return `${(ms / 1000).toFixed(2)}s`;
|
|
110
|
+
}
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<div
|
|
114
|
+
class="message-bubble"
|
|
115
|
+
class:message-bubble--user={message.role === 'user'}
|
|
116
|
+
class:message-bubble--assistant={message.role === 'assistant'}
|
|
117
|
+
class:message-bubble--system={message.role === 'system'}
|
|
118
|
+
class:message-bubble--log={message.role === 'log'}
|
|
119
|
+
class:message-bubble--log-error={message.role === 'log' && message.metadata?.level === 'error'}
|
|
120
|
+
class:message-bubble--log-warning={message.role === 'log' &&
|
|
121
|
+
message.metadata?.level === 'warning'}
|
|
122
|
+
class:message-bubble--last={isLast}
|
|
123
|
+
>
|
|
124
|
+
<!-- Avatar / Icon -->
|
|
125
|
+
<div class="message-bubble__avatar">
|
|
126
|
+
<Icon icon={getRoleIcon(message.role)} />
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<!-- Content -->
|
|
130
|
+
<div class="message-bubble__content">
|
|
131
|
+
<!-- Header -->
|
|
132
|
+
<div class="message-bubble__header">
|
|
133
|
+
<span class="message-bubble__role">{getRoleLabel(message.role)}</span>
|
|
134
|
+
{#if message.role === 'log' && message.metadata?.level}
|
|
135
|
+
<span class="message-bubble__log-level message-bubble__log-level--{message.metadata.level}">
|
|
136
|
+
<Icon icon={getLogLevelIcon()} />
|
|
137
|
+
{message.metadata.level.toUpperCase()}
|
|
138
|
+
</span>
|
|
139
|
+
{/if}
|
|
140
|
+
{#if showTimestamp}
|
|
141
|
+
<span class="message-bubble__timestamp">{formatTimestamp(message.timestamp)}</span>
|
|
142
|
+
{/if}
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<!-- Message Text -->
|
|
146
|
+
<div class="message-bubble__text">
|
|
147
|
+
{message.content}
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
<!-- Metadata Footer -->
|
|
151
|
+
{#if message.metadata?.duration !== undefined || message.nodeId}
|
|
152
|
+
<div class="message-bubble__footer">
|
|
153
|
+
{#if message.nodeId}
|
|
154
|
+
<span class="message-bubble__node" title="Node ID: {message.nodeId}">
|
|
155
|
+
<Icon icon="mdi:graph" />
|
|
156
|
+
{message.metadata?.nodeLabel ?? message.nodeId}
|
|
157
|
+
</span>
|
|
158
|
+
{/if}
|
|
159
|
+
{#if message.metadata?.duration !== undefined}
|
|
160
|
+
<span class="message-bubble__duration" title="Execution duration">
|
|
161
|
+
<Icon icon="mdi:timer-outline" />
|
|
162
|
+
{formatDuration(message.metadata.duration)}
|
|
163
|
+
</span>
|
|
164
|
+
{/if}
|
|
165
|
+
</div>
|
|
166
|
+
{/if}
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<style>
|
|
171
|
+
.message-bubble {
|
|
172
|
+
display: flex;
|
|
173
|
+
gap: 0.75rem;
|
|
174
|
+
padding: 0.75rem 1rem;
|
|
175
|
+
margin-bottom: 0.5rem;
|
|
176
|
+
border-radius: 0.75rem;
|
|
177
|
+
animation: fadeIn 0.2s ease-out;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@keyframes fadeIn {
|
|
181
|
+
from {
|
|
182
|
+
opacity: 0;
|
|
183
|
+
transform: translateY(8px);
|
|
184
|
+
}
|
|
185
|
+
to {
|
|
186
|
+
opacity: 1;
|
|
187
|
+
transform: translateY(0);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* Role-specific styling */
|
|
192
|
+
.message-bubble--user {
|
|
193
|
+
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
|
|
194
|
+
color: #ffffff;
|
|
195
|
+
margin-left: 2rem;
|
|
196
|
+
flex-direction: row-reverse;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.message-bubble--assistant {
|
|
200
|
+
background-color: #f8fafc;
|
|
201
|
+
border: 1px solid #e2e8f0;
|
|
202
|
+
color: #1e293b;
|
|
203
|
+
margin-right: 2rem;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.message-bubble--system {
|
|
207
|
+
background-color: #fef3c7;
|
|
208
|
+
border: 1px solid #fcd34d;
|
|
209
|
+
color: #92400e;
|
|
210
|
+
margin: 0 1rem;
|
|
211
|
+
font-size: 0.875rem;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.message-bubble--log {
|
|
215
|
+
background-color: #f1f5f9;
|
|
216
|
+
border: 1px solid #cbd5e1;
|
|
217
|
+
color: #475569;
|
|
218
|
+
margin: 0 1rem;
|
|
219
|
+
font-size: 0.8125rem;
|
|
220
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.message-bubble--log-error {
|
|
224
|
+
background-color: #fef2f2;
|
|
225
|
+
border-color: #fecaca;
|
|
226
|
+
color: #991b1b;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.message-bubble--log-warning {
|
|
230
|
+
background-color: #fffbeb;
|
|
231
|
+
border-color: #fde68a;
|
|
232
|
+
color: #92400e;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.message-bubble--last {
|
|
236
|
+
margin-bottom: 1rem;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* Avatar */
|
|
240
|
+
.message-bubble__avatar {
|
|
241
|
+
flex-shrink: 0;
|
|
242
|
+
width: 2rem;
|
|
243
|
+
height: 2rem;
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: center;
|
|
246
|
+
justify-content: center;
|
|
247
|
+
border-radius: 50%;
|
|
248
|
+
font-size: 1.125rem;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.message-bubble--user .message-bubble__avatar {
|
|
252
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
253
|
+
color: #ffffff;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.message-bubble--assistant .message-bubble__avatar {
|
|
257
|
+
background-color: #dbeafe;
|
|
258
|
+
color: #2563eb;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.message-bubble--system .message-bubble__avatar {
|
|
262
|
+
background-color: #fde68a;
|
|
263
|
+
color: #92400e;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.message-bubble--log .message-bubble__avatar {
|
|
267
|
+
background-color: #e2e8f0;
|
|
268
|
+
color: #64748b;
|
|
269
|
+
width: 1.5rem;
|
|
270
|
+
height: 1.5rem;
|
|
271
|
+
font-size: 0.875rem;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Content */
|
|
275
|
+
.message-bubble__content {
|
|
276
|
+
flex: 1;
|
|
277
|
+
min-width: 0;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* Header */
|
|
281
|
+
.message-bubble__header {
|
|
282
|
+
display: flex;
|
|
283
|
+
align-items: center;
|
|
284
|
+
gap: 0.5rem;
|
|
285
|
+
margin-bottom: 0.25rem;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.message-bubble--user .message-bubble__header {
|
|
289
|
+
flex-direction: row-reverse;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.message-bubble__role {
|
|
293
|
+
font-weight: 600;
|
|
294
|
+
font-size: 0.8125rem;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.message-bubble--user .message-bubble__role {
|
|
298
|
+
color: rgba(255, 255, 255, 0.9);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.message-bubble--assistant .message-bubble__role {
|
|
302
|
+
color: #3b82f6;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.message-bubble--log .message-bubble__role {
|
|
306
|
+
font-weight: 500;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.message-bubble__log-level {
|
|
310
|
+
display: flex;
|
|
311
|
+
align-items: center;
|
|
312
|
+
gap: 0.25rem;
|
|
313
|
+
font-size: 0.6875rem;
|
|
314
|
+
font-weight: 600;
|
|
315
|
+
padding: 0.125rem 0.375rem;
|
|
316
|
+
border-radius: 0.25rem;
|
|
317
|
+
text-transform: uppercase;
|
|
318
|
+
letter-spacing: 0.05em;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.message-bubble__log-level--info {
|
|
322
|
+
background-color: #dbeafe;
|
|
323
|
+
color: #1d4ed8;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.message-bubble__log-level--warning {
|
|
327
|
+
background-color: #fef3c7;
|
|
328
|
+
color: #b45309;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.message-bubble__log-level--error {
|
|
332
|
+
background-color: #fee2e2;
|
|
333
|
+
color: #dc2626;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.message-bubble__log-level--debug {
|
|
337
|
+
background-color: #f3e8ff;
|
|
338
|
+
color: #7c3aed;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.message-bubble__timestamp {
|
|
342
|
+
font-size: 0.6875rem;
|
|
343
|
+
opacity: 0.7;
|
|
344
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.message-bubble--user .message-bubble__timestamp {
|
|
348
|
+
color: rgba(255, 255, 255, 0.7);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/* Message text */
|
|
352
|
+
.message-bubble__text {
|
|
353
|
+
line-height: 1.5;
|
|
354
|
+
white-space: pre-wrap;
|
|
355
|
+
word-break: break-word;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.message-bubble--log .message-bubble__text {
|
|
359
|
+
font-size: 0.8125rem;
|
|
360
|
+
line-height: 1.4;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* Footer */
|
|
364
|
+
.message-bubble__footer {
|
|
365
|
+
display: flex;
|
|
366
|
+
align-items: center;
|
|
367
|
+
gap: 0.75rem;
|
|
368
|
+
margin-top: 0.5rem;
|
|
369
|
+
font-size: 0.6875rem;
|
|
370
|
+
opacity: 0.7;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.message-bubble--user .message-bubble__footer {
|
|
374
|
+
justify-content: flex-end;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.message-bubble__node,
|
|
378
|
+
.message-bubble__duration {
|
|
379
|
+
display: flex;
|
|
380
|
+
align-items: center;
|
|
381
|
+
gap: 0.25rem;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/* Responsive */
|
|
385
|
+
@media (max-width: 640px) {
|
|
386
|
+
.message-bubble--user,
|
|
387
|
+
.message-bubble--assistant {
|
|
388
|
+
margin-left: 0;
|
|
389
|
+
margin-right: 0;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.message-bubble__avatar {
|
|
393
|
+
width: 1.75rem;
|
|
394
|
+
height: 1.75rem;
|
|
395
|
+
font-size: 1rem;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PlaygroundMessage } from '../../types/playground.js';
|
|
2
|
+
/**
|
|
3
|
+
* Component props
|
|
4
|
+
*/
|
|
5
|
+
interface Props {
|
|
6
|
+
/** The message to display */
|
|
7
|
+
message: PlaygroundMessage;
|
|
8
|
+
/** Whether to show the timestamp */
|
|
9
|
+
showTimestamp?: boolean;
|
|
10
|
+
/** Whether this is the last message (affects styling) */
|
|
11
|
+
isLast?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const MessageBubble: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type MessageBubble = ReturnType<typeof MessageBubble>;
|
|
15
|
+
export default MessageBubble;
|