Path: redb-route/redb.Route.Llm/Engine/PromptRef.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Llm/Engine/PromptRef.cs ---- using redb.Route.Abstractions; using redb.Route.Llm.Engine.Storage; namespace redb.Route.Llm.Engine; /// /// Resolver for prompt references used by ?initialBodyRef= and /// ?systemPromptRef= URI parameters. /// /// Convention (matches the framework-wide #name registry-ref pattern /// already used by Kafka/S3/Firebase connection-factory refs in redb.Route): /// /// /// null / empty → null /// #name → lookup name in (latest version), /// then fall back to as a plain string. /// anything else → returned verbatim as a literal prompt /// /// A #name ref that does not resolve in either registry returns null — /// callers decide whether to substitute an empty string or surface an error. /// internal static class PromptRef { public static async ValueTask ResolveAsync( string? raw, IPromptTemplateRegistry? templates, IRouteContext? context, IExchange? exchange, CancellationToken ct) { if (string.IsNullOrEmpty(raw)) return null; if (raw[0] != '#') return raw; var name = raw[1..]; if (name.Length == 0) return null; if (templates is not null) { var tmpl = await templates.GetAsync(name, version: null, exchange, ct).ConfigureAwait(false); if (tmpl is not null) return tmpl.Body; } return context?.GetFromRegistry(name); } }