Skip to content
cdrakePublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

NeuroFlow

NeuroFlow is a Tauri application and Rust/WASM orchestration core for schema-first neuroimaging pipelines. It consumes NeuroFlow workflow, tool, and heuristic documents extracted from the NiiVue Desktop workflow model and turns them into an operator workspace for validating, diagramming, and eventually running pipelines.

Source Lineage

  • Specification source: ../neuroflow-spec
  • Workflow source model: niivue/niivue/packages/niivue-desktop/workflows
  • Diagramming model: NiiVue Desktop WorkflowDiagramView, BlockPalette, and workflow draft utilities
  • UI direction: follow the BIDSvue app (the bidsui project, not yet public) as the shared BIDS application language. Since BIDSvue is SvelteKit, NeuroFlow mirrors its theme tokens and shell conventions in React rather than importing components directly.

Repository Shape

  • src/: React/Vite app shell hosted by Tauri.
  • src/components/WorkflowDiagram.tsx: graph view ported from the NiiVue Desktop diagramming concepts.
  • src/domain/: TypeScript workflow types, graph helpers, and validation bridge.
  • crates/neuroflow-core/: Rust workflow validation and planning core.
  • crates/neuroflow-wasm/: WASM bindings around the Rust core.
  • crates/neuroflow-mcp/: MCP server that exposes the registry to AI agents and runs script tools (RFC 0009); see its README.
  • src-tauri/: Tauri native host and commands.
  • fixtures/: source-derived NeuroFlow examples.
  • gallery/: schema-valid tool and workflow documents plus the launcher scripts they run (Neurodesk web apps, native CLIs such as dcm2niix and niimath, Python and MATLAB/Octave tools, and an app's headless entry point such as BIDSvue's import); see its README.
  • demos/prompt-to-workflow/: a headless agent composes, validates and runs a workflow from a user prompt through the MCP server, with the recorded run.
  • docs/: architecture and source-lineage notes.

Development

npm install
npm run dev

Run the Tauri shell:

npm run tauri:dev

Build the Rust/WASM package:

npm run wasm:build

The build remaps host paths out of the binary, so the same rustc, wasm-bindgen and wasm-opt versions give byte-identical src/wasm/ output on any machine.

Run Rust checks:

cargo check --workspace

Run the tests:

npm run validate:gallery   # gallery documents against the spec schemas
npm run test:gallery       # gallery adapters and check_tool.mjs
npm run test:ui            # builder domain tests (tests/ui)
cargo test --workspace
(cd crates/neuroflow-conformance && cargo test)   # core vs the spec schemas

Pipeline builder

npm run tauri:dev opens the desktop builder. It is the NiiVue Desktop workflow canvas (block palette, React Flow diagram, step inspector) pointed at this repository's gallery and runtime:

  • Library lists gallery/workflows/*.neuroflow.json; Tools lists every gallery/tools/*.tool.json, grouped by its niivue/ui block category (Import, Ingest, Processing, Quality, Inspect, Output) with the design's category colors. A fit badge marks tools whose required inputs can be fed from the selected (or last) step's outputs; drag or click to add a step.
  • Environment runs an up-front check on launch and on demand: it resolves every interpreter the tools declare, probes each tool through gallery/scripts/check_tool.mjs (the same executable, version and package rules the adapters apply at launch) and lists anything that needs the user to act, with the fix, before any run. Those tools carry a setup badge in the palette and on the canvas. Interactive apps (BIDSvue, NeuroVue) are ready when their command is on PATH and their checkout is found; otherwise they show as setup with what to install or clone. An app's headless entry point (App CLI in the palette, e.g. bidsvue-ingest) is a headless tool like any other: ready when the app checkout, its entry file and the runner (bun) are found and the app's own check (BIDSvue's --check, which covers dcm2niix) passes. Registry and data roots, the sessions root and interpreter overrides are editable there.
  • Run takes the workflow's declared inputs (persisted per workflow), explains why a run is blocked (validation issue, missing input, tool needing setup), then executes the document in-process on the neuroflow-mcp runtime. Progress, per-step status, outputs with Open (reveals the file), the run folder, the provenance record and, on failure, the step's stderr tail are shown as they arrive. Cancel stops the current step's process tree and records the run as cancelled.

In a plain browser (npm run dev) the same UI works as an editor with a simulated run; nothing is probed or executed.

Registries adds tools and workflows at run time without rebuilding the builder. It can load a published bundle with a neuroflow-registry.json index (?registry=<url>, or URL), a folder picked from disk, or, on the desktop, the registry folders it runs from. Import JSON and Export JSON carry workflows between the hosted builder and the desktop app. See docs/registry-bundles.md, which walks through publishing the Neurodesk web apps' generated tools.

Runs land under ~/.neuroflow/runs/<run-id>/ (run.json, run.provenance.json, outputs/<step>/, logs/<step>/), the same layout the MCP server writes.

Current Status

The desktop builder edits and runs the gallery workflows end to end on this machine through the Rust/Tauri boundary (src-tauri/src/host.rs, backed by the neuroflow-mcp library crate). Interactive uiApp steps launch their declared command in a configured checkout (NEUROFLOW_UI_APP_<APP>, or by default the tool's repo directory next to the NeuroFlow checkout, e.g. ../neurovue) and wait for the app to finish its session contract. The Run panel can cancel an active local run; the runtime terminates the current step's whole process tree (each step runs in its own process group) and writes a cancelled session record. Remote hosts are not wired yet.

License

Licensed under either of the Apache License, Version 2.0 or the MIT license, at your option. Contributions are accepted under the same terms.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages