Skip to content

feat(cli): scaffold selected backend framework - #785

Open
vishxrad wants to merge 14 commits into
mainfrom
visharad/th-2051-route-replacement
Open

feat(cli): scaffold selected backend framework#785
vishxrad wants to merge 14 commits into
mainfrom
visharad/th-2051-route-replacement

Conversation

@vishxrad

@vishxrad vishxrad commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ask CLI users to choose the direct OpenAI SDK route, LangGraph, or Vercel AI SDK after selecting OpenUI Cloud or self-hosted
  • replace the selected backend route and, for self-hosted framework choices, select the matching frontend message format and stream adapter
  • use native LangGraph named-event SSE and native Vercel AI SDK UIMessage streaming instead of re-encoding either as OpenAI Chat Completions SSE
  • preserve LangGraph model-step ordering and ToolMessage results in the frontend adapter so multi-step history remains valid
  • keep OpenUI Cloud on the existing OpenAI Responses transport and frontend adapter so managed conversations and Cloud tools remain intact
  • add framework-native authoring and execution for app-owned function tools in the Cloud + LangGraph and Cloud + Vercel AI SDK variants
  • include get_weather as the app-owned diagnostic tool for every Cloud route and both self-hosted framework routes
  • prevent immediate dev-server startup when the required API key is missing and report the remediation in the CLI
  • remove staged route/page variants and stale dependency locks from generated projects
  • document the framework matrix and Cloud/provider boundary

Framework behavior

Self-hosted

  • none: OpenAI SDK Chat Completions route + OpenAI frontend adapter/message format
  • langgraph: inline StateGraph returns graph.stream(..., { encoding: "text/event-stream" }); the frontend uses langGraphAdapter() and langGraphMessageFormat
  • vercel-ai-sdk: streamText() returns toUIMessageStreamResponse(); the frontend lets the AI SDK decode its own SSE and maps the typed UIMessage chunks into Agent Interface events

The Vercel OSS scaffold consumes vercelAIAdapter() and vercelAIMessageFormat from @openuidev/react-headless through the @openuidev/react-ui public re-export. This PR carries the reviewed package implementation as a backup and requires @openuidev/react-headless ^0.9.6; publish headless 0.9.6 before publishing this CLI update.

OpenUI Cloud

OpenUI Cloud remains the model provider and conversation store for every Cloud variant. Artifact generation, web search, image search, and configured MCP tools continue to execute in Cloud.

Selecting LangGraph or Vercel AI SDK does not replace the OpenAI SDK Responses transport or configure a second model provider. It adds framework-native app tools on the user server; the route sends those function outputs back into the same stored Cloud conversation. No second persistence layer is required for the normal tool loop.

Choose the self-hosted template when using a user-owned model provider.

LangChain package note

@openuidev/langchain targets a separate LangGraph protocol-v2 server and requires an API URL, assistant ID, agent-side stream transformer, and a second process/deployment. The CLI self-hosted LangGraph option is an inline StateGraph inside the Next.js route, so adopting that package would require a separate scaffold topology rather than a route/page replacement.

Issue

TH-2051 — Ask for backend framework in CLI

Validation

  • merged and verified against current main (0 commits behind at push time)
  • pnpm --filter @openuidev/cli run ci
  • pnpm --filter @openuidev/cli build
  • pnpm --filter @openuidev/react-ui run build
  • all 152 React Headless tests, including focused Vercel AI SDK and LangGraph tool-order integration coverage
  • scaffolded all Cloud/self-hosted × none/LangGraph/Vercel AI SDK combinations and verified option directories are removed
  • packed local @openuidev/react-headless@0.9.6, installed it into fresh generated LangGraph and Vercel OSS apps, and completed both Next.js production builds
  • installed, type-checked, linted, and production-built fresh generated self-hosted LangGraph and Vercel AI SDK apps
  • verified native LangGraph SSE is consumed end-to-end by langGraphAdapter()
  • verified the Vercel AI SDK parser maps native text/tool chunks and tool history correctly
  • ran both generated OSS routes against a real provider: each called Open-Meteo, returned structured weather data, and completed the second model step
  • parsed both real streams through their packaged frontend adapters and verified exact tool arguments, tool results, and final OpenUI text
  • previously installed, type-checked, and production-built both generated Cloud framework variants
  • verified missing-key immediate starts exit before spawning Next

@vishxrad
vishxrad marked this pull request as ready for review July 16, 2026 14:56
@vishxrad
vishxrad force-pushed the visharad/th-2051-route-replacement branch from 92faf00 to dcbc7d3 Compare August 4, 2026 10:04
…e-replacement

# Conflicts:
#	packages/openui-cli/src/templates/openui-cloud/package-lock.json
#	packages/openui-cli/src/templates/openui-self-hosted/package-lock.json
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openui-docs Ready Ready Preview Aug 5, 2026 7:34pm

Request Review

@abhithesys abhithesys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use adapters on frontend for message transformation and framework native streaming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants