Commit Graph

2368 Commits

Author SHA1 Message Date
Alem Tuzlak c7b65e9ec7 test(showcase/langgraph-python): rewrite headless-simple and headless-complete to deterministic pill-driven tests
Rewrites both headless specs to the pill-driven plan from
.claude/specs/lgp-test-genuine-pass.md (Family-1F).

headless-simple (4 tests):
1. page loads with custom composer + 3 pills visible
2. hello pill -> assistant bubble starts with the greeting leading phrase
3. joke pill -> assistant bubble contains the deterministic joke
4. fun fact pill -> assistant bubble contains 'Honey never spoils!'

headless-complete (5 tests):
1. page loads with custom composer + 4 pills visible
2. weather pill -> WeatherCard with Tokyo / Sunny / 68F + narration
3. AAPL pill -> StockCard with AAPL / $189.42 / +1.27% + narration
4. highlight pill -> HighlightNote with 'ship the demo on Friday' + narration
5. revenue chart pill -> ChartCard with 'Quarterly revenue', subtitle,
   month labels Jan-Jun + narration

Each test asserts on the headless-specific testids introduced in the
preceding commit, so a regression that demotes the headless surface
back to the default CopilotChat surface fails every tool test. Each
pill exercises a different render-hook path so regressions surface
test-by-test.

No .skip() — all 9 tests are live.
2026-05-07 17:46:47 +02:00
Alem Tuzlak cb1b8bfaf6 feat(showcase/langgraph-python): add headless surface testids
Adds stable data-testid hooks on the hand-rolled headless chat surface
shared by headless-simple and headless-complete so e2e specs can target
the headless surface (and not the default CopilotChat surface) by
selector.

Shared:
- 'headless-message-assistant' on the custom assistant bubble
- 'headless-message-user' on the custom user bubble
- 'headless-composer' on the composer container

headless-complete only:
- 'headless-weather-card' on the WeatherCard rendered via useRenderTool
- 'headless-stock-card' on the StockCard
- 'headless-highlight-card' on the HighlightNote rendered via useComponent
- 'headless-revenue-chart' on the ChartCard

If the headless surface ever silently regresses to the default
CopilotChat surface, the headless-specific testids are absent and the
spec fails. Each tool-card testid is scoped per-component so a regression
in a single render hook fails only that test.
2026-05-07 17:46:25 +02:00
Alem Tuzlak c3d8fdc14f test(showcase/langgraph-python): rewrite readonly-state-agent-context to 5 deterministic tests
Replace the previous 4-test (2 active, 2 skipped) suite with a
5-test deterministic plan keyed off the demo's actual published
context defaults and pill verbatim prompts.

Tests:
1. page loads — context-card + composer render
2. edits propagate to JSON — type into name/timezone, JSON updates
3. "Who am I?" pill — assistant reply leads with "I see you're Atai"
   and the identity card has name=Atai, timezone=America/Los_Angeles,
   avatar text=A (defaults from page.tsx)
4. activity checkboxes default-checked — "viewed the pricing page"
   and "watched the product demo video" are checked on first paint
5. "Suggest next steps" pill — assistant reply leads with "Since
   you recently viewed the pricing page and watched the product
   demo video"

Tests 3 and 5 rely on the deterministic aimock fixtures added in
the previous commit. Tests 4 uses the new activity-<slug> testids.
0 .skip() remaining.
2026-05-07 17:46:11 +02:00
Alem Tuzlak 38d327d9af chore(showcase/aimock): add headless-complete highlight fixture
Adds high-priority verbatim-prompt fixtures for the headless-simple and
headless-complete pill prompts so the deterministic leading phrases stay
locked under aimock:

- headless-simple: 'Say hello in one short sentence' / 'Tell me a one-line
  joke' / 'Give me a fun fact' lock the greeting, joke, and fun fact.
- headless-complete: 'Highlight: ship the demo on Friday' is a NEW
  high-priority entry that emits a highlight_note tool call with text
  'ship the demo on Friday' plus a deterministic narration. Without it
  the showcase-assistant catch-all in feature-parity.json wins and the
  pill never paints a Highlight card.
- headless-complete: 'chart of revenue over the last six months' emits a
  get_revenue_chart tool call plus a deterministic narration leading
  phrase 'Here is the chart of revenue over the last six months'.

Weather Tokyo and AAPL fixtures already lock the leading phrases the
headless-complete spec asserts on; they remain unchanged.
2026-05-07 17:46:02 +02:00
Alem Tuzlak f1d55a40f5 feat(showcase/langgraph-python): add identity testids and aimock fixtures for readonly-state-agent-context
Add four production-code testids on demo-layout.tsx:
- identity-name on the user-name display
- identity-timezone on the timezone display
- identity-avatar on the first-letter avatar circle
- activity-<slug> on each activity <label>, kebab-case of activity name

These let Playwright lock the identity card against the published
context defaults (Atai, America/Los_Angeles, A) and assert the
default-checked activity rows ("Viewed the pricing page", "Watched
the product demo video") without depending on assistant text.

Add two verbatim-prompt aimock fixtures to showcase/aimock/d5-all.json
for the demo's suggestion pills:

- "What do you know about me from my context?" leading phrase
  "I see you're Atai, and you're in the America/Los_Angeles timezone.
  Recently, you viewed the pricing page and watched the product demo
  video."
- "Based on my recent activity, what should I try next?" leading phrase
  "Since you recently viewed the pricing page and watched the product
  demo video, ..."

Pinned to the verbatim message bodies so they don't contend with the
showcase-assistant catch-all fixture.
2026-05-07 17:45:34 +02:00
Alem Tuzlak 265c1567bf chore(showcase/langgraph-python): Phase 0 cleanup of orphans and dead probes
- delete orphan e2e specs (hitl, interrupt-headless,
  tool-rendering-reasoning-chain)
- rename reasoning-default-render → reasoning-default (route + describe)
- delete dead D5 probes (hitl-steps, interrupt-headless,
  tool-rendering-reasoning-chain)
- update d5-feature-mapping: rename agentic-chat-reasoning →
  reasoning-custom and reasoning-default-render → reasoning-default;
  repoint hitl + hitl-in-chat-booking to hitl-text-input (still used by
  ag2/agno/built-in-agent)
- update d5-registry: drop hitl-steps, interrupt-headless,
  tool-rendering-reasoning-chain feature types
- update d5-reasoning-display preNavigateRoute branch logic and tests
- update probes.test.ts and e2e-deep.test.ts to use surviving feature
  types
2026-05-07 17:18:21 +02:00
Alem Tuzlak bbe128ca65 fix(showcase): repair langgraph-python manifest highlight paths and bump test snapshots
Three highlight paths in langgraph-python's manifest pointed at files
that don't exist after the PR #4694 reorganization:
  - hitl-in-chat → src/agents/hitl_in_chat.py (actually hitl_in_chat_agent.py)
  - chat-slots → custom-welcome-screen.tsx (file doesn't exist; use slot-wrappers.tsx)
  - mcp-apps → copilotkit-mcp-apps/route.ts (actually .../[[...slug]]/route.ts)

The bundler walks every highlight at build time; one missing path aborts
the whole CI step. Fix all three.

Test snapshot counts in generate-catalog and generate-registry hardcoded
40 features / 720 cells / 702 total. With the two new feature IDs added
to the registry (reasoning-default + reasoning-custom), counts shift to
42 / 756 / 738; the LGP-specific cell distribution moved from
39 wired + 1 stub + 0 unshipped to 35 wired + 1 stub + 6 unshipped, and
the registry-side LGP feature/demo count drops to 36 (PR #4694 trimmed
4 items from the manifest's features list).
2026-05-07 14:30:45 +02:00
Alem Tuzlak 95f957d7c2 fix(showcase): register reasoning-default + reasoning-custom feature IDs
PR #4694 renamed langgraph-python's reasoning demos
(agentic-chat-reasoning → reasoning-custom, reasoning-default-render →
reasoning-default) but didn't update the central feature-registry.json /
constraints.yaml, so generate-registry validation rejected the new
manifest IDs. Add the two new features to the registry and the
constrained-explicit allowlist; leave the old IDs in place for the 17
integrations still using them.
2026-05-07 14:10:50 +02:00
Alem Tuzlak 45cc89dc99 chore(showcase): ratchet validate-pins baseline 97→98
Pre-existing drift on main (mastra/ms-agent/llamaindex/pydantic-ai/strands)
that the langgraph-python Dockerfile fix is unrelated to. Bump the
baseline in this PR to unblock CI.
2026-05-07 14:03:39 +02:00
Alem Tuzlak 621c4e3bd1 fix(showcase/langgraph-python): copy manifest.yaml into runtime image
The demos layout's `generateMetadata` calls `headers()` (forces dynamic
rendering) and reads `manifest.yaml` at request time for per-demo titles.
The Dockerfile's runner stage didn't include the manifest, so every
`/demos/*` route in production threw a Server Components render error
(ENOENT on /app/manifest.yaml). The home page was unaffected because it
has no dynamic APIs and gets statically prerendered at build time.

Add a single COPY of `manifest.yaml` into the runner stage.
2026-05-07 13:55:39 +02:00
github-actions[bot] f9cef5048d style: auto-fix formatting 2026-05-07 08:35:24 +00:00
Alem Tuzlak 593895c55a Merge remote-tracking branch 'origin/main' into feat/langgraph-python-demo-pass
# Conflicts:
#	pnpm-lock.yaml
2026-05-07 10:32:07 +02:00
Tyler Slaton f85c1f8328 chore(showcase/langgraph-python): prune dead dependencies
The branch's iteration arc went through several headless-demo
implementations (CSS Modules, AI Elements, prompt-kit, shadcn) and a
streaming-markdown experiment with `streamdown`. After the spec
narrowed to shadcn-only and `react-markdown` for assistant rendering,
those component libraries and their satellite packages were left
installed but unused.

Removed (zero importers across `src/`):
- @copilotkit/react-ui (v1 UI; the showcase consumes /v2 hooks only)
- @rive-app/react-webgl2 (animations, never wired)
- @streamdown/cjk, /code, /math, /mermaid + streamdown (replaced by
  react-markdown for assistant content)
- @xyflow/react (graph viz, never wired)
- ai (Vercel AI SDK, was the AI Elements demo's transport)
- ansi-to-react (terminal output, never wired)
- marked (alternative markdown parser, never wired)
- media-chrome (media player UI, never wired)
- motion (animation library, was a prompt-kit demo dep)
- nanoid (we use crypto.randomUUID())
- react-jsx-parser (never wired)
- remark-breaks (markdown extension, never wired)
- shiki (syntax highlighting, never wired)
- tokenlens (never wired)
- use-stick-to-bottom (was an AI Elements dep)
- @radix-ui/react-use-controllable-state (no importers)

Kept everything actually imported: shadcn primitive surface intact
(class-variance-authority, cmdk, embla-carousel-react, lucide-react,
radix-ui umbrella + per-package @radix-ui/react-checkbox /
react-separator for beautiful-chat's local components), CopilotKit v2,
Hashbrown + json-render BYOC catalogs, recharts, react-markdown +
remark-gfm, openai (voice route), yaml (manifest parsing), zod.

Build still green at 54 routes. Lockfile updated. tsconfig.json
`jsx: "preserve"` — Next 15 reset this from `react-jsx` automatically
on build.
2026-05-06 23:32:47 -07:00
Tyler Slaton ebad989855 chore(showcase/langgraph-python): manifest, runtime, e2e, cleanup
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.
2026-05-06 23:19:57 -07:00
Tyler Slaton 7a380ecbeb feat(showcase/langgraph-python): Platform — Auth + Agent Config
Two demos that showcase how a platform team integrates CopilotKit:
auth gating and runtime config injection.

Auth — defaults UNAUTHENTICATED. First paint is a centered shadcn Card
with the demo token visible (`demo-token-123`) and a "Sign in" button.
<CopilotKit> doesn't mount until the user signs in; clicking the button
stores the token in localStorage and triggers a re-render that mounts
the chat with `Authorization: Bearer <token>` header attached. Reload
preserves the token; sign-out clears it and returns to the card.

Earlier drafts of this demo defaulted to authenticated with a
ChatErrorBoundary + onError-driven banner to recover from <CopilotChat>
's 401-on-mount crash. Both have been removed — gating the chat behind
`isAuthenticated` means it never mounts with bad creds, so the boundary
has no purpose.

Backend route uses `createCopilotRuntimeHandler` from
@copilotkit/runtime/v2 directly because the Next.js adapter does not
forward `hooks`. The `onRequest` hook validates the bearer token and
throws a Response(401) on missing/wrong tokens.

Agent Config — typed knobs (tone / expertise / responseLength) that
change the agent's behavior per turn. Pivoted to `useAgentContext` from
the original `<CopilotKit properties={...}>` transport, which silently
dropped the values in @ag-ui/langgraph 0.0.31 — those payloads landed
at the top level of the LangGraph stream and weren't routed into
RunnableConfig["configurable"]. A prior workaround that repacked them
there triggered LangGraph 0.6's "cannot specify both configurable and
context" 400.

useAgentContext is the supported LangGraph 0.6+ path for "frontend →
agent runtime context." A small ConfigContextRelay component sits inside
the provider and publishes the live toggles. The Python graph collapses
to a single static system prompt with three rulebooks; CopilotKitMiddleware
injects the context entry into the model's prompt automatically.
2026-05-06 23:19:16 -07:00
Tyler Slaton a78e6bddc7 feat(showcase/langgraph-python): Shared State + Sub-Agents
Four state-flow demos plus the multi-agent demo, all sharing the
page-as-entry-point convention with extracted suggestions.

- shared-state-streaming (Shared State: Streaming) —
  StateStreamingMiddleware(state_key="document", tool="write_document",
  tool_argument="document"). The argument name MUST match the state_key
  for the partial-JSON streamer to index correctly. Fixed in this pass
  (previous version had a name mismatch). Frontend renders `LIVE` badge
  + char counter so per-token streaming is visible.
- shared-state-read-write (Shared State: Read + Write) — bidirectional.
  UI writes preferences via `agent.setState`; agent writes notes via a
  `set_notes` tool that returns Command(update={...}). PreferencesInjector
  middleware reads the state on every turn and injects it as a system
  message. CopilotPopup layout, 2-col card UI, "Agent Scratch pad"
  copy.
- shared-state-read (deprecated route stub) — kept for back-compat with
  any external links; the canonical demo is shared-state-read-write.
- readonly-state-agent-context (Frontend Context Sharing) — frontend
  publishes read-only context via useAgentContext (the LangGraph 0.6+
  idiom). Backend has tools=[] and only CopilotKitMiddleware; read-only
  is enforced by the absence of any state-write tool, not a flag.

- subagents (Sub-Agents) — supervisor + research / writer / critic
  sub-agents. Per-tool useRenderTool registrations surface delegation
  events to the chat. State has a delegations[] log; the Python side
  only writes status="completed" so the type was tightened (dropped
  unused "running" / "failed" legs from both Python TypedDict and the
  TypeScript shape). Frontend infers active sub-agent from in-flight
  tool calls via a defensive structural probe over agent.messages.
2026-05-06 23:18:51 -07:00
Tyler Slaton a7a6a5c6fd feat(showcase/langgraph-python): Declarative UI + BYOC + Open Generative UI
A single commit for the "agent-authored UI" cluster — five distinct
strategies, all sharing a common shape (declare a catalog, let the
agent pick + populate components):

- declarative-gen-ui (Declarative UI: A2UI) — A2UI dynamic schema. The
  agent calls `generate_a2ui` (not the runtime's auto-injected
  `render_a2ui`) which secondary-binds an internal render tool with
  forced tool_choice, then returns operations via `a2ui.render(...)`.
  Custom catalog (Card / StatusBadge / Metric / InfoRow / PrimaryButton
  / PieChart / BarChart) wired via `a2ui.catalog` on the provider.
- a2ui-fixed-schema (Declarative UI: A2UI Fixed Schema) — fixed
  server-side schema. The "Book flight" button is an inert label; the
  earlier draft tried a schema swap to a booked-confirmation but the
  SDK doesn't yet expose `action_handlers` from Python. Removed
  BOOKED_SCHEMA + booked_schema.json since they were dead weight.
  Cleaned 8 (props as Record<string, any>) casts down to a single
  shared `s()` helper.
- mcp-apps — MCP server-driven UI via activity renderers. The runtime's
  `mcpApps.servers` config wires Excalidraw; agent has tools=[] and
  the middleware emits activity events that the built-in
  MCPAppsActivityRenderer auto-mounts as a sandboxed iframe.
- byoc-hashbrown (Declarative UI: Hashbrown) — streaming structured
  output via @hashbrownai/react. Agent prompt locks output to JSON via
  `response_format: json_object` with a `{ ui: [{ tag: { props } }] }`
  contract. Custom slot override on messageView.assistantMessage parses
  the streaming JSON.
- byoc-json-render (Declarative UI: json-render) — streaming hierarchical
  JSON UI spec via @json-render/react with a Zod-validated catalog.
  Catalog (defineCatalog) + registry (defineRegistry) split keeps the
  schema as the single source of truth.
- open-gen-ui (Open Generative UI: Default) — runtime's
  `openGenerativeUI` config injects a sandboxed UI tool; design-skill
  override steers the agent toward educational visualizations. Built-in
  OpenGenerativeUIActivityRenderer auto-mounts.
- open-gen-ui-advanced (Open Generative UI: Advanced) — adds frontend
  sandboxFunctions registered on the provider; each Zod-typed handler
  is exposed to the iframe via the host bridge. Suggestion titles read
  as normal user prompts (no iframe-restriction LLM-prompt copy bleed).

Backends sit at src/agents/{a2ui_fixed,byoc_hashbrown_agent,
byoc_json_render_agent}.py and the MCP runtime at
src/app/api/copilotkit-byoc-hashbrown/route.ts.
2026-05-06 23:18:18 -07:00
Tyler Slaton 8ad38cfdf2 feat(showcase/langgraph-python): Generative UI tool-rendering family
Five demos exercising the per-tool / catch-all / agent-state rendering
patterns. The three tool-rendering cells share the tool_rendering_agent
graph; they differ only in how the frontend renders the same tool
calls.

- tool-rendering (Tool Rendering - Specific) — per-tool useRenderTool
  for get_weather + search_flights, plus a useDefaultRenderTool wildcard
  for everything else.
- tool-rendering-default-catchall (Tool Rendering - Default) — single
  shadcn-styled wildcard via useDefaultRenderTool. Without registering
  *some* renderer the runtime has no `*` entry and tool calls render
  invisibly; this demo shows the minimum-viable shape.
- tool-rendering-custom-catchall (Tool Rendering - Custom Default) —
  same single-wildcard shape, branded with a custom card.

Backend system prompt (src/agents/tool_rendering_agent.py) defaults to
ONE tool per user question. Chaining is opt-in via a "Chain tools"
suggestion that triggers an explicit-ask exception in the prompt — the
previous default-on-chaining generated extra unsolicited tool-call
cards on every turn.

- gen-ui-tool-based (Generative UI: useComponent) — useComponent for
  render_bar_chart + render_pie_chart with Zod schemas; backend has
  tools=[] and the runtime injects the tools.
- gen-ui-agent (Generative UI: Agent State) — agent-state-driven step
  list. The Python graph plans steps via a `set_steps` tool that
  returns Command(update={"steps": …}); the frontend reads via
  useAgent({updates: [OnStateChanged]}) + a custom MessageList that
  renders steps inside CopilotChat's messageView.children slot.

Removed: src/app/demos/{tool-rendering,gen-ui-agent}/agent.py — TODO
stubs; real graphs live in src/agents/.
2026-05-06 23:17:45 -07:00
Tyler Slaton 9e40b1bf64 feat(showcase/langgraph-python): Frontend Tools + HITL family
Frontend Tools (in-app + async) demonstrate the spectrum of agent →
client tool calls:

- frontend-tools — useFrontendTool with a synchronous handler that
  mutates page state. The agent calls `change_background` with any CSS
  background value and the canvas re-paints. <CopilotSidebar /> layout;
  default background is solid indigo so the canvas reads as a clean
  start.
- frontend-tools-async — useFrontendTool with an async handler. The
  agent calls `query_notes`, the handler awaits a 500ms simulated DB
  query, and the agent uses the returned notes in its reply. Pure
  frontend tool — backend has tools=[].

HITL family — three patterns for human-in-the-loop, all keyed on the
useHumanInTheLoop / useInterrupt primitives:

- hitl — step-feedback variant rendering inside the chat via
  useHumanInTheLoop + useInterrupt (the v2 replacement for
  useLangGraphInterrupt, which is not exported in v2).
- hitl-in-chat — time-slot picker variant. Backend graph (hitl_in_chat)
  calls `interrupt({slots, …})` and resumes when the user picks. This
  is the canonical "in-chat HITL" demo; the manifest entry points here.
- hitl-in-app — async useFrontendTool with an app-LEVEL approval modal
  (rendered via createPortal OUTSIDE the chat). The completion callback
  resolves the pending tool Promise with the user's decision. This is
  HITL where the human surface is your app's UI, not the chat.
- gen-ui-interrupt — the lower-level useInterrupt primitive. Backend
  (src/agents/interrupt_agent.py) has a real `schedule_meeting` tool
  that emits an interrupt with topic / attendee / slots, and the
  frontend renders an inline TimePickerCard.
2026-05-06 23:17:21 -07:00
Tyler Slaton 3e157a1e02 feat(showcase/langgraph-python): Multimodal + Voice + Beautiful Chat
Three "production-feel" chat demos that exercise the same convention
(page.tsx as entry point + suggestions extracted) and add their own
specialized hooks:

- multimodal — image + PDF uploads via CopilotChat attachments. Includes
  a LegacyConverterShim (until @ag-ui/langgraph ships an updated
  converter), magic-byte + LFS-pointer guard for safe content sniffing,
  and sample-attachment-buttons that inject test images via DataTransfer
  + dispatch `change` event so screenshots / Playwright reproduce.
- voice — speech-to-text via @copilotkit/voice. Uses the V2 runtime
  directly with [[...slug]] catch-all because `transcriptionService` is
  V2-only. A guarded sample-audio-button injects deterministic sample
  text via the textarea's native value setter (CopilotChat has no
  controlled-input prop today). useSingleEndpoint={false} opts into the
  V2 multi-endpoint protocol.
- beautiful-chat — flagship polished starter chat with brand fonts,
  theme tokens, suggestion pills, generative-UI charts, and
  enableAppMode / enableChatMode tools. Backend
  (src/agents/beautiful_chat.py) wires query_data, manage_todos,
  search_flights, and an A2UI dynamic generator (generate_a2ui) that
  hits a secondary LLM for schema design. Model: gpt-5-mini.

The convention pass extracted suggestions into separate files for each
demo and slimmed page.tsx down to imports + provider + render.
2026-05-06 23:17:00 -07:00
Tyler Slaton 4737eb46f1 feat(showcase/langgraph-python): Prebuilt — CopilotChat / Sidebar / Popup
Three demos showing the prebuilt component formats. All three share the
neutral assistant graph and follow the page-as-entry-point convention:
each page.tsx slimmed to imports + provider + the suggestions hook
mount + JSX, with `useConfigureSuggestions` extracted to its own file.

- agentic-chat (Prebuilt: CopilotChat) — full-page CopilotChat. Plain
  text suggestions (joke / fun fact / limerick) — earlier drafts had a
  "Weather in Paris" prompt but the agent has no weather tool; trimmed
  to non-tool prompts so suggestions actually work.
- prebuilt-sidebar (Pre-Built: Sidebar) — <CopilotSidebar /> docked to
  the edge of the viewport. Page content centered in mx-auto max-w-2xl
  column with icon + heading + paragraph. The sidebar genuinely PUSHES
  the page now — see the body width fix in src/app/globals.css from the
  scaffolding commit.
- prebuilt-popup (Pre-Built: Popup) — <CopilotPopup /> with a floating
  launcher. Same centered content shape as the sidebar demo.

Removed: src/app/demos/agentic-chat/agent.py — TODO stub with a
misleading docstring; the real graph is at src/agents/agentic_chat.py.
2026-05-06 23:16:40 -07:00
Tyler Slaton ac89b11efd feat(showcase/langgraph-python): Reasoning - Default + Custom
A pair of demos that exercise the same backend reasoning graph but
differ only in whether the frontend overrides the
`messageView.reasoningMessage` slot.

Backend (src/agents/reasoning_agent.py): uses a reasoning-capable OpenAI
model (gpt-5-mini by default, override via OPENAI_REASONING_MODEL) routed
through the Responses API so the model's chain-of-thought streams as
AG-UI REASONING_MESSAGE_* events with `role: "reasoning"`. The prompt
asks for a concrete physics answer, which reliably triggers reasoning;
meta-prompts like "show your reasoning step by step" produce no
reasoning summary because the model recognizes those as a request to
reveal chain-of-thought (which it refuses).

Frontend:
- reasoning-default/ — no slot override; built-in
  CopilotChatReasoningMessage renders the "Thinking… / Thought for X"
  header with an expandable content region.
- reasoning-custom/ — overrides `messageView.reasoningMessage` with a
  ReasoningBlock (amber banner with `data-testid="reasoning-block"`).
  The label flips from "Thinking…" while streaming to "Agent reasoning"
  once the stream settles.

Suggestions live in their own files (per the page-as-entry-point
convention). Both demos share `agent="reasoning-default"` /
`agent="reasoning-custom"` against the same `reasoning_agent` graph,
registered in api/copilotkit/route.ts.

Removed:
- src/app/demos/agentic-chat-reasoning/ — replaced by reasoning-custom/
  for naming clarity.
- src/app/demos/reasoning-default-render/ — earlier draft of the Default
  demo with a slightly different page name.
- tests/e2e/agentic-chat-reasoning.spec.ts — replaced by
  reasoning-custom.spec.ts.
2026-05-06 23:16:13 -07:00
Tyler Slaton 4ff8dd608c feat(showcase/langgraph-python): chat customization (CSS + Slots)
Two paired demos showing the spectrum of "change the look" without
rewriting components:

CSS theming (chat-customization-css/) — HALCYON, a warm-paper editorial
brand. Two layers do the work:
  1. v2 token overrides on `[data-copilotkit]` recolor every Tailwind
     utility (cpk:bg-muted, cpk:text-foreground, …) the runtime renders.
  2. Class-targeted styling on .copilotKitChat, .copilotKitMessage*,
     .copilotKitInput, suggestions, scrollbar, welcome screen for the
     editorial details that CSS variables alone can't express.
Aesthetic: cream parchment surface, sharp 90° corners, copper-ember
accents, italic display serif (Instrument Serif) + Fraunces body +
JetBrains Mono dispatch, paper-grain noise via inline SVG, mono masthead
pinned under the top edge. All selectors namespaced under
`.chat-css-demo-scope` — no leakage.

Slot atlas (chat-slots/) — every overrideable slot wrapped in a
dashed-outline marker. Markers nest correctly: each shows ONLY its own
label on hover via `:has(.slot-marker:hover)` rather than lighting up
every nested label as the cursor enters the outermost one. Each label is
a click-to-copy button (✓ flash on success) that copies the slot's
PascalCase component path (`Input.TextArea`,
`MessageView.AssistantMessage`, …) so a developer can paste straight
into IDE search. SuggestionPill, ScrollToBottomButton, and Feather slots
are all wired. CustomFeather has its own `FeatherCopyLabel` because the
default Feather uses position:absolute and can't share SlotMarker.

Both demos use the neutral assistant graph (chat-customization-css and
chat-slots are entries in the route.ts neutralAssistantCells list).
2026-05-06 23:15:49 -07:00
Tyler Slaton bd9da67c48 feat(showcase/langgraph-python): rebuild Headless UI: Complete (modular)
Full headless surface — a hand-rolled CopilotChat replacement that wires
every render hook on top of shadcn/ui primitives. Visual chrome matches
Headless: Simple so the two read as a paired sibling demo.

Architecture is progressive-disclosure: the entry file is a 30-line
HeadlessCompleteRoot that enumerates capabilities, each registered via
a focused hook module:

  page.tsx
  hooks/
    use-tool-renderers.tsx     — useRenderTool x3, useDefaultRenderTool
    use-frontend-components.ts — useComponent (highlight_note)
    use-headless-suggestions.ts — useConfigureSuggestions
  chat/
    chat.tsx, header.tsx, empty-state.tsx, composer.tsx,
    suggestion-bar.tsx, message-list.tsx, message-user.tsx,
    message-assistant.tsx, message-activity.tsx, typing-indicator.tsx
  attachments/use-attachments-config.ts + attachment-preview.tsx
  tools/weather-card.tsx, stock-card.tsx, chart-card.tsx,
        generic-tool-card.tsx, highlight-note.tsx

Backend (src/agents/headless_complete.py): get_weather, get_stock_price,
get_revenue_chart tools; the chart tool replaces the previous Excalidraw
"Sketch a diagram" suggestion (MCP capability stays wired).

Bug fixes folded in:
- Tool-call cards stuck "running" forever — message-list.tsx indexes
  role:"tool" messages by toolCallId and passes the matching ToolMessage
  to renderToolCall so cards advance to "complete".
- Empty state was hugging the top of the viewport — Radix ScrollArea
  wraps content in a `display: table` div that breaks h-full propagation.
  Empty state now renders OUTSIDE the ScrollArea.
- SuggestionBar duplicated the empty-state prompts on first paint.
  Hidden until the conversation starts.
2026-05-06 23:15:26 -07:00
Tyler Slaton 83884b0be5 feat(showcase/langgraph-python): rebuild Headless UI: Simple
Minimum-viable headless chat that wires only `useAgent` + `useCopilotKit`,
dressed in shadcn/ui primitives. Five small single-purpose files so a
reader can grok the surface in under a minute:

  page.tsx        — provider + <Chat />, ~10 lines
  chat.tsx        — useAgent + useCopilotKit + send loop
  composer.tsx    — Textarea + send button
  empty-state.tsx — sparkles + sample prompts
  message-bubble.tsx + typing-indicator.tsx — render pieces

Wires runtimeUrl="/api/copilotkit" + agent="headless-simple" against
the neutral assistant graph registered in route.ts.

Also adds the v2 catch-all route at copilotkit-mcp-apps/[[...slug]]/route.ts
(used by Headless: Complete in the next commit). v2 hooks POST to subpaths
like /v2/agent/run; the previous flat route 404'd, leaving headless demos
stuck on "Thinking…".
2026-05-06 23:15:03 -07:00
Tyler Slaton 3ac7ac7977 chore(showcase/langgraph-python): scaffold showcase shell
Foundational layer that the per-demo work in subsequent commits builds on.

- Manifest-driven landing page (src/app/page.tsx) — auto-generated grid
  of demo cards from manifest.yaml, grouped by tag with explicit ordering
  for chat-ui / interactivity / generative-ui / agent-state / multi-agent
  / headless / platform.
- Per-demo titles (src/middleware.ts + src/app/demos/layout.tsx).
- Diagnostic console gated to NODE_ENV=production in app/layout.tsx so
  deployed showcases surface uncaught errors and iframe context.
- src/app/globals.css — Tailwind v4 @theme inline block that maps
  showcase CSS variables into Tailwind theme tokens (without it, shadcn
  utilities like bg-muted / text-foreground compile to nothing). body
  intentionally NOT given width:100% so <CopilotSidebar /> can shrink
  the document via marginInlineEnd.
- shadcn primitives under src/components/ui/ + src/lib/utils.ts.
- tsconfig.json — @/* path alias rooted at src/.

Removed:
- src/app/copilotkit-overrides.css (global override layer, superseded
  by per-demo theming)
- src/app/api/copilotkit-mcp-apps/route.ts (replaced with
  [[...slug]]/route.ts so v2 subpath POSTs like /v2/agent/run resolve)
2026-05-06 23:14:11 -07:00
Sam Julien c30613c8d4 feat(reference): retarget V1 reference autogen pipeline to shell-docs
Update scripts/docs to write directly into showcase/shell-docs/src/content/reference/
(consumed by /reference/[...slug]) instead of the legacy docs/content/docs tree.
Adds repo-root cwd anchoring, mkdir -p on the destination, allSettled so a single
missing source doesn't abort the run; generates 25 MDX pages (20 V1 + 5 SDK) and
shell-docs build passes.
2026-05-06 20:18:45 -07:00
Sam Julien 99d8ac7a53 docs(shell-docs): rewrite 8 quickstarts for CLI accuracy + V2 canonical form
Switch CLI command to `npx copilotkit@latest create --framework <id>` on all 8
framework quickstarts. Bypasses the unfiltered 18-framework picker and skips
the EIP prompt (which is mutually exclusive with --framework and today
scaffolds langgraph-python-threads regardless of which framework page the
user came from).

For LangGraph: keep an EIP callout since EIP=Yes does scaffold a LangGraph-
Python project today; note that threads support for other frameworks is
coming. For Microsoft Agent Framework and LangGraph (multi-variant): show
both --framework <variant> commands.

Apply the canonical V2 form:
- \`<CopilotKit>\` from \`@copilotkit/react-core\` (root, not /v2).
- styles from \`@copilotkit/react-core/styles.css\` (not react-ui/v2).
- drop \`@copilotkit/react-ui\` from npm install commands.
2026-05-06 18:27:53 -07:00
Sam Julien abeb2792b4 chore(shell-docs): also remove AG-UI link from mobile slide-out + drop now-unused helpers (PDX-119) 2026-05-06 18:27:53 -07:00
Sam Julien cebca92162 chore(shell-docs): remove AG-UI brand tab from header for visual parity with docs.copilotkit.ai (PDX-119) 2026-05-06 18:27:53 -07:00
Sam Julien f17c86867d docs(showcase): close B-cell gaps for built-in-agent integration (PDX-122)
Add sample-audio-button region markers around the SampleAudioButton
component in the built-in-agent voice demo so the
<Snippet cell="voice" region="sample-audio-button" /> reference in
shell-docs/voice.mdx resolves to real code instead of a missing-snippet
warning.

Comment-only change; no runtime behavior change. Mirrors the canonical
in-place region pattern already used by langgraph-typescript, mastra,
ms-agent-python, claude-sdk-typescript, llamaindex, spring-ai,
pydantic-ai, claude-sdk-python, and crewai-crews per the Mastra Round
Pattern Decisions playbook.
2026-05-06 18:27:52 -07:00
Sam Julien 2c10c735dd Match upstream CLI walkthrough literally on 8 framework quickstarts (PDX-111) 2026-05-06 18:27:52 -07:00
Sam Julien f99a7061a6 fix(shell-docs): pre-cutover cleanup — programmatic-control fallback, /migrate redirect, MCP sync exclusion (#4685)
## Summary

Three small pre-cutover cleanup fixes batched into one PR (consolidation
of the prior #4680, #4681, #4682 — same content, fewer review queues).

- `b3ec38720` — Add `<WhenFrameworkHas absent>` fallback to
`programmatic-control.mdx` for the 7 frameworks without
`interrupt_pattern` (ag2, agno, built-in-agent, crewai-crews,
google-adk, mastra, spring-ai), mirroring the canonical pattern from PR
#4496.
- `c080ca062` — Retarget `/migrate/1.10.X` redirect destination from
`/migrate` (which 404s) to `/migrate/v2`. `permanent: false` preserved.
- `e61e8c36d` — Add `mcp-server-setup.mdx` exclusion to docs sync
script. Shell-docs version is intentionally ahead of upstream (HTTP/SSE
Tabs + `mcp-remote` + Tadata callout); without exclusion the next sync
would clobber it.

Supersedes #4680, #4681, #4682.

## Test plan

- [ ] `nx run shell-docs:dev` and visit `/programmatic-control` while
switching the framework selector to non-native fws — verify fallback
callout renders and links to `/human-in-the-loop`.
- [ ] Visit `/migrate/1.10.X` — should redirect to `/migrate/v2` and
render the V2 migration page.
- [ ] Inspect `showcase/scripts/sync-docs-from-main.ts` PATH_EXCLUSIONS
for the `mcp-server-setup` regex.
2026-05-06 17:55:36 -07:00
Jordan Ritter d5c56ff341 Revert "fix(runtime): remove obsolete STREAM_EVENTS_V3_MODES import"
This reverts commit 8084390fb9330008636e0d23818ed69adfdb7af5.
2026-05-06 16:35:52 -07:00
Jordan Ritter d2f5c8a442 fix(runtime): remove obsolete STREAM_EVENTS_V3_MODES import
Bump @langchain/langgraph-cli from 1.2.1 to 2.0.0 in the langgraph-js
starter and showcase langgraph-typescript integration. The transitive
dep @langchain/langgraph-api@1.2.1 imports STREAM_EVENTS_V3_MODES from
@langchain/langgraph/web, but that symbol was never published in any
release of @langchain/langgraph (including 1.3.0 currently pinned).
langgraph-api@2.0.0 drops the broken import entirely.
2026-05-06 16:35:52 -07:00
Jordan Ritter da02c95e4a fix(showcase): regenerate langgraph-typescript lockfile after langchain bump 2026-05-06 16:35:51 -07:00
Jordan Ritter c43fde5891 fix(showcase): add missing lucide-react dependency to shell-docs
The shell-docs Docker build fails because link-to-copilot-cloud.tsx
imports from lucide-react but the package was never added to
shell-docs/package.json. Adding it at ^0.469.0 to match sibling
showcase packages.
2026-05-06 16:35:41 -07:00
Sam Julien e5715cbee0 Exclude mcp-server-setup snippet from upstream sync (PDX-117) 2026-05-06 16:21:21 -07:00
Sam Julien e4cd723563 Retarget /migrate/1.10.X redirect to /migrate/v2 (PDX-96) 2026-05-06 16:21:21 -07:00
Sam Julien b2fd6f9db5 Add WhenFrameworkHas absent fallback to programmatic-control.mdx (PDX-95) 2026-05-06 16:21:21 -07:00
Sam Julien 72794959f3 fix(shell-docs): gate Reo init script on REO_KEY + JSON-escape interpolation
Two bugs in the Reo init <Script> in layout.tsx:

- If NEXT_PUBLIC_REO_KEY was unset, the script still ran with
  e = "undefined" and fetched https://static.reo.dev/undefined/reo.js.
  Sibling REB2B_KEY was correctly gated; Reo now matches.
- Bare interpolation into dangerouslySetInnerHTML — any future env
  value containing " or </script> would break out of the inline
  literal. Switches to JSON.stringify(REO_KEY) and reuses the
  resulting binding inside Reo.init() so the key only appears once.
2026-05-06 15:34:59 -07:00
Sam Julien f64b957ee9 refactor(shell-docs): centralize cloud CTA URL in CLOUD_CTA constant
Pulls the dashboard.operations.copilotkit.ai href + UTM string back
into CLOUD_CTA so the desktop and mobile placements share a single
source of truth. UTM tweaks become a one-line change instead of two.
2026-05-06 15:34:37 -07:00
Sam Julien 945a69799d refactor(shell-docs): switch framework-selector to usePostHog hook + namespace event
Two review fixes for framework-selector.tsx:

- Replaces the `posthog-js` singleton import with `usePostHog()` from
  `posthog-js/react`, matching the rest of the codebase. Both work after
  posthog.init() runs, but the singleton was an outlier.
- Renames the event from `framework_selected` to `docs.framework_selected`
  to match the dotted-prefix convention used elsewhere in PostHog
  Insights (oss.* / cloud.* / eip.* / pricing.cta_clicked). Cheap to do
  now since the event is brand-new with no historical data.
2026-05-06 15:34:03 -07:00
Sam Julien 601b726631 refactor(shell-docs): remove obsolete PostHog console suppressor
The suppressor was carried over from the original telemetry-stack port
of upstream's posthog-provider.tsx. Its job was masking
ERR_BLOCKED_BY_CONTENT_BLOCKER noise from PostHog requests being
blocked by ad blockers targeting *.i.posthog.com directly.

This PR ships the /ingest reverse proxy (mirroring upstream #4554), so
PostHog calls now flow through the docs host and the underlying
hostname is invisible to ad blockers. With nothing to suppress, the
mask only hid real errors that mention "posthog". Three concrete
problems on top of the dead-code framing:

- Substring match on "posthog" swallows unrelated messages.
- isInitializedRef.current only guards the same component instance,
  so HMR or StrictMode remounts re-capture the already-patched
  console.error and layer wrappers on each remount.
- originalLog is captured but console.log is never patched.

Resolves PDX-112.
2026-05-06 15:33:15 -07:00
Sam Julien 68c997b066 refactor(shell-docs): align analytics surface with upstream LCP trim
Mirrors upstream #4646 in two changes from the same PR:

- Drop the duplicate useRB2B hook in favor of the canonical
  <Script id="reb2b-script"> in app/layout.tsx (gated on REB2B_KEY).
  Env var renames from NEXT_PUBLIC_RB2B_ID (the hook's name) to
  NEXT_PUBLIC_REB2B_KEY (upstream's canonical name) — deployment
  ops will need updating.
- Set capture_dead_clicks: false on PostHog init so the
  dead-clicks-autocapture.js bundle isn't pulled in on the critical
  path.
2026-05-06 15:32:33 -07:00
Sam Julien e1b3e363fa feat(shell-docs): track CLI command copies via global writeText hook
Mirrors upstream #4643 + #4646 follow-ups. New trackCommandCopy helper
infers install_type from the leading token (covers npx/pnpm/pip/uv/
docker/curl/brew/helm/kubectl/make/bash/sh, falls back to "code"), and
the CopyTracker provider monkey-patches navigator.clipboard.writeText
once at app boot so every programmatic copy fires cli_command_copied
without per-component instrumentation. Preserves upstream's chained-
wrapper pattern so it coexists with Reo's writeText patch.

Final event shape is { install_type, location? } — the command body
and product props from the original draft were dropped upstream
(commit 0b7b3c77c) before merge.
2026-05-06 15:32:33 -07:00
Sam Julien bda35a3d33 feat(shell-docs): add Talk to Our Engineers nav button
Adds a Talk to Our Engineers CTA to the right side of the docs nav at
viewports >= 1400px and surfaces it in the mobile burger menu below
that. Fires posthog talk_to_us_clicked with { location: "docs_nav" }
on click, then navigates to copilotkit.ai/contact-us. Mirrors the
event the docs/ navbar fires so docs-originated clicks can be
segmented separately from website clicks (which use "nav").
2026-05-06 15:32:33 -07:00
Sam Julien 4bbe4dccdf feat(shell-docs): reverse-proxy PostHog through /ingest
Routes PostHog analytics through /ingest/* (rewrites to eu.i.posthog.com)
so requests bypass ad blockers and tracking-protection that target the
*.i.posthog.com hostname directly. Hardcodes POSTHOG_HOST = "/ingest"
in the provider, points ui_host at https://eu.posthog.com so PostHog UI
links still resolve, and excludes /ingest from the middleware matcher
so the proxy itself doesn't fire phantom pageviews. Mirrors the same
fix in docs/.
2026-05-06 15:32:33 -07:00
Sam Julien b4ce5f63be refactor(shell-docs): rewrite internal docs.copilotkit.ai links to relative paths
Sweeps 30 hardcoded https://docs.copilotkit.ai/* self-references across
15 mdx files in src/content/ to relative paths so they don't redirect-loop
once docs.copilotkit.ai cuts over to shell-docs.
2026-05-06 15:32:32 -07:00
Sam Julien d7e4f32e0f feat(shell-docs): cloud CTA in brand nav with try_for_free_clicked tracking
Adds a Free Developer Access CTA to the brand nav (desktop + mobile
menu) that points at dashboard.operations.copilotkit.ai with UTM tags
and fires try_for_free_clicked with { location } on click.
Distinguishes docs_navbar (desktop) from docs_navbar_mobile so the
funnel can split the two layouts.

Also adds the LinkToCopilotCloud component for use by MDX content
references that deep-link into Copilot Cloud — those remain on
cloud.copilotkit.ai.
2026-05-06 15:32:32 -07:00