Add @openuidev/vue-lang — Vue 3 runtime adapter#402
Open
dc-riskhub wants to merge 2 commits intothesysdev:mainfrom
Open
Add @openuidev/vue-lang — Vue 3 runtime adapter#402dc-riskhub wants to merge 2 commits intothesysdev:mainfrom
dc-riskhub wants to merge 2 commits intothesysdev:mainfrom
Conversation
Follows the same pattern as svelte-lang: thin adapter over lang-core with Vue-specific type narrowing, provide/inject context, and a recursive Renderer component. - Vue 3.5+ with Composition API and <script setup> - ComponentRenderProps narrowed to VNode - Renderer.vue: parses OpenUI Lang, manages form state, renders tree - RenderNode.vue: dynamic <component :is> with onErrorCaptured boundary - Context via provide/inject with typed InjectionKey symbols - 8 composables: useOpenUI, useTriggerAction, useIsStreaming, etc. - Form validation via reactive() (mirrors svelte-lang's $state) - 30 tests (library, renderer, validation) — all passing - Vite library mode build (6.27 kB)
Open
Full chat example mirroring svelte-chat with Vue 3.5 + Composition API: - Nuxt 3 app with Nitro server (SSR disabled, client-only SPA) - Vercel AI SDK v6: Chat class from @ai-sdk/vue, streamText on server - 5 OpenUI components: TextContent, Button, Card, Stack, Chart (Chart.js) - Library definition with Zod schemas, same structure as svelte-chat - API route: /api/chat with tool support (weather, stocks, calc, search) - System prompt generated via scripts/generate-prompt.mjs (uses jiti) - Welcome screen with conversation starters - Streaming message display with tool call indicators - Auto-scroll on new messages Setup: copy .env.example to .env, add OPENAI_API_KEY, start with nuxt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@openuidev/vue-langpackage — Vue 3.5+ runtime adapter for OpenUI, following the identical pattern established bysvelte-langvue-chatexample — full Nuxt 3 chat app with Vercel AI SDK, mirroringsvelte-chat@openuidev/vue-lang— Runtime Adapterlibrary.tsComponentRenderPropstoVNode, wrapscoreDefineComponent/coreCreateLibraryRenderer.vueh()RenderNode.vue<component :is>withonErrorCapturederror boundarycontext.tsprovide/injectwith typedInjectionKeysymbols, 8 composablesvalidation.tsreactive()(mirrors svelte-lang's$state)index.tsvue-chat— Example AppFull Nuxt 3 chat application using the Vercel AI SDK (
@ai-sdk/vueChat class +streamText):/api/chat):streamTextwith tool support (weather, stocks, calculator, web search)scripts/generate-prompt.mjsArchitecture
Same pipeline as
svelte-chat:Chat.sendMessage()(Vercel AI SDK)streamText().toUIMessageStreamResponse()AssistantMessageextracts text contentRendererfromvue-langparses OpenUI Lang → renders Vue component treetriggerAction→BuiltinActionType.ContinueConversationPipeline parity with react-lang and svelte-lang
createParser(library.toJSONSchema())fromlang-corelibrary.components[typeName]→ passprops+renderNodegetFieldValue/setFieldValue/triggerActiononAction,onStateUpdate,onParseResultTest plan
vue-lang
pnpm --filter @openuidev/vue-lang build— Vite library mode (6.27 kB)pnpm --filter @openuidev/vue-lang test— Vitest with jsdomvue-chat
pnpm installclean in monorepo contextOPENAI_API_KEYin.env)