@d34dman/flowdrop 0.0.54 → 0.0.56
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.
|
@@ -143,6 +143,15 @@ export const DEFAULT_PORT_CONFIG = {
|
|
|
143
143
|
category: 'media',
|
|
144
144
|
enabled: true
|
|
145
145
|
},
|
|
146
|
+
// Tool type
|
|
147
|
+
{
|
|
148
|
+
id: 'tool',
|
|
149
|
+
name: 'Tool',
|
|
150
|
+
description: 'Tool interface for agent connections',
|
|
151
|
+
color: 'var(--fd-node-amber)',
|
|
152
|
+
category: 'special',
|
|
153
|
+
enabled: true
|
|
154
|
+
},
|
|
146
155
|
// Special types
|
|
147
156
|
{
|
|
148
157
|
id: 'url',
|
|
@@ -54,7 +54,7 @@ export declare class ProximityConnectHelper {
|
|
|
54
54
|
* 1. Find the closest node within minDistance (edge-to-edge)
|
|
55
55
|
* 2. Check both directions (dragged->nearby and nearby->dragged)
|
|
56
56
|
* 3. Return the first exact-type match, or first compatible match
|
|
57
|
-
* 4. Skip pairs where an edge already exists
|
|
57
|
+
* 4. Skip pairs where an edge already exists
|
|
58
58
|
*
|
|
59
59
|
* @returns Array with at most ONE ProximityEdgeCandidate
|
|
60
60
|
*/
|
|
@@ -66,15 +66,14 @@ export class ProximityConnectHelper {
|
|
|
66
66
|
* 1. Find the closest node within minDistance (edge-to-edge)
|
|
67
67
|
* 2. Check both directions (dragged->nearby and nearby->dragged)
|
|
68
68
|
* 3. Return the first exact-type match, or first compatible match
|
|
69
|
-
* 4. Skip pairs where an edge already exists
|
|
69
|
+
* 4. Skip pairs where an edge already exists
|
|
70
70
|
*
|
|
71
71
|
* @returns Array with at most ONE ProximityEdgeCandidate
|
|
72
72
|
*/
|
|
73
73
|
static findCompatibleEdges(draggedNode, allNodes, existingEdges, minDistance) {
|
|
74
74
|
const checker = getPortCompatibilityChecker();
|
|
75
|
-
// Build lookup
|
|
75
|
+
// Build lookup set for O(1) duplicate checks
|
|
76
76
|
const existingEdgeSet = new Set(existingEdges.map((e) => `${e.source}:${e.sourceHandle}->${e.target}:${e.targetHandle}`));
|
|
77
|
-
const connectedTargetHandles = new Set(existingEdges.map((e) => `${e.target}:${e.targetHandle}`));
|
|
78
77
|
// Find the closest node within distance
|
|
79
78
|
let closestNode = null;
|
|
80
79
|
let closestDistance = Infinity;
|
|
@@ -104,11 +103,8 @@ export class ProximityConnectHelper {
|
|
|
104
103
|
const sourceHandle = this.buildHandleId(draggedNode.id, 'output', outPort.id);
|
|
105
104
|
const targetHandle = this.buildHandleId(closestNode.id, 'input', inPort.id);
|
|
106
105
|
const edgeKey = `${draggedNode.id}:${sourceHandle}->${closestNode.id}:${targetHandle}`;
|
|
107
|
-
const targetHandleKey = `${closestNode.id}:${targetHandle}`;
|
|
108
106
|
if (existingEdgeSet.has(edgeKey))
|
|
109
107
|
continue;
|
|
110
|
-
if (connectedTargetHandles.has(targetHandleKey))
|
|
111
|
-
continue;
|
|
112
108
|
const candidate = {
|
|
113
109
|
id: `proximity-${uuidv4()}`,
|
|
114
110
|
source: draggedNode.id,
|
|
@@ -142,11 +138,8 @@ export class ProximityConnectHelper {
|
|
|
142
138
|
const sourceHandle = this.buildHandleId(closestNode.id, 'output', outPort.id);
|
|
143
139
|
const targetHandle = this.buildHandleId(draggedNode.id, 'input', inPort.id);
|
|
144
140
|
const edgeKey = `${closestNode.id}:${sourceHandle}->${draggedNode.id}:${targetHandle}`;
|
|
145
|
-
const targetHandleKey = `${draggedNode.id}:${targetHandle}`;
|
|
146
141
|
if (existingEdgeSet.has(edgeKey))
|
|
147
142
|
continue;
|
|
148
|
-
if (connectedTargetHandles.has(targetHandleKey))
|
|
149
|
-
continue;
|
|
150
143
|
const candidate = {
|
|
151
144
|
id: `proximity-${uuidv4()}`,
|
|
152
145
|
source: closestNode.id,
|
|
@@ -191,9 +184,8 @@ export class ProximityConnectHelper {
|
|
|
191
184
|
*/
|
|
192
185
|
static findCompatibleEdgesByPortCoordinates(draggedNodeId, portCoordinates, existingEdges, maxDistance) {
|
|
193
186
|
const checker = getPortCompatibilityChecker();
|
|
194
|
-
// Build lookup
|
|
187
|
+
// Build lookup set for O(1) duplicate checks
|
|
195
188
|
const existingEdgeSet = new Set(existingEdges.map((e) => `${e.source}:${e.sourceHandle}->${e.target}:${e.targetHandle}`));
|
|
196
|
-
const connectedTargetHandles = new Set(existingEdges.map((e) => `${e.target}:${e.targetHandle}`));
|
|
197
189
|
// Partition ports by owner and direction, group other-node ports by dataType
|
|
198
190
|
const draggedOutputs = [];
|
|
199
191
|
const draggedInputs = [];
|
|
@@ -224,10 +216,6 @@ export class ProximityConnectHelper {
|
|
|
224
216
|
const edgeKey = `${sourceCoord.nodeId}:${sourceCoord.handleId}->${targetCoord.nodeId}:${targetCoord.handleId}`;
|
|
225
217
|
if (existingEdgeSet.has(edgeKey))
|
|
226
218
|
return;
|
|
227
|
-
// Check target handle not already connected (single-input rule)
|
|
228
|
-
const targetHandleKey = `${targetCoord.nodeId}:${targetCoord.handleId}`;
|
|
229
|
-
if (connectedTargetHandles.has(targetHandleKey))
|
|
230
|
-
return;
|
|
231
219
|
// Calculate port-to-port distance
|
|
232
220
|
const dx = sourceCoord.x - targetCoord.x;
|
|
233
221
|
const dy = sourceCoord.y - targetCoord.y;
|