Add immutable namespace views

This commit is contained in:
2026-10-17 06:14:09 +00:00
parent 60c58260ec
commit aa54b8d1c4
8 changed files with 347 additions and 2 deletions

View File

@@ -63,6 +63,33 @@ new engine to observe configuration edits. See the [constructor GoDoc](../../eng
for the exact public contract and the [framework format reference](../formats.md)
for definition fields.
### Use Scoped Engine Views
Create a view when an application wants short request IDs to resolve within a
selected collection:
```go
scoped, err := engine.WithNamespaces(promptkit.Namespaces{
Prompt: "support",
Profile: "support",
})
if err != nil { return err }
prepared, err := scoped.Prepare(ctx, promptkit.RunRequest{
PromptID: "answer",
ProfileID: "concise",
})
```
Ordinary execution and preparation qualify slashless caller selections with
their respective namespace. Already-qualified IDs pass through unchanged;
configured defaults and references are not rewritten. Each call replaces the
view's scope defaults, including clearing a scope with an empty field, without
changing the receiver or rebuilding its captured configuration and execution
collaborators. Namespace syntax is checked when creating the view; resource
existence is checked when selected. See [`WithNamespaces`](../../namespaces.go)
for the exact public contract.
## Supply Embedded Application Defaults
Use `FilesystemInputs` for embedded defaults and `DirectoryInputs` for an