.NET API
InstructionParameterBinder
Tracon.Core.dllSubstitutes {{name}} placeholders in an instructions text with
concrete values.
public static class InstructionParameterBinderInheritance
Section titled “Inheritance”object ← InstructionParameterBinder
Inherited Members
Section titled “Inherited Members”object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”This is value substitution only, not a template engine.
There is no expression, condition, loop, or field access
({{a.b}}) - deliberately: a template language is a security surface
once it is in the library, and every consumer eventually wants their own dialect.
Substitution is single-pass. Regex.Replace
scans the original text once; the text a match is replaced with is never
re-scanned for further placeholders. A value that itself contains
{{name}} is therefore inserted literally, not substituted again -
this is what keeps binding from recursing.
JSON-safe escaping is context-aware, not unconditional. A
placeholder written as a full JSON string value in the template - that is,
immediately preceded and followed by a " character, as in
"{{customer}}" - has its value JSON-escaped (quote, backslash,
control characters) so the produced text stays valid JSON. A placeholder
anywhere else in the text is substituted as-is: escaping it unconditionally
would litter plain-text instructions with stray backslashes.
Methods
Section titled “Methods”Bind(string?, IReadOnlyList<AgentParameter>, IReadOnlyDictionary<string, string>?)
Section titled “ Bind(string?, IReadOnlyList<AgentParameter>, IReadOnlyDictionary<string, string>?)”Substitutes every placeholder in instructions with a concrete value.
public static string? Bind(string? instructions, IReadOnlyList<AgentParameter> schema, IReadOnlyDictionary<string, string>? values)Parameters
Section titled “Parameters”instructions string?
The template text. null or empty is returned unchanged.
schema IReadOnlyList<AgentParameter>
The parameter schema the placeholders must be declared in.
values IReadOnlyDictionary<string, string>?
The values supplied for this run. A schema entry missing from this dictionary falls back to its AgentParameter.DefaultValue, then to an empty string.
Returns
Section titled “Returns”The text with every declared placeholder substituted.
Remarks
Section titled “Remarks”A placeholder whose name is not declared in
schema is left untouched, literal braces and all -
this method never fails. AgentParameterValidator is what
rejects an undeclared placeholder, and it runs at compile time, before
a value is ever bound.
Exceptions
Section titled “Exceptions”schema is null.