Carry optional prompt labels through results

This commit is contained in:
2026-10-17 05:54:32 +00:00
parent 8cbb7c0daf
commit ec3245c97e
40 changed files with 363 additions and 121 deletions

View File

@@ -7,10 +7,11 @@ import (
// PromptIdentity identifies one prompt ID and its optional descriptive version
// label in the effective configuration captured when an Engine is constructed.
// It has no stable JSON representation.
// A nil Version means no label was declared; a non-nil empty string is an
// explicit label. It has no stable JSON representation.
type PromptIdentity struct {
ID string
Version string
Version *string
}
// ListProfiles returns profile IDs in the effective configuration captured
@@ -38,8 +39,8 @@ func (e *Engine) ListProfiles(ctx context.Context) ([]string, error) {
// ListPrompts returns every prompt ID in the effective configuration captured
// when the engine was constructed, sorted lexically by ID. Each identity may
// include its descriptive version label. The
// returned slice is caller-owned and safe to mutate while the engine is used
// include its descriptive version label. The returned slice and each Version
// pointer are caller-owned and safe to mutate while the engine is used
// concurrently. Empty inventories succeed.
//
// Listing reports membership, not execution readiness. It does not reload
@@ -58,7 +59,7 @@ func (e *Engine) ListPrompts(ctx context.Context) ([]PromptIdentity, error) {
}
public := make([]PromptIdentity, len(identities))
for i, identity := range identities {
public[i] = PromptIdentity{ID: identity.ID, Version: identity.Version}
public[i] = PromptIdentity{ID: identity.ID, Version: copyStringPtr(identity.Version)}
}
if err := ctx.Err(); err != nil {
return nil, mapPublicError(err)