/** Prompt instructions for interactive reply blocks, generated once from the shared catalog. */ import { createLibrary, defineComponent } from '@openuidev/lang-core'; import { GENUI_COMPONENTS, GENUI_EXAMPLES, GENUI_GROUPS, GENUI_PREAMBLE, GENUI_ROOT, GENUI_RULES } from '../../shared/genui.ts'; let cached: string | null = null; export function genUiPrompt(): string { if (cached === null) { const library = createLibrary({ root: GENUI_ROOT, components: GENUI_COMPONENTS.map((c) => defineComponent({ ...c, component: null as never })), componentGroups: GENUI_GROUPS, }); cached = `\n\n${library.prompt({ preamble: GENUI_PREAMBLE, additionalRules: GENUI_RULES, examples: GENUI_EXAMPLES, bindings: true })}`; } return cached; }