@d34dman/flowdrop 0.0.30 → 0.0.32
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 +861 -0
- package/dist/components/playground/Playground.svelte.d.ts +25 -0
- package/dist/components/playground/PlaygroundModal.svelte +220 -0
- package/dist/components/playground/PlaygroundModal.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 +58 -49
- package/dist/editor/index.js +53 -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 +125 -0
- package/dist/playground/index.js +147 -0
- package/dist/playground/mount.d.ts +184 -0
- package/dist/playground/mount.js +209 -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,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playground Types
|
|
3
|
+
*
|
|
4
|
+
* TypeScript types for the Playground feature, enabling interactive
|
|
5
|
+
* workflow testing with chat interface and session management.
|
|
6
|
+
*
|
|
7
|
+
* @module types/playground
|
|
8
|
+
*/
|
|
9
|
+
import type { ConfigProperty } from './index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Status of a playground session
|
|
12
|
+
*/
|
|
13
|
+
export type PlaygroundSessionStatus = 'idle' | 'running' | 'completed' | 'failed';
|
|
14
|
+
/**
|
|
15
|
+
* Role of a message sender in the playground
|
|
16
|
+
*
|
|
17
|
+
* - `user`: Message from the user
|
|
18
|
+
* - `assistant`: Response from the workflow/AI
|
|
19
|
+
* - `system`: System notifications
|
|
20
|
+
* - `log`: Execution log entries
|
|
21
|
+
*/
|
|
22
|
+
export type PlaygroundMessageRole = 'user' | 'assistant' | 'system' | 'log';
|
|
23
|
+
/**
|
|
24
|
+
* Log level for log-type messages
|
|
25
|
+
*/
|
|
26
|
+
export type PlaygroundMessageLevel = 'info' | 'warning' | 'error' | 'debug';
|
|
27
|
+
/**
|
|
28
|
+
* Playground session representing a test conversation
|
|
29
|
+
*
|
|
30
|
+
* Sessions maintain conversation history and allow interactive testing
|
|
31
|
+
* of workflows in an isolated environment.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const session: PlaygroundSession = {
|
|
36
|
+
* id: "sess-123",
|
|
37
|
+
* workflowId: "wf-456",
|
|
38
|
+
* name: "Test Session 1",
|
|
39
|
+
* status: "idle",
|
|
40
|
+
* createdAt: "2024-01-20T10:00:00Z",
|
|
41
|
+
* updatedAt: "2024-01-20T10:30:00Z"
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export interface PlaygroundSession {
|
|
46
|
+
/** Session unique identifier */
|
|
47
|
+
id: string;
|
|
48
|
+
/** Associated workflow ID */
|
|
49
|
+
workflowId: string;
|
|
50
|
+
/** Session display name */
|
|
51
|
+
name: string;
|
|
52
|
+
/** Current session status */
|
|
53
|
+
status: PlaygroundSessionStatus;
|
|
54
|
+
/** Session creation timestamp (ISO 8601) */
|
|
55
|
+
createdAt: string;
|
|
56
|
+
/** Last activity timestamp (ISO 8601) */
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
/** Custom session metadata */
|
|
59
|
+
metadata?: Record<string, unknown>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Message metadata containing additional context
|
|
63
|
+
*/
|
|
64
|
+
export interface PlaygroundMessageMetadata {
|
|
65
|
+
/** Log level for log-type messages */
|
|
66
|
+
level?: PlaygroundMessageLevel;
|
|
67
|
+
/** Execution duration in milliseconds */
|
|
68
|
+
duration?: number;
|
|
69
|
+
/** Human-readable node label */
|
|
70
|
+
nodeLabel?: string;
|
|
71
|
+
/** Node output data */
|
|
72
|
+
outputs?: Record<string, unknown>;
|
|
73
|
+
/** Allow additional properties */
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Message in a playground session
|
|
78
|
+
*
|
|
79
|
+
* Messages can be user inputs, assistant responses, system notifications,
|
|
80
|
+
* or execution logs. Each message is timestamped and can be associated
|
|
81
|
+
* with a specific workflow node.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const message: PlaygroundMessage = {
|
|
86
|
+
* id: "msg-123",
|
|
87
|
+
* sessionId: "sess-456",
|
|
88
|
+
* role: "assistant",
|
|
89
|
+
* content: "I've analyzed your data and found 3 patterns.",
|
|
90
|
+
* timestamp: "2024-01-20T10:30:00Z",
|
|
91
|
+
* nodeId: "node-ai-analyzer",
|
|
92
|
+
* metadata: { duration: 2500, nodeLabel: "AI Analyzer" }
|
|
93
|
+
* };
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export interface PlaygroundMessage {
|
|
97
|
+
/** Message unique identifier */
|
|
98
|
+
id: string;
|
|
99
|
+
/** Parent session ID */
|
|
100
|
+
sessionId: string;
|
|
101
|
+
/** Role of the message sender */
|
|
102
|
+
role: PlaygroundMessageRole;
|
|
103
|
+
/** Message content */
|
|
104
|
+
content: string;
|
|
105
|
+
/** Message timestamp (ISO 8601) */
|
|
106
|
+
timestamp: string;
|
|
107
|
+
/** Associated node ID (for log messages) */
|
|
108
|
+
nodeId?: string;
|
|
109
|
+
/** Additional message metadata */
|
|
110
|
+
metadata?: PlaygroundMessageMetadata;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Input field derived from workflow input nodes
|
|
114
|
+
*
|
|
115
|
+
* Used to auto-generate input forms in the playground based on
|
|
116
|
+
* the workflow's input nodes' configSchema.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const inputField: PlaygroundInputField = {
|
|
121
|
+
* nodeId: "node-text-input",
|
|
122
|
+
* fieldId: "user_message",
|
|
123
|
+
* label: "User Message",
|
|
124
|
+
* type: "string",
|
|
125
|
+
* defaultValue: "Hello!",
|
|
126
|
+
* required: true,
|
|
127
|
+
* schema: { type: "string", format: "multiline" }
|
|
128
|
+
* };
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export interface PlaygroundInputField {
|
|
132
|
+
/** Source node ID */
|
|
133
|
+
nodeId: string;
|
|
134
|
+
/** Field identifier */
|
|
135
|
+
fieldId: string;
|
|
136
|
+
/** Display label */
|
|
137
|
+
label: string;
|
|
138
|
+
/** Field data type */
|
|
139
|
+
type: string;
|
|
140
|
+
/** Default value from node config */
|
|
141
|
+
defaultValue?: unknown;
|
|
142
|
+
/** Whether the field is required */
|
|
143
|
+
required: boolean;
|
|
144
|
+
/** JSON Schema for the field */
|
|
145
|
+
schema?: ConfigProperty;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Request payload for sending a message to the playground
|
|
149
|
+
*/
|
|
150
|
+
export interface PlaygroundMessageRequest {
|
|
151
|
+
/** Message content (typically user input) */
|
|
152
|
+
content: string;
|
|
153
|
+
/** Additional input values for workflow nodes */
|
|
154
|
+
inputs?: Record<string, unknown>;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Response from the messages endpoint with polling support
|
|
158
|
+
*/
|
|
159
|
+
export interface PlaygroundMessagesResult {
|
|
160
|
+
/** Array of messages */
|
|
161
|
+
messages: PlaygroundMessage[];
|
|
162
|
+
/** Whether there are more messages to fetch */
|
|
163
|
+
hasMore: boolean;
|
|
164
|
+
/** Current session status (useful for polling) */
|
|
165
|
+
sessionStatus: PlaygroundSessionStatus;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Configuration for the Playground component
|
|
169
|
+
*/
|
|
170
|
+
export interface PlaygroundConfig {
|
|
171
|
+
/** Polling interval in milliseconds (default: 1500) */
|
|
172
|
+
pollingInterval?: number;
|
|
173
|
+
/** Maximum number of messages to display (default: 500) */
|
|
174
|
+
maxMessages?: number;
|
|
175
|
+
/** Auto-scroll to bottom on new messages (default: true) */
|
|
176
|
+
autoScroll?: boolean;
|
|
177
|
+
/** Show timestamps on messages (default: true) */
|
|
178
|
+
showTimestamps?: boolean;
|
|
179
|
+
/** Show log messages inline or in collapsible section (default: "collapsible") */
|
|
180
|
+
logDisplayMode?: 'inline' | 'collapsible';
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Display mode for the Playground component
|
|
184
|
+
*/
|
|
185
|
+
export type PlaygroundMode = 'embedded' | 'standalone' | 'modal';
|
|
186
|
+
/**
|
|
187
|
+
* Chat input detection patterns for identifying chat nodes in workflows
|
|
188
|
+
*/
|
|
189
|
+
export declare const CHAT_INPUT_PATTERNS: readonly ["chat_input", "text_input", "user_input", "message_input", "prompt_input"];
|
|
190
|
+
/**
|
|
191
|
+
* Check if a node type is a chat input node
|
|
192
|
+
*
|
|
193
|
+
* @param nodeTypeId - The node type identifier
|
|
194
|
+
* @returns True if the node is a chat input type
|
|
195
|
+
*/
|
|
196
|
+
export declare function isChatInputNode(nodeTypeId: string): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* API response wrapper for playground endpoints
|
|
199
|
+
*/
|
|
200
|
+
export interface PlaygroundApiResponse<T> {
|
|
201
|
+
/** Whether the request was successful */
|
|
202
|
+
success: boolean;
|
|
203
|
+
/** Response data */
|
|
204
|
+
data?: T;
|
|
205
|
+
/** Error message if unsuccessful */
|
|
206
|
+
error?: string;
|
|
207
|
+
/** Human-readable message */
|
|
208
|
+
message?: string;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Type alias for session list response
|
|
212
|
+
*/
|
|
213
|
+
export type PlaygroundSessionsResponse = PlaygroundApiResponse<PlaygroundSession[]>;
|
|
214
|
+
/**
|
|
215
|
+
* Type alias for single session response
|
|
216
|
+
*/
|
|
217
|
+
export type PlaygroundSessionResponse = PlaygroundApiResponse<PlaygroundSession>;
|
|
218
|
+
/**
|
|
219
|
+
* Type alias for message response
|
|
220
|
+
*/
|
|
221
|
+
export type PlaygroundMessageResponse = PlaygroundApiResponse<PlaygroundMessage>;
|
|
222
|
+
/**
|
|
223
|
+
* Type alias for messages list response with polling metadata
|
|
224
|
+
*/
|
|
225
|
+
export interface PlaygroundMessagesApiResponse extends PlaygroundApiResponse<PlaygroundMessage[]> {
|
|
226
|
+
/** Whether there are more messages to fetch */
|
|
227
|
+
hasMore?: boolean;
|
|
228
|
+
/** Current session status */
|
|
229
|
+
sessionStatus?: PlaygroundSessionStatus;
|
|
230
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playground Types
|
|
3
|
+
*
|
|
4
|
+
* TypeScript types for the Playground feature, enabling interactive
|
|
5
|
+
* workflow testing with chat interface and session management.
|
|
6
|
+
*
|
|
7
|
+
* @module types/playground
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Chat input detection patterns for identifying chat nodes in workflows
|
|
11
|
+
*/
|
|
12
|
+
export const CHAT_INPUT_PATTERNS = [
|
|
13
|
+
'chat_input',
|
|
14
|
+
'text_input',
|
|
15
|
+
'user_input',
|
|
16
|
+
'message_input',
|
|
17
|
+
'prompt_input'
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Check if a node type is a chat input node
|
|
21
|
+
*
|
|
22
|
+
* @param nodeTypeId - The node type identifier
|
|
23
|
+
* @returns True if the node is a chat input type
|
|
24
|
+
*/
|
|
25
|
+
export function isChatInputNode(nodeTypeId) {
|
|
26
|
+
const normalizedId = nodeTypeId.toLowerCase();
|
|
27
|
+
return CHAT_INPUT_PATTERNS.some((pattern) => normalizedId.includes(pattern));
|
|
28
|
+
}
|
package/dist/utils/colors.js
CHANGED
|
@@ -308,7 +308,7 @@ export function getArrayElementType(arrayDataType) {
|
|
|
308
308
|
* @returns Object with r, g, b values (0-255) or null if invalid
|
|
309
309
|
*/
|
|
310
310
|
export function hexToRgb(hex) {
|
|
311
|
-
const cleanHex = hex.replace(/^#/,
|
|
311
|
+
const cleanHex = hex.replace(/^#/, '');
|
|
312
312
|
if (!/^[0-9A-Fa-f]{6}$/.test(cleanHex)) {
|
|
313
313
|
return null;
|
|
314
314
|
}
|
|
@@ -327,7 +327,7 @@ export function hexToRgb(hex) {
|
|
|
327
327
|
export function rgbToHex(r, g, b) {
|
|
328
328
|
const toHex = (value) => {
|
|
329
329
|
const clamped = Math.max(0, Math.min(255, Math.round(value)));
|
|
330
|
-
return clamped.toString(16).padStart(2,
|
|
330
|
+
return clamped.toString(16).padStart(2, '0');
|
|
331
331
|
};
|
|
332
332
|
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
333
333
|
}
|
|
@@ -340,7 +340,7 @@ export function rgbToHex(r, g, b) {
|
|
|
340
340
|
export function getLightTint(hex) {
|
|
341
341
|
const rgb = hexToRgb(hex);
|
|
342
342
|
if (!rgb) {
|
|
343
|
-
return
|
|
343
|
+
return '#fffbeb'; // Fallback to amber-50
|
|
344
344
|
}
|
|
345
345
|
// Mix with white at 95% to create a very light tint
|
|
346
346
|
const mixRatio = 0.95;
|
|
@@ -358,7 +358,7 @@ export function getLightTint(hex) {
|
|
|
358
358
|
export function getBorderTint(hex) {
|
|
359
359
|
const rgb = hexToRgb(hex);
|
|
360
360
|
if (!rgb) {
|
|
361
|
-
return
|
|
361
|
+
return '#fcd34d'; // Fallback to amber-300
|
|
362
362
|
}
|
|
363
363
|
// Mix with white at 60% to create a medium-light tint
|
|
364
364
|
const mixRatio = 0.6;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@d34dman/flowdrop",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.32",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite dev",
|
|
8
8
|
"build": "vite build && npm run prepack",
|
|
@@ -118,6 +118,11 @@
|
|
|
118
118
|
"svelte": "./dist/display/index.js",
|
|
119
119
|
"default": "./dist/display/index.js"
|
|
120
120
|
},
|
|
121
|
+
"./playground": {
|
|
122
|
+
"types": "./dist/playground/index.d.ts",
|
|
123
|
+
"svelte": "./dist/playground/index.js",
|
|
124
|
+
"default": "./dist/playground/index.js"
|
|
125
|
+
},
|
|
121
126
|
"./styles": "./dist/styles/base.css",
|
|
122
127
|
"./styles/*": "./dist/styles/*"
|
|
123
128
|
},
|