Add opt-in PromptKit namespaces

This commit is contained in:
2026-11-07 04:23:39 +00:00
parent 8e5e64c6e9
commit 644e6c365b
12 changed files with 353 additions and 32 deletions

View File

@@ -555,6 +555,25 @@ performs a network probe. See the [PromptKit resource inspection contracts](http
A missing ID is a usage error; native lookup errors and cancellation retain
supported cause identity.
### Resource namespace selection
An application can enable resource namespace flags with `ckprompt.WithNamespaces`
and provide prompt, profile, and backend defaults. Omitted flags retain those
defaults; an explicitly empty value clears the corresponding default. Qualified
resource IDs pass through unchanged. Without the option, the application loader
controls the engine view and these flags are unavailable.
| Operation | Available namespace flags |
| --- | --- |
| `show prompt` | `--llm-prompt-namespace` |
| `show profile` | `--llm-profile-namespace` |
| `show backend` | `--llm-backend-namespace` |
| `requirements show` | `--llm-prompt-namespace`, `--llm-profile-namespace` |
| `requirements validate`, `show prepared`, `test` | All three, including `--llm-backend-namespace` |
Catalog namespace filters remain separate; configuration inspection has no
resource namespace selectors.
## PromptKit prepared-request preview
When `Suite.PrepareRequest` is present, `ckprompt.Command(suite)` installs
@@ -601,9 +620,12 @@ The command accepts:
The `promptkit` namespace identifies the operation, so there is no built-in
`--scope` flag. An explicitly empty profile or session value retains PromptKit's
native empty-string meaning. Requirements inspection does not require a profile
to be execution-ready. See the
[PromptKit v0.18.0 consumer guide](https://forge.maximumdirect.net/base-layer/promptkit/src/commit/d9f6aad30509e538fc73ea16710df3a3ec084502/docs/consumers/pkg-promptkit.md)
native empty-string meaning. Profile selection establishes the reported profile
identity rather than changing the discovered requirements. An enabled profile
namespace qualifies an explicitly supplied short profile ID; it does not rewrite
the prompt's stored default reference. Requirements inspection does not require
the selected profile to be execution-ready. See the
[PromptKit v0.20.0 consumer guide](https://forge.maximumdirect.net/base-layer/promptkit/src/commit/8ff9aa3efdc9f16b9d2729e0a29ea083eb3c3eaf/docs/consumers/pkg-promptkit.md)
for native configuration, selection, and requirements behavior. The built-in
flags other than `--llm-var` are singleton bindings; when repeated, the last value
is used. Suite selectors retain their declared binding behavior.

View File

@@ -339,6 +339,12 @@ same canonical request flags into their own input types. Each collection exposes
individual handles and an `All` method, so a command can choose its applicable
subset. The application decides how to apply the resulting values to its request.
`ckprompt.WithNamespaces` enables standard resource namespace selection from
application-supplied defaults. Loaders used with this option should leave view
selection to the adapter. Without it, a loader can supply its own engine view.
Direct callbacks receive the composed selection in their request. The
[CLI reference](../cli.md#resource-namespace-selection) lists applicable flags.
Catalog, named definition inspection, and requirements discovery do not render
messages or load request artifacts. Concrete request validation follows native
PromptKit preparation, which can resolve prompt/profile resources, load

View File

@@ -1,6 +1,6 @@
# Shared reporting and PromptKit v0.20.0 implementation plan
Status: implementation in progress; Stages 1–11 complete.
Status: implementation in progress; Stages 1–12 complete.
## Scope, authority, and execution
@@ -433,6 +433,11 @@ native result rather than asserting PromptKit's rendering algorithm.
## Stage 12: Opt-in namespace composition
**Complete.** Opt-in namespace defaults and applicable selectors reach custom
callbacks and native engine views. The root, ckconfig, and ckprompt workspace
suites passed with Go 1.27.0; focused tests cover default composition, clearing,
applicability, loader views, and native error identity.
Add `WithNamespaces(suite, promptkit.Namespaces) Suite` and store explicit
application defaults in an optional suite field. Add `Namespaces
*promptkit.Namespaces` to applicable ckprompt request envelopes, including