@flowdrop/flowdrop 1.3.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.
- package/README.md +68 -24
- package/dist/adapters/WorkflowAdapter.js +2 -22
- package/dist/adapters/agentspec/autoLayout.d.ts +51 -5
- package/dist/adapters/agentspec/autoLayout.js +120 -23
- package/dist/chat/commandClassifier.d.ts +19 -0
- package/dist/chat/commandClassifier.js +30 -0
- package/dist/chat/index.d.ts +27 -0
- package/dist/chat/index.js +32 -0
- package/dist/chat/responseParser.d.ts +21 -0
- package/dist/chat/responseParser.js +87 -0
- package/dist/commands/batch.d.ts +18 -0
- package/dist/commands/batch.js +56 -0
- package/dist/commands/executor.d.ts +37 -0
- package/dist/commands/executor.js +1044 -0
- package/dist/commands/index.d.ts +14 -0
- package/dist/commands/index.js +17 -0
- package/dist/commands/parser.d.ts +16 -0
- package/dist/commands/parser.js +278 -0
- package/dist/commands/positioner.d.ts +19 -0
- package/dist/commands/positioner.js +33 -0
- package/dist/commands/storeIntegration.svelte.d.ts +16 -0
- package/dist/commands/storeIntegration.svelte.js +67 -0
- package/dist/commands/types.d.ts +343 -0
- package/dist/commands/types.js +45 -0
- package/dist/components/App.svelte +431 -17
- package/dist/components/App.svelte.d.ts +10 -0
- package/dist/components/CanvasBanner.stories.svelte +6 -2
- package/dist/components/CanvasController.svelte +38 -0
- package/dist/components/CanvasController.svelte.d.ts +32 -0
- package/dist/components/ConfigMappingRow.svelte +130 -0
- package/dist/components/ConfigMappingRow.svelte.d.ts +8 -0
- package/dist/components/ConfigPanel.svelte +56 -7
- package/dist/components/ConfigPanel.svelte.d.ts +2 -0
- package/dist/components/FlowDropEdge.svelte +8 -57
- package/dist/components/Logo.svelte +14 -14
- package/dist/components/LogsSidebar.svelte +5 -5
- package/dist/components/Navbar.svelte +58 -10
- package/dist/components/Navbar.svelte.d.ts +7 -0
- package/dist/components/NodeSidebar.svelte +238 -362
- package/dist/components/NodeSwapPicker.svelte +537 -0
- package/dist/components/NodeSwapPicker.svelte.d.ts +16 -0
- package/dist/components/PortMappingRow.svelte +209 -0
- package/dist/components/PortMappingRow.svelte.d.ts +12 -0
- package/dist/components/SwapMappingEditor.svelte +550 -0
- package/dist/components/SwapMappingEditor.svelte.d.ts +12 -0
- package/dist/components/WorkflowEditor.svelte +99 -4
- package/dist/components/WorkflowEditor.svelte.d.ts +8 -0
- package/dist/components/chat/AIChatPanel.svelte +658 -0
- package/dist/components/chat/AIChatPanel.svelte.d.ts +13 -0
- package/dist/components/chat/CommandPreview.svelte +184 -0
- package/dist/components/chat/CommandPreview.svelte.d.ts +9 -0
- package/dist/components/console/CommandConsole.stories.svelte +93 -0
- package/dist/components/console/CommandConsole.stories.svelte.d.ts +27 -0
- package/dist/components/console/CommandConsole.svelte +259 -0
- package/dist/components/console/CommandConsole.svelte.d.ts +11 -0
- package/dist/components/console/ConsoleAutocomplete.svelte +139 -0
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +21 -0
- package/dist/components/console/ConsoleInput.svelte +712 -0
- package/dist/components/console/ConsoleInput.svelte.d.ts +16 -0
- package/dist/components/console/ConsoleOutput.svelte +121 -0
- package/dist/components/console/ConsoleOutput.svelte.d.ts +11 -0
- package/dist/components/console/formatters.d.ts +26 -0
- package/dist/components/console/formatters.js +118 -0
- package/dist/components/interrupt/index.d.ts +1 -0
- package/dist/components/interrupt/index.js +1 -0
- package/dist/components/nodes/SimpleNode.stories.svelte +64 -0
- package/dist/components/nodes/SimpleNode.svelte +27 -11
- package/dist/components/nodes/SquareNode.stories.svelte +45 -0
- package/dist/components/nodes/SquareNode.svelte +27 -11
- package/dist/components/nodes/WorkflowNode.stories.svelte +63 -0
- package/dist/config/endpoints.d.ts +8 -0
- package/dist/config/endpoints.js +5 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.js +9 -0
- package/dist/editor/index.d.ts +3 -1
- package/dist/editor/index.js +4 -2
- package/dist/helpers/proximityConnect.js +8 -1
- package/dist/helpers/workflowEditorHelper.d.ts +3 -53
- package/dist/helpers/workflowEditorHelper.js +13 -228
- package/dist/playground/index.d.ts +1 -1
- package/dist/playground/index.js +1 -1
- package/dist/schemas/v1/workflow.schema.json +107 -22
- package/dist/services/chatService.d.ts +65 -0
- package/dist/services/chatService.js +131 -0
- package/dist/services/historyService.d.ts +6 -4
- package/dist/services/historyService.js +21 -6
- package/dist/skins/slate.js +16 -0
- package/dist/stores/interruptStore.svelte.js +6 -1
- package/dist/stores/playgroundStore.svelte.d.ts +1 -1
- package/dist/stores/playgroundStore.svelte.js +11 -2
- package/dist/stores/portCoordinateStore.svelte.d.ts +4 -0
- package/dist/stores/portCoordinateStore.svelte.js +20 -26
- package/dist/stores/workflowStore.svelte.d.ts +31 -2
- package/dist/stores/workflowStore.svelte.js +84 -64
- package/dist/stories/EdgeDecorator.svelte +4 -4
- package/dist/styles/base.css +48 -0
- package/dist/svelte-app.d.ts +7 -1
- package/dist/svelte-app.js +4 -1
- package/dist/types/chat.d.ts +63 -0
- package/dist/types/chat.js +9 -0
- package/dist/types/events.d.ts +28 -2
- package/dist/types/events.js +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/settings.d.ts +6 -0
- package/dist/types/settings.js +3 -0
- package/dist/utils/edgeStyling.d.ts +42 -0
- package/dist/utils/edgeStyling.js +176 -0
- package/dist/utils/nodeIds.d.ts +31 -0
- package/dist/utils/nodeIds.js +42 -0
- package/dist/utils/nodeSwap.d.ts +221 -0
- package/dist/utils/nodeSwap.js +686 -0
- package/package.json +6 -1
- package/dist/helpers/nodeLayoutHelper.d.ts +0 -14
- package/dist/helpers/nodeLayoutHelper.js +0 -19
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NodeMetadata } from "../../types/index.js";
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Whether the console is currently visible/open */
|
|
4
|
+
open: boolean;
|
|
5
|
+
/** Available node types for autocomplete suggestions */
|
|
6
|
+
nodeTypes?: NodeMetadata[];
|
|
7
|
+
/** Called when user submits a command (Enter key) */
|
|
8
|
+
onSubmit: (value: string) => void;
|
|
9
|
+
/** Called when user pastes multiple lines */
|
|
10
|
+
onBatchSubmit?: (lines: string[]) => void;
|
|
11
|
+
/** Called when user presses Escape to close the console */
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const ConsoleInput: import("svelte").Component<Props, {}, "">;
|
|
15
|
+
type ConsoleInput = ReturnType<typeof ConsoleInput>;
|
|
16
|
+
export default ConsoleInput;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
ConsoleOutput Component
|
|
3
|
+
Scrollable output area for displaying command results in the console
|
|
4
|
+
Styled with BEM syntax matching CommandConsole pattern
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { tick } from "svelte";
|
|
9
|
+
|
|
10
|
+
export interface ConsoleEntry {
|
|
11
|
+
type: "input" | "success" | "error" | "formatted";
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
/** Output entries to display */
|
|
17
|
+
entries: ConsoleEntry[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let { entries }: Props = $props();
|
|
21
|
+
|
|
22
|
+
let outputElement: HTMLDivElement | undefined = $state();
|
|
23
|
+
|
|
24
|
+
$effect(() => {
|
|
25
|
+
// Track entries length to auto-scroll on new entries
|
|
26
|
+
const _count = entries.length;
|
|
27
|
+
tick().then(() => {
|
|
28
|
+
if (outputElement) {
|
|
29
|
+
outputElement.scrollTop = outputElement.scrollHeight;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div
|
|
36
|
+
class="console-output"
|
|
37
|
+
bind:this={outputElement}
|
|
38
|
+
role="log"
|
|
39
|
+
aria-live="polite"
|
|
40
|
+
>
|
|
41
|
+
{#each entries as entry}
|
|
42
|
+
<div class="console-output__entry console-output__entry--{entry.type}">
|
|
43
|
+
{#if entry.type === "input"}
|
|
44
|
+
<span class="console-output__prefix">></span>
|
|
45
|
+
<span class="console-output__text">{entry.text}</span>
|
|
46
|
+
{:else if entry.type === "formatted"}
|
|
47
|
+
<pre class="console-output__pre">{entry.text}</pre>
|
|
48
|
+
{:else}
|
|
49
|
+
<span class="console-output__text">{entry.text}</span>
|
|
50
|
+
{/if}
|
|
51
|
+
</div>
|
|
52
|
+
{/each}
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.console-output {
|
|
57
|
+
flex: 1;
|
|
58
|
+
overflow-y: auto;
|
|
59
|
+
padding: 0.5rem 1rem;
|
|
60
|
+
font-family: monospace;
|
|
61
|
+
font-size: 0.875rem;
|
|
62
|
+
line-height: 1.6;
|
|
63
|
+
|
|
64
|
+
/* Custom scrollbar styling matching MainLayout pattern */
|
|
65
|
+
scrollbar-width: thin;
|
|
66
|
+
scrollbar-color: var(--fd-scrollbar-thumb) var(--fd-scrollbar-track);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.console-output::-webkit-scrollbar {
|
|
70
|
+
width: 8px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.console-output::-webkit-scrollbar-track {
|
|
74
|
+
background: var(--fd-scrollbar-track);
|
|
75
|
+
border-radius: 4px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.console-output::-webkit-scrollbar-thumb {
|
|
79
|
+
background: var(--fd-scrollbar-thumb);
|
|
80
|
+
border-radius: 4px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.console-output::-webkit-scrollbar-thumb:hover {
|
|
84
|
+
background: var(--fd-scrollbar-thumb-hover);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.console-output__entry {
|
|
88
|
+
white-space: pre-wrap;
|
|
89
|
+
word-break: break-word;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.console-output__entry--input {
|
|
93
|
+
color: var(--fd-muted-foreground);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.console-output__entry--success {
|
|
97
|
+
color: var(--fd-success);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.console-output__entry--error {
|
|
101
|
+
color: var(--fd-error);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.console-output__entry--formatted {
|
|
105
|
+
color: var(--fd-foreground);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.console-output__pre {
|
|
109
|
+
margin: 0;
|
|
110
|
+
font-family: inherit;
|
|
111
|
+
font-size: inherit;
|
|
112
|
+
line-height: inherit;
|
|
113
|
+
white-space: pre;
|
|
114
|
+
overflow-x: auto;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.console-output__prefix {
|
|
118
|
+
margin-right: 0.5rem;
|
|
119
|
+
user-select: none;
|
|
120
|
+
}
|
|
121
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ConsoleEntry {
|
|
2
|
+
type: "input" | "success" | "error" | "formatted";
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Output entries to display */
|
|
7
|
+
entries: ConsoleEntry[];
|
|
8
|
+
}
|
|
9
|
+
declare const ConsoleOutput: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type ConsoleOutput = ReturnType<typeof ConsoleOutput>;
|
|
11
|
+
export default ConsoleOutput;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure formatting functions for rich command result display.
|
|
3
|
+
* Converts CommandResult data into aligned table strings for console output.
|
|
4
|
+
*/
|
|
5
|
+
import type { ListNodesResultData, ListEdgesResultData, ListTypesResultData, InfoResultData, HelpResultData } from "../../commands/types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Formats list nodes result as an aligned table: ID, Label, Type.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatListNodes(data: ListNodesResultData): string;
|
|
10
|
+
/**
|
|
11
|
+
* Formats list edges result as a table: Source, Port, ->, Target, Port.
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatListEdges(data: ListEdgesResultData): string;
|
|
14
|
+
/**
|
|
15
|
+
* Formats list types result as a table: Type ID, Name, Category.
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatListTypes(data: ListTypesResultData): string;
|
|
18
|
+
/**
|
|
19
|
+
* Formats info result as structured output with header fields,
|
|
20
|
+
* config section, ports section, and edges section.
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatInfo(data: InfoResultData): string;
|
|
23
|
+
/**
|
|
24
|
+
* Formats help result as a table: Name, Syntax, Description.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatHelp(data: HelpResultData): string;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pads a string to a given width (right-padded with spaces).
|
|
3
|
+
*/
|
|
4
|
+
function pad(str, width) {
|
|
5
|
+
return str.length >= width ? str : str + " ".repeat(width - str.length);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Formats a simple table from rows with headers.
|
|
9
|
+
* Each column is auto-sized to fit the widest value.
|
|
10
|
+
*/
|
|
11
|
+
function formatTable(headers, rows) {
|
|
12
|
+
const colWidths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? "").length)));
|
|
13
|
+
const headerLine = headers.map((h, i) => pad(h, colWidths[i])).join(" ");
|
|
14
|
+
const separator = colWidths.map((w) => "-".repeat(w)).join(" ");
|
|
15
|
+
const dataLines = rows.map((row) => row.map((cell, i) => pad(cell, colWidths[i])).join(" "));
|
|
16
|
+
return [headerLine, separator, ...dataLines].join("\n");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Formats list nodes result as an aligned table: ID, Label, Type.
|
|
20
|
+
*/
|
|
21
|
+
export function formatListNodes(data) {
|
|
22
|
+
if (data.nodes.length === 0) {
|
|
23
|
+
return "No nodes in workflow";
|
|
24
|
+
}
|
|
25
|
+
const rows = data.nodes.map((n) => [n.nodeId, n.label, n.type]);
|
|
26
|
+
return formatTable(["ID", "Label", "Type"], rows);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Formats list edges result as a table: Source, Port, ->, Target, Port.
|
|
30
|
+
*/
|
|
31
|
+
export function formatListEdges(data) {
|
|
32
|
+
if (data.edges.length === 0) {
|
|
33
|
+
return "No edges in workflow";
|
|
34
|
+
}
|
|
35
|
+
const rows = data.edges.map((e) => [
|
|
36
|
+
e.sourceNodeId,
|
|
37
|
+
e.sourcePort,
|
|
38
|
+
"->",
|
|
39
|
+
e.targetNodeId,
|
|
40
|
+
e.targetPort,
|
|
41
|
+
]);
|
|
42
|
+
return formatTable(["Source", "Port", "", "Target", "Port"], rows);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Formats list types result as a table: Type ID, Name, Category.
|
|
46
|
+
*/
|
|
47
|
+
export function formatListTypes(data) {
|
|
48
|
+
if (data.types.length === 0) {
|
|
49
|
+
return "No node types available";
|
|
50
|
+
}
|
|
51
|
+
const rows = data.types.map((t) => [t.typeId, t.name, t.category]);
|
|
52
|
+
return formatTable(["Type ID", "Name", "Category"], rows);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Formats info result as structured output with header fields,
|
|
56
|
+
* config section, ports section, and edges section.
|
|
57
|
+
*/
|
|
58
|
+
export function formatInfo(data) {
|
|
59
|
+
const lines = [];
|
|
60
|
+
// Header fields
|
|
61
|
+
lines.push(`Node: ${data.nodeId}`);
|
|
62
|
+
lines.push(`Label: ${data.label}`);
|
|
63
|
+
lines.push(`Type: ${data.type}`);
|
|
64
|
+
lines.push(`Position: (${Math.round(data.position.x)}, ${Math.round(data.position.y)})`);
|
|
65
|
+
// Config section
|
|
66
|
+
const configEntries = Object.entries(data.config);
|
|
67
|
+
if (configEntries.length > 0) {
|
|
68
|
+
lines.push("");
|
|
69
|
+
lines.push("Config:");
|
|
70
|
+
for (const [key, value] of configEntries) {
|
|
71
|
+
const display = typeof value === "string"
|
|
72
|
+
? `"${value}"`
|
|
73
|
+
: JSON.stringify(value) ?? "null";
|
|
74
|
+
lines.push(` ${key}: ${display}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Ports section
|
|
78
|
+
if (data.inputs.length > 0 || data.outputs.length > 0) {
|
|
79
|
+
lines.push("");
|
|
80
|
+
lines.push("Ports:");
|
|
81
|
+
if (data.inputs.length > 0) {
|
|
82
|
+
lines.push(" Inputs:");
|
|
83
|
+
for (const port of data.inputs) {
|
|
84
|
+
lines.push(` ${port.portId} (${port.dataType})`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (data.outputs.length > 0) {
|
|
88
|
+
lines.push(" Outputs:");
|
|
89
|
+
for (const port of data.outputs) {
|
|
90
|
+
lines.push(` ${port.portId} (${port.dataType})`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Connected edges section
|
|
95
|
+
if (data.connectedEdges.length > 0) {
|
|
96
|
+
lines.push("");
|
|
97
|
+
lines.push("Edges:");
|
|
98
|
+
for (const edge of data.connectedEdges) {
|
|
99
|
+
if (edge.direction === "incoming") {
|
|
100
|
+
lines.push(` ${edge.remoteNodeId}:${edge.remotePort} -> ${edge.localPort}`);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
lines.push(` ${edge.localPort} -> ${edge.remoteNodeId}:${edge.remotePort}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return lines.join("\n");
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Formats help result as a table: Name, Syntax, Description.
|
|
111
|
+
*/
|
|
112
|
+
export function formatHelp(data) {
|
|
113
|
+
if (data.commands.length === 0) {
|
|
114
|
+
return "No commands available";
|
|
115
|
+
}
|
|
116
|
+
const rows = data.commands.map((c) => [c.name, c.syntax, c.description]);
|
|
117
|
+
return formatTable(["Name", "Syntax", "Description"], rows);
|
|
118
|
+
}
|
|
@@ -11,3 +11,4 @@ export { default as ConfirmationPrompt } from "./ConfirmationPrompt.svelte";
|
|
|
11
11
|
export { default as ChoicePrompt } from "./ChoicePrompt.svelte";
|
|
12
12
|
export { default as TextInputPrompt } from "./TextInputPrompt.svelte";
|
|
13
13
|
export { default as FormPrompt } from "./FormPrompt.svelte";
|
|
14
|
+
export { default as ReviewPrompt } from "./ReviewPrompt.svelte";
|
|
@@ -13,3 +13,4 @@ export { default as ConfirmationPrompt } from "./ConfirmationPrompt.svelte";
|
|
|
13
13
|
export { default as ChoicePrompt } from "./ChoicePrompt.svelte";
|
|
14
14
|
export { default as TextInputPrompt } from "./TextInputPrompt.svelte";
|
|
15
15
|
export { default as FormPrompt } from "./FormPrompt.svelte";
|
|
16
|
+
export { default as ReviewPrompt } from "./ReviewPrompt.svelte";
|
|
@@ -158,3 +158,67 @@
|
|
|
158
158
|
})}
|
|
159
159
|
/>
|
|
160
160
|
</Story>
|
|
161
|
+
|
|
162
|
+
<Story name="Dynamic Ports">
|
|
163
|
+
<NodeDecorator
|
|
164
|
+
data={createSampleNodeData({
|
|
165
|
+
label: "Custom Function",
|
|
166
|
+
config: {
|
|
167
|
+
dynamicInputs: [
|
|
168
|
+
{
|
|
169
|
+
name: "param_a",
|
|
170
|
+
label: "Parameter A",
|
|
171
|
+
description: "First parameter",
|
|
172
|
+
dataType: "string",
|
|
173
|
+
required: true,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "param_b",
|
|
177
|
+
label: "Parameter B",
|
|
178
|
+
description: "Second parameter",
|
|
179
|
+
dataType: "number",
|
|
180
|
+
required: false,
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
dynamicOutputs: [
|
|
184
|
+
{
|
|
185
|
+
name: "result",
|
|
186
|
+
label: "Result",
|
|
187
|
+
description: "Function result",
|
|
188
|
+
dataType: "json",
|
|
189
|
+
required: false,
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
metadata: {
|
|
194
|
+
id: "custom_function",
|
|
195
|
+
name: "Custom Function",
|
|
196
|
+
description: "A node with dynamic input and output ports",
|
|
197
|
+
category: "processing",
|
|
198
|
+
version: "1.0.0",
|
|
199
|
+
type: "simple",
|
|
200
|
+
supportedTypes: ["simple", "square", "default"],
|
|
201
|
+
icon: "mdi:function-variant",
|
|
202
|
+
color: "#8b5cf6",
|
|
203
|
+
inputs: [
|
|
204
|
+
{
|
|
205
|
+
id: "trigger",
|
|
206
|
+
name: "Trigger",
|
|
207
|
+
type: "input",
|
|
208
|
+
dataType: "trigger",
|
|
209
|
+
required: false,
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
outputs: [
|
|
213
|
+
{
|
|
214
|
+
id: "done",
|
|
215
|
+
name: "Done",
|
|
216
|
+
type: "output",
|
|
217
|
+
dataType: "trigger",
|
|
218
|
+
required: false,
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
})}
|
|
223
|
+
/>
|
|
224
|
+
</Story>
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
NodeMetadata,
|
|
17
17
|
NodeExtensions,
|
|
18
18
|
NodePort,
|
|
19
|
+
DynamicPort,
|
|
19
20
|
} from "../../types/index.js";
|
|
21
|
+
import { dynamicPortToNodePort } from "../../types/index.js";
|
|
20
22
|
import Icon from "@iconify/svelte";
|
|
21
23
|
import {
|
|
22
24
|
getDataTypeColor,
|
|
@@ -133,20 +135,34 @@
|
|
|
133
135
|
}
|
|
134
136
|
}
|
|
135
137
|
|
|
138
|
+
const dynamicInputs = $derived(
|
|
139
|
+
((props.data.config?.dynamicInputs as DynamicPort[]) || []).map((port) =>
|
|
140
|
+
dynamicPortToNodePort(port, "input"),
|
|
141
|
+
),
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const dynamicOutputs = $derived(
|
|
145
|
+
((props.data.config?.dynamicOutputs as DynamicPort[]) || []).map((port) =>
|
|
146
|
+
dynamicPortToNodePort(port, "output"),
|
|
147
|
+
),
|
|
148
|
+
);
|
|
149
|
+
|
|
136
150
|
/**
|
|
137
151
|
* All visible input ports in user-defined order.
|
|
138
152
|
*/
|
|
139
153
|
const visibleInputPorts = $derived(
|
|
140
|
-
applyPortOrder(
|
|
141
|
-
(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
),
|
|
154
|
+
applyPortOrder(
|
|
155
|
+
[...(props.data.metadata?.inputs ?? []), ...dynamicInputs],
|
|
156
|
+
portOrder.inputs,
|
|
157
|
+
).filter((p: NodePort) =>
|
|
158
|
+
isPortVisible(
|
|
159
|
+
p,
|
|
160
|
+
"input",
|
|
161
|
+
hiddenPorts,
|
|
162
|
+
hideUnconnectedHandles,
|
|
163
|
+
getConnectedHandles(),
|
|
164
|
+
props.data.nodeId,
|
|
165
|
+
),
|
|
150
166
|
),
|
|
151
167
|
);
|
|
152
168
|
|
|
@@ -155,7 +171,7 @@
|
|
|
155
171
|
*/
|
|
156
172
|
const visibleOutputPorts = $derived(
|
|
157
173
|
applyPortOrder(
|
|
158
|
-
props.data.metadata?.outputs ?? [],
|
|
174
|
+
[...(props.data.metadata?.outputs ?? []), ...dynamicOutputs],
|
|
159
175
|
portOrder.outputs,
|
|
160
176
|
).filter((p: NodePort) =>
|
|
161
177
|
isPortVisible(
|
|
@@ -80,3 +80,48 @@
|
|
|
80
80
|
selected={true}
|
|
81
81
|
/>
|
|
82
82
|
</Story>
|
|
83
|
+
|
|
84
|
+
<Story name="Dynamic Ports">
|
|
85
|
+
<NodeDecorator
|
|
86
|
+
data={createSampleNodeData({
|
|
87
|
+
label: "Data Mapper",
|
|
88
|
+
config: {
|
|
89
|
+
dynamicInputs: [
|
|
90
|
+
{
|
|
91
|
+
name: "source",
|
|
92
|
+
label: "Source Data",
|
|
93
|
+
dataType: "json",
|
|
94
|
+
required: true,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
dynamicOutputs: [
|
|
98
|
+
{
|
|
99
|
+
name: "mapped",
|
|
100
|
+
label: "Mapped Output",
|
|
101
|
+
dataType: "json",
|
|
102
|
+
required: false,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "errors",
|
|
106
|
+
label: "Errors",
|
|
107
|
+
dataType: "string",
|
|
108
|
+
required: false,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
metadata: {
|
|
113
|
+
id: "data_mapper",
|
|
114
|
+
name: "Data Mapper",
|
|
115
|
+
description: "Map data between formats",
|
|
116
|
+
category: "processing",
|
|
117
|
+
version: "1.0.0",
|
|
118
|
+
type: "square",
|
|
119
|
+
supportedTypes: ["square"],
|
|
120
|
+
icon: "mdi:swap-horizontal",
|
|
121
|
+
color: "#0ea5e9",
|
|
122
|
+
inputs: [],
|
|
123
|
+
outputs: [],
|
|
124
|
+
},
|
|
125
|
+
})}
|
|
126
|
+
/>
|
|
127
|
+
</Story>
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
NodeMetadata,
|
|
17
17
|
NodeExtensions,
|
|
18
18
|
NodePort,
|
|
19
|
+
DynamicPort,
|
|
19
20
|
} from "../../types/index.js";
|
|
21
|
+
import { dynamicPortToNodePort } from "../../types/index.js";
|
|
20
22
|
import Icon from "@iconify/svelte";
|
|
21
23
|
import {
|
|
22
24
|
getDataTypeColor,
|
|
@@ -117,20 +119,34 @@
|
|
|
117
119
|
openConfigSidebar();
|
|
118
120
|
}
|
|
119
121
|
}
|
|
122
|
+
const dynamicInputs = $derived(
|
|
123
|
+
((props.data.config?.dynamicInputs as DynamicPort[]) || []).map((port) =>
|
|
124
|
+
dynamicPortToNodePort(port, "input"),
|
|
125
|
+
),
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const dynamicOutputs = $derived(
|
|
129
|
+
((props.data.config?.dynamicOutputs as DynamicPort[]) || []).map((port) =>
|
|
130
|
+
dynamicPortToNodePort(port, "output"),
|
|
131
|
+
),
|
|
132
|
+
);
|
|
133
|
+
|
|
120
134
|
/**
|
|
121
135
|
* All visible input ports in user-defined order.
|
|
122
136
|
*/
|
|
123
137
|
const visibleInputPorts = $derived(
|
|
124
|
-
applyPortOrder(
|
|
125
|
-
(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
),
|
|
138
|
+
applyPortOrder(
|
|
139
|
+
[...(props.data.metadata?.inputs ?? []), ...dynamicInputs],
|
|
140
|
+
portOrder.inputs,
|
|
141
|
+
).filter((p: NodePort) =>
|
|
142
|
+
isPortVisible(
|
|
143
|
+
p,
|
|
144
|
+
"input",
|
|
145
|
+
hiddenPorts,
|
|
146
|
+
hideUnconnectedHandles,
|
|
147
|
+
getConnectedHandles(),
|
|
148
|
+
props.data.nodeId,
|
|
149
|
+
),
|
|
134
150
|
),
|
|
135
151
|
);
|
|
136
152
|
|
|
@@ -139,7 +155,7 @@
|
|
|
139
155
|
*/
|
|
140
156
|
const visibleOutputPorts = $derived(
|
|
141
157
|
applyPortOrder(
|
|
142
|
-
props.data.metadata?.outputs ?? [],
|
|
158
|
+
[...(props.data.metadata?.outputs ?? []), ...dynamicOutputs],
|
|
143
159
|
portOrder.outputs,
|
|
144
160
|
).filter((p: NodePort) =>
|
|
145
161
|
isPortVisible(
|
|
@@ -77,3 +77,66 @@
|
|
|
77
77
|
selected={true}
|
|
78
78
|
/>
|
|
79
79
|
</Story>
|
|
80
|
+
|
|
81
|
+
<Story name="Dynamic Ports">
|
|
82
|
+
<NodeDecorator
|
|
83
|
+
data={createSampleNodeData({
|
|
84
|
+
label: "Custom Function",
|
|
85
|
+
config: {
|
|
86
|
+
dynamicInputs: [
|
|
87
|
+
{
|
|
88
|
+
name: "input_1",
|
|
89
|
+
label: "First Input",
|
|
90
|
+
description: "The first input parameter",
|
|
91
|
+
dataType: "string",
|
|
92
|
+
required: true,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "input_2",
|
|
96
|
+
label: "Second Input",
|
|
97
|
+
description: "The second input parameter",
|
|
98
|
+
dataType: "number",
|
|
99
|
+
required: false,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
dynamicOutputs: [
|
|
103
|
+
{
|
|
104
|
+
name: "output_1",
|
|
105
|
+
label: "Primary Output",
|
|
106
|
+
description: "The main output value",
|
|
107
|
+
dataType: "string",
|
|
108
|
+
required: false,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
metadata: {
|
|
113
|
+
id: "custom-function",
|
|
114
|
+
name: "Custom Function",
|
|
115
|
+
description:
|
|
116
|
+
"Execute a custom function with dynamic inputs and outputs",
|
|
117
|
+
category: "processing",
|
|
118
|
+
version: "1.0.0",
|
|
119
|
+
type: "workflow",
|
|
120
|
+
icon: "mdi:function-variant",
|
|
121
|
+
inputs: [
|
|
122
|
+
{
|
|
123
|
+
id: "trigger",
|
|
124
|
+
name: "Trigger",
|
|
125
|
+
type: "input",
|
|
126
|
+
dataType: "trigger",
|
|
127
|
+
required: false,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
outputs: [
|
|
131
|
+
{
|
|
132
|
+
id: "done",
|
|
133
|
+
name: "Done",
|
|
134
|
+
type: "output",
|
|
135
|
+
dataType: "trigger",
|
|
136
|
+
required: false,
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
})}
|
|
141
|
+
/>
|
|
142
|
+
</Story>
|
|
@@ -72,6 +72,14 @@ export interface EndpointConfig {
|
|
|
72
72
|
/** List interrupts for a pipeline */
|
|
73
73
|
listByPipeline: string;
|
|
74
74
|
};
|
|
75
|
+
chat: {
|
|
76
|
+
/** Send a message to the chat */
|
|
77
|
+
sendMessage: string;
|
|
78
|
+
/** Get conversation history */
|
|
79
|
+
getHistory: string;
|
|
80
|
+
/** Clear conversation history */
|
|
81
|
+
clearHistory: string;
|
|
82
|
+
};
|
|
75
83
|
templates: {
|
|
76
84
|
list: string;
|
|
77
85
|
get: string;
|
package/dist/config/endpoints.js
CHANGED
|
@@ -60,6 +60,11 @@ export const defaultEndpointConfig = {
|
|
|
60
60
|
listBySession: "/playground/sessions/{sessionId}/interrupts",
|
|
61
61
|
listByPipeline: "/pipelines/{pipelineId}/interrupts",
|
|
62
62
|
},
|
|
63
|
+
chat: {
|
|
64
|
+
sendMessage: "/workflows/{id}/chat/messages",
|
|
65
|
+
getHistory: "/workflows/{id}/chat/messages",
|
|
66
|
+
clearHistory: "/workflows/{id}/chat/messages",
|
|
67
|
+
},
|
|
63
68
|
templates: {
|
|
64
69
|
list: "/templates",
|
|
65
70
|
get: "/templates/{id}",
|
package/dist/core/index.d.ts
CHANGED
|
@@ -49,6 +49,9 @@ export { isFieldOptionArray, normalizeOptions, } from "../components/form/types.
|
|
|
49
49
|
export { resolveScopeToKey, keyToScope, generateDefaultUISchema, collectReferencedKeys, } from "../utils/uischema.js";
|
|
50
50
|
export { DEFAULT_PORT_CONFIG } from "../config/defaultPortConfig.js";
|
|
51
51
|
export { defaultEndpointConfig, createEndpointConfig, } from "../config/endpoints.js";
|
|
52
|
+
export { generateNodeId, extractConfigDefaults } from "../utils/nodeIds.js";
|
|
53
|
+
export type { AddNodeCommand, DeleteNodeCommand, RenameNodeCommand, SetConfigCommand, GetConfigCommand, ConnectCommand, DisconnectPortsCommand, DisconnectNodeCommand, ListNodesCommand, ListEdgesCommand, ListTypesCommand, InfoCommand, UndoCommand, RedoCommand, ConfigOpenCommand, SelectNodeCommand, HelpCommand, ClearCommand, SwapNodeCommand, MoveNodeCommand, AutoLayoutCommand, Command, ParseResult, CommandErrorCode, AddNodeResultData, ListNodesResultData, ListEdgesResultData, ListTypesResultData, InfoResultData, GetConfigResultData, SetConfigResultData, HelpResultData, CommandResultData, CommandResultOk, CommandResultError, CommandResult, BatchResult, UIAction, CommandDispatch, CommandContext, } from "../commands/index.js";
|
|
54
|
+
export { buildTypeMap, parseCommand, executeCommand, toShortId, toShortTypeId, resolveNode, executeBatch, computeAutoPosition, } from "../commands/index.js";
|
|
52
55
|
export { WorkflowAdapter } from "../adapters/WorkflowAdapter.js";
|
|
53
56
|
export type { StandardNode, StandardEdge, StandardWorkflow, WorkflowExecutionResult, WorkflowValidationResult, } from "../adapters/WorkflowAdapter.js";
|
|
54
57
|
export type { AgentSpecNodeComponentType, AgentSpecToolComponentType, AgentSpecComponentType, AgentSpecProperty, AgentSpecNodeBase, AgentSpecStartNode, AgentSpecEndNode, AgentSpecLLMNode, AgentSpecAPINode, AgentSpecAgentNode, AgentSpecFlowNode, AgentSpecMapNode, AgentSpecBranchingNode, AgentSpecToolNode, AgentSpecNode, AgentSpecBranch, AgentSpecControlFlowEdge, AgentSpecDataFlowEdge, AgentSpecFlow, AgentSpecToolBase, AgentSpecServerTool, AgentSpecClientTool, AgentSpecRemoteTool, AgentSpecTool, AgentSpecLLMConfig, AgentSpecAgent, AgentSpecDocument, } from "../types/agentspec.js";
|
|
@@ -77,3 +80,5 @@ export { getTheme as theme, getResolvedTheme as resolvedTheme, setTheme, toggleT
|
|
|
77
80
|
export { sanitizeHtml } from "../utils/sanitize.js";
|
|
78
81
|
export { logger, setLogLevel, getLogLevel } from "../utils/logger.js";
|
|
79
82
|
export type { LogLevel } from "../utils/logger.js";
|
|
83
|
+
export { computeSwapPreview, computeSwapPreviewWithOptions, executeSwap, mapConfig, getVersionUpgrade, compareSemver, performSwap, validateSwapResult, SwapValidationError, } from "../utils/nodeSwap.js";
|
|
84
|
+
export type { SwapPreview, SwapResult, PortMapping, DroppedEdge, MatchQuality, PortMappingOverride, ConfigMappingOverride, SwapOptions, SwapStrategy, SwapStrategyContext, SwapEventContext, } from "../utils/nodeSwap.js";
|