@flowdrop/flowdrop 1.4.0 → 1.5.0

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 (100) hide show
  1. package/README.md +68 -24
  2. package/dist/adapters/WorkflowAdapter.js +2 -22
  3. package/dist/adapters/agentspec/autoLayout.d.ts +51 -5
  4. package/dist/adapters/agentspec/autoLayout.js +120 -23
  5. package/dist/chat/commandClassifier.d.ts +19 -0
  6. package/dist/chat/commandClassifier.js +30 -0
  7. package/dist/chat/index.d.ts +27 -0
  8. package/dist/chat/index.js +32 -0
  9. package/dist/chat/responseParser.d.ts +21 -0
  10. package/dist/chat/responseParser.js +87 -0
  11. package/dist/commands/batch.d.ts +18 -0
  12. package/dist/commands/batch.js +56 -0
  13. package/dist/commands/executor.d.ts +37 -0
  14. package/dist/commands/executor.js +1044 -0
  15. package/dist/commands/index.d.ts +14 -0
  16. package/dist/commands/index.js +17 -0
  17. package/dist/commands/parser.d.ts +16 -0
  18. package/dist/commands/parser.js +278 -0
  19. package/dist/commands/positioner.d.ts +19 -0
  20. package/dist/commands/positioner.js +33 -0
  21. package/dist/commands/storeIntegration.svelte.d.ts +16 -0
  22. package/dist/commands/storeIntegration.svelte.js +67 -0
  23. package/dist/commands/types.d.ts +343 -0
  24. package/dist/commands/types.js +45 -0
  25. package/dist/components/App.svelte +351 -12
  26. package/dist/components/App.svelte.d.ts +3 -0
  27. package/dist/components/CanvasController.svelte +38 -0
  28. package/dist/components/CanvasController.svelte.d.ts +32 -0
  29. package/dist/components/ConfigMappingRow.svelte +130 -0
  30. package/dist/components/ConfigMappingRow.svelte.d.ts +8 -0
  31. package/dist/components/ConfigPanel.svelte +56 -7
  32. package/dist/components/ConfigPanel.svelte.d.ts +2 -0
  33. package/dist/components/FlowDropEdge.svelte +2 -10
  34. package/dist/components/LogsSidebar.svelte +5 -5
  35. package/dist/components/NodeSidebar.svelte +15 -49
  36. package/dist/components/NodeSwapPicker.svelte +537 -0
  37. package/dist/components/NodeSwapPicker.svelte.d.ts +16 -0
  38. package/dist/components/PortMappingRow.svelte +209 -0
  39. package/dist/components/PortMappingRow.svelte.d.ts +12 -0
  40. package/dist/components/SwapMappingEditor.svelte +550 -0
  41. package/dist/components/SwapMappingEditor.svelte.d.ts +12 -0
  42. package/dist/components/WorkflowEditor.svelte +99 -4
  43. package/dist/components/WorkflowEditor.svelte.d.ts +8 -0
  44. package/dist/components/chat/AIChatPanel.svelte +658 -0
  45. package/dist/components/chat/AIChatPanel.svelte.d.ts +13 -0
  46. package/dist/components/chat/CommandPreview.svelte +184 -0
  47. package/dist/components/chat/CommandPreview.svelte.d.ts +9 -0
  48. package/dist/components/console/CommandConsole.stories.svelte +93 -0
  49. package/dist/components/console/CommandConsole.stories.svelte.d.ts +27 -0
  50. package/dist/components/console/CommandConsole.svelte +259 -0
  51. package/dist/components/console/CommandConsole.svelte.d.ts +11 -0
  52. package/dist/components/console/ConsoleAutocomplete.svelte +139 -0
  53. package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +21 -0
  54. package/dist/components/console/ConsoleInput.svelte +712 -0
  55. package/dist/components/console/ConsoleInput.svelte.d.ts +16 -0
  56. package/dist/components/console/ConsoleOutput.svelte +121 -0
  57. package/dist/components/console/ConsoleOutput.svelte.d.ts +11 -0
  58. package/dist/components/console/formatters.d.ts +26 -0
  59. package/dist/components/console/formatters.js +118 -0
  60. package/dist/components/interrupt/index.d.ts +1 -0
  61. package/dist/components/interrupt/index.js +1 -0
  62. package/dist/config/endpoints.d.ts +8 -0
  63. package/dist/config/endpoints.js +5 -0
  64. package/dist/core/index.d.ts +5 -0
  65. package/dist/core/index.js +9 -0
  66. package/dist/editor/index.d.ts +3 -1
  67. package/dist/editor/index.js +4 -2
  68. package/dist/helpers/proximityConnect.js +8 -1
  69. package/dist/helpers/workflowEditorHelper.d.ts +3 -53
  70. package/dist/helpers/workflowEditorHelper.js +13 -228
  71. package/dist/playground/index.d.ts +1 -1
  72. package/dist/playground/index.js +1 -1
  73. package/dist/schemas/v1/workflow.schema.json +107 -22
  74. package/dist/services/chatService.d.ts +65 -0
  75. package/dist/services/chatService.js +131 -0
  76. package/dist/services/historyService.d.ts +6 -4
  77. package/dist/services/historyService.js +21 -6
  78. package/dist/stores/interruptStore.svelte.js +6 -1
  79. package/dist/stores/playgroundStore.svelte.d.ts +1 -1
  80. package/dist/stores/playgroundStore.svelte.js +11 -2
  81. package/dist/stores/portCoordinateStore.svelte.d.ts +4 -0
  82. package/dist/stores/portCoordinateStore.svelte.js +20 -26
  83. package/dist/stores/workflowStore.svelte.d.ts +31 -2
  84. package/dist/stores/workflowStore.svelte.js +84 -64
  85. package/dist/types/chat.d.ts +63 -0
  86. package/dist/types/chat.js +9 -0
  87. package/dist/types/events.d.ts +28 -2
  88. package/dist/types/events.js +1 -0
  89. package/dist/types/index.d.ts +8 -0
  90. package/dist/types/settings.d.ts +6 -0
  91. package/dist/types/settings.js +3 -0
  92. package/dist/utils/edgeStyling.d.ts +42 -0
  93. package/dist/utils/edgeStyling.js +176 -0
  94. package/dist/utils/nodeIds.d.ts +31 -0
  95. package/dist/utils/nodeIds.js +42 -0
  96. package/dist/utils/nodeSwap.d.ts +221 -0
  97. package/dist/utils/nodeSwap.js +686 -0
  98. package/package.json +6 -1
  99. package/dist/helpers/nodeLayoutHelper.d.ts +0 -14
  100. package/dist/helpers/nodeLayoutHelper.js +0 -19
@@ -2,8 +2,7 @@
2
2
  * Workflow Editor Helper
3
3
  * Contains business logic for workflow operations
4
4
  */
5
- import { MarkerType } from "@xyflow/svelte";
6
- import { hasCycles, hasInvalidCycles, isLoopbackEdge, } from "../utils/connections.js";
5
+ import { hasCycles, hasInvalidCycles, } from "../utils/connections.js";
7
6
  import { workflowApi, nodeApi, setEndpointConfig } from "../services/api.js";
8
7
  import { v4 as uuidv4 } from "uuid";
9
8
  import { workflowActions } from "../stores/workflowStore.svelte.js";
@@ -12,231 +11,35 @@ import { WorkflowAdapter } from "../adapters/WorkflowAdapter.js";
12
11
  import { AgentSpecAdapter } from "../adapters/agentspec/AgentSpecAdapter.js";
13
12
  import { validateForAgentSpecExport } from "../adapters/agentspec/validator.js";
14
13
  import { extractPortId } from "../utils/handleIds.js";
15
- import { EDGE_MARKER_SIZES } from "../config/constants.js";
16
14
  import { logger } from "../utils/logger.js";
15
+ import { generateNodeId, extractConfigDefaults } from "../utils/nodeIds.js";
16
+ import { applyConnectionStyling as applyConnectionStylingUtil, updateEdgeStyles as updateEdgeStylesUtil, isGatewayBranch as isGatewayBranchUtil, getPortDataType as getPortDataTypeUtil, getEdgeCategory as getEdgeCategoryUtil, getEdgeCategoryWithLoopback as getEdgeCategoryWithLoopbackUtil, } from "../utils/edgeStyling.js";
17
+ export { generateNodeId, extractConfigDefaults } from "../utils/nodeIds.js";
17
18
  /**
18
- * Generate a unique node ID based on node type and existing nodes
19
- * Format: <node_type>.<number>
20
- * Example: boolean_gateway.1, calculator.2
21
- */
22
- export function generateNodeId(nodeTypeId, existingNodes) {
23
- // Count how many nodes of this type already exist
24
- const existingNodeIds = existingNodes
25
- .filter((node) => node.data?.metadata?.id === nodeTypeId)
26
- .map((node) => node.id);
27
- // Extract the numbers from existing IDs with the same prefix
28
- const existingNumbers = existingNodeIds
29
- .map((id) => {
30
- const match = id.match(new RegExp(`^${nodeTypeId}\\.(\\d+)$`));
31
- return match ? parseInt(match[1], 10) : 0;
32
- })
33
- .filter((num) => num > 0);
34
- // Find the next available number (highest + 1)
35
- const nextNumber = existingNumbers.length > 0 ? Math.max(...existingNumbers) + 1 : 1;
36
- return `${nodeTypeId}.${nextNumber}`;
37
- }
38
- /**
39
- * Edge styling configuration based on source port data type
19
+ * Edge styling configuration based on source port data type.
20
+ * Delegates to standalone functions in utils/edgeStyling.ts.
40
21
  */
41
22
  export class EdgeStylingHelper {
42
- /**
43
- * Extract the port ID from a handle ID
44
- * @param handleId - The handle ID string (e.g., "sample-node.1-output-trigger" or "trigger")
45
- * @returns The port ID (e.g., "trigger") or the handleId itself for short format
46
- */
47
23
  static extractPortIdFromHandle(handleId) {
48
24
  return extractPortId(handleId);
49
25
  }
50
- /**
51
- * Check if a port ID matches a dynamic branch in a Gateway node
52
- * Gateway nodes store branches in config.branches array
53
- * @param node - The workflow node to check
54
- * @param portId - The port ID to look up
55
- * @returns true if the portId matches a gateway branch
56
- */
57
26
  static isGatewayBranch(node, portId) {
58
- // Check if this is a gateway node with dynamic branches
59
- const nodeType = node.data?.metadata?.type || node.type;
60
- if (nodeType !== "gateway") {
61
- return false;
62
- }
63
- // Check if the portId matches a branch name in config.branches
64
- const branches = node.data?.config?.branches;
65
- if (!branches || !Array.isArray(branches)) {
66
- return false;
67
- }
68
- return branches.some((branch) => branch.name === portId);
27
+ return isGatewayBranchUtil(node, portId);
69
28
  }
70
- /**
71
- * Get the data type of a port from a node's metadata
72
- * Also handles dynamic ports like Gateway branches
73
- * @param node - The workflow node containing the port
74
- * @param portId - The port ID to look up
75
- * @param portType - Whether to look in "inputs" or "outputs"
76
- * @returns The port's dataType or null if not found
77
- */
78
29
  static getPortDataType(node, portId, portType) {
79
- // First, check static ports in metadata
80
- const ports = portType === "output"
81
- ? node.data?.metadata?.outputs
82
- : node.data?.metadata?.inputs;
83
- if (ports && Array.isArray(ports)) {
84
- const port = ports.find((p) => p.id === portId);
85
- if (port?.dataType) {
86
- return port.dataType;
87
- }
88
- }
89
- // Check dynamic ports from config (dynamicInputs/dynamicOutputs)
90
- const dynamicKey = portType === "output" ? "dynamicOutputs" : "dynamicInputs";
91
- const dynamicPorts = node.data?.config?.[dynamicKey];
92
- if (dynamicPorts && Array.isArray(dynamicPorts)) {
93
- const dynamicPort = dynamicPorts.find((p) => p.name === portId);
94
- if (dynamicPort?.dataType) {
95
- return dynamicPort.dataType;
96
- }
97
- }
98
- // For output ports, also check dynamic Gateway branches
99
- // Gateway branches are always trigger type (control flow)
100
- if (portType === "output" && this.isGatewayBranch(node, portId)) {
101
- return "trigger";
102
- }
103
- return null;
30
+ return getPortDataTypeUtil(node, portId, portType);
104
31
  }
105
- /**
106
- * Determine the edge category based on source port data type
107
- * Note: This method does not check for loopback edges.
108
- * Use getEdgeCategoryWithLoopback() for full edge categorization.
109
- *
110
- * @param sourcePortDataType - The data type of the source output port
111
- * @returns The edge category for styling
112
- */
113
32
  static getEdgeCategory(sourcePortDataType) {
114
- if (sourcePortDataType === "trigger") {
115
- return "trigger";
116
- }
117
- if (sourcePortDataType === "tool") {
118
- return "tool";
119
- }
120
- // All other data types (string, number, boolean, array, etc.) are "data" edges
121
- return "data";
33
+ return getEdgeCategoryUtil(sourcePortDataType);
122
34
  }
123
- /**
124
- * Determine the full edge category including loopback detection
125
- * Loopback edges take precedence over source port data type
126
- *
127
- * @param edge - The edge to categorize
128
- * @param sourcePortDataType - The data type of the source output port
129
- * @returns The edge category for styling
130
- */
131
35
  static getEdgeCategoryWithLoopback(edge, sourcePortDataType) {
132
- // Loopback edges are identified by their target handle
133
- // Check this first as it takes precedence
134
- if (isLoopbackEdge(edge)) {
135
- return "loopback";
136
- }
137
- // Fall back to source port data type categorization
138
- return this.getEdgeCategory(sourcePortDataType);
36
+ return getEdgeCategoryWithLoopbackUtil(edge, sourcePortDataType);
139
37
  }
140
- /**
141
- * Apply custom styling to connection edges based on edge type:
142
- * - Loopback: Dashed gray line for loop iteration (targets loop_back port)
143
- * - Trigger ports: Solid black line with arrow
144
- * - Tool ports: Dashed amber line with arrow
145
- * - Data ports: Normal gray line with arrow
146
- */
147
38
  static applyConnectionStyling(edge, sourceNode, targetNode) {
148
- // Extract port ID from sourceHandle
149
- const sourcePortId = this.extractPortIdFromHandle(edge.sourceHandle);
150
- // Get the source port's data type
151
- const sourcePortDataType = sourcePortId
152
- ? this.getPortDataType(sourceNode, sourcePortId, "output")
153
- : null;
154
- // Determine edge category (loopback takes precedence)
155
- const edgeCategory = this.getEdgeCategoryWithLoopback(edge, sourcePortDataType);
156
- // Apply styling based on edge category
157
- // Marker colors use CSS custom properties so they respond to theme changes automatically
158
- switch (edgeCategory) {
159
- case "loopback":
160
- // Loopback edges: dashed gray line for loop iteration
161
- edge.style =
162
- "stroke: var(--fd-edge-loopback); stroke-dasharray: var(--fd-edge-loopback-dasharray); stroke-width: var(--fd-edge-loopback-width); opacity: var(--fd-edge-loopback-opacity);";
163
- edge.class = "flowdrop--edge--loopback";
164
- edge.markerEnd = {
165
- type: MarkerType.ArrowClosed,
166
- ...EDGE_MARKER_SIZES.loopback,
167
- color: "var(--fd-edge-loopback)",
168
- };
169
- break;
170
- case "trigger":
171
- // Trigger edges: solid dark line for control flow
172
- edge.style =
173
- "stroke: var(--fd-edge-trigger); stroke-width: var(--fd-edge-trigger-width);";
174
- edge.class = "flowdrop--edge--trigger";
175
- edge.markerEnd = {
176
- type: MarkerType.ArrowClosed,
177
- ...EDGE_MARKER_SIZES.trigger,
178
- color: "var(--fd-edge-trigger)",
179
- };
180
- break;
181
- case "tool":
182
- // Tool edges: dashed amber line
183
- edge.style = "stroke: var(--fd-edge-tool); stroke-dasharray: 5 3;";
184
- edge.class = "flowdrop--edge--tool";
185
- edge.markerEnd = {
186
- type: MarkerType.ArrowClosed,
187
- ...EDGE_MARKER_SIZES.tool,
188
- color: "var(--fd-edge-tool)",
189
- };
190
- break;
191
- case "data":
192
- default:
193
- // Data edges: normal gray line
194
- edge.style = "stroke: var(--fd-edge-data);";
195
- edge.class = "flowdrop--edge--data";
196
- edge.markerEnd = {
197
- type: MarkerType.ArrowClosed,
198
- ...EDGE_MARKER_SIZES.data,
199
- color: "var(--fd-edge-data)",
200
- };
201
- break;
202
- }
203
- // Store metadata in edge data for API and persistence
204
- edge.data = {
205
- ...edge.data,
206
- metadata: {
207
- ...(edge.data?.metadata || {}),
208
- edgeType: edgeCategory,
209
- sourcePortDataType: sourcePortDataType ?? undefined,
210
- },
211
- targetNodeType: targetNode.type,
212
- targetCategory: targetNode.data.metadata.category,
213
- };
39
+ applyConnectionStylingUtil(edge, sourceNode, targetNode);
214
40
  }
215
- /**
216
- * Update existing edges with custom styling rules
217
- */
218
41
  static updateEdgeStyles(edges, nodes) {
219
- return edges.map((edge) => {
220
- // Find source and target nodes
221
- const sourceNode = nodes.find((node) => node.id === edge.source);
222
- const targetNode = nodes.find((node) => node.id === edge.target);
223
- // Create a copy of the edge
224
- const updatedEdge = { ...edge };
225
- if (!sourceNode || !targetNode) {
226
- // Set default edgeType even when nodes are not found
227
- updatedEdge.data = {
228
- ...updatedEdge.data,
229
- metadata: {
230
- ...(updatedEdge.data?.metadata || {}),
231
- edgeType: "data",
232
- },
233
- };
234
- return updatedEdge;
235
- }
236
- // Apply full styling when nodes are available
237
- this.applyConnectionStyling(updatedEdge, sourceNode, targetNode);
238
- return updatedEdge;
239
- });
42
+ return updateEdgeStylesUtil(edges, nodes);
240
43
  }
241
44
  }
242
45
  /**
@@ -323,27 +126,9 @@ export class NodeOperationsHelper {
323
126
  else {
324
127
  // New format (direct NodeMetadata)
325
128
  nodeType = parsedData;
326
- // Extract initial config from configSchema
327
- let initialConfig = {};
328
- if (nodeType.configSchema &&
329
- typeof nodeType.configSchema === "object") {
330
- // If configSchema is a JSON Schema, extract default values
331
- if (nodeType.configSchema.properties) {
332
- // JSON Schema format - extract defaults
333
- Object.entries(nodeType.configSchema.properties).forEach(([key, prop]) => {
334
- if (prop && typeof prop === "object" && "default" in prop) {
335
- initialConfig[key] = prop.default;
336
- }
337
- });
338
- }
339
- else {
340
- // Simple object format - use as is
341
- initialConfig = { ...nodeType.configSchema };
342
- }
343
- }
344
129
  nodeData = {
345
130
  label: nodeType.name,
346
- config: initialConfig,
131
+ config: extractConfigDefaults(nodeType.configSchema),
347
132
  metadata: nodeType,
348
133
  };
349
134
  }
@@ -117,7 +117,7 @@ export { default as SessionManager } from "../components/playground/SessionManag
117
117
  export { default as InputCollector } from "../components/playground/InputCollector.svelte";
118
118
  export { default as ExecutionLogs } from "../components/playground/ExecutionLogs.svelte";
119
119
  export { default as MessageBubble } from "../components/playground/MessageBubble.svelte";
120
- export { InterruptBubble, ConfirmationPrompt, ChoicePrompt, TextInputPrompt, FormPrompt, } from "../components/interrupt/index.js";
120
+ export { InterruptBubble, ConfirmationPrompt, ChoicePrompt, TextInputPrompt, FormPrompt, ReviewPrompt, } from "../components/interrupt/index.js";
121
121
  export { PlaygroundService, playgroundService, } from "../services/playgroundService.js";
122
122
  export { InterruptService, interruptService, } from "../services/interruptService.js";
123
123
  export { getCurrentSession, getSessions, getMessages, getIsExecuting, getIsLoading, getError as getPlaygroundError, getCurrentWorkflow, getLastPollTimestamp, getSessionStatus, getMessageCount, getChatMessages, getLogMessages, getLatestMessage, getInputFields, getHasChatInput, getSessionCount, playgroundActions, createPollingCallback, subscribeToSessionStatus, getCurrentSessionId, isSessionSelected, getMessagesSnapshot, getLatestMessageTimestamp, } from "../stores/playgroundStore.svelte.js";
@@ -123,7 +123,7 @@ export { default as MessageBubble } from "../components/playground/MessageBubble
123
123
  // ============================================================================
124
124
  // Interrupt Components (Human-in-the-Loop)
125
125
  // ============================================================================
126
- export { InterruptBubble, ConfirmationPrompt, ChoicePrompt, TextInputPrompt, FormPrompt, } from "../components/interrupt/index.js";
126
+ export { InterruptBubble, ConfirmationPrompt, ChoicePrompt, TextInputPrompt, FormPrompt, ReviewPrompt, } from "../components/interrupt/index.js";
127
127
  // ============================================================================
128
128
  // Playground Service
129
129
  // ============================================================================
@@ -38,7 +38,13 @@
38
38
  "$ref": "#/$defs/WorkflowMetadata"
39
39
  }
40
40
  },
41
- "required": ["id", "name", "nodes", "edges", "metadata"],
41
+ "required": [
42
+ "id",
43
+ "name",
44
+ "nodes",
45
+ "edges",
46
+ "metadata"
47
+ ],
42
48
  "$defs": {
43
49
  "AutocompleteConfig": {
44
50
  "type": "object",
@@ -89,7 +95,9 @@
89
95
  "description": "Whether to allow multiple selections.\nWhen true, users can select multiple values displayed as tags.\n"
90
96
  }
91
97
  },
92
- "required": ["url"]
98
+ "required": [
99
+ "url"
100
+ ]
93
101
  },
94
102
  "Branch": {
95
103
  "type": "object",
@@ -117,7 +125,10 @@
117
125
  "description": "Whether this is the default/fallback branch"
118
126
  }
119
127
  },
120
- "required": ["name", "label"]
128
+ "required": [
129
+ "name",
130
+ "label"
131
+ ]
121
132
  },
122
133
  "ConfigProperty": {
123
134
  "type": "object",
@@ -125,7 +136,14 @@
125
136
  "properties": {
126
137
  "type": {
127
138
  "type": "string",
128
- "enum": ["string", "number", "boolean", "array", "object", "integer"],
139
+ "enum": [
140
+ "string",
141
+ "number",
142
+ "boolean",
143
+ "array",
144
+ "object",
145
+ "integer"
146
+ ],
129
147
  "description": "JSON Schema type"
130
148
  },
131
149
  "title": {
@@ -251,14 +269,18 @@
251
269
  ]
252
270
  }
253
271
  },
254
- "required": ["type"]
272
+ "required": [
273
+ "type"
274
+ ]
255
275
  },
256
276
  "ConfigSchema": {
257
277
  "type": "object",
258
278
  "properties": {
259
279
  "type": {
260
280
  "type": "string",
261
- "enum": ["object"]
281
+ "enum": [
282
+ "object"
283
+ ]
262
284
  },
263
285
  "properties": {
264
286
  "type": "object",
@@ -279,7 +301,10 @@
279
301
  "default": false
280
302
  }
281
303
  },
282
- "required": ["type", "properties"]
304
+ "required": [
305
+ "type",
306
+ "properties"
307
+ ]
283
308
  },
284
309
  "DynamicPort": {
285
310
  "type": "object",
@@ -313,7 +338,11 @@
313
338
  "description": "Whether this port is required for execution"
314
339
  }
315
340
  },
316
- "required": ["name", "label", "dataType"]
341
+ "required": [
342
+ "name",
343
+ "label",
344
+ "dataType"
345
+ ]
317
346
  },
318
347
  "NodeCategory": {
319
348
  "type": "string",
@@ -404,7 +433,11 @@
404
433
  "description": "Whether the node is currently being executed"
405
434
  }
406
435
  },
407
- "required": ["status", "executionCount", "isExecuting"]
436
+ "required": [
437
+ "status",
438
+ "executionCount",
439
+ "isExecuting"
440
+ ]
408
441
  },
409
442
  "NodeExecutionStatus": {
410
443
  "type": "string",
@@ -548,7 +581,11 @@
548
581
  },
549
582
  "type": {
550
583
  "type": "string",
551
- "enum": ["input", "output", "metadata"],
584
+ "enum": [
585
+ "input",
586
+ "output",
587
+ "metadata"
588
+ ],
552
589
  "description": "Port direction (input receives data, output sends data)"
553
590
  },
554
591
  "dataType": {
@@ -577,7 +614,12 @@
577
614
  ]
578
615
  }
579
616
  },
580
- "required": ["id", "name", "type", "dataType"]
617
+ "required": [
618
+ "id",
619
+ "name",
620
+ "type",
621
+ "dataType"
622
+ ]
581
623
  },
582
624
  "NodeType": {
583
625
  "type": "string",
@@ -635,7 +677,9 @@
635
677
  "description": "Optional description for this option"
636
678
  }
637
679
  },
638
- "required": ["const"]
680
+ "required": [
681
+ "const"
682
+ ]
639
683
  },
640
684
  "PortDataSchema": {
641
685
  "type": "object",
@@ -643,7 +687,14 @@
643
687
  "properties": {
644
688
  "type": {
645
689
  "type": "string",
646
- "enum": ["object", "array", "string", "number", "integer", "boolean"],
690
+ "enum": [
691
+ "object",
692
+ "array",
693
+ "string",
694
+ "number",
695
+ "integer",
696
+ "boolean"
697
+ ],
647
698
  "description": "The JSON Schema type. Use `object` for nested properties,\n`array` for lists with `items` schema.\n"
648
699
  },
649
700
  "title": {
@@ -692,7 +743,10 @@
692
743
  "description": "Y coordinate"
693
744
  }
694
745
  },
695
- "required": ["x", "y"]
746
+ "required": [
747
+ "x",
748
+ "y"
749
+ ]
696
750
  },
697
751
  "TemplateVariable": {
698
752
  "type": "object",
@@ -750,7 +804,10 @@
750
804
  "description": "Source node ID"
751
805
  }
752
806
  },
753
- "required": ["name", "type"]
807
+ "required": [
808
+ "name",
809
+ "type"
810
+ ]
754
811
  },
755
812
  "TemplateVariablesConfig": {
756
813
  "type": "object",
@@ -797,7 +854,9 @@
797
854
  "description": "Map of available variables keyed by variable name"
798
855
  }
799
856
  },
800
- "required": ["variables"]
857
+ "required": [
858
+ "variables"
859
+ ]
801
860
  },
802
861
  "WorkflowEdge": {
803
862
  "type": "object",
@@ -828,7 +887,12 @@
828
887
  "type": {
829
888
  "type": "string",
830
889
  "description": "Connection line type",
831
- "enum": ["default", "straight", "step", "smoothstep"]
890
+ "enum": [
891
+ "default",
892
+ "straight",
893
+ "step",
894
+ "smoothstep"
895
+ ]
832
896
  },
833
897
  "selectable": {
834
898
  "type": "boolean",
@@ -855,7 +919,11 @@
855
919
  "properties": {
856
920
  "edgeType": {
857
921
  "type": "string",
858
- "enum": ["trigger", "tool", "data"],
922
+ "enum": [
923
+ "trigger",
924
+ "tool",
925
+ "data"
926
+ ],
859
927
  "description": "Edge type for visual styling"
860
928
  },
861
929
  "sourcePortDataType": {
@@ -879,7 +947,11 @@
879
947
  }
880
948
  }
881
949
  },
882
- "required": ["id", "source", "target"]
950
+ "required": [
951
+ "id",
952
+ "source",
953
+ "target"
954
+ ]
883
955
  },
884
956
  "WorkflowMetadata": {
885
957
  "type": "object",
@@ -923,7 +995,11 @@
923
995
  "default": "flowdrop"
924
996
  }
925
997
  },
926
- "required": ["version", "createdAt", "updatedAt"]
998
+ "required": [
999
+ "version",
1000
+ "createdAt",
1001
+ "updatedAt"
1002
+ ]
927
1003
  },
928
1004
  "WorkflowNode": {
929
1005
  "type": "object",
@@ -984,10 +1060,19 @@
984
1060
  ]
985
1061
  }
986
1062
  },
987
- "required": ["label", "config", "metadata"]
1063
+ "required": [
1064
+ "label",
1065
+ "config",
1066
+ "metadata"
1067
+ ]
988
1068
  }
989
1069
  },
990
- "required": ["id", "type", "position", "data"]
1070
+ "required": [
1071
+ "id",
1072
+ "type",
1073
+ "position",
1074
+ "data"
1075
+ ]
991
1076
  }
992
1077
  }
993
1078
  }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Chat Service
3
+ *
4
+ * Handles API interactions for the LLM Chat feature including
5
+ * sending messages, retrieving history, and clearing history.
6
+ *
7
+ * @module services/chatService
8
+ */
9
+ import type { ChatRequest, ChatResponse, ChatHistoryMessage } from "../types/chat.js";
10
+ /**
11
+ * Chat Service class
12
+ *
13
+ * Provides methods to interact with the chat API endpoints
14
+ * for LLM-powered workflow building assistance.
15
+ */
16
+ export declare class ChatService {
17
+ private static instance;
18
+ private constructor();
19
+ /**
20
+ * Get the singleton instance of ChatService
21
+ *
22
+ * @returns The ChatService singleton instance
23
+ */
24
+ static getInstance(): ChatService;
25
+ /**
26
+ * Get the endpoint configuration
27
+ *
28
+ * @throws Error if endpoint configuration is not set
29
+ * @returns The endpoint configuration
30
+ */
31
+ private getConfig;
32
+ /**
33
+ * Generic API request helper
34
+ *
35
+ * @param url - The URL to fetch
36
+ * @param options - Fetch options
37
+ * @returns The parsed JSON response
38
+ */
39
+ private request;
40
+ /**
41
+ * Send a message to the chat endpoint
42
+ *
43
+ * @param workflowId - The workflow ID
44
+ * @param request - The chat request payload
45
+ * @returns The chat response from the LLM
46
+ */
47
+ sendMessage(workflowId: string, request: ChatRequest): Promise<ChatResponse>;
48
+ /**
49
+ * Get conversation history for a workflow
50
+ *
51
+ * @param workflowId - The workflow ID
52
+ * @returns Array of chat history messages
53
+ */
54
+ getHistory(workflowId: string): Promise<ChatHistoryMessage[]>;
55
+ /**
56
+ * Clear conversation history for a workflow
57
+ *
58
+ * @param workflowId - The workflow ID
59
+ */
60
+ clearHistory(workflowId: string): Promise<void>;
61
+ }
62
+ /**
63
+ * Pre-instantiated ChatService singleton
64
+ */
65
+ export declare const chatService: ChatService;