Engine server

Drive the TessaFab engine from your own front end with JSON-RPC 2.0 over standard input and output.

The desktop app doesn’t pattern anything itself: it runs the engine as a separate process and talks to it. You can do the same to build your own front end, a batch tool or an integration.

tessafab-engine serve          # the open source engine (crates/server)
tessafab-engine --version

The engine speaks JSON-RPC 2.0, one JSON message per line on standard input and output. Logs go to standard error. It keeps the sliced files parsed in memory, so changing the pattern or settings and generating again doesn’t re-read them.

→ {"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}
← {"jsonrpc": "2.0", "id": 1, "result": {"version": "0.1.0", "protocol": 2, "engine": "rust"}}
→ {"jsonrpc": "2.0", "id": 2, "method": "open", "params": {"paths": ["/models/tiles.gcode.3mf"]}}
← {"jsonrpc": "2.0", "method": "progress", "params": {"id": 2, "fraction": 0.5, "message": "…"}}
← {"jsonrpc": "2.0", "id": 2, "result": {…}}

Requests run one at a time. While a long call runs, the engine sends progress notifications, and still answers ping and cancel.

Methods

Method Params Does
initialize libraryDir? Start; optionally where the user’s patterns are. Returns the version and protocol.
open paths Open sliced files as a new session.
replaceInputs paths Swap re-exported files in, keeping the project.
describe The open files: plates, pieces, surfaces, filaments, slicer settings.
toolpaths input, plate, layerFrom?, layerTo? A plate’s toolpaths for drawing.
setProject project, base? Replace the project (JSON).
loadProject / saveProject path Read or write a .tessafab.json.
assemblyStatus, defaultPlacements The assembly’s state; a starting placement.
exportLayout path Write the assembly as a layout SVG.
patterns Every pattern: provided, yours, from packs.
patternInfo, patternGeometry, patternSource pattern (and directions?) One pattern’s details, tiles or drawing.
patternStarter, patternPreview source, form, values?… For a pattern editor.
savePattern, deletePattern, importPattern, exportPattern Manage your patterns.
savePreset, renamePreset, deletePreset patternId, … Manage presets.
packs, importPack, exportPack, removePack Pattern packs.
targets What it can export (G-code; Pro adds layered SVG).
generate target? Make the result for the current project.
checkResult target? The checks shown before export.
export target?, paths Write the result.
assembledToolpaths, assembledSolid The result in its assembled places, for 3D views.
thumbnail path, plate? A sliced file’s thumbnail.
projectSummary path A saved project at a glance.
edition (or licence) The edition and its limits.
ping, cancel, shutdown Liveness, stop the running call, quit.

The Pro engine (tessafab-engine-pro serve, in the app) also reads image patterns (importImage), imports layouts (importLayout), adds the layered SVG target, and answers licence with the real licence.

Errors

Code Meaning
-32700 Parse error
-32600 Invalid request
-32601 Unknown method
-32602 Bad params
-32000 Engine error: the message is meant for the user
-32001 Cancelled
-32603 Internal error

The protocol is described at the top of crates/engine/src/rpc.rs, and how the engine is put together in docs/engine.md.