Web Server¶
basemode-loom includes a FastAPI server for headless use or building custom frontends.
Starting the server¶
Or from Python:
import uvicorn
from basemode_loom import GenerationStore
from basemode_loom.api import create_app
store = GenerationStore()
app = create_app(store)
uvicorn.run(app, host="127.0.0.1", port=8000)
REST API¶
List trees¶
Returns a list of all root nodes as JSON objects.
Create a root¶
Delete a tree¶
Get full tree¶
Returns {"nodes": [...]} with all nodes in the tree.
Get tree stats¶
Returns the same stats as basemode-loom stats.
WebSocket API¶
For live interactive sessions, connect to the WebSocket endpoint:
The WebSocket handler manages a full LoomSession. On connection, send an init message to specify which tree to open:
The server then streams state updates and generation events back to the client as JSON. Navigation and generation commands are sent as messages to the server.
This is the same session interface used internally by the TUI, so any command that works in the TUI is available over WebSocket.