Expand description
§turul-ai-catalog-tui
Terminal view over a resolved AI Catalog tree, built on ratatui.
The crate renders a ResolvedCatalog (from turul-ai-catalog-client) as a scrollable tree of
entries with a detail pane for the selected one. Every string that comes from a document, a
report or a URL is drawn as DisplayText, and an entry’s data is shown only as the text of its
canonical JSON, whatever the entry type is.
Enter on an entry opens its artifact through a function the caller supplies, and the view shows
the retrieved text, again as DisplayText, with how it compares with the entry’s digest and
who, if anyone, signed it. JSON is laid out one member per line with long strings shortened; r
shows the exact text. Esc returns to the list. The crate fetches nothing itself.
The crate has no feature flags.
§Example
use turul_ai_catalog_client::ResolvedCatalog;
use turul_ai_catalog_tui::Opened;
fn show(catalog: ResolvedCatalog) -> Result<(), turul_ai_catalog_tui::RunError> {
// Fails with `RunError::NotATerminal` unless stdin and stdout are both terminals.
// This caller does not retrieve artifacts, so Enter shows why.
turul_ai_catalog_tui::run(catalog, |_, _| {
Opened::Failed("this viewer does not retrieve artifacts".into())
})
}Part of turul-agent-card, a Rust implementation of the AI Catalog specification.
§Licence
Apache-2.0.
Structs§
- View
State - Holds the selection over every entry row of the tree, in the order
renderdraws them, and the artifact shown in place of the list, if any.
Enums§
- Action
- What the session does after a key press.
- Integrity
- How an opened artifact’s bytes compare with its entry’s
digest. - Opened
- The result of opening an entry’s artifact.
- RunError
- Describes why a terminal session did not run or failed.
- Signature
- What the entry’s trust manifests came to when the artifact was opened.
Functions§
- render
- Draws the whole tree and the selected entry’s detail into
frame, or, while an artifact is shown, that artifact: the entry’s identifier andurl, how it compares with the digest, and its text. - run
- Shows the catalog until a quit key, then restores the terminal. On Enter,
openretrieves the selected entry’s artifact and its result is shown until Esc.