nenjo-xml
Generic XML serialization and MiniJinja rendering used by Nenjo prompt and runtime-context assembly.
The crate deliberately has no knowledge of agent manifests, sessions, tasks,
or privileged template namespaces. Callers provide a flat
HashMap<String, String> when they need template rendering; dotted keys are
converted into nested MiniJinja access.
Template rendering
use HashMap;
use render_template;
let vars = from;
let rendered = render_template;
assert_eq!;
Available entry points include:
render_templatefor chainable-undefined rendering with fallback to the original template on syntax errors;try_render_templatefor fallible rendering;try_render_template_strictwhen undefined values must be rejected;render_template_with_named_templatesfor MiniJinja includes.
Auto-escaping is disabled because prompt fragments commonly contain XML.
Backslash-escaped Jinja delimiters, such as \{{ example }}, remain literal.
Nenjo's static prompt boundary
The XML crate accepts any caller-provided keys, but Nenjo's authored system prompts, developer prompts, and context blocks expose only:
- declared package arguments under
args.*; - resolved context-block selectors, including
context.*and package paths; - resolved knowledge indexes under
pkg.*,lib.*, orlocal.*.
Agent identity and live chat, task, project, routine, gate, Git, memory, artifact, and clock state are not template variables. The agent runtime emits those values as typed session or turn context and rejects their selectors in static prompts.
XML serialization
Serde-compatible values can be serialized directly:
use ;
use Serialize;
let profile = Profile ;
assert!;
assert!;
The crate also exports xml_escape, xml_unescape, render_items, and
metadata_json_to_xml. Parsing helpers for targeted XML inspection live under
nenjo_xml::xml::parse.