Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

Visual workflow builder for agentic LLM pipelines. Users drag-and-drop nodes (Start, Agent, If/Else, Approval, End) onto a canvas, connect them, configure LLM prompts and branching logic, then execute workflows server-side against OpenAI. Run results are persisted as JSON audit trails.
Visual workflow builder for agentic LLM pipelines. Users drag-and-drop nodes (Start, Agent, If/Else, Approval) onto a canvas, connect them, configure LLM prompts and branching logic, then execute workflows server-side against OpenAI. Run results are persisted as JSON audit trails.

## Monorepo Layout

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Agentic Workflow Builder

Agentic Workflow Builder is a web app for visually composing, executing, and auditing LLM workflows. Drag Start, Agent, If/Else, Approval, and End nodes onto the canvas, connect them with Bezier edges, configure prompts inline, and run the flow through a server-side engine that records every step for later review.
Agentic Workflow Builder is a web app for visually composing, executing, and auditing LLM workflows. Drag Start, Agent, If/Else, and Approval nodes onto the canvas, connect them with Bezier edges, configure prompts inline, and run the flow through a server-side engine that records every step for later review.

## Repository Layout

Expand Down
3 changes: 0 additions & 3 deletions apps/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ <h3>Nodes</h3>
<div class="draggable-node" draggable="true" data-type="approval">
<span class="icon icon-chermark-badge icon-primary"></span>User Approval
</div>
<div class="draggable-node" draggable="true" data-type="end">
<span class="icon icon-rectangle-2698 icon-primary"></span>End
</div>
</div>
</div>
<div class="canvas-controls">
Expand Down
33 changes: 33 additions & 0 deletions apps/web/src/app/workflow-editor.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { describe, expect, it, vi } from 'vitest';

import { WorkflowEditor } from './workflow-editor';

describe('WorkflowEditor renderPorts', () => {
it('renders an output port for start nodes', () => {
const renderPorts = (
WorkflowEditor.prototype as unknown as {
renderPorts: (
node: { id: string; type: string },
el: { appendChild: (port: { handle: string }) => void }
) => void;
}
).renderPorts;
const createPort = vi.fn((_nodeId: string, handle: string) => ({ handle }));
const appended: Array<{ handle: string }> = [];
const element = {
appendChild: (port: { handle: string }) => {
appended.push(port);
}
};

renderPorts.call(
{ createPort, getNodeHeaderPortTop: () => 24 },
{ id: 'node_start', type: 'start' },
element
);

expect(createPort).toHaveBeenCalledTimes(1);
expect(createPort).toHaveBeenCalledWith('node_start', 'output', 'port-out', 'Next step', 24);
expect(appended).toEqual([{ handle: 'output' }]);
});
});
11 changes: 3 additions & 8 deletions apps/web/src/app/workflow-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,6 @@ export class WorkflowEditor {
case 'approval':
return { prompt: 'Review and approve this step.', collapsed: true };
case 'start':
case 'end':
return { collapsed: true };
default:
return { collapsed: true };
Expand Down Expand Up @@ -1802,7 +1801,7 @@ export class WorkflowEditor {

if (!node.data) node.data = {};
if (node.data.collapsed === undefined) {
node.data.collapsed = node.type === 'start' || node.type === 'end';
node.data.collapsed = node.type === 'start';
}
const hasSettings = this.nodeHasSettings(node);
el.classList.toggle('expanded', !node.data.collapsed);
Expand Down Expand Up @@ -1954,7 +1953,6 @@ export class WorkflowEditor {
return `<span class="icon icon-robot icon-primary"></span>${escapeHtml(name)}`;
}
if (node.type === 'start') return '<span class="icon icon-lesson-introduction icon-primary"></span>Start';
if (node.type === 'end') return '<span class="icon icon-rectangle-2698 icon-primary"></span>End';
if (node.type === 'if') return '<span class="icon icon-path icon-primary"></span>Condition';
if (node.type === 'approval') return '<span class="icon icon-chermark-badge icon-primary"></span>User Approval';
return `<span class="icon icon-primary"></span>${node.type}`;
Expand Down Expand Up @@ -2313,13 +2311,11 @@ export class WorkflowEditor {
}

if (node.type !== 'start') {
const inputTooltip = node.type === 'end' ? 'End input' : 'Input';
const portIn = this.createPort(node.id, 'input', 'port-in', inputTooltip, this.getNodeHeaderPortTop(node));
const portIn = this.createPort(node.id, 'input', 'port-in', 'Input', this.getNodeHeaderPortTop(node));
el.appendChild(portIn);
}

if (node.type !== 'end') {
if (node.type === 'if') {
if (node.type === 'if') {
const conditions = this.getIfConditions(node);
if (this.shouldAggregateCollapsedIfPorts(node)) {
const aggregateConditionPort = this.createPort(
Expand Down Expand Up @@ -2399,7 +2395,6 @@ export class WorkflowEditor {
const outputTooltip = node.type === 'start' ? 'Next step' : 'Output';
el.appendChild(this.createPort(node.id, 'output', 'port-out', outputTooltip, this.getNodeHeaderPortTop(node)));
}
}
}

createPort(
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/data/help-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const helpContent = `

<section id="overview">
<h2>Overview</h2>
<p>The Agentic Workflow Builder lets you compose agent flows with Start, Agent, Condition, Approval, and End nodes. Drag nodes, connect them, configure prompts, and run against the server-side workflow engine.</p>
<p>The Agentic Workflow Builder lets you compose agent flows with Start, Agent, Condition, and Approval nodes. Drag nodes, connect them, configure prompts, and run against the server-side workflow engine.</p>
</section>

<section id="getting-started">
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type NodeType = 'start' | 'agent' | 'if' | 'approval' | 'end' | string;
export type NodeType = 'start' | 'agent' | 'if' | 'approval' | string;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

sed -n '1,40p' packages/types/src/index.ts

Repository: CodeSignal/learn_bespoke-agentic-workflow-builder

Length of output: 946


🏁 Script executed:

rg -nP "export\s+type\s+NodeType\s*=.*\|\s*string" packages/types/src/index.ts

Repository: CodeSignal/learn_bespoke-agentic-workflow-builder

Length of output: 165


🏁 Script executed:

rg -nP "type\s*===\s*'end'|type\s*===\s*'input'" packages/workflow-engine/src/index.ts

Repository: CodeSignal/learn_bespoke-agentic-workflow-builder

Length of output: 135


🏁 Script executed:

# Additional checks: see if 'end' type is referenced anywhere in the codebase
rg -n "'end'" packages/types/src/index.ts
rg -n "type.*end" packages/workflow-engine/src/ --max-count=10

Repository: CodeSignal/learn_bespoke-agentic-workflow-builder

Length of output: 75


🏁 Script executed:

# Search for 'end' node type usage more broadly
rg -n "'end'" packages/workflow-engine/src/ -A 2 -B 2

Repository: CodeSignal/learn_bespoke-agentic-workflow-builder

Length of output: 75


🏁 Script executed:

# Check the full index.ts file to see what types are actually exported or used for legacy handling
cat -n packages/types/src/index.ts

Repository: CodeSignal/learn_bespoke-agentic-workflow-builder

Length of output: 1967


🏁 Script executed:

# Search for 'input' and 'end' in all TypeScript files to understand legacy type handling
rg -n "type.*'input'|type.*'end'" packages/ -t ts --max-count=15

Repository: CodeSignal/learn_bespoke-agentic-workflow-builder

Length of output: 173


🏁 Script executed:

# Check context around line 265 to understand 'input' type handling
sed -n '260,270p' packages/workflow-engine/src/index.ts

Repository: CodeSignal/learn_bespoke-agentic-workflow-builder

Length of output: 389


🏁 Script executed:

# Search for all 'input' type references in engine
rg -n "type.*===.*'input'|'input'.*type|input.*node" packages/workflow-engine/src/index.ts -B 2 -A 2

Repository: CodeSignal/learn_bespoke-agentic-workflow-builder

Length of output: 294


🏁 Script executed:

# Check if there are any normalization or migration functions that handle legacy types
rg -n "normalize|legacy|migrate|'end'|'input'" packages/workflow-engine/src/index.ts | head -20

Repository: CodeSignal/learn_bespoke-agentic-workflow-builder

Length of output: 1031


Remove | string from NodeType to enforce strict type contracts at the package boundary.

Line 1 includes | string, which permits any string value (including 'end') to satisfy the type—undermining the type safety goal. While the engine has normalization logic that handles legacy 'input' types (converted to 'approval' in normalizeGraph), this conversion is a runtime concern, not a compile-time contract. The type definition should reflect the authoritative set of supported node types.

Suggested fix
-export type NodeType = 'start' | 'agent' | 'if' | 'approval' | string;
+export type NodeType = 'start' | 'agent' | 'if' | 'approval';

Legacy types ('input', 'end') should be handled at normalization boundaries (e.g., normalizeGraph), not through a permissive type contract.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export type NodeType = 'start' | 'agent' | 'if' | 'approval' | string;
export type NodeType = 'start' | 'agent' | 'if' | 'approval';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/types/src/index.ts` at line 1, Update the NodeType declaration to
remove the permissive "| string" union so the exported type is a closed set of
allowed literals (e.g., 'start' | 'agent' | 'if' | 'approval'), and ensure any
legacy types like 'input' or 'end' are converted inside normalization code
(e.g., normalizeGraph) rather than widened in the NodeType export; locate the
NodeType type in packages/types/src/index.ts and replace the current permissive
definition with the strict literal union so consumers get compile-time
guarantees.


export interface BaseNodeData {
collapsed?: boolean;
Expand Down
4 changes: 0 additions & 4 deletions packages/workflow-engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,6 @@ export class WorkflowEngine {
this.waitingForInput = true;
this.log(node.id, 'wait_input', 'Waiting for user approval');
return undefined;
case 'end':
return undefined;
default:
this.log(node.id, 'warn', `Unknown node type "${node.type}" skipped`);
}
Expand Down Expand Up @@ -456,8 +454,6 @@ export class WorkflowEngine {
return 'condition node';
case 'approval':
return 'approval node';
case 'end':
return 'end node';
default:
return `${node.type} node`;
}
Expand Down