Request a run
koharu-pipeline takes a request: a target, a set of stages, and optionally settings for that run only. The app’s buttons, the canvas, and the agent all start runs this way.
- A request that can’t run fails at once: no stages, detection on blocks, a stage other than inpainting on an area, or a page or block the project doesn’t hold.
- What a run reports is kept in order as it happens, the last event saying how it ended, so a caller that looks late still sees everything.
- Each run is traced: a span from its queuing to its end, under whatever asked for it, and one for each page stage while it runs.
- Only a stage knows its models. Each writes its result for a page as one undo step labelled with the stage’s name.
Ask for a frame
koharu-renderer turns a page of the open session into an immutable frame, cheap to share, and draws it with vello on the GPU. Besides pixels, a frame answers what each layer drew: its bounds, whether it shows, a text’s resolved layout, its masks merged into one, and its pixels alone, as PSD export needs them.
Text size, line breaks, and placement are worked out at every render and nowhere else. Code that needs them, such as placement measuring a page’s size, asks the renderer rather than computing its own.
The canvas, PNG and PSD export, thumbnails, and the pipeline’s painted areas draw through the same
painter on the same GPU, so every output matches what the editor shows.
Present in the window
The window draws three layers on its own surface: the native canvas, then the React interface, then any popup the interface opens, such as an open<select>. CEF renders the interface off-screen and hands over each paint as a GPU texture where the GPU can take it, or copied through memory otherwise. The page shows wherever the interface is transparent.
The pointer goes to the canvas where the interface painted nothing over it and to the interface everywhere else. Keys go to the side a press last landed on: after a press on the canvas, to the canvas first and on to the interface when the canvas doesn’t take the key. koharu-canvas turns the pointer into gestures, previews them in an overlay, and answers edits that the desktop applies like any other writer’s.
Inspect the desktop result
Debug builds expose CEF’s DevTools protocol athttp://127.0.0.1:4000, in a browser profile of their own. Use it to inspect and drive the interface. A CDP screenshot shows only the interface, so capture the composited window, canvas included, with the debug build’s capture command.
Design and sources: the koharu-pipeline, koharu-renderer, and koharu-desktop READMEs.