defuss-shadcn / Application / Scaffolds / scaffold-workflow-studio
Workflow Studio
A workflow studio as a clickdummy - "Loom" for a team that wires its automations as graphs, the way n8n and ComfyUI do. Six apps are drawn as workflows you can change and run: an AI agent crew that answers a customer from prompts and two data sources, a route planner that asks its traffic service twice, a 3D scene built in three.js from a scene graph with shader and animation subworkflows, an order-to-cash process that hands typed business objects from step to step, and a neural network whose 973 weights and biases were written by hand to compute A + B, A − B, A × B and A ÷ B for A and B from 0 to 100, and the BDI-II form logic - all 21 items with their options and every scoring rule. The tree on the left finds any node; Follow flies the editor to it. Part of the Application Scaffolds.
On this page (2)
§Workflow studio
Pick an app on the left, then Run (or press R in the editor; with Auto-run pressed every change runs it again): the dashes show the data moving, the connection labels say what went through, the Preview shows the result. Click a prompt, a script, the weights or the order to edit it in a window or a wizard. Type in the navigator's filter and pick a node: with Follow on, the editor flies to it; a click on a card opens its way in the tree. Every edit lands in History - click a row to step the workflow back to it - and every edit and run in Events. The language switch is in the toolbar.
§How it works
A page, not a component: it composes the library and keeps its own glue in one script - the six apps' node types, connection types, documents and previews.
- One editor, six documents. Each app registers its node types with
df$.shadcn.workflow.register('global', ...)and its connection types withregisterEdge(); a route (#/agents,#/algorithm,#/scene,#/process,#/neural,#/bdi) loads its document. An edited document is kept while another app is open. - Custom editing. Prompts, the Dijkstra code, the stops and the network's weights open in a Window (
edit()resolves the new value; JSON that does not parse keeps the window open). The order opens a three-step Dialog wizard that folds the answers into one Order object. The guardrail's blocked words are edited by the page itself:editor: 'external'firesworkflow-field-edit, the page cancels it and writes withsetField(). - Custom labels and values.
renderLabelputs a flame or an ice cube on the temperature, turns the traffic hour red in a rush hour, a credit limit red when it is tight;renderdraws an order as a table, the stops as badges, a block's weights as a heat map and the readout as a matrix. - Custom connections. Every port type has a connection type: a message counts its tokens, a batch of documents its size, an Order its id and total, a tensor its shape and how many units fired. Motion and live traffic connections move; a run moves dashes into the node that is working.
- The Nodes panel. The palette outlet lists the open app's node types by category -
data-workflow-typeson the outlet names them, since every app registers its types for the whole page. A click adds a node in the middle of the view, a drag drops it where you let go. - Room on the canvas. A connection label sits halfway along its line, else further along it or just beside it, where it covers neither a card nor another label, and hides while there is no such place; far off, each card keeps its title readable. Each card is as high as its content after the first run. Below 1600 px of width the History starts folded to its tab, so the editor keeps its room.
- The navigator.
tree()feeds a Data Tree with every group, node and subworkflow node; a pick callsreveal()- with Follow pressed the editor flies there - and a click on a card opens the one way to it in the tree (data-exclusive,reveal()). - Auto-run. With Auto-run pressed in the toolbar, a change to what runs - a value, a node, a connection, an undo or a step in the history - runs the workflow again half a second after the last change; a run still going is cancelled first. Moving a card or changing a label runs nothing.
- The history. The sidebar right of the editor lists every change of the level on screen, oldest first, from
history(): the current one marked, the undone ones struck through. A row, Back or Forward callstravel(), which undoes or redoes one change at a time until the workflow stands at that change; a new edit drops the changes after it, as undo does. Each subworkflow level keeps its own history. - Events.
workflow-change,workflow-field-change,workflow-field-edit,workflow-select,workflow-run,workflow-node-stateandworkflow-navigateall land in the Events panel;workflow-node-statealso collects the outputs the Preview draws. - The 3D scene. three.js 0.180.0 loads from jsDelivr when the scene app first runs. The Render node draws one still frame for its card; the Preview plays the scene - the motion subworkflow spins and bobs the meshes, the shader subworkflow becomes a
ShaderMaterial(noise and a fresnel rim). Reduced motion shows one still frame. - The neural calculator. A ReLU network whose 973 weights and biases are written by a small program, not trained. A step - is x at least k? - is two ReLUs and exact on whole numbers; with it the network takes A apart into bits, multiplies by gating B with each bit, divides by restoring long division (plus two decimals), picks the op's result with a gate, and turns the magnitude into decimal digits. The digits leave through seven readout matrices of 10 rows each, plus sign and ÷ 0. Check all runs every A, B and op - 40,804 inputs - through the weights as they stand in the editor: change one and see what breaks.
- The BDI-II form logic. Each of the 21 items is a node with its options - 0 to 3, and for sleep (item 16) and appetite (item 18) also the letter that says more or less. Every rule is a node of its own after them: the sum, missing answers (prorated up to a limit you set, else the score stops as incomplete), the severity band (0 - 13 minimal, 14 - 19 mild, 20 - 28 moderate, 29 - 63 severe; the cut-offs open as JSON), the item 9 check that flags any thought of suicide for a clinician, and the direction notes. The nodes carry the item names and short anchors of our own: the statements themselves are copyrighted by Pearson, and a licensed form pastes them in. A screening score, never a diagnosis.
- The agents are stand-ins. The classifier, researcher, critic and writer are deterministic functions shaped like model calls (a prompt, a model, a temperature, streamed progress), and the knowledge base, the order API, the traffic service and the credit bureau answer from data in the page - so the demo runs offline and the same way every time.
Comments, ideas or improvements? Edit this page's source on GitHub