mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2026-02-04 03:30:32 -07:00
3.6 KiB
3.6 KiB
Flow Editor and Nodes
Back to Docs Index | Index (HTML)
Purpose
Document the Borealis visual flow editor (React Flow) and how nodes are defined, grouped, and rendered.
Core UI Components
Data/Engine/web-interface/src/Flow_Editor/Flow_Editor.jsx- canvas, drag/drop, edge editing, context menus.Data/Engine/web-interface/src/Flow_Editor/Node_Sidebar.jsx- node catalog and drag source.Data/Engine/web-interface/src/Flow_Editor/Node_Configuration_Sidebar.jsx- per-node configuration UI.Data/Engine/web-interface/src/Flow_Editor/Context_Menu_Sidebar.jsx- right-click actions.
Node Registration Pipeline
- Node modules are auto-loaded in
Data/Engine/web-interface/src/App.jsxvia:import.meta.glob('./Nodes/**/*.jsx', { eager: true }). - Each module default-exports a descriptor object that includes:
type(unique node type string)component(React component)- metadata like
name,category,description,config,usage_documentation
App.jsxbuilds:nodeTypes(type -> component)categorizedNodes(category -> list of descriptors)
Node Categories (Current Folder Layout)
AgentAlertingData Analysis & ManipulationData CollectionFlow ControlGeneral PurposeImage ProcessingOrganizationReportingTemplates
Scheduling Flow Usage
Data/Engine/web-interface/src/Scheduling/Create_Job.jsxuses React Flow for job status and dependency visualization.
API Endpoints
None. This is a UI-only domain.
Related Documentation
Codex Agent (Detailed)
How node modules are structured
- A node file exports a descriptor object, for example:
type: "agent"component: BorealisAgentNodeconfig: [{ key, label, type, defaultValue, optionsKey, ... }]
- The
componentis the React Flow node UI. - The descriptor is used by the sidebar for display and configuration forms.
Adding a new node (step-by-step)
- Create a new file under
Data/Engine/web-interface/src/nodes/<Category>/Node_<Name>.jsx. - Export a descriptor object as the default export with
typeandcomponentfields. - Include
configentries if you want the configuration sidebar to render fields. - Rebuild the WebUI (or run Vite dev mode) so
import.meta.globpicks it up. - Validate drag/drop in the Node Sidebar and ensure the node renders correctly.
Sidebar behavior
Node_Sidebar.jsxrenderscategorizedNodesand setsdataTransferpayloads withapplication/reactflow.Flow_Editor.jsxlistens for drop events and creates nodes from the descriptor catalog.
Node configuration sidebar
Node_Configuration_Sidebar.jsxusesuseReactFlow().setNodesto update node data.configmetadata drives form rendering; data is stored innode.data.
Canvas interactions
- Right-click context menus allow node delete, edge unlink, and property edit.
- Snap guides are computed in
Flow_Editor.jsxfor alignment.
Job flow editor
Scheduling/Create_Job.jsxuses a custom React Flow setup for status and dependency visualization.- Keep job flow nodes separate from the general node catalog to avoid accidental crossover.
Common gotchas
- Folder path casing is
src/nodes/in the repo, butApp.jsximports./Nodes/(Windows is case-insensitive). - Ensure each node descriptor has a unique
typeor React Flow will mis-render. - If the sidebar does not show the new node, verify the export default object has
typeandcomponent.