@nano-ui-kit/a2ui-retrieval
v0.0.1
Published
A2UI retrieval — pattern search, catalog + taxonomy navigation, intent classification, clarity assessment, anti-pattern detection, prompt analysis, feedback/gap stores. The primitive layer every A2UI generator needs; pairs with @nano-ui-kit/a2ui-corpus an
Maintainers
Readme
@nano-ui-kit/a2ui-retrieval
A2UI retrieval primitives — pattern search, catalog + taxonomy navigation, intent classification, clarity assessment, anti-pattern detection, prompt analysis, and the feedback / gap stores. The layer every A2UI generator needs; opinionated on what "A2UI" means but generator-agnostic beyond that.
Pairs with:
@nano-ui-kit/a2ui-corpus— the data it reads@nano-ui-kit/a2ui-utils— the component registry@nano-ui-kit/a2ui-validator— shape + catalog validation
Install
npm install @nano-ui-kit/a2ui-retrieval \
@nano-ui-kit/a2ui-corpus \
@nano-ui-kit/a2ui-utilsWhat's inside
Catalog + taxonomy
getCatalog(),getComponent(type),getComponentsByCategory(cat)— load and navigate the full NanoUI component registry.classifyIntent(q),getDomain(name),getAllDomains()— domain router.getTraits(),getTraitsByCategory(cat)— trait catalog.
Pattern library
getAllPatterns(),getPattern(name),searchPatterns(q, opts)— hand-authored reference patterns. Keyword-ranked.semanticSearchPatterns(q, { llmAdapter })— embedding-ranked.registerPattern(p)— runtime add; used by pattern-export and training ingestion.getComponentData(type)— per-component a2ui metadata.
Intent processing
isConversational(q)— gate on purely chatty inputs.assessClarity(q)— ambiguity / missing-signal detection.decomposeIntent(q),composeSubtasks(subtasks)— multi-part intents.analyzePrompt(q)— concept + signature extraction.
Validation + feedback
checkAllAntiPatterns(messages)— anti-pattern detector.checkIntentAlignment(intent, messages)— coverage + drift check.feedbackStore.record(...)+.analyze()— thumbs-up/down corpus.loadGaps(),addGap(...)— gap registry.
Wiring
getWiringCatalog()— handlers, actions, controllers available for compose-layer event wiring.
Use outside the compose pipeline
Anyone building their own A2UI generator can use this directly:
import { classifyIntent, searchPatterns, assembleContext } from '@nano-ui-kit/a2ui-retrieval';
const intent = 'pricing table with three tiers';
const domain = classifyIntent(intent); // → 'layout'
const hits = searchPatterns(intent, { domain, limit: 5 });
const context = await assembleContext(intent, { patterns: hits });
// hand `context` to your own LLM call, emit A2UI.The data this reads (patterns, compositions, fragments, component
schemas) comes from @nano-ui-kit/a2ui-corpus. No hand-wiring required.
Development / design notes
- Node + browser: filesystem paths are Node-only; the Vite-flavored globs cover the browser build.
- State: the
feedback/andgaps/stores are file-backed at@nano-ui-kit/a2ui-corpus/{feedback,gaps}/— local-session state, not shipped with the corpus tarball.
License
MIT © Kim Granlund
