Add built-in profile repository wiring

This commit is contained in:
2026-07-04 16:48:18 +00:00
parent 712c6b92b8
commit 32e2433628
34 changed files with 581 additions and 64 deletions

View File

@@ -10,7 +10,8 @@ This document describes implemented adapter/repository boundaries and their curr
- `internal/adapter/http`: HTTP request/response mapping for `POST /v1/runs`.
- root package `scriptorium`: public Go library facade for preparing and running prompt requests.
- `internal/promptdef`: filesystem prompt-definition repository.
- `internal/profile`: filesystem execution-profile repository.
- `internal/profile`: filesystem, `fs.FS`, and overlay execution-profile repositories.
- `internal/profile/builtin`: embedded built-in execution-profile repository.
- `internal/artifact`: input artifact reader.
- `internal/prompt`: Go-template renderer.
- `internal/llm`: OpenAI-compatible LLM client implementation.
@@ -43,6 +44,13 @@ Filesystem repositories:
- Input: prompt/profile YAML files under configured directories.
- Output: normalized domain definitions/profiles or typed errors.
Profile repository composition:
- Built-in profiles are embedded and loaded through the same profile validation rules as filesystem profiles.
- When no custom profile directory is configured, the runner receives the built-in profile repository.
- When a custom profile directory is configured, the runner receives an overlay repository with custom profiles as primary and built-ins as fallback.
- Overlay lookup falls back only after custom profile-not-found errors; custom load/validation/raw-key errors are returned directly.
Artifact reader:
- Input: `domain.ArtifactRef`.
@@ -69,7 +77,7 @@ Validator:
Primary app settings consumed by adapters:
- `prompt_dir`
- `profile_dir`
- `profile_dir` (optional custom profile source)
- `schema_dir`
- `server.addr`
- `defaults.render_format`
@@ -94,6 +102,7 @@ Strict decoding and input checks:
- prompt/profile repositories scan nested subdirectories recursively.
- prompt/profile lookup uses YAML `id` values; subdirectory paths are organizational only.
- duplicate prompt/profile IDs are invalid and fail instead of using first-match behavior.
- duplicate profile IDs across custom and built-in sources are allowed; the custom source overrides the built-in profile.
- HTTP DTO decoder rejects unknown JSON fields.
- raw API key payload fields are rejected by strict decoding in profile/http paths.