Add namespace and collection inventories

This commit is contained in:
2026-10-17 06:25:14 +00:00
parent c9b623b374
commit 8669294cf6
9 changed files with 295 additions and 3 deletions

View File

@@ -97,6 +97,8 @@ type identityInventory interface {
ListBackends(context.Context) ([]string, error)
ListProfiles(context.Context) ([]string, error)
ListPrompts(context.Context) ([]domain.PromptIdentity, error)
ListNamespaces(context.Context, []string) ([]string, error)
ListCollections(context.Context) ([]configuration.CollectionIdentity, error)
}
// ListingFilterMode selects namespace membership for one identity listing.
@@ -277,6 +279,21 @@ func (e *Engine) ListPrompts(ctx context.Context, filters ...ListingFilter) ([]d
return filtered, nil
}
func (e *Engine) ListNamespaces(ctx context.Context, kinds []string) ([]string, error) {
for _, kind := range kinds {
switch kind {
case "prompt", "profile", "backend":
default:
return nil, fmt.Errorf("%w: unknown resource kind %q", usecase.ErrInvalidRequest, kind)
}
}
return e.listing.ListNamespaces(ctx, kinds)
}
func (e *Engine) ListCollections(ctx context.Context) ([]configuration.CollectionIdentity, error) {
return e.listing.ListCollections(ctx)
}
func filterIdentityList(
ctx context.Context,
filters []ListingFilter,