Adopt native PromptKit resource inspection

This commit is contained in:
2026-11-07 04:05:51 +00:00
parent 6c35da3ab6
commit 5ff0dd4ea2
12 changed files with 313 additions and 385 deletions

View File

@@ -528,72 +528,32 @@ output.
## PromptKit definition inspection
Applications can install prompt and profile inspection independently with
`ckprompt.Command(suite)`. The `ckprompt.FromEngine(loadEngine)` adapter
supplies these callbacks alongside native requirements discovery and the five
catalogs. Its loader receives invocation context, configuration selection,
typed input, and shared state. Direct suite callbacks retain their own
implementation and lifecycle.
Prompt inspection uses an ID only. The prompt format and native selection
behavior remain owned by
[PromptKit v0.18.0](https://forge.maximumdirect.net/base-layer/promptkit/src/commit/d9f6aad30509e538fc73ea16710df3a3ec084502/docs/consumers/pkg-promptkit.md).
Applications can install prompt, profile, and backend inspection independently
with `ckprompt.Command(suite)`. `ckprompt.FromEngine(loadEngine)` supplies these
callbacks alongside requirements discovery and the five catalogs. Its loader
receives invocation context, configuration selection, typed input, and shared
state. Direct callbacks retain their own lifecycle.
```text
example promptkit show prompt customer/summary --format yaml
example promptkit show prompt customer/summary
example promptkit show profile customer-support --format yaml
example promptkit show profile customer-support --format json
example promptkit show backend local --format yaml
```
Both commands require one ID operand and accept `--config`, `--overlay`, and
`--format text|yaml` (default `text`). These commands have no built-in
`--scope` selection; their namespace is `promptkit`.
Each command takes one resource ID and accepts `--config` and `--overlay`.
Reports use the native PromptKit inspection value through the shared reporting
formats; automatic and explicit text use YAML for these structured values. Native
JSON field names and omission rules apply. Absent optional fields are omitted;
explicit zero values and empty collections remain present. Prompt messages are
captured content, not rendered requests, and the prompt hash is opaque.
Prompt YAML preserves native input order. The prompt hash is an opaque
owning-library equality value.
```yaml
prompt_id: customer/summary
prompt_hash: opaque-value
default_profile_id: customer-support
inputs:
- name: topic
required: true
content_type: text/plain
description: Topic to summarize
output_contract:
format: json
validation_mode: basic
schema_path: ""
repair_attempts: 2
```
Profile YAML preserves the effective values reported by PromptKit, including
zero values and nested provider parameters. `api_key_env` is only an
environment-variable name. `api_key_required` reports a direct credential
requirement; neither field reports credential availability. A nil provider
parameter map is displayed as `{}`.
```yaml
profile_id: customer-support
effective_model_params:
backend_id: local
endpoint: https://example.invalid/v1
model: support-model
temperature: 0
max_tokens: 0
top_p: 0
timeout_seconds: 600
service_tier: ""
reasoning_effort: ""
api_key_env: ""
extra_params: {}
api_key_required: true
```
Text uses labeled fields and includes nested `extra_params` values. A missing ID
is a usage error. Definition selection reaches the owning inspection API and
preserves supported error identity and cancellation.
Profile reports describe the selected profile before backend completion or
request overrides. Backend reports describe configured backend fields. An
`api_key_env` value names an environment variable; it is not a credential
value or a claim that one is available. Neither report resolves references or
performs a network probe. See the [PromptKit resource inspection contracts](https://forge.maximumdirect.net/base-layer/promptkit/src/commit/8ff9aa3efdc9f16b9d2729e0a29ea083eb3c3eaf/resource_inspection.go).
A missing ID is a usage error; native lookup errors and cancellation retain
supported cause identity.
## PromptKit requirements

View File

@@ -258,12 +258,12 @@ engine's captured configuration. Add that scope to a `ckconfig.Suite` to expose
it under `config` with validate/show/sources/explain and native diff operations;
it does not install PromptKit catalog, definition, or requirements commands.
`ckprompt.FromEngine(loadEngine)` supplies eight callbacks: prompt, profile,
backend, namespace, and collection catalogs; named prompt and profile
`ckprompt.FromEngine(loadEngine)` supplies nine callbacks: prompt, profile,
backend, namespace, and collection catalogs; named prompt, profile, and backend
inspection; and native requirements discovery. Concrete request validation and
smoke testing are separate capabilities, added explicitly with
`ckprompt.WithRequestValidation` and `ckprompt.WithSmokeTesting`. The suite has
ten independently optional callbacks in total. `ckprompt.Command(suite)` creates
eleven independently optional callbacks in total. `ckprompt.Command(suite)` creates
only operations whose callbacks are present; discovery, validation, and smoke
testing can be installed independently. A composed suite can enable both
additional operations:
@@ -300,7 +300,7 @@ absent, so explicitly supplied empty values stay meaningful. Applications that
validate and then execute a request are encouraged to share their request
construction logic between those paths.
The eight catalog and inspection callbacks and the two explicit additions are
The nine catalog and inspection callbacks and the two explicit additions are
independently optional. For catalogs without named or requirements inspection,
narrow the suite before command capture:
@@ -308,6 +308,7 @@ narrow the suite before command capture:
definitions := ckprompt.FromEngine(loadEngine)
definitions.InspectPrompt = nil
definitions.InspectProfile = nil
definitions.InspectBackend = nil
definitions.InspectRequirements = nil
definitionCommand := ckprompt.Command(definitions)
```

View File

@@ -1,6 +1,6 @@
# Shared reporting and PromptKit v0.20.0 implementation plan
Status: implementation in progress; Stages 1–7 complete.
Status: implementation in progress; Stages 1–8 complete.
## Scope, authority, and execution
@@ -287,6 +287,14 @@ policy wording as behavior changes. Do not add domain comparison tests.
## Stage 8: Adopt PromptKit v0.20.0 and native resource inspection
**Complete.** ckprompt selects released PromptKit v0.20.0 at commit
`8ff9aa3efdc9f16b9d2729e0a29ea083eb3c3eaf` with verified module sums and
updated attribution. Native prompt, profile, and backend inspection tests,
including format, callback, error, and cancellation cases, passed with Go
1.27.0. Root and ckconfig workspace suites also passed. The full ckprompt suite
still encounters the remaining local format bindings scheduled for Stage 9;
those bindings are not part of the completed inspection migration.
Update ckprompt's PromptKit requirement and authentic sums to v0.20.0; keep
ConfigKit v1.1.0 and existing Go minima. Review the released notices and update
[module attribution](../../integrations/ckprompt/docs/oss/attribution.md) and