burr icon indicating copy to clipboard operation
burr copied to clipboard

feat: add visual builder + workspace mode to Burr UI

Open andreahlert opened this issue 8 months ago • 7 comments

Building on #667 (Graph Builder by @skrawcz), this adds a workspace mode and significantly enhanced builder that turns Burr's UI into a development environment.

What's new

Visual Builder (enhanced)

  • 9 node types: Action, Input, Result, LLM Call, API Call, Code, Streaming, Loop, Router
  • Each type has specialized property editors (LLM: provider/model, API: url/method, Code: inline editor, Router: branch conditions)
  • Inline + button on edges (Activepieces-style) with searchable type picker
  • Recursive layout algorithm (replaces dagre) supporting loop arcs and router fan-out/fan-in
  • Node type picker with search bar and categories (I/O, Logic, Integrations)

Monaco Editor (split view)

  • Builder canvas on the left, VS Code-style editor on the right
  • Multi-file code generation: actions.py, app.py, run.py, requirements.txt
  • File explorer sidebar with tabs (open/close files)
  • Bidirectional sync: edit code and the graph updates, edit graph and the code updates
  • Full Ctrl+C/V/Z support in both canvas and editor

Project save/load

  • File menu (New, Save, Open, Download .py)
  • Projects persisted server-side in ~/.burr/builder_projects/
  • Ctrl+S to save

Workspace integration

  • Backend workspace router with file browsing, code viewing, and script execution (SSE streaming)
  • Link workspace directories to projects
  • Path traversal protection with workspace validation

Other improvements

  • Undo/redo with 50-state history
  • Keyboard shortcuts (Delete to remove nodes, Ctrl+C/V to copy/paste nodes)
  • Code generation includes proper imports, sanitized identifiers, and with_tracker()

Screenshots

Builder with nodes and generated code 02-builder-with-nodes

Node editor with LLM Call configuration 03-builder-node-editor

Searchable node type picker 04-builder-picker

Technical details

Backend (Python)

  • burr/tracking/server/workspace.py: new APIRouter with endpoints for file tree, file content, script execution (SSE), process management, workspace links, and builder project persistence
  • Modified run.py to mount workspace router, schema.py to add supports_workspace

Frontend (~6,700 new lines)

  • utils/: builderTypes, codeGenerator (9 node types + multi-file), codeParser (bidirectional sync), flowLayout (recursive layout), treeUtils (immutable tree ops), stateFlow
  • hooks/useBuilderState.ts: tree-based state with undo/redo, keyboard shortcuts, save/load
  • builder/: BuilderView (split layout), BuilderGraph (ReactFlow with custom node/edge types), NodeEditor, NodeTypePicker (portal-based), 4 node components, 5 edge components with inline + buttons
  • workspace/: FileExplorer, CodeViewer, RunTerminal, WorkspaceSelector
  • project/: ProjectWorkspaceView, ActivityBar, SidePanel, TabBar, TrackingSidePanel

Dependencies added

  • @monaco-editor/react (MIT)
  • @tanstack/react-query (MIT)
  • @xyflow/react (MIT)
  • react-joyride (MIT)

All MIT license, ASF Category A compatible.

How I tested

  • npx tsc --noEmit zero errors
  • Backend endpoints tested with curl
  • Manual E2E: create flow, add nodes via toolbar and inline +, edit properties, see code update, save/load projects

Checklist

  • [x] PR has an informative and human-readable title
  • [x] Changes are limited to a single goal
  • [x] Code passed the pre-commit check
  • [x] New functions are documented
  • [x] Placeholder code is flagged / future TODOs are captured in comments

andreahlert avatar Mar 23 '26 05:03 andreahlert

@andreahlert I can't get this to run locally -- did you commit everything? otherwise see the CI failures.

skrawcz avatar Mar 28 '26 06:03 skrawcz

Also need some example to load to help someone get started.

skrawcz avatar Mar 28 '26 06:03 skrawcz

Thanks for reviewing. Didn't have the time to check it properly, I'll do it as soon as possible. Target: 03-30-2026

andreahlert avatar Mar 28 '26 12:03 andreahlert

Thanks for trying it out. Two things:

  1. Missing pieces: This PR is meant to be applied on top of #667 (your graph builder). On main alone, the builder route works but some of the other UI improvements (HomeView, SearchView, etc.) won't be there. The builder itself at /builder should load fine since all its deps are self-contained. I'll add a note about this in the PR description.

  2. Example graphs: Good call. I'll add a few pre-loaded examples (chatbot flow, data pipeline, agent with tools) that load from the File > Open menu so someone can see the builder in action without building from scratch.

Working on both now.

andreahlert avatar Mar 28 '26 20:03 andreahlert

Screenshot 2026-03-29 at 09 25 22 Screenshot 2026-03-29 at 09 25 26

validated things load locally at least.

skrawcz avatar Mar 29 '26 16:03 skrawcz

All review feedback addressed. Rebased clean on main, no conflicts.

@JiwaniZakir your three points: cleanup_processes() is wrapped in try/finally now so backend shutdown always runs, supports_workspace is derived from workspace.is_available() instead of hardcoded, and _read_links() has an in-process cache with invalidation on write.

@skrawcz docstrings on every function/class in workspace.py, including the inner ones. Examples were already in from the graph-builder merge.

@elijahbenizzy opened #735 to track the node type implementations as a follow-up. Agreed it's fine for the initial merge.

Ready for re-review whenever you get a chance.

andreahlert avatar Apr 09 '26 14:04 andreahlert

This PR has been inactive for 17 days after receiving review feedback. Converting to draft.

Please mark it as ready for review when you have addressed the comments. If no activity occurs within 90 days, it will be closed automatically.

github-actions[bot] avatar Apr 27 '26 09:04 github-actions[bot]