Commit Graph

647 Commits

Author SHA1 Message Date
Alem Tuzlak 846a8a8938 test(showcase): add hitl-in-chat regression spec for Alice 1:1 suggestion
Pins the contract that the new full-sentence aimock fixture pair beats
the broad `userMessage: "Alice"` matcher:

1. Sending the suggestion `"Schedule a 1:1 with Alice next week to
   review Q2 goals."` renders `[data-testid="time-picker-card"]`,
   not the Tokyo greeting. The test explicitly asserts the Tokyo
   greeting is absent — `toHaveCount(0)` against
   `/Nice to meet you, Alice/i` — so any future broad-match
   regression fails here loudly.
2. Clicking a slot transitions to `[data-testid="time-picker-picked"]`
   and the assistant follow-up message contains "Booked ... Alice",
   verifying the `hasToolResult: true` branch of the fixture pair
   also wires through.
2026-05-01 12:17:24 +02:00
Alem Tuzlak e79cac1208 fix(showcase): unblock gen-ui-agent recursion + drop deepagents wrapper
Verified end-to-end against a local langgraph-python stack: agent now
walks plan → step1 in_progress → step1 completed → ... → final summary,
and the frontend renders a single inline progress card that updates in
place all the way to "All 3 steps complete".

Two real changes pulled out from the verification round:

1. agent.py: drop the `deepagents.create_deep_agent` wrapper for the
   plain `langchain.agents.create_agent` ReAct loop. The deepagents
   planner / sub-agent / write_todos middleware ate enough supersteps
   per turn that the run regularly tripped LangGraph's recursion
   limit before the agent could publish all three step transitions.
   The plain ReAct loop is one superstep per LLM/tool call, and
   `state_schema=GenUiAgentState` is supported directly so the
   middleware-only state-extension hack is gone.

2. route.ts: bake `recursion_limit: 100` into every LangGraphAgent
   via `assistantConfig`. `with_config({"recursion_limit": ...})` on
   the compiled Python graph does NOT propagate when the graph is
   served via the langgraph runs API — the wrapper is invisible to
   the assistant config the server hands to Pregel, which then falls
   through to langchain_core's hard-coded default of 25. Setting
   `assistantConfig.recursion_limit` on the JS side makes the limit
   travel with every run kicked off through this route, regardless
   of what the Python graph thinks its config is.
2026-05-01 11:47:40 +02:00
Alem Tuzlak 0fcf904978 fix(showcase): switch langgraph-python gen-ui-agent to v2 useAgent
The langgraph-python gen-ui-agent demo was the only one of 18
integrations using the V1 `useCoAgentStateRender` hook. That hook
binds renders to messages via per-message claims, so each
state-changing tool call (each `set_steps` invocation) produced its
own card snapshot in the chat — a typical 3-step plan run pushed
~7+ stacked cards instead of one updating card.

Migrate the page to the canonical V2 pattern already used by every
other gen-ui-agent demo (mastra, strands, ag2, agno, crewai-crews,
langgraph-typescript, pydantic-ai, ...): subscribe to live state via
`useAgent` and render a single `InlineAgentStateCard` inside
`messageView.children`. The card now re-renders in place as state
streams — no per-message claims, no duplicates.

Also tighten the agent system prompt with an explicit numbered tool
sequence (1 plan + 6 transitions + final message) to make the
"step 3 stuck in_progress" tail-of-run failure less likely with
gpt-4o-mini. The UI is robust to a missed final transition either
way: when `agent.isRunning` flips to false, the card headlines
"All N steps complete" regardless of step.status.

Replace the stale e2e spec (which targeted a long-removed
`task-progress` test id) with one that pins the contract:
- exactly one `agent-state-card` rendered, even after the run
  finishes
- every `agent-step` ends in `data-status="completed"`
2026-05-01 11:11:17 +02:00
github-actions[bot] 374b85bec4 style: auto-fix formatting 2026-05-01 08:06:25 +00:00
Jordan Ritter 1a64cd7539 fix(showcase): add mount method to _FakeFastAPI in strands test stub
The strands agent_server.py now calls app.mount() to attach the voice
sub-app. The test's _FakeFastAPI stub needed the mount method added.
2026-05-01 01:04:18 -07:00
Jordan Ritter bba219102b style(showcase): format voice route files 2026-05-01 00:55:03 -07:00
Jordan Ritter e89107f8e3 fix(showcase): add voice agent backends and audio assets
- Add dedicated tool-free voice agents for strands, llamaindex,
  ms-agent-python (aimock returns tool calls when tools are registered,
  which the adapters don't loop on)
- Add sample_agent alias to langgraph-typescript langgraph.json
  (was only in dev-mode config)
- Add SampleAudioButton and voice route to google-adk
- Add sample.wav to agno, ms-agent-dotnet, ms-agent-python, google-adk
2026-05-01 00:52:30 -07:00
Jordan Ritter 6e35b71135 fix(showcase): port 9 voice routes from V1 to V2 multi-route handler
V1 CopilotRuntime in single-route mode rejects multipart/form-data
with 415 Unsupported Media Type. Port all 9 integrations to V2
createCopilotRuntimeHandler which handles the /voice sub-route
natively.

Integrations: claude-sdk-python, claude-sdk-typescript, crewai-crews,
llamaindex, ms-agent-dotnet, ms-agent-python, pydantic-ai, spring-ai,
strands
2026-05-01 00:52:19 -07:00
Jordan Ritter 39c3bf0016 fix: resolve tool-rendering D5 failures on spring-ai and mastra
spring-ai: StreamingToolAgent Phase 1 streaming was not including tool
definitions in the OpenAI API request. Without tool schemas, aimock
could not match the fixture requiring toolName:"get_weather" and fell
through to a generic text-only fixture. The tool call was never
emitted, so useRenderTool never triggered and the weather card never
rendered.

Attach toolCallbacks to the Phase 1 streaming request while keeping
internalToolExecutionEnabled=false. The LLM/aimock sees the tool
schemas and can return tool_calls, but Spring AI does not auto-execute
them. Phase 2 handles execution as before.

mastra: Mastra Agent class uses the object KEY in the tools config as
the OpenAI function name, not the createTool id. The weatherAgent
registered tools as { weatherTool, queryDataTool, ... } which sent
function names "weatherTool", "queryDataTool" etc. to aimock. The D5
fixture expects toolName:"get_weather", so it never matched. Also
aligned the createTool id from "get-weather" to "get_weather".

Use explicit keys matching the expected function names:
{ get_weather: weatherTool, query_data: queryDataTool, ... }

Verified locally: spring-ai 31/32 green (voice pre-existing), mastra
32/32 fully green.
2026-04-30 23:23:34 -07:00
Jordan Ritter 463b0b7d0b feat(showcase): D5 voice test for langgraph-python
Add D5 voice test that exercises sample-audio transcription via aimock.
Infrastructure: voice in D5 feature type registry + mapping, skipFill
support in conversation runner (9 new tests), inputValue forwarding
in e2e-deep Page wrappers, aimock transcription fixture, tool-free
weather fallback fixture for agents without tools. Verified locally:
D5 suite passes green on langgraph-python (60.4s).
2026-04-30 22:15:45 -07:00
Jordan Ritter eb6358f67d fix(showcase): handle Pydantic models in langroid multimodal agent
The _normalize_part function in multimodal_agent.py checked
isinstance(part, dict) to gate all content-part processing.
When RunAgentInput is deserialized via Pydantic, ag_ui.core
types (TextInputContent, ImageInputContent, DocumentInputContent)
are model instances — not dicts — so every multimodal content
part was silently dropped.

This caused the D5 multimodal probe's PDF turn to fail: the user
message text was lost, the aimock matched the stale turn-1 fixture
instead of the turn-2 fixture, and the assertion saw the image
response where it expected the document response.

Convert Pydantic models to dicts via model_dump(by_alias=True)
before processing, preserving camelCase field names (mimeType)
that the rest of the function relies on.
2026-04-30 19:17:22 -07:00
Jordan Ritter d39facb804 fix(showcase): fix ms-agent-python multimodal agent run() signature
The _MultimodalAgent.run() override used *args/**kwargs but
AgentFrameworkAgent.run() expects input_data: dict. The mismatch
caused TypeError at runtime. Changed to match the base signature
and yield events from the base generator.
2026-04-30 19:02:16 -07:00
Jordan Ritter aa0674fbf2 fix(showcase): switch built-in-agent interrupt pages to V2 CopilotKitProvider
gen-ui-interrupt and interrupt-headless pages were using V1 CopilotKit
with named agents (agent="gen-ui-interrupt", agent="interrupt-headless")
but the built-in-agent runtime only registers a single "default" agent
via CopilotRuntime V2. This caused 404/agent-not-found errors at D5.

Switch both pages to CopilotKitProvider with useSingleEndpoint and
remove agentId from CopilotChat, matching the pattern used by all
other built-in-agent demo pages.
2026-04-30 18:30:51 -07:00
Jordan Ritter fbe882eca0 fix(showcase): restore langgraph-python declarative-gen-ui to a2ui_dynamic graph (#4553)
## Summary

PR #4542 incorrectly changed the langgraph-python declarative-gen-ui
route from `graphId: "a2ui_dynamic"` to `graphId: "sample_agent"` and
removed `injectA2UITool: false`. This caused a regression from 31/31
green to red.

The `a2ui_dynamic` graph owns the `generate_a2ui` tool itself — the
runtime must NOT auto-inject its own A2UI tool on top (`injectA2UITool:
false`). The `sample_agent` graph is a generic chat agent with no tools,
which can never produce A2UI surfaces.

## Test plan

- [ ] langgraph-python returns to D5 green (31/31)
2026-04-30 17:51:46 -07:00
Jordan Ritter 738a85cfe9 fix(showcase): restore langgraph-python declarative-gen-ui to a2ui_dynamic graph
PR #4542 incorrectly changed graphId from "a2ui_dynamic" to
"sample_agent" and removed injectA2UITool: false. The a2ui_dynamic
graph owns the generate_a2ui tool itself — the runtime must NOT
auto-inject. This caused langgraph-python to regress from 31/31 to red.
2026-04-30 17:50:23 -07:00
Jordan Ritter fc854c0436 fix: use custom stream converter for BYOC agents to fix D5 timeout (#4552)
## Summary

- Switch byoc-hashbrown and byoc-json-render agent factories from `type:
"tanstack"` to `type: "custom"` with a dedicated stream converter,
matching the proven pattern used by the main built-in-agent factory
(`tanstack-factory.ts`)
- Remove invalid `response_format: { type: "json_object" }` from
`modelOptions` -- TanStack AI v0.8.x uses the OpenAI Responses API which
does not support this Chat Completions parameter
- System prompts already enforce JSON-only output; `temperature: 0.2` is
retained as a valid Responses API parameter

The `type: "tanstack"` path routes through the runtime's
`convertTanStackStream` which has a `runFinished` flag (PR #4476) that
blocks all events after the first `RUN_FINISHED`. Combined with the
invalid `response_format` parameter being silently rejected by the
Responses API, this prevented text events from reaching the frontend,
causing the D5 probe to timeout waiting for
`[data-testid="copilot-assistant-message"]`.

## Test plan

- [ ] Verify byoc-hashbrown D5 passes locally with `bin/showcase test
built-in-agent --d5`
- [ ] Verify all other 27 built-in-agent features still pass D5
- [ ] Verify byoc-json-render D5 passes (same fix pattern)
2026-04-30 17:35:46 -07:00
Jordan Ritter 0c270e5eb1 fix: use custom stream converter for BYOC agents to fix D5 timeout
The byoc-hashbrown and byoc-json-render agents used `type: "tanstack"`
which routes through the runtime's `convertTanStackStream`. That
converter has a `runFinished` flag (PR #4476) that blocks all events
after the first RUN_FINISHED, which can prevent text events from
reaching the frontend.

Additionally, both agents passed `response_format: { type: "json_object" }`
via `modelOptions`. TanStack AI's OpenAI adapter v0.8.x uses the
Responses API (`client.responses.create()`), not Chat Completions. The
Responses API does not support `response_format` (it uses `text.format`
instead), so this parameter was silently causing failures.

Fix both issues by:
- Switching from `type: "tanstack"` to `type: "custom"` with a dedicated
  stream converter that skips RUN_FINISHED and forwards text events,
  matching the proven pattern in tanstack-factory.ts
- Removing the invalid `response_format` from modelOptions (the system
  prompt already enforces JSON-only output)
- Keeping `temperature: 0.2` which is valid for the Responses API
2026-04-30 17:33:58 -07:00
Jordan Ritter 3ec233fd26 fix(showcase): fix 3 llamaindex D5 timeouts caused by deferred annotations (#4551)
## Summary

- Remove `from __future__ import annotations` from 3 llamaindex agents
that were timing out at D5
- The deferred annotations import causes Pydantic to fail with
"class-not-fully-defined" when resolving `Annotated[str, "..."]` tool
parameters, producing a `RUN_ERROR` SSE event instead of streaming text
- The D5 conversation runner cannot detect `RUN_ERROR` as an assistant
response, so it times out after 30s

## Affected agents

- `a2ui_fixed.py` (gen-ui-a2ui-fixed / a2ui-fixed-schema feature)
- `a2ui_dynamic.py` (gen-ui-declarative / declarative-gen-ui feature)
- `tool_rendering_reasoning_chain_agent.py`
(tool-rendering-reasoning-chain feature)

## Root cause

`from __future__ import annotations` (PEP 563) defers evaluation of all
annotations to strings. When the LlamaIndex `AGUIChatWorkflow` passes
`backend_tools` to Pydantic for schema generation, `Annotated[str,
"Origin airport code"]` is stored as the string `"Annotated[str, 'Origin
airport code']"` instead of the actual type. Pydantic cannot resolve
this and raises `PydanticUserError: class-not-fully-defined`.

Agents without `backend_tools` (like `reasoning_agent.py`) were
unaffected because the code path that triggers Pydantic schema
validation is never reached with an empty tool list.

## Test plan

- [x] Built Docker image locally and curled all 3 endpoints directly
- [x] Before fix: all 3 returned `RUN_ERROR` with Pydantic
class-not-fully-defined
- [x] After fix: all 3 stream `TEXT_MESSAGE_CHUNK` events and finish
with `RUN_FINISHED`
- [ ] CI green
- [ ] D5 probe passes for all 3 features on production
2026-04-30 17:26:57 -07:00
Jordan Ritter 3dc802a927 fix(showcase): remove from __future__ import annotations from 3 llamaindex agents
The `from __future__ import annotations` import causes all type
annotations to be stored as strings rather than evaluated at
definition time. When the LlamaIndex AGUIChatWorkflow validates
backend_tools via Pydantic, `Annotated[str, "..."]` parameters
fail with "class-not-fully-defined" because Pydantic cannot
resolve the deferred string annotations.

This caused RUN_ERROR on every request to these three agents,
which the D5 conversation runner cannot detect as a response,
leading to the 30s timeout.

Affected agents:
- tool_rendering_reasoning_chain_agent.py (4 backend tools)
- a2ui_fixed.py (display_flight backend tool)
- a2ui_dynamic.py (generate_a2ui backend tool)

Verified locally: all three endpoints now stream
TEXT_MESSAGE_CHUNK events and finish with RUN_FINISHED.
2026-04-30 17:24:59 -07:00
Jordan Ritter 3cd2520c5a fix(showcase): add missing module stubs in crewai-crews forwarded props tests
The _stub_agent_server_deps fixture was missing stubs for
agents.interrupt_crew and agents.tool_rendering, which were added to
agent_server.py in d6b784ee9 (interrupt demos). The missing
interrupt_crew stub caused ModuleNotFoundError on import, failing 5
tests on both Python 3.10 and 3.12 in the Showcase: Validate workflow.
2026-04-30 17:15:53 -07:00
Jordan Ritter ef1bf442eb fix(showcase): revert custom agno reasoning handler, use stock AGUI
The custom _run_reasoning_agent handler had a bug where text messages
weren't rendered by the frontend despite the backend emitting correct
AG-UI events. The stock AGUI handler works with reasoning=False and
aimock fixtures — the D5 probe checks for reasoning keywords in the
transcript, not for REASONING_MESSAGE events specifically.

Locally verified: 28/29 D5 features pass (only auth fails — pre-existing
auth gate regression unrelated to this change).
2026-04-30 17:04:57 -07:00
Jordan Ritter bf98500bd6 fix(showcase): agno reasoning handler must emit text message for D5 probes
The _run_reasoning_agent handler's fallback path (for aimock fixtures
that return plain text with "Reasoning:" prefix) was setting
answer_text="" which skipped emitting any TEXT_MESSAGE events.
CopilotKit requires a text message to render an assistant bubble in
the conversation view -- reasoning events alone produce no visible
DOM element that the D5 probe selectors can match, causing both
reasoning-display and tool-rendering-reasoning-chain to timeout
with 0 assistant messages.

Fix: set answer_text = full_text so the response is emitted as both
a reasoning message (for the ReasoningBlock slot) and a text message
(for the conversation transcript the probe reads).
2026-04-30 17:04:56 -07:00
github-actions[bot] 751eb7d389 style: auto-fix formatting 2026-04-30 17:04:56 -07:00
Jordan Ritter db1d7d05cb fix(showcase): agno reasoning, ms-agent-python slots/multimodal, mastra subagents
- agno: custom _run_reasoning_agent handler emitting proper
  REASONING_MESSAGE AG-UI events (Agno's stock handler only emits
  STEP_STARTED/FINISHED which CopilotKit ignores); disable reasoning=True
  to avoid multi-call CoT loop that breaks aimock fixtures
- ms-agent-python: wire chat-slots assistantMessage + disclaimer overrides;
  add missing public/demo-files/ (sample.png, sample.pdf)
- mastra: register byocHashbrownAgent in main route; rewrite subagents
  e2e test to match actual page structure
2026-04-30 17:04:56 -07:00
Jordan Ritter 1db0bd7042 fix(showcase): resolve agent-not-found errors across integrations
- ms-agent-dotnet auth: V1→V2 CopilotKit import for proper agent discovery
- ms-agent-python: register interrupt agents (array declared but never iterated)
- claude-sdk-python: register hitl-in-chat-booking agent + fix stale dates
- ag2 + langgraph-python: declarative-gen-ui routes use default agent with
  runtime auto-injection instead of custom backend a2ui agents
- google-adk: hoist copilotRuntimeNextJSAppRouterEndpoint to module scope
  (per-request invocation caused race condition in agent Promise chain)
- langgraph-fastapi: remove AgentConfigLangGraphAgent that caused HTTP 400
  with LangGraph 0.6.0+; add default alias for open-gen-ui
2026-04-30 17:04:55 -07:00
Jordan Ritter 60d8139d3d fix(showcase): register all 25 graphs in langgraph-typescript server
The production LangGraph server only registered 5 of 25 graphs from
langgraph.json, causing 404s for all unregistered graph endpoints.
Also adds 6 missing agent registrations to the main route and
normalizes deploymentUrl trailing slashes across dedicated routes.
2026-04-30 17:04:40 -07:00
Jordan Ritter faac42c313 fix(showcase): wire byoc-hashbrown backend agents correctly
- agno: add default agent alias + per-request runtime
- langgraph-fastapi: add default agent alias
- llamaindex: fix agent name mismatch (byoc_hashbrown → byoc-hashbrown-demo)
- mastra: create dedicated byocHashbrownAgent with hashbrown system prompt
  (was using weatherAgent which produced plain text instead of JSON)
- ms-agent-dotnet: upgrade byoc page to V2 CopilotKit import
2026-04-30 17:04:40 -07:00
Jordan Ritter d36660ba24 fix(showcase): add D5 probe testid to byoc-hashbrown across all integrations
The D5 conversation runner detects assistant responses via
data-testid="copilot-assistant-message". The byoc-hashbrown demo
overrides the assistantMessage slot with a custom HashBrown renderer,
which dropped that attribute. Without it the harness sees 0 messages
and times out.
2026-04-30 17:04:39 -07:00
Jordan Ritter be01722df4 feat(showcase): close all spring-ai unsupported gaps
Add interrupt demos (Strategy B), byoc-json-render demo (zero-tool
agent + @json-render frontend), and shared-state-streaming (per-token
STATE_SNAPSHOT emission via tool-call argument interception).
Spring AI moves from 4 unsupported features to 0.
2026-04-30 15:59:07 -07:00
Jordan Ritter d6b784ee9a feat(showcase): add interrupt demos to 12 integrations via Strategy B
Replace gen-ui-interrupt and interrupt-headless "not supported" stubs
with working demos using useFrontendTool + async Promise pattern.
Backend agents use system prompt + tools=[] — CopilotKit runtime
routes tool calls to the frontend handler. Pattern proven by
ms-agent-python/dotnet, now extended to ag2, agno, built-in-agent,
claude-sdk-python, claude-sdk-typescript, crewai-crews, google-adk,
langroid, llamaindex, mastra, pydantic-ai, strands.
2026-04-30 15:59:00 -07:00
Jordan Ritter 81b2d9a53e fix(showcase): add harness testids to claude-sdk-typescript BYOC renderers (#4539)
## Summary

- Added `data-testid="copilot-assistant-message"` and
`data-message-role="assistant"` to the BYOC hashbrown and json-render
custom assistant message renderers in claude-sdk-typescript
- These attributes were already present in the langgraph-python
gold-standard; this aligns the TS port

## Why

The byoc-hashbrown and byoc-json-render demos override CopilotChat's
`messageView.assistantMessage` slot with custom renderers. The e2e-deep
conversation runner counts assistant messages via
`[data-testid="copilot-assistant-message"]` to detect "response
settled." Without that attribute on the custom renderers, the count
stayed at 0 forever and the byoc feature timed out -- the only D5
failure blocking claude-sdk-typescript from green.

## Test plan

- `showcase test claude-sdk-typescript --d5 --verbose` goes from 28/29
(byoc timeout) to 29/29 green
- No demo functionality changed -- only test-harness attributes added to
wrapper divs
2026-04-30 14:44:38 -07:00
Jordan Ritter a1e27b330e fix(showcase): add harness testids to claude-sdk-typescript BYOC renderers
The byoc-hashbrown and byoc-json-render demos override the CopilotChat
assistantMessage slot with custom renderers, but the overrides were
missing the data-testid="copilot-assistant-message" attribute that the
e2e-deep conversation runner uses to detect settled assistant responses.
Without it, the runner's readMessageCount always returned 0 and the
byoc feature timed out at D5.

The langgraph-python gold-standard already had these attributes; this
aligns claude-sdk-typescript to match.
2026-04-30 14:44:10 -07:00
Jordan Ritter 7db463a208 fix(showcase): wire all three slot overrides in llamaindex chat-slots demo
The llamaindex chat-slots demo only had the welcomeScreen slot,
missing the input.disclaimer and messageView.assistantMessage
overrides that langgraph-python (gold standard) provides. The D5
probe checks for data-testid="custom-assistant-message" after the
assistant responds, so the feature was stuck at D4.

Add CustomAssistantMessage and CustomDisclaimer components (matching
langgraph-python), wire them into CopilotChat props, update the e2e
spec to cover all three slots, and update manifest highlights.
2026-04-30 14:31:35 -07:00
github-actions[bot] 4629573f32 style: auto-fix formatting 2026-04-30 20:33:59 +00:00
Jordan Ritter a9193b2d7f fix(showcase/google-adk): align chat-customization-css theme with D5 reference
Update CSS custom properties and page layout to match the D5 probe
reference theme expectations.
2026-04-30 13:32:21 -07:00
Jordan Ritter b4361d8ea7 fix(showcase/google-adk): add SampleAttachmentButtons and multimodal attachment pipeline
Add SampleAttachmentButtons component with PDF/image sample files,
wire multimodal demo page to support file attachments matching D5
probe expectations.
2026-04-30 13:32:14 -07:00
Jordan Ritter ebcbdc5774 fix(showcase/google-adk): demo wiring fixes for D5 probe compatibility
Fix chat-slots agent name (dashes to underscores), prebuilt-popup
defaultOpen prop, auth demo defaults to unauthenticated state, and
add missing data-testid attributes to byoc renderers.
2026-04-30 13:32:07 -07:00
Jordan Ritter 69ca0c6afc fix(showcase/ag2): demo page fixes — agent-config, testids, imports, wiring
- agent-config: replace useAgent/setState pattern with CopilotKit properties
  prop (the correct way to pass config to AG2 ContextVariables)
- headless-complete: change runtimeUrl from /api/copilotkit to
  /api/copilotkit-mcp-apps so MCP Apps activity messages render
- byoc-hashbrown, byoc-json-render: re-attach data-testid="copilot-assistant-message"
  on custom assistantMessage slot overrides (harness conversation runner
  needs this to detect settled responses)
- agentic-chat-reasoning, beautiful-chat: add demo-level data-testid wrappers
- tool-rendering-reasoning-chain, voice: fix CopilotKit import path
  (import from @copilotkit/react-core, not /v2, for consistency)
2026-04-30 13:13:51 -07:00
Jordan Ritter 0f6942c5d0 fix(showcase/ag2): multimodal content flattener + attachment pipeline
Rewrite the multimodal demo's message converter from a legacy-binary-shape
rewriter to a content flattener. AG2's AGUIStream validates message content
as a plain string and rejects arrays of content parts with a 400. The new
ContentFlattenerShim extracts text from multipart user messages before the
AG-UI run dispatches them to the AG2 backend.

Also adds defensive validation to sample-attachment-buttons: magic-byte
checks, LFS pointer detection, and actionable error messages.
2026-04-30 13:13:38 -07:00
Jordan Ritter 0aef10f9a2 fix(showcase/ag2): backend wiring — mount order, @tool() decorator, route fixes
- Fix Starlette mount order: /open-gen-ui-advanced before /open-gen-ui to
  prevent prefix shadowing (open-gen-ui-advanced was unreachable)
- Fix @tool -> @tool() decorator in agent_config_agent.py (bare @tool
  silently fails to register the function as a CopilotKit tool)
- Wire headless-complete agent into copilotkit-mcp-apps route so the
  headless-complete demo can exercise MCP Apps rendering
- Update manifest to reference copilotkit-mcp-apps route for headless-complete
- Remove stale @ts-ignore in auth route
2026-04-30 13:13:27 -07:00
Jordan Ritter 2c32b48dda fix(showcase): fix spring-ai D5 failures — all 28 features green (#4525)
## Summary

- Fix TOOL_CALL_RESULT events reusing parent assistant message ID across
StreamingToolAgent, SharedStateReadWriteController, and
SubagentsController —
React's deduplicateMessages() Map overwrote assistant messages with tool
  messages when they shared the same ID
- Add `data-testid="copilot-assistant-message"` to BYOC hashbrown
renderer so
  the D5 test harness can detect assistant messages
- Register AG-UI Jackson mixins via JacksonConfig postConfigurer,
normalize
array-format content via ContentNormalizingModule, remove ChatMemory
beans
  that interfered with aimock fixture matching, inject Spring-managed
  ObjectMapper into AgentConfigController

## Test plan

- [x] All 28/28 spring-ai D5 features pass locally (verified stable
across
  multiple consecutive runs)
- [x] Docker build succeeds
- [x] No regressions — previously passing 22 features remain green
2026-04-30 12:55:21 -07:00
Jordan Ritter 81a0fbe080 fix(showcase): fix spring-ai D5 failures — all 28 features green
Root cause: TOOL_CALL_RESULT events reused the parent assistant
message ID, causing React deduplicateMessages() to overwrite
assistant messages with tool messages (Map keyed by ID). Fix uses
unique UUIDs for each tool result message across all three
controllers. Also adds data-testid to the BYOC hashbrown renderer
so the D5 harness can detect assistant messages, registers AG-UI
Jackson mixins via JacksonConfig postConfigurer, normalizes
array-format content via ContentNormalizingModule, removes ChatMemory
beans that interfered with aimock fixture matching, and injects
Spring-managed ObjectMapper into AgentConfigController.
2026-04-30 12:54:52 -07:00
Tyler Slaton 26e245c009 chore: run pnpm format
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
2026-04-30 12:32:31 -07:00
Jordan Ritter e28295dd3d fix(showcase): spring-ai HITL D5 features — 6/11 green (#4505)
## Summary

- Spring-ai StreamingToolAgent now classifies tool calls as frontend vs
backend, emitting TOOL_CALL events without TOOL_CALL_RESULT for frontend
tools so the CopilotKit runtime's processAgentResult handles them
- On HITL re-invocation (tool result sent back), sends full AG-UI
message history to aimock/LLM via convertMessages() for correct fixture
matching
- Fixes 3 HITL features: hitl-text-input, hitl-approve-deny, hitl-steps
(spring-ai now 6/11 D5 green, up from 3/11)

## Remaining 5 failures (pre-existing, not caused by this PR)

| Feature | Root cause |
|---------|-----------|
| tool-rendering | CopilotKit frontend re-render drops assistant
messages (count goes 1→0) |
| shared-state-read | SharedStateReadWriteController — separate
controller, not StreamingToolAgent |
| shared-state-write | Same as shared-state-read |
| subagents | SubagentsController — aimock returns "No fixture matched"
(404) |
| mcp-apps | Depends on external MCP server (excalidraw.com) unreachable
from Docker |

All 5 fail identically on baseline (main) without this PR's changes.

## Test plan

- [x] `showcase test spring-ai --d5` — 6 green, 5 red (same 5 red on
baseline)
- [x] Direct curl to Java backend confirms correct AG-UI event sequences
for all HITL flows
- [x] No regressions: agentic-chat, gen-ui-custom, gen-ui-headless still
pass
2026-04-30 09:02:43 -07:00
Jordan Ritter 78deb8b488 fix(showcase): spring-ai HITL features — frontend tool detection + multi-turn history
StreamingToolAgent now classifies tool calls as frontend vs backend by
comparing input.tools() (CopilotKit-injected frontend tools) against
the registered toolCallbacks (backend tools). Frontend-only tool calls
emit TOOL_CALL_START/ARGS/END without TOOL_CALL_RESULT so the CopilotKit
runtime's processAgentResult detects the missing result and executes the
frontend handler (useHumanInTheLoop, useFrontendTool).

On re-invocation (when the runtime sends back the tool result), the
agent now sends the full AG-UI message history to aimock/LLM via
convertMessages() so the fixture matcher sees the tool result and
returns a follow-up text response instead of repeating the tool call.

Fixes 3 HITL D5 features: hitl-text-input, hitl-approve-deny,
hitl-steps. Spring-ai now passes 6/11 D5 features locally (up from 3).
The remaining 5 failures (tool-rendering, shared-state-read/write,
subagents, mcp-apps) are pre-existing and unrelated to StreamingToolAgent
— they involve separate controllers, missing aimock fixtures, external
MCP servers, and CopilotKit frontend rendering issues.
2026-04-30 08:40:47 -07:00
Alem Tuzlak 797e4177f2 Merge branch 'main' into blitz/lgp-d5-coverage-design/integration 2026-04-30 16:42:48 +02:00
Jordan Ritter 1a2f388863 fix(showcase): get built-in-agent to all-D5-green (10/10) (#4500)
## Summary

- Fixes all 10 D5 features for the built-in-agent TanStack integration
(was 6/10)
- Custom stream converter bypasses the runtime's `runFinished` blocking
(PR #4476) that breaks TanStack's multi-turn agent loop for server tools
- Forwards AG-UI frontend tools (useHumanInTheLoop, useRenderTool) as
TanStack definition-only declarations
- Fixes HITL TimePickerCard status case mismatch (CopilotKit v2 uses
lowercase "executing" not "Executing")
- Migrates hitl-in-chat demo to CopilotKit v2 with proper agentId wiring

## Test plan

- [x] `showcase/bin/showcase test built-in-agent --d5 --verbose` passes
10/10 (2 consecutive runs)
- [x] All 10 features: agentic-chat, gen-ui-headless, gen-ui-custom,
tool-rendering, shared-state-read, shared-state-write, hitl-text-input,
hitl-approve-deny, subagents, mcp-apps
2026-04-30 07:24:41 -07:00
Jordan Ritter 4107ab486b fix(showcase): get built-in-agent to all-D5-green (10/10)
Three fixes for the built-in-agent TanStack integration:

1. **Custom stream converter** — the runtime's `convertTanStackStream`
   (PR #4476) blocks all events after the first `RUN_FINISHED`, which
   breaks TanStack's multi-turn agent loop. Server tools like
   `get_weather` and `set_notes` need the loop to execute the tool,
   emit TOOL_CALL_RESULT, and re-prompt for the text response. Switch
   to `type: "custom"` with a local converter that skips RUN_FINISHED
   without blocking subsequent events, and deduplicates tool-call
   events (TanStack's buildToolResultChunks re-emits START/ARGS/END
   for server tool results).

2. **Frontend tool forwarding** — register AG-UI frontend tools
   (useHumanInTheLoop, useRenderTool, useFrontendTool) as TanStack
   definition-only declarations so the LLM can call them. Without
   this, tools like `book_call` were unknown to TanStack and silently
   dropped.

3. **HITL status case mismatch** — CopilotKit v2's ToolCallStatus uses
   lowercase strings ("executing") but the TimePickerCard checked for
   PascalCase ("Executing"). Normalize with toLowerCase() so buttons
   enable correctly.

Also migrates hitl-in-chat demo from CopilotKitProvider (v1) to
CopilotKit (v2) with proper agentId wiring.
2026-04-30 07:24:09 -07:00
Jordan Ritter 63878c3b12 fix(showcase): register request_user_approval stub in llamaindex hitl-in-app agent
AGUIChatWorkflow only emits TOOL_CALL_CHUNK events for tools registered
via the frontend_tools constructor argument. Without a backend stub for
request_user_approval the workflow silently dropped the tool call from
the aimock response, so CopilotKit never intercepted it and the approval
dialog never opened.

Add a FunctionTool stub (same pattern as book_call in hitl_in_chat_agent)
and pass it in frontend_tools so the AG-UI event chain fires correctly.

All 11 llamaindex D5 features now pass locally.
2026-04-30 06:41:34 -07:00
Jordan Ritter 17d68e5a0d fix(showcase): test built-in-agent with runtime PR #4482 pkg-pr-new build (#4485)
## Summary
Install pkg-pr-new build of @copilotkit/runtime (from PR #4482) in
built-in-agent, and align all demo page wiring with the LangGraph-Python
D5 fixtures.

**Runtime fix** — The `@copilotkit/runtime` dependency points to a
`pkg.pr.new` URL instead of the `next` npm tag. This MUST be reverted to
`"next"` once a proper @copilotkit/runtime release includes the TanStack
RUN_FINISHED fix from PR #4482.

**D5 wiring fixes** — Seven D5 features failed because built-in-agent
demo pages used different tool names and hook types than the LGP
reference agent:

- **tool-rendering**: switched from `useComponent("weather")` to
`useRenderTool("get_weather")` with correct `{parameters, result,
status}` render shape
- **gen-ui-tool-based**: renamed `useComponent("haiku")` to
`useComponent("generate_haiku")`, rewrote HaikuCard to accept args as
direct props
- **hitl-in-chat**: created `/demos/hitl-in-chat` route (was missing);
reuses TimePickerCard from hitl-in-chat-booking with `book_call` tool
- **shared-state**: added `set_notes` server tool so the fixture's
`set_notes` call has a backend handler
- **subagents**: renamed `delegate_to_planner`/`delegate_to_researcher`
to `research_agent`/`writing_agent`/`critique_agent` matching LGP
fixture tool names
- **subagents page**: updated `useComponent` registrations and
DelegationCard for the renamed tools

## Results
- Before: 3/10 D5 features pass
- After: targeting 10/10 (pending D5 probe verification)

## Test plan
- [x] Docker image builds
- [x] TypeScript check — no new errors (only pre-existing Zod version
mismatch)
- [x] All 6 files modified/created verified
- [ ] D5 probe run against deployed built-in-agent
- [ ] Team review of runtime change scope
- [ ] Revert runtime dep to `"next"` after proper release
2026-04-30 06:26:29 -07:00