Correct prompt definition selection and decoding

This commit is contained in:
2026-08-11 22:11:39 +00:00
parent a718762da1
commit 25f1ba0b30
4 changed files with 435 additions and 129 deletions

View File

@@ -9,9 +9,10 @@ explains how to select these sources and invoke the engine. The
owns the resulting outbound wire behavior.
Prompt and profile sources recursively discover files ending in `.yaml` or
`.yml`. YAML decoding is strict: unknown fields are errors for the selected
definition. Definitions are selected by their YAML `id`, not their file name
or directory.
`.yml`. Each prompt-definition file contains exactly one YAML document;
comments and trailing whitespace are allowed. YAML decoding is strict: unknown
fields are errors for the selected definition. Definitions are selected by
their YAML `id`, not their file name or directory.
## Prompt Definitions

View File

@@ -12,9 +12,12 @@ validation modes, built-in catalog, and source precedence.
## Prompt Definitions
`internal/promptdef` discovers YAML deterministically, decodes and validates
definitions, selects an ID and optional version, and resolves file-backed
message content through an explicit source-root abstraction. Operating-system
`internal/promptdef` discovers YAML deterministically, requires one strictly
decoded document per file, and scans normalized ID and version metadata before
validating the selected definition. It retains the point-in-time metadata scan
needed for duplicate detection while opening file-backed message content only
for one exact selected candidate. Content resolution uses an explicit
source-root abstraction. Operating-system
sources enforce containment against canonical roots and targets so symlinks
cannot escape. Injected `fs.FS` sources enforce containment in their clean
relative path namespace. A single-file source uses the selected prompt file's