Files
sim/tests/executor/fixtures/workflows.ts
waleedlatif1 8218a88ce6 Feature/execution (#87)
* feat(executor): split executor into specialized components

* fix(executor): if there is a dependency on a block that is not along the selected path, ignore it; if we are at max iterations for a loop, stop

* feat(exector): cleanup inline comments in executor

* fix(executor): fix issue in removeDownstreamBlocks when we are breaking out of a loop to prevent infinite recursion

* feat(executor/tests): setup initial testing directory

* feat(executor): make the path selection for routing/conditional blocks independent of context, instead of deactivating paths we just activate others
2025-02-26 02:09:56 -08:00

146 lines
3.1 KiB
TypeScript

import { SerializedWorkflow } from '../../../serializer/types'
export const createMinimalWorkflow = (): SerializedWorkflow => ({
version: '1.0',
blocks: [
{
id: 'starter',
position: { x: 0, y: 0 },
config: { tool: 'test-tool', params: {} },
inputs: {},
outputs: {},
enabled: true,
metadata: { id: 'starter', name: 'Starter Block' },
},
{
id: 'block1',
position: { x: 100, y: 0 },
config: { tool: 'test-tool', params: {} },
inputs: {},
outputs: {},
enabled: true,
metadata: { id: 'test', name: 'Test Block' },
},
],
connections: [
{
source: 'starter',
target: 'block1',
},
],
loops: {},
})
export const createWorkflowWithLoop = (): SerializedWorkflow => ({
version: '1.0',
blocks: [
{
id: 'starter',
position: { x: 0, y: 0 },
config: { tool: 'test-tool', params: {} },
inputs: {},
outputs: {},
enabled: true,
metadata: { id: 'starter', name: 'Starter Block' },
},
{
id: 'block1',
position: { x: 100, y: 0 },
config: { tool: 'test-tool', params: {} },
inputs: {},
outputs: {},
enabled: true,
metadata: { id: 'test', name: 'Loop Block 1' },
},
{
id: 'block2',
position: { x: 200, y: 0 },
config: { tool: 'test-tool', params: {} },
inputs: {},
outputs: {},
enabled: true,
metadata: { id: 'test', name: 'Loop Block 2' },
},
],
connections: [
{
source: 'starter',
target: 'block1',
},
{
source: 'block1',
target: 'block2',
},
{
source: 'block2',
target: 'block1',
},
],
loops: {
loop1: {
id: 'loop1',
nodes: ['block1', 'block2'],
maxIterations: 5,
},
},
})
export const createWorkflowWithCondition = (): SerializedWorkflow => ({
version: '1.0',
blocks: [
{
id: 'starter',
position: { x: 0, y: 0 },
config: { tool: 'test-tool', params: {} },
inputs: {},
outputs: {},
enabled: true,
metadata: { id: 'starter', name: 'Starter Block' },
},
{
id: 'condition1',
position: { x: 100, y: 0 },
config: { tool: 'test-tool', params: {} },
inputs: {},
outputs: {},
enabled: true,
metadata: { id: 'condition', name: 'Condition Block' },
},
{
id: 'block1',
position: { x: 200, y: -50 },
config: { tool: 'test-tool', params: {} },
inputs: {},
outputs: {},
enabled: true,
metadata: { id: 'test', name: 'True Path Block' },
},
{
id: 'block2',
position: { x: 200, y: 50 },
config: { tool: 'test-tool', params: {} },
inputs: {},
outputs: {},
enabled: true,
metadata: { id: 'test', name: 'False Path Block' },
},
],
connections: [
{
source: 'starter',
target: 'condition1',
},
{
source: 'condition1',
target: 'block1',
sourceHandle: 'condition-true',
},
{
source: 'condition1',
target: 'block2',
sourceHandle: 'condition-false',
},
],
loops: {},
})