mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
ebad989855
Cross-cutting changes that don't belong with any one demo: manifest + landing-page tags, runtime route adjustments, e2e + QA notes that follow the demo renames, and a few small cleanups. Manifest (manifest.yaml + src/app/page.tsx tag labels): - Naming convention: every demo uses `Thing: Subthing` (Generative UI: Tool Rendering - Default / Custom Default / Specific; Open Generative UI: Default / Advanced; Shared State: Streaming / Read + Write; Reasoning: Default / Custom; Frontend Tools: In-App Actions / Async; Human in the Loop: In-chat / In-App / Interrupt based; Chat Customization: CSS / Slots; Headless UI: Simple / Complete). - Retags: Auth → `platform`; HITL Step Selection + Interrupt-based → `interactivity`; Reasoning Default + Custom → `chat-ui`; Generative UI: Tools → `generative-ui`. - Renames: Readonly State (Agent Context) → Frontend Context Sharing. - HITL slot points at /demos/hitl-in-chat (working useHumanInTheLoop+interrupt path) instead of the previous /demos/hitl that had no backend `interrupt()` calls. - Highlight paths corrected for the rebuilt headless demos (root-level paths replaced with hooks/, chat/, tools/, attachments/ subdirs). - Descriptions rewritten where they had drifted from the implementation (gen-ui-agent: dropped useCoAgentStateRender claim; headless-simple: shadcn primitives, not raw Tailwind; headless-complete: enumerates the actual hooks wired). Runtime / route: - src/app/api/copilotkit/route.ts — 30 agents registered (incl. the reasoning-custom rename from agentic-chat-reasoning). - copilotkit-mcp-apps/route.ts replaced with [[...slug]]/route.ts so v2 subpath POSTs (/v2/agent/run) resolve. - src/app/api/copilotkit-voice/[[...slug]]/route.ts — env var standardized (was `AGENT_URL || LANGGRAPH_DEPLOYMENT_URL`, now matches the rest of the showcase with just LANGGRAPH_DEPLOYMENT_URL); trailing `/` removed from deploymentUrl. Tests / QA: - e2e specs renamed and paths updated for the demo renames. - qa notes for a2ui-fixed-schema (booked-state checklist removed) and byoc-json-render (Wave 4a residue removed). - docs-links.json key renamed for reasoning-custom. Cleanup: - Removed remaining stub agent.py files in demo dirs (real graphs in src/agents/); removed dead beautiful-chat/components/headless-chat.tsx (zero importers); removed [A2UI-DEBUG] / [A2UI-RESPONSE] print statements from beautiful_chat.py; gpt-5.4-mini → gpt-5-mini typo fix in beautiful_chat.py:249 (would have 4xx'd every model call); stripped iframe-restriction LLM-prompt copy bleed from open-gen-ui-advanced suggestion titles. The convention pass that ran across ~28 demos earlier in this branch is already reflected in their per-demo commits — every page.tsx reads as imports + provider + suggestions hook + JSX, with `useConfigureSuggestions` extracted to a sibling suggestions.ts.
5.1 KiB
5.1 KiB
QA: Declarative Generative UI (A2UI — Fixed Schema) — LangGraph (Python)
Prerequisites
- Demo is deployed and accessible at
/demos/a2ui-fixed-schemaon the dashboard host - Agent backend is healthy;
OPENAI_API_KEYis set on Railway;LANGGRAPH_DEPLOYMENT_URLpoints at a LangGraph deployment exposing thea2ui_fixedgraph (registered as agent namea2ui-fixed-schema— seesrc/app/api/copilotkit-a2ui-fixed-schema/route.ts) - Note: the demo source contains no
data-testidattributes. Checks below rely on verbatim visible text, DOM structure, and the JSON schema atsrc/agents/a2ui_schemas/flight_schema.json
Test Steps
1. Basic Functionality
- Navigate to
/demos/a2ui-fixed-schema; verify the page renders within 3s and a singleCopilotChatpane is centered (max-width ~896px, rounded-2xl, full-height) - Verify the chat is wired to
runtimeUrl="/api/copilotkit-a2ui-fixed-schema"andagent="a2ui-fixed-schema"(DevTools → Network: sending a message hits that endpoint) - Verify the single suggestion pill is visible with verbatim title "Find SFO → JFK" (message body: "Find me a flight from SFO to JFK on United for $289.")
- Send "Hello" and verify an assistant text response appears within 10s (no flight card for plain text)
2. Feature-Specific Checks
Schema Wiring (fixed catalog + includeBasicCatalog)
- DevTools → Network: after the first successful
display_flightcall, verify the response stream contains ana2ui_operationscontainer withcatalogId: "copilotkit://flight-fixed-catalog"(matchesCATALOG_IDinsrc/agents/a2ui_fixed.pyandsrc/app/demos/a2ui-fixed-schema/a2ui/catalog.ts) - Verify the same container carries the full
FLIGHT_SCHEMAcomponent tree (12 nodes fromsrc/agents/a2ui_schemas/flight_schema.json:root,content,title,route,from,arrow,to,meta,airline,price,bookButton,bookButtonLabel)
Search-Flights Prompt (display_flight tool → flight_schema.json)
- Click the "Find SFO → JFK" suggestion; within 20s verify a single flight card renders in-transcript assembled per
flight_schema.json:- outer
Cardwith aColumnof children in this order: title row, route row, meta row, book button Titlenode renders the literal text "Flight Details" (1.15rem / 600 weight, color#010507)routerow showsAirport"SFO" →Arrow(→, color#AFAFB7) →Airport"JFK" (both monospaced, 1.5rem, 600 weight, 0.05em letter-spacing)metarow showsAirlineBadge"UNITED" (uppercase pill, lilac#BEC2FFborder, 0.08em tracking) on the left andPriceTag"$289" (monospaced, color#189370, 1.1rem / 600 weight) on the rightButtonrenders full-width with label "Book flight" (black#010507background, white text, 12px radius)
- outer
- Verify all four data-model fields resolved correctly (origin=
SFO, destination=JFK, airline=United, price=$289) — each is a{ path: "/..." }binding in the schema and must reach the DOM as a plain string via theGenericBinder(no literal{path}leak and no React error #31)
Book-Flight Button (inert — pure presentation)
- Verify the "Book flight" button is rendered with the schema-declared label and is clickable, but the click is a no-op: the agent is not invoked, no schema swap occurs, and the button does not transition to a "Booked" state. Schema-swap-on-action will be wired up once the Python SDK exposes
action_handlers=ona2ui.render(see comment insrc/agents/a2ui_fixed.py).
Follow-up Prompt (data-model refresh)
- Send "Find me a flight from LAX to ORD on Delta for $412."; within 20s verify the card updates in place with origin=
LAX, destination=ORD, airline=DELTA, price=$412(same schema, new data model — proves the fixed-schema pattern: schema once, data streams)
3. Error Handling
- Send an empty message; verify it is a no-op (no user bubble, no assistant response)
- Send "What is the capital of France?"; verify the agent replies in plain text without invoking
display_flight(no flight card rendered, noa2ui_operationsin the response) - DevTools → Console: walk through all flows above; verify no uncaught errors and specifically no React error #31 ("objects are not valid as a React child, found: object with keys {path}") — the
DynStringunion ina2ui/definitions.tsis what prevents this, so a single occurrence is a regression
Expected Results
- Chat loads within 3s; plain-text response within 10s; flight card renders within 20s of the search prompt
display_flightis called exactly once per search prompt; result contains ana2ui_operationscontainer withcatalogId: "copilotkit://flight-fixed-catalog"and the full 12-node flight schema- All custom renderers in
a2ui/renderers.tsx(Card,Title,Airport,Arrow,AirlineBadge,PriceTag,Button) render at least once per search-flights run - Clicking "Book flight" is a no-op (inert presentation button — see comment in
src/agents/a2ui_fixed.py) - No UI layout breaks, no
{path}leak into the DOM, no uncaught console errors