Skip to main content

Module template_hub

Module template_hub 

Source
Expand description

Template Hub - a browsable catalog of downloadable flow templates.

The Model Hub (crate::hub) browses + downloads AI-model artifacts; the Template Hub is its analog for flow templates. The catalog is a checked-in JSON file ([template_catalog.json]) shaped as an API-response envelope { "apiVersion": "1", "templates": [ … ] } - a proof-of-concept of the future cloud template registry, exactly mirroring the Model Hub’s hub_catalog.json. Each entry embeds the full FlowGraph; “downloading” an entry copies that graph into the local template store (~/.flow-studio/templates/), after which it shows up in the top-bar Load modal like any other saved template.

Editing the JSON is all it takes to add/remove templates - no Rust changes, and no product-specific templates hardcoded in the codebase.

Structs§

HubInstalledStatus
Where a hub template currently lives in the local store, plus what version was last installed. None when nothing matches.
TemplateHubEntry
Browse metadata for a hub template (no embedded graph - that’s resolved on install). Serialized to the frontend with camelCase keys.
TemplateHubEntryWithStatus
One hub entry + install status. The update_available flag is pre-computed server-side so the frontend doesn’t need to parse versions.

Functions§

add_to_collection
Install a catalog entry into a user-chosen collection.
catalog
Browse list: catalog entries mapped to display metadata (+ node/edge counts from the embedded graph).
catalog_with_status
Annotate the catalog with per-entry install status. A template counts as installed when either:
update_installed
Overwrite an installed hub template in place with the catalog’s current graph, bumping hub_version. When force is false and the user has edited the file (mtime > installed_at), returns a Refused error so the frontend can prompt the user before clobbering local edits.