Add an @openuidev/copilotkit adapter for OpenUI tool rendering

Aperta
#1,100 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@vishxrad ci sta già lavorando.

Dal 30/8/2026.

  • #1102 di @vishxrad — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
react, typescript

Direzione di ricerca

Start by comparing the existing @openuidev/assistant-ui integration with the proposed package under packages/copilotkit, and check CopilotKit v2 APIs from @copilotkit/react-core/v2. The issue outlines the required tool flows, rendering, replay behavior, tests, docs, and example, but does not name specific files or tests. Done means the package and example meet the listed validation cases and package checks; linked PR #1102 is already open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Is your feature request related to a problem? Please describe.

CopilotKit applications already own the chat shell, conversation state, AG-UI transport, and tool lifecycle. There is no first-party OpenUI adapter for rendering streamed OpenUI Lang inside CopilotKit tool calls. Applications must currently register tools, inject the OpenUI component instructions, map streaming status, handle human input, and restore submitted form state themselves.

This is different from using OpenUI's AG-UI adapter with AgentInterface. In this case CopilotKit remains the host shell and OpenUI renders generated interfaces inside its tool-call extension points.

Describe the solution you'd like

Add a focused @openuidev/copilotkit package under packages/copilotkit, modeled on the existing @openuidev/assistant-ui integration.

Proposed behavior:

  • Register present_openui through CopilotKit v2 useFrontendTool for display-only UI, with followUp: false.
  • Register prompt_openui through useHumanInTheLoop for forms and choices that pause until the user responds.
  • Render partial streamed ui arguments with OpenUI Renderer and openuiChatLibrary.
  • Generate model instructions from the same OpenUI library used by the renderer.
  • Return @ToAssistant action context, parameters, form name, and form state through CopilotKit's tool result flow.
  • Restore submitted form state when completed tool calls are replayed from conversation history.
  • Apply an OpenUI ThemeProvider by default, with an opt-out for applications that already own the theme boundary.
  • Support custom libraries, prompt options, tool names, renderer options, and error handling.
  • Add focused unit and renderer tests, package documentation, API reference documentation, and a small runnable CopilotKit example for browser validation.

The adapter would target CopilotKit v2 from @copilotkit/react-core/v2. The current published @copilotkit/react-core version is 1.69.3.

Division of responsibility:

  • CopilotKit owns the chat shell, agent connection, messages, tool execution, and continuation.
  • OpenUI owns the generated UI language, streaming parser, component library, rendering, interaction state, and action payloads.

Describe alternatives you've considered

  1. Document an app-local integration only. This leaves every application to duplicate status mapping, prompt generation, action serialization, and replay behavior.
  2. Add CopilotKit directly to @openuidev/react-ui. This would make an optional chat shell a dependency or peer of the main React UI package.
  3. Use OpenUI AgentInterface with the AG-UI adapter. That is useful when OpenUI owns the shell, but it does not address applications where CopilotKit must remain the shell.

A separate adapter package keeps the host-specific dependency isolated and matches the existing assistant-ui package boundary.

Additional context

Proposed interaction path:

CopilotKit chat -> model tool call -> streamed OpenUI Lang -> OpenUI Renderer
CopilotKit chat <- next model turn <- tool result <- follow-up or form action

Planned validation includes:

  • display-only chart rendering with no raw OpenUI Lang visible;
  • a FollowUpBlock item producing exactly one new CopilotKit turn;
  • a validated form submission carrying distinctive form values into exactly one new turn;
  • streamed partial arguments, parser error handling, theme application, and replayed form state;
  • package typecheck, tests, lint, build, publint, and package export checks.

If this package boundary and scope are acceptable, I can implement it on a linked branch and open a pull request after approval.

Lingua principale
TypeScript
Stelle
10k
Fork
698
Merge medio
1g 6h
PR unite (30g)
158

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di thesysdev/openui

Tutte le issue di thesysdev/openui

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.