@d34dman/flowdrop 0.0.56 → 0.0.58
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 +4 -4
- package/dist/adapters/WorkflowAdapter.d.ts +2 -1
- package/dist/adapters/agentspec/AgentSpecAdapter.d.ts +96 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.js +663 -0
- package/dist/adapters/agentspec/agentAdapter.d.ts +59 -0
- package/dist/adapters/agentspec/agentAdapter.js +91 -0
- package/dist/adapters/agentspec/autoLayout.d.ts +34 -0
- package/dist/adapters/agentspec/autoLayout.js +127 -0
- package/dist/adapters/agentspec/componentTypeDefaults.d.ts +73 -0
- package/dist/adapters/agentspec/componentTypeDefaults.js +238 -0
- package/dist/adapters/agentspec/defaultNodeTypes.d.ts +53 -0
- package/dist/adapters/agentspec/defaultNodeTypes.js +561 -0
- package/dist/adapters/agentspec/index.d.ts +37 -0
- package/dist/adapters/agentspec/index.js +39 -0
- package/dist/adapters/agentspec/validator.d.ts +34 -0
- package/dist/adapters/agentspec/validator.js +169 -0
- package/dist/components/App.svelte +57 -13
- package/dist/components/ConfigForm.svelte +46 -12
- package/dist/components/ConfigForm.svelte.d.ts +8 -0
- package/dist/components/NodeSidebar.svelte +20 -8
- package/dist/components/NodeSidebar.svelte.d.ts +2 -1
- package/dist/components/SchemaForm.svelte +34 -12
- package/dist/components/SchemaForm.svelte.d.ts +8 -0
- package/dist/components/WorkflowEditor.svelte +14 -13
- package/dist/components/form/FormFieldset.svelte +142 -0
- package/dist/components/form/FormFieldset.svelte.d.ts +11 -0
- package/dist/components/form/FormMarkdownEditor.svelte +546 -422
- package/dist/components/form/FormMarkdownEditor.svelte.d.ts +2 -0
- package/dist/components/form/FormUISchemaRenderer.svelte +136 -0
- package/dist/components/form/FormUISchemaRenderer.svelte.d.ts +32 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +3 -0
- package/dist/components/form/types.d.ts +1 -1
- package/dist/components/nodes/WorkflowNode.svelte +1 -2
- package/dist/config/agentSpecEndpoints.d.ts +70 -0
- package/dist/config/agentSpecEndpoints.js +65 -0
- package/dist/config/endpoints.d.ts +6 -0
- package/dist/core/index.d.ts +29 -3
- package/dist/core/index.js +31 -1
- package/dist/form/code.js +6 -1
- package/dist/form/fieldRegistry.d.ts +79 -15
- package/dist/form/fieldRegistry.js +104 -49
- package/dist/form/full.d.ts +2 -2
- package/dist/form/full.js +2 -2
- package/dist/form/index.d.ts +5 -3
- package/dist/form/index.js +9 -2
- package/dist/form/markdown.d.ts +3 -3
- package/dist/form/markdown.js +8 -4
- package/dist/helpers/workflowEditorHelper.d.ts +24 -0
- package/dist/helpers/workflowEditorHelper.js +55 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/registry/BaseRegistry.d.ts +92 -0
- package/dist/registry/BaseRegistry.js +124 -0
- package/dist/registry/builtinFormats.d.ts +23 -0
- package/dist/registry/builtinFormats.js +70 -0
- package/dist/registry/builtinNodes.js +4 -0
- package/dist/registry/index.d.ts +2 -1
- package/dist/registry/index.js +2 -0
- package/dist/registry/nodeComponentRegistry.d.ts +26 -57
- package/dist/registry/nodeComponentRegistry.js +29 -82
- package/dist/registry/workflowFormatRegistry.d.ts +122 -0
- package/dist/registry/workflowFormatRegistry.js +96 -0
- package/dist/schema/index.d.ts +23 -0
- package/dist/schema/index.js +23 -0
- package/dist/services/agentSpecExecutionService.d.ts +106 -0
- package/dist/services/agentSpecExecutionService.js +333 -0
- package/dist/stores/portCoordinateStore.js +1 -4
- package/dist/stores/workflowStore.d.ts +3 -0
- package/dist/stores/workflowStore.js +3 -0
- package/dist/svelte-app.d.ts +4 -0
- package/dist/svelte-app.js +9 -1
- package/dist/types/agentspec.d.ts +318 -0
- package/dist/types/agentspec.js +48 -0
- package/dist/types/events.d.ts +28 -1
- package/dist/types/index.d.ts +31 -0
- package/dist/types/index.js +5 -0
- package/dist/types/uischema.d.ts +144 -0
- package/dist/types/uischema.js +51 -0
- package/dist/utils/uischema.d.ts +52 -0
- package/dist/utils/uischema.js +88 -0
- package/package.json +231 -225
- package/schemas/v1/workflow.schema.json +952 -0
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Spec Default Node Types
|
|
3
|
+
*
|
|
4
|
+
* Provides optional starter node type definitions for the Agent Spec format.
|
|
5
|
+
* These are full NodeMetadata objects with visual type, category, default ports,
|
|
6
|
+
* config schema, and icon — suitable for populating the sidebar.
|
|
7
|
+
*
|
|
8
|
+
* These definitions are NOT required by the adapter — the adapter uses
|
|
9
|
+
* componentTypeDefaults.ts for import/export infrastructure.
|
|
10
|
+
* Users can provide their own node definitions instead.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { getDefaultAgentSpecNodeTypes } from '@d34dman/flowdrop/core';
|
|
15
|
+
*
|
|
16
|
+
* mountFlowDropApp(container, {
|
|
17
|
+
* nodes: getDefaultAgentSpecNodeTypes(), // or your own definitions
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import { AGENTSPEC_NAMESPACE as AGENTSPEC_NS, TRIGGER_INPUT, TRIGGER_OUTPUT } from './componentTypeDefaults.js';
|
|
22
|
+
/**
|
|
23
|
+
* Build the full registry of Agent Spec node types.
|
|
24
|
+
*/
|
|
25
|
+
function buildRegistry() {
|
|
26
|
+
const registry = new Map();
|
|
27
|
+
// ========================================================================
|
|
28
|
+
// StartNode — Graph entry point
|
|
29
|
+
// ========================================================================
|
|
30
|
+
registry.set('start_node', {
|
|
31
|
+
componentType: 'start_node',
|
|
32
|
+
metadata: {
|
|
33
|
+
id: `${AGENTSPEC_NS}.start_node`,
|
|
34
|
+
name: 'Start',
|
|
35
|
+
type: 'terminal',
|
|
36
|
+
description: 'Flow entry point. Defines the initial inputs for the flow.',
|
|
37
|
+
category: 'triggers',
|
|
38
|
+
version: '1.0.0',
|
|
39
|
+
icon: 'mdi:play-circle',
|
|
40
|
+
color: '#22c55e',
|
|
41
|
+
badge: 'START',
|
|
42
|
+
inputs: [],
|
|
43
|
+
outputs: [TRIGGER_OUTPUT],
|
|
44
|
+
configSchema: {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {}
|
|
47
|
+
},
|
|
48
|
+
formats: ['agentspec'],
|
|
49
|
+
extensions: { 'agentspec:component_type': 'start_node' }
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
// ========================================================================
|
|
53
|
+
// EndNode — Graph exit point
|
|
54
|
+
// ========================================================================
|
|
55
|
+
registry.set('end_node', {
|
|
56
|
+
componentType: 'end_node',
|
|
57
|
+
metadata: {
|
|
58
|
+
id: `${AGENTSPEC_NS}.end_node`,
|
|
59
|
+
name: 'End',
|
|
60
|
+
type: 'terminal',
|
|
61
|
+
description: 'Flow exit point. Defines the final outputs of the flow.',
|
|
62
|
+
category: 'outputs',
|
|
63
|
+
version: '1.0.0',
|
|
64
|
+
icon: 'mdi:stop-circle',
|
|
65
|
+
color: '#ef4444',
|
|
66
|
+
badge: 'END',
|
|
67
|
+
inputs: [TRIGGER_INPUT],
|
|
68
|
+
outputs: [],
|
|
69
|
+
configSchema: {
|
|
70
|
+
type: 'object',
|
|
71
|
+
properties: {}
|
|
72
|
+
},
|
|
73
|
+
formats: ['agentspec'],
|
|
74
|
+
extensions: { 'agentspec:component_type': 'end_node' }
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// ========================================================================
|
|
78
|
+
// LLMNode — Text generation from prompts
|
|
79
|
+
// ========================================================================
|
|
80
|
+
registry.set('llm_node', {
|
|
81
|
+
componentType: 'llm_node',
|
|
82
|
+
metadata: {
|
|
83
|
+
id: `${AGENTSPEC_NS}.llm_node`,
|
|
84
|
+
name: 'LLM',
|
|
85
|
+
type: 'default',
|
|
86
|
+
description: 'Generate text using a large language model with configurable prompts.',
|
|
87
|
+
category: 'ai',
|
|
88
|
+
version: '1.0.0',
|
|
89
|
+
icon: 'mdi:brain',
|
|
90
|
+
color: '#8b5cf6',
|
|
91
|
+
badge: 'LLM',
|
|
92
|
+
inputs: [
|
|
93
|
+
TRIGGER_INPUT,
|
|
94
|
+
{
|
|
95
|
+
id: 'prompt',
|
|
96
|
+
name: 'Prompt',
|
|
97
|
+
type: 'input',
|
|
98
|
+
dataType: 'string',
|
|
99
|
+
required: false,
|
|
100
|
+
description: 'Input prompt text (can also use {{variable}} in prompt template)'
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
outputs: [
|
|
104
|
+
TRIGGER_OUTPUT,
|
|
105
|
+
{
|
|
106
|
+
id: 'llm_output',
|
|
107
|
+
name: 'LLM Output',
|
|
108
|
+
type: 'output',
|
|
109
|
+
dataType: 'string',
|
|
110
|
+
description: 'Generated text from the LLM'
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
configSchema: {
|
|
114
|
+
type: 'object',
|
|
115
|
+
properties: {
|
|
116
|
+
prompt_template: {
|
|
117
|
+
type: 'string',
|
|
118
|
+
title: 'Prompt Template',
|
|
119
|
+
description: 'Prompt template with {{variable}} placeholders for dynamic inputs',
|
|
120
|
+
format: 'multiline',
|
|
121
|
+
default: '{{prompt}}'
|
|
122
|
+
},
|
|
123
|
+
system_prompt: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
title: 'System Prompt',
|
|
126
|
+
description: 'System message to set the LLM behavior',
|
|
127
|
+
format: 'multiline',
|
|
128
|
+
default: ''
|
|
129
|
+
},
|
|
130
|
+
llm_config_ref: {
|
|
131
|
+
type: 'string',
|
|
132
|
+
title: 'LLM Configuration',
|
|
133
|
+
description: 'Reference to an LLM configuration (e.g., model name, provider)',
|
|
134
|
+
default: ''
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
formats: ['agentspec'],
|
|
139
|
+
extensions: { 'agentspec:component_type': 'llm_node' }
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
// ========================================================================
|
|
143
|
+
// BranchingNode — Conditional routing
|
|
144
|
+
// ========================================================================
|
|
145
|
+
registry.set('branching_node', {
|
|
146
|
+
componentType: 'branching_node',
|
|
147
|
+
metadata: {
|
|
148
|
+
id: `${AGENTSPEC_NS}.branching_node`,
|
|
149
|
+
name: 'Branch',
|
|
150
|
+
type: 'gateway',
|
|
151
|
+
description: 'Route execution to different paths based on conditions.',
|
|
152
|
+
category: 'logic',
|
|
153
|
+
version: '1.0.0',
|
|
154
|
+
icon: 'mdi:source-branch',
|
|
155
|
+
color: '#f59e0b',
|
|
156
|
+
badge: 'BRANCH',
|
|
157
|
+
inputs: [
|
|
158
|
+
TRIGGER_INPUT,
|
|
159
|
+
{
|
|
160
|
+
id: 'input',
|
|
161
|
+
name: 'Input',
|
|
162
|
+
type: 'input',
|
|
163
|
+
dataType: 'mixed',
|
|
164
|
+
required: false,
|
|
165
|
+
description: 'Data to evaluate branch conditions against'
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
outputs: [],
|
|
169
|
+
configSchema: {
|
|
170
|
+
type: 'object',
|
|
171
|
+
properties: {
|
|
172
|
+
branches: {
|
|
173
|
+
type: 'array',
|
|
174
|
+
title: 'Branches',
|
|
175
|
+
description: 'Conditional branches for routing',
|
|
176
|
+
items: {
|
|
177
|
+
type: 'object',
|
|
178
|
+
properties: {
|
|
179
|
+
name: {
|
|
180
|
+
type: 'string',
|
|
181
|
+
title: 'Branch ID',
|
|
182
|
+
description: 'Unique identifier for the branch'
|
|
183
|
+
},
|
|
184
|
+
label: {
|
|
185
|
+
type: 'string',
|
|
186
|
+
title: 'Label',
|
|
187
|
+
description: 'Display label for the branch'
|
|
188
|
+
},
|
|
189
|
+
condition: {
|
|
190
|
+
type: 'string',
|
|
191
|
+
title: 'Condition',
|
|
192
|
+
description: 'Expression that determines when this branch activates'
|
|
193
|
+
},
|
|
194
|
+
isDefault: {
|
|
195
|
+
type: 'boolean',
|
|
196
|
+
title: 'Default Branch',
|
|
197
|
+
description: 'Whether this is the fallback branch',
|
|
198
|
+
default: false
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
required: ['name']
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
formats: ['agentspec'],
|
|
207
|
+
extensions: { 'agentspec:component_type': 'branching_node' }
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
// ========================================================================
|
|
211
|
+
// ToolNode — Tool execution
|
|
212
|
+
// ========================================================================
|
|
213
|
+
registry.set('tool_node', {
|
|
214
|
+
componentType: 'tool_node',
|
|
215
|
+
metadata: {
|
|
216
|
+
id: `${AGENTSPEC_NS}.tool_node`,
|
|
217
|
+
name: 'Tool',
|
|
218
|
+
type: 'tool',
|
|
219
|
+
description: 'Execute a tool function with inputs and receive outputs.',
|
|
220
|
+
category: 'tools',
|
|
221
|
+
version: '1.0.0',
|
|
222
|
+
icon: 'mdi:wrench',
|
|
223
|
+
color: '#06b6d4',
|
|
224
|
+
badge: 'TOOL',
|
|
225
|
+
inputs: [
|
|
226
|
+
TRIGGER_INPUT,
|
|
227
|
+
{
|
|
228
|
+
id: 'tool',
|
|
229
|
+
name: 'Tool',
|
|
230
|
+
type: 'input',
|
|
231
|
+
dataType: 'tool',
|
|
232
|
+
required: false,
|
|
233
|
+
description: 'Tool connection'
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
outputs: [
|
|
237
|
+
TRIGGER_OUTPUT,
|
|
238
|
+
{
|
|
239
|
+
id: 'tool',
|
|
240
|
+
name: 'Tool',
|
|
241
|
+
type: 'output',
|
|
242
|
+
dataType: 'tool',
|
|
243
|
+
description: 'Tool passthrough'
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: 'result',
|
|
247
|
+
name: 'Result',
|
|
248
|
+
type: 'output',
|
|
249
|
+
dataType: 'mixed',
|
|
250
|
+
description: 'Tool execution result'
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
configSchema: {
|
|
254
|
+
type: 'object',
|
|
255
|
+
properties: {
|
|
256
|
+
tool_ref: {
|
|
257
|
+
type: 'string',
|
|
258
|
+
title: 'Tool Reference',
|
|
259
|
+
description: 'Reference to the tool to execute ($component_ref:tool_name)',
|
|
260
|
+
default: ''
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
formats: ['agentspec'],
|
|
265
|
+
extensions: { 'agentspec:component_type': 'tool_node' }
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
// ========================================================================
|
|
269
|
+
// APINode — API call
|
|
270
|
+
// ========================================================================
|
|
271
|
+
registry.set('api_node', {
|
|
272
|
+
componentType: 'api_node',
|
|
273
|
+
metadata: {
|
|
274
|
+
id: `${AGENTSPEC_NS}.api_node`,
|
|
275
|
+
name: 'API Call',
|
|
276
|
+
type: 'default',
|
|
277
|
+
description: 'Make an HTTP API call with configurable endpoint, method, and headers.',
|
|
278
|
+
category: 'data',
|
|
279
|
+
version: '1.0.0',
|
|
280
|
+
icon: 'mdi:api',
|
|
281
|
+
color: '#3b82f6',
|
|
282
|
+
badge: 'API',
|
|
283
|
+
inputs: [
|
|
284
|
+
TRIGGER_INPUT,
|
|
285
|
+
{
|
|
286
|
+
id: 'body',
|
|
287
|
+
name: 'Request Body',
|
|
288
|
+
type: 'input',
|
|
289
|
+
dataType: 'json',
|
|
290
|
+
required: false,
|
|
291
|
+
description: 'Request body data'
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
outputs: [
|
|
295
|
+
TRIGGER_OUTPUT,
|
|
296
|
+
{
|
|
297
|
+
id: 'response',
|
|
298
|
+
name: 'Response',
|
|
299
|
+
type: 'output',
|
|
300
|
+
dataType: 'json',
|
|
301
|
+
description: 'API response data'
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: 'status_code',
|
|
305
|
+
name: 'Status Code',
|
|
306
|
+
type: 'output',
|
|
307
|
+
dataType: 'number',
|
|
308
|
+
description: 'HTTP status code'
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
configSchema: {
|
|
312
|
+
type: 'object',
|
|
313
|
+
properties: {
|
|
314
|
+
endpoint: {
|
|
315
|
+
type: 'string',
|
|
316
|
+
title: 'Endpoint URL',
|
|
317
|
+
description: 'The API endpoint to call',
|
|
318
|
+
default: ''
|
|
319
|
+
},
|
|
320
|
+
method: {
|
|
321
|
+
type: 'string',
|
|
322
|
+
title: 'HTTP Method',
|
|
323
|
+
enum: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
|
|
324
|
+
default: 'GET'
|
|
325
|
+
},
|
|
326
|
+
headers: {
|
|
327
|
+
type: 'string',
|
|
328
|
+
title: 'Headers',
|
|
329
|
+
description: 'Request headers as JSON',
|
|
330
|
+
format: 'multiline',
|
|
331
|
+
default: '{}'
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
formats: ['agentspec'],
|
|
336
|
+
extensions: { 'agentspec:component_type': 'api_node' }
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
// ========================================================================
|
|
340
|
+
// AgentNode — Multi-round agent conversation
|
|
341
|
+
// ========================================================================
|
|
342
|
+
registry.set('agent_node', {
|
|
343
|
+
componentType: 'agent_node',
|
|
344
|
+
metadata: {
|
|
345
|
+
id: `${AGENTSPEC_NS}.agent_node`,
|
|
346
|
+
name: 'Agent',
|
|
347
|
+
type: 'default',
|
|
348
|
+
description: 'Run a multi-round agent conversation within the flow.',
|
|
349
|
+
category: 'agents',
|
|
350
|
+
version: '1.0.0',
|
|
351
|
+
icon: 'mdi:robot',
|
|
352
|
+
color: '#ec4899',
|
|
353
|
+
badge: 'AGENT',
|
|
354
|
+
inputs: [
|
|
355
|
+
TRIGGER_INPUT,
|
|
356
|
+
{
|
|
357
|
+
id: 'input',
|
|
358
|
+
name: 'Input',
|
|
359
|
+
type: 'input',
|
|
360
|
+
dataType: 'string',
|
|
361
|
+
required: false,
|
|
362
|
+
description: 'Input message for the agent'
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
outputs: [
|
|
366
|
+
TRIGGER_OUTPUT,
|
|
367
|
+
{
|
|
368
|
+
id: 'output',
|
|
369
|
+
name: 'Output',
|
|
370
|
+
type: 'output',
|
|
371
|
+
dataType: 'string',
|
|
372
|
+
description: 'Agent response output'
|
|
373
|
+
}
|
|
374
|
+
],
|
|
375
|
+
configSchema: {
|
|
376
|
+
type: 'object',
|
|
377
|
+
properties: {
|
|
378
|
+
agent_ref: {
|
|
379
|
+
type: 'string',
|
|
380
|
+
title: 'Agent Reference',
|
|
381
|
+
description: 'Reference to the agent ($component_ref:agent_name)',
|
|
382
|
+
default: ''
|
|
383
|
+
},
|
|
384
|
+
max_turns: {
|
|
385
|
+
type: 'integer',
|
|
386
|
+
title: 'Max Turns',
|
|
387
|
+
description: 'Maximum number of conversation turns',
|
|
388
|
+
minimum: 1,
|
|
389
|
+
default: 10
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
formats: ['agentspec'],
|
|
394
|
+
extensions: { 'agentspec:component_type': 'agent_node' }
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
// ========================================================================
|
|
398
|
+
// FlowNode — Nested flow execution
|
|
399
|
+
// ========================================================================
|
|
400
|
+
registry.set('flow_node', {
|
|
401
|
+
componentType: 'flow_node',
|
|
402
|
+
metadata: {
|
|
403
|
+
id: `${AGENTSPEC_NS}.flow_node`,
|
|
404
|
+
name: 'Sub-Flow',
|
|
405
|
+
type: 'simple',
|
|
406
|
+
description: 'Execute another flow as a sub-routine within this flow.',
|
|
407
|
+
category: 'processing',
|
|
408
|
+
version: '1.0.0',
|
|
409
|
+
icon: 'mdi:sitemap',
|
|
410
|
+
color: '#14b8a6',
|
|
411
|
+
badge: 'FLOW',
|
|
412
|
+
inputs: [
|
|
413
|
+
TRIGGER_INPUT,
|
|
414
|
+
{
|
|
415
|
+
id: 'input',
|
|
416
|
+
name: 'Input',
|
|
417
|
+
type: 'input',
|
|
418
|
+
dataType: 'mixed',
|
|
419
|
+
required: false,
|
|
420
|
+
description: 'Input data passed to the sub-flow'
|
|
421
|
+
}
|
|
422
|
+
],
|
|
423
|
+
outputs: [
|
|
424
|
+
TRIGGER_OUTPUT,
|
|
425
|
+
{
|
|
426
|
+
id: 'output',
|
|
427
|
+
name: 'Output',
|
|
428
|
+
type: 'output',
|
|
429
|
+
dataType: 'mixed',
|
|
430
|
+
description: 'Output data from the sub-flow'
|
|
431
|
+
}
|
|
432
|
+
],
|
|
433
|
+
configSchema: {
|
|
434
|
+
type: 'object',
|
|
435
|
+
properties: {
|
|
436
|
+
flow_ref: {
|
|
437
|
+
type: 'string',
|
|
438
|
+
title: 'Flow Reference',
|
|
439
|
+
description: 'Reference to the flow ($component_ref:flow_name)',
|
|
440
|
+
default: ''
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
formats: ['agentspec'],
|
|
445
|
+
extensions: { 'agentspec:component_type': 'flow_node' }
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
// ========================================================================
|
|
449
|
+
// MapNode — Map-reduce operations
|
|
450
|
+
// ========================================================================
|
|
451
|
+
registry.set('map_node', {
|
|
452
|
+
componentType: 'map_node',
|
|
453
|
+
metadata: {
|
|
454
|
+
id: `${AGENTSPEC_NS}.map_node`,
|
|
455
|
+
name: 'Map',
|
|
456
|
+
type: 'default',
|
|
457
|
+
description: 'Apply a flow or operation to each item in a collection (map-reduce).',
|
|
458
|
+
category: 'processing',
|
|
459
|
+
version: '1.0.0',
|
|
460
|
+
icon: 'mdi:map-marker-path',
|
|
461
|
+
color: '#f97316',
|
|
462
|
+
badge: 'MAP',
|
|
463
|
+
inputs: [
|
|
464
|
+
TRIGGER_INPUT,
|
|
465
|
+
{
|
|
466
|
+
id: 'collection',
|
|
467
|
+
name: 'Collection',
|
|
468
|
+
type: 'input',
|
|
469
|
+
dataType: 'array',
|
|
470
|
+
required: true,
|
|
471
|
+
description: 'Input collection to iterate over'
|
|
472
|
+
}
|
|
473
|
+
],
|
|
474
|
+
outputs: [
|
|
475
|
+
TRIGGER_OUTPUT,
|
|
476
|
+
{
|
|
477
|
+
id: 'results',
|
|
478
|
+
name: 'Results',
|
|
479
|
+
type: 'output',
|
|
480
|
+
dataType: 'array',
|
|
481
|
+
description: 'Mapped output collection'
|
|
482
|
+
}
|
|
483
|
+
],
|
|
484
|
+
configSchema: {
|
|
485
|
+
type: 'object',
|
|
486
|
+
properties: {
|
|
487
|
+
input_collection: {
|
|
488
|
+
type: 'string',
|
|
489
|
+
title: 'Input Collection Property',
|
|
490
|
+
description: 'Name of the input property containing the collection',
|
|
491
|
+
default: 'collection'
|
|
492
|
+
},
|
|
493
|
+
output_collection: {
|
|
494
|
+
type: 'string',
|
|
495
|
+
title: 'Output Collection Property',
|
|
496
|
+
description: 'Name of the output property for mapped results',
|
|
497
|
+
default: 'results'
|
|
498
|
+
},
|
|
499
|
+
map_flow_ref: {
|
|
500
|
+
type: 'string',
|
|
501
|
+
title: 'Map Flow Reference',
|
|
502
|
+
description: 'Reference to the flow to execute per item ($component_ref:flow_name)',
|
|
503
|
+
default: ''
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
formats: ['agentspec'],
|
|
508
|
+
extensions: { 'agentspec:component_type': 'map_node' }
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
return registry;
|
|
512
|
+
}
|
|
513
|
+
// ============================================================================
|
|
514
|
+
// Public API
|
|
515
|
+
// ============================================================================
|
|
516
|
+
/** Singleton registry instance */
|
|
517
|
+
const registry = buildRegistry();
|
|
518
|
+
/**
|
|
519
|
+
* Get FlowDrop NodeMetadata for an Agent Spec component type.
|
|
520
|
+
*
|
|
521
|
+
* @param componentType - The Agent Spec component_type value
|
|
522
|
+
* @returns NodeMetadata for the component type, or undefined if not found
|
|
523
|
+
*
|
|
524
|
+
* @example
|
|
525
|
+
* ```typescript
|
|
526
|
+
* const metadata = getAgentSpecNodeMetadata('llm_node');
|
|
527
|
+
* // Returns NodeMetadata with id='agentspec.llm_node', type='default', category='ai', etc.
|
|
528
|
+
* ```
|
|
529
|
+
*/
|
|
530
|
+
export function getAgentSpecNodeMetadata(componentType) {
|
|
531
|
+
return registry.get(componentType)?.metadata;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Get all default Agent Spec node types as FlowDrop NodeMetadata.
|
|
535
|
+
* These are starter templates — users can provide their own node types instead.
|
|
536
|
+
*
|
|
537
|
+
* @returns Array of NodeMetadata for all 9 default Agent Spec node types
|
|
538
|
+
*/
|
|
539
|
+
export function getDefaultAgentSpecNodeTypes() {
|
|
540
|
+
return Array.from(registry.values()).map((entry) => entry.metadata);
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Get a copy of the NodeMetadata for a component type with custom inputs/outputs.
|
|
544
|
+
* Used during import to create node metadata that matches the Agent Spec definition's
|
|
545
|
+
* actual ports rather than the defaults.
|
|
546
|
+
*
|
|
547
|
+
* @param componentType - The Agent Spec component_type value
|
|
548
|
+
* @param inputs - Custom input ports
|
|
549
|
+
* @param outputs - Custom output ports
|
|
550
|
+
* @returns A new NodeMetadata with the custom ports merged in
|
|
551
|
+
*/
|
|
552
|
+
export function createAgentSpecNodeMetadata(componentType, inputs, outputs) {
|
|
553
|
+
const base = registry.get(componentType)?.metadata;
|
|
554
|
+
if (!base)
|
|
555
|
+
return undefined;
|
|
556
|
+
return {
|
|
557
|
+
...base,
|
|
558
|
+
inputs: inputs ?? base.inputs,
|
|
559
|
+
outputs: outputs ?? base.outputs
|
|
560
|
+
};
|
|
561
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Spec Adapter — Barrel Exports
|
|
3
|
+
*
|
|
4
|
+
* Provides bidirectional conversion between FlowDrop and Oracle's Open Agent Spec.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import {
|
|
9
|
+
* AgentSpecAdapter,
|
|
10
|
+
* AgentSpecAgentAdapter,
|
|
11
|
+
* getAgentSpecNodeMetadata,
|
|
12
|
+
* validateForAgentSpecExport,
|
|
13
|
+
* validateAgentSpecFlow
|
|
14
|
+
* } from '@d34dman/flowdrop/core';
|
|
15
|
+
*
|
|
16
|
+
* // Export a FlowDrop workflow as Agent Spec JSON
|
|
17
|
+
* const adapter = new AgentSpecAdapter();
|
|
18
|
+
* const agentSpecJson = adapter.exportJSON(workflow);
|
|
19
|
+
*
|
|
20
|
+
* // Import an Agent Spec flow into FlowDrop
|
|
21
|
+
* const flowDropWorkflow = adapter.importJSON(agentSpecJson);
|
|
22
|
+
*
|
|
23
|
+
* // Validate before export
|
|
24
|
+
* const result = validateForAgentSpecExport(workflow);
|
|
25
|
+
* if (!result.valid) console.error(result.errors);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export { AgentSpecAdapter } from './AgentSpecAdapter.js';
|
|
29
|
+
export { AgentSpecAgentAdapter } from './agentAdapter.js';
|
|
30
|
+
export type { AgentConfig, AgentSpecImportResult } from './agentAdapter.js';
|
|
31
|
+
export { getAgentSpecNodeMetadata, getDefaultAgentSpecNodeTypes, createAgentSpecNodeMetadata } from './defaultNodeTypes.js';
|
|
32
|
+
export { getComponentTypeDefaults, extractComponentType, isAgentSpecNodeId, AGENTSPEC_NAMESPACE } from './componentTypeDefaults.js';
|
|
33
|
+
export type { ComponentTypeDefaults } from './componentTypeDefaults.js';
|
|
34
|
+
export { validateForAgentSpecExport, validateAgentSpecFlow } from './validator.js';
|
|
35
|
+
export type { AgentSpecValidationResult } from './validator.js';
|
|
36
|
+
export { computeAutoLayout } from './autoLayout.js';
|
|
37
|
+
export type { AutoLayoutConfig } from './autoLayout.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Spec Adapter — Barrel Exports
|
|
3
|
+
*
|
|
4
|
+
* Provides bidirectional conversion between FlowDrop and Oracle's Open Agent Spec.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import {
|
|
9
|
+
* AgentSpecAdapter,
|
|
10
|
+
* AgentSpecAgentAdapter,
|
|
11
|
+
* getAgentSpecNodeMetadata,
|
|
12
|
+
* validateForAgentSpecExport,
|
|
13
|
+
* validateAgentSpecFlow
|
|
14
|
+
* } from '@d34dman/flowdrop/core';
|
|
15
|
+
*
|
|
16
|
+
* // Export a FlowDrop workflow as Agent Spec JSON
|
|
17
|
+
* const adapter = new AgentSpecAdapter();
|
|
18
|
+
* const agentSpecJson = adapter.exportJSON(workflow);
|
|
19
|
+
*
|
|
20
|
+
* // Import an Agent Spec flow into FlowDrop
|
|
21
|
+
* const flowDropWorkflow = adapter.importJSON(agentSpecJson);
|
|
22
|
+
*
|
|
23
|
+
* // Validate before export
|
|
24
|
+
* const result = validateForAgentSpecExport(workflow);
|
|
25
|
+
* if (!result.valid) console.error(result.errors);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
// Core adapter
|
|
29
|
+
export { AgentSpecAdapter } from './AgentSpecAdapter.js';
|
|
30
|
+
// Agent-level adapter (wraps flow with agent/tools/LLM config)
|
|
31
|
+
export { AgentSpecAgentAdapter } from './agentAdapter.js';
|
|
32
|
+
// Default node types (optional starter templates — users can provide their own)
|
|
33
|
+
export { getAgentSpecNodeMetadata, getDefaultAgentSpecNodeTypes, createAgentSpecNodeMetadata } from './defaultNodeTypes.js';
|
|
34
|
+
// Component type defaults (adapter infrastructure)
|
|
35
|
+
export { getComponentTypeDefaults, extractComponentType, isAgentSpecNodeId, AGENTSPEC_NAMESPACE } from './componentTypeDefaults.js';
|
|
36
|
+
// Validation
|
|
37
|
+
export { validateForAgentSpecExport, validateAgentSpecFlow } from './validator.js';
|
|
38
|
+
// Auto-layout
|
|
39
|
+
export { computeAutoLayout } from './autoLayout.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Spec Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates workflows against Agent Spec constraints for export,
|
|
5
|
+
* and validates imported Agent Spec documents for correctness.
|
|
6
|
+
*/
|
|
7
|
+
import type { AgentSpecFlow } from '../../types/agentspec.js';
|
|
8
|
+
import type { StandardWorkflow } from '../WorkflowAdapter.js';
|
|
9
|
+
/** Validation result */
|
|
10
|
+
export interface AgentSpecValidationResult {
|
|
11
|
+
valid: boolean;
|
|
12
|
+
errors: string[];
|
|
13
|
+
warnings: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Validate a FlowDrop StandardWorkflow for Agent Spec export compatibility.
|
|
17
|
+
*
|
|
18
|
+
* Checks:
|
|
19
|
+
* - Must have exactly 1 start node (terminal/triggers)
|
|
20
|
+
* - Must have at least 1 end node (terminal/outputs)
|
|
21
|
+
* - Gateway nodes must have branches defined
|
|
22
|
+
*/
|
|
23
|
+
export declare function validateForAgentSpecExport(workflow: StandardWorkflow): AgentSpecValidationResult;
|
|
24
|
+
/**
|
|
25
|
+
* Validate an imported Agent Spec Flow document.
|
|
26
|
+
*
|
|
27
|
+
* Checks:
|
|
28
|
+
* - Has a start_node reference that exists
|
|
29
|
+
* - At least one end_node exists
|
|
30
|
+
* - All edge references point to existing nodes
|
|
31
|
+
* - BranchingNode has branches
|
|
32
|
+
* - Data flow edges reference valid properties
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateAgentSpecFlow(flow: AgentSpecFlow): AgentSpecValidationResult;
|