Skip to content

Commit 025c9a2

Browse files
committed
chore(blitz): merge F13 into integration
2 parents bb961b6 + 6ac9a4f commit 025c9a2

81 files changed

Lines changed: 6875 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

showcase/integrations/mastra/manifest.yaml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ features:
5151
- auth
5252
- shared-state-read-write
5353
- subagents
54+
- beautiful-chat
55+
- byoc-hashbrown
56+
- byoc-json-render
57+
- multimodal
58+
- open-gen-ui
59+
- open-gen-ui-advanced
60+
- voice
61+
- gen-ui-tool-based
62+
- hitl
63+
- hitl-in-chat-booking
64+
- mcp-apps
65+
- tool-rendering-reasoning-chain
66+
not_supported_features:
67+
- gen-ui-interrupt
68+
- interrupt-headless
5469
demos:
5570
- id: cli-start
5671
name: CLI Start Command
@@ -356,3 +371,133 @@ demos:
356371
- src/app/demos/subagents/page.tsx
357372
- src/app/demos/subagents/delegation-log.tsx
358373
- src/app/api/copilotkit/route.ts
374+
- id: beautiful-chat
375+
name: Beautiful Chat (Flagship)
376+
description: Flagship CopilotKit showcase combining A2UI, Open Generative UI, and MCP Apps in one cell
377+
tags:
378+
- chat-ui
379+
- generative-ui
380+
route: /demos/beautiful-chat
381+
animated_preview_url:
382+
highlight:
383+
- src/app/demos/beautiful-chat/page.tsx
384+
- src/app/api/copilotkit-beautiful-chat/route.ts
385+
- id: byoc-hashbrown
386+
name: BYOC — Hashbrown
387+
description: Bring-your-own-component dashboard rendered via @hashbrownai/react useUiKit + useJsonParser
388+
tags:
389+
- generative-ui
390+
route: /demos/byoc-hashbrown
391+
animated_preview_url:
392+
highlight:
393+
- src/app/demos/byoc-hashbrown/page.tsx
394+
- src/app/api/copilotkit-byoc-hashbrown/route.ts
395+
- id: byoc-json-render
396+
name: BYOC — JSON Render
397+
description: Bring-your-own-component dashboard rendered from a streamed JSON envelope into a frontend-owned catalog
398+
tags:
399+
- generative-ui
400+
route: /demos/byoc-json-render
401+
animated_preview_url:
402+
highlight:
403+
- src/app/demos/byoc-json-render/page.tsx
404+
- src/app/api/copilotkit-byoc-json-render/route.ts
405+
- id: multimodal
406+
name: Multimodal Attachments
407+
description: Image + PDF uploads forwarded to a vision-capable Mastra agent (gpt-4o)
408+
tags:
409+
- chat-ui
410+
route: /demos/multimodal
411+
animated_preview_url:
412+
highlight:
413+
- src/mastra/agents/index.ts
414+
- src/app/demos/multimodal/page.tsx
415+
- src/app/api/copilotkit-multimodal/route.ts
416+
- id: open-gen-ui
417+
name: Open Generative UI
418+
description: Agent-authored HTML + CSS streamed into a sandboxed iframe via the runtime's openGenerativeUI flag
419+
tags:
420+
- generative-ui
421+
route: /demos/open-gen-ui
422+
animated_preview_url:
423+
highlight:
424+
- src/app/demos/open-gen-ui/page.tsx
425+
- src/app/api/copilotkit-ogui/route.ts
426+
- id: open-gen-ui-advanced
427+
name: Open Generative UI (Advanced)
428+
description: Open Generative UI with host-side sandbox functions wired through the iframe bridge
429+
tags:
430+
- generative-ui
431+
route: /demos/open-gen-ui-advanced
432+
animated_preview_url:
433+
highlight:
434+
- src/app/demos/open-gen-ui-advanced/page.tsx
435+
- src/app/demos/open-gen-ui-advanced/sandbox-functions.ts
436+
- src/app/api/copilotkit-ogui/route.ts
437+
- id: voice
438+
name: Voice Input
439+
description: Mic-to-text input via OpenAI Whisper, streamed into the chat composer
440+
tags:
441+
- chat-ui
442+
route: /demos/voice
443+
animated_preview_url:
444+
highlight:
445+
- src/app/demos/voice/page.tsx
446+
- src/app/demos/voice/sample-audio-button.tsx
447+
- src/app/api/copilotkit-voice/[[...slug]]/route.ts
448+
- id: gen-ui-tool-based
449+
name: Tool-Based Generative UI
450+
description: Agent uses a frontend tool to trigger rich generative UI inline in the chat
451+
tags:
452+
- generative-ui
453+
route: /demos/gen-ui-tool-based
454+
animated_preview_url:
455+
highlight:
456+
- src/app/demos/gen-ui-tool-based/page.tsx
457+
- src/app/api/copilotkit/route.ts
458+
- id: hitl
459+
name: Human in the Loop (Step Selection)
460+
description: Step-selection HITL surface rendered inline via `useHumanInTheLoop` (the LangGraph-specific `useLangGraphInterrupt` branch is a no-op on Mastra)
461+
tags:
462+
- interactivity
463+
route: /demos/hitl
464+
animated_preview_url:
465+
highlight:
466+
- src/app/demos/hitl/page.tsx
467+
- src/app/api/copilotkit/route.ts
468+
- id: hitl-in-chat-booking
469+
name: In-Chat HITL (Booking)
470+
description: Time-picker card rendered inline via useHumanInTheLoop for a booking flow (alias of hitl-in-chat)
471+
tags:
472+
- interactivity
473+
route: /demos/hitl-in-chat
474+
animated_preview_url:
475+
highlight:
476+
- src/app/demos/hitl-in-chat/page.tsx
477+
- src/app/demos/hitl-in-chat/time-picker-card.tsx
478+
- src/app/api/copilotkit/route.ts
479+
- id: mcp-apps
480+
name: MCP Apps
481+
description: MCP server-driven UI rendered inline via the runtime's mcpApps config and the built-in activity renderer
482+
tags:
483+
- generative-ui
484+
route: /demos/mcp-apps
485+
animated_preview_url:
486+
highlight:
487+
- src/mastra/agents/index.ts
488+
- src/app/demos/mcp-apps/page.tsx
489+
- src/app/api/copilotkit-mcp-apps/route.ts
490+
- id: tool-rendering-reasoning-chain
491+
name: Tool Rendering + Reasoning Chain
492+
description: Sequential tool calls rendered with per-tool components plus a reasoning chain rendered inline via a custom reasoningMessage slot
493+
tags:
494+
- generative-ui
495+
route: /demos/tool-rendering-reasoning-chain
496+
animated_preview_url:
497+
highlight:
498+
- src/app/demos/tool-rendering-reasoning-chain/page.tsx
499+
- src/app/demos/tool-rendering-reasoning-chain/reasoning-block.tsx
500+
- src/app/demos/tool-rendering-reasoning-chain/weather-card.tsx
501+
- src/app/demos/tool-rendering-reasoning-chain/flight-list-card.tsx
502+
- src/app/demos/tool-rendering-reasoning-chain/custom-catchall-renderer.tsx
503+
- src/app/api/copilotkit/route.ts
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Voice demo audio
2+
3+
Drop a small (<100KB) WAV file named `sample.wav` in this directory. The voice
4+
demo (`/demos/voice`) fetches it client-side and POSTs to the transcription
5+
endpoint so the flow works without mic permissions.
6+
7+
Expected content: an audio clip speaking the phrase
8+
**"What is the weather in Tokyo?"** — the demo caption advertises that phrase
9+
to the user, and the bundled QA checklist + E2E spec assert the transcribed
10+
text contains "weather" and/or "Tokyo".
11+
12+
Generate locally, for example:
13+
14+
- macOS: `say -o sample.aiff "What is the weather in Tokyo?" && ffmpeg -i sample.aiff -ar 16000 -ac 1 sample.wav`
15+
- Linux: `espeak-ng -w sample.wav "What is the weather in Tokyo?"`
16+
- Windows: PowerShell `System.Speech.Synthesis.SpeechSynthesizer``SetOutputToWaveFile`
17+
18+
Target: 16kHz mono, 3-5s duration, <100KB.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:bd4aa7b049f1c3e324dfd15af4068d7f8fbf2eae1dd044df270dddc5f38a5c57
3+
size 87078
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// Dedicated runtime for the Beautiful Chat flagship showcase cell (Mastra).
2+
//
3+
// Beautiful Chat simultaneously exercises A2UI (dynamic + fixed schema),
4+
// Open Generative UI, and MCP Apps. This route enables all three flags on
5+
// a single runtime backing one shared Mastra agent — keeping these global
6+
// runtime flags scoped to the flagship cell so other demos sharing the
7+
// main `/api/copilotkit` endpoint preserve their per-demo
8+
// `useFrontendTool` / `useComponent` registrations.
9+
10+
import { NextRequest, NextResponse } from "next/server";
11+
import {
12+
CopilotRuntime,
13+
ExperimentalEmptyAdapter,
14+
copilotRuntimeNextJSAppRouterEndpoint,
15+
} from "@copilotkit/runtime";
16+
import { getLocalAgent } from "@ag-ui/mastra";
17+
import { mastra } from "@/mastra";
18+
19+
const beautifulChatAgent = getLocalAgent({
20+
mastra,
21+
agentId: "weatherAgent",
22+
resourceId: "mastra-beautiful-chat",
23+
});
24+
25+
if (!beautifulChatAgent) {
26+
throw new Error(
27+
"getLocalAgent returned null for weatherAgent — required for /demos/beautiful-chat",
28+
);
29+
}
30+
31+
const runtime = new CopilotRuntime({
32+
// @ts-ignore -- see main route.ts
33+
agents: {
34+
"beautiful-chat": beautifulChatAgent,
35+
// Internal components call useAgent() with no args (defaults to "default").
36+
default: beautifulChatAgent,
37+
},
38+
openGenerativeUI: true,
39+
a2ui: {
40+
// weatherAgent already has its own `generate_a2ui` tool — don't double-bind.
41+
injectA2UITool: false,
42+
},
43+
mcpApps: {
44+
servers: [
45+
{
46+
type: "http",
47+
url: process.env.MCP_SERVER_URL || "https://mcp.excalidraw.com",
48+
serverId: "beautiful_chat_mcp",
49+
},
50+
],
51+
},
52+
});
53+
54+
export const POST = async (req: NextRequest) => {
55+
try {
56+
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
57+
endpoint: "/api/copilotkit-beautiful-chat",
58+
serviceAdapter: new ExperimentalEmptyAdapter(),
59+
runtime,
60+
});
61+
return await handleRequest(req);
62+
} catch (error: unknown) {
63+
const e = error as { message?: string; stack?: string };
64+
return NextResponse.json(
65+
{ error: e.message, stack: e.stack },
66+
{ status: 500 },
67+
);
68+
}
69+
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Dedicated runtime for the byoc-hashbrown demo (Mastra).
2+
//
3+
// The demo page wraps CopilotChat in the HashBrownDashboard provider and
4+
// overrides the assistant message slot with a renderer that consumes
5+
// hashbrown-shaped structured output via `@hashbrownai/react`'s `useUiKit`
6+
// + `useJsonParser`.
7+
//
8+
// In Mastra, the same shared weatherAgent backs this demo — the dashboard
9+
// shape is enforced entirely on the frontend by the catalog the renderer
10+
// consumes. For full parity (system prompt tuned to emit the dashboard
11+
// envelope), a dedicated Mastra agent could be wired here later.
12+
13+
import { NextRequest, NextResponse } from "next/server";
14+
import {
15+
CopilotRuntime,
16+
ExperimentalEmptyAdapter,
17+
copilotRuntimeNextJSAppRouterEndpoint,
18+
} from "@copilotkit/runtime";
19+
import { getLocalAgent } from "@ag-ui/mastra";
20+
import { mastra } from "@/mastra";
21+
22+
const byocHashbrownAgent = getLocalAgent({
23+
mastra,
24+
agentId: "weatherAgent",
25+
resourceId: "mastra-byoc-hashbrown",
26+
});
27+
28+
if (!byocHashbrownAgent) {
29+
throw new Error(
30+
"getLocalAgent returned null for weatherAgent — required for /demos/byoc-hashbrown",
31+
);
32+
}
33+
34+
const runtime = new CopilotRuntime({
35+
// @ts-ignore -- see main route.ts
36+
agents: { "byoc-hashbrown-demo": byocHashbrownAgent },
37+
});
38+
39+
export const POST = async (req: NextRequest) => {
40+
try {
41+
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
42+
endpoint: "/api/copilotkit-byoc-hashbrown",
43+
serviceAdapter: new ExperimentalEmptyAdapter(),
44+
runtime,
45+
});
46+
return await handleRequest(req);
47+
} catch (error: unknown) {
48+
const e = error as { message?: string; stack?: string };
49+
return NextResponse.json(
50+
{ error: e.message, stack: e.stack },
51+
{ status: 500 },
52+
);
53+
}
54+
};
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Dedicated runtime for the byoc-json-render demo (Mastra).
2+
//
3+
// The demo page renders streaming JSON from the agent into a frontend-owned
4+
// component catalog. In the langgraph-python integration, a dedicated
5+
// `byoc_json_render` LangGraph graph emits the JSON envelope; for the
6+
// Mastra port we reuse the shared weatherAgent — the dashboard shape is
7+
// enforced entirely on the frontend by the catalog and the renderer.
8+
9+
import { NextRequest, NextResponse } from "next/server";
10+
import {
11+
CopilotRuntime,
12+
ExperimentalEmptyAdapter,
13+
copilotRuntimeNextJSAppRouterEndpoint,
14+
} from "@copilotkit/runtime";
15+
import { getLocalAgent } from "@ag-ui/mastra";
16+
import { mastra } from "@/mastra";
17+
18+
const byocJsonRenderAgent = getLocalAgent({
19+
mastra,
20+
agentId: "weatherAgent",
21+
resourceId: "mastra-byoc-json-render",
22+
});
23+
24+
if (!byocJsonRenderAgent) {
25+
throw new Error(
26+
"getLocalAgent returned null for weatherAgent — required for /demos/byoc-json-render",
27+
);
28+
}
29+
30+
const runtime = new CopilotRuntime({
31+
// @ts-ignore -- see main route.ts
32+
agents: { byoc_json_render: byocJsonRenderAgent },
33+
});
34+
35+
export const POST = async (req: NextRequest) => {
36+
try {
37+
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
38+
endpoint: "/api/copilotkit-byoc-json-render",
39+
serviceAdapter: new ExperimentalEmptyAdapter(),
40+
runtime,
41+
});
42+
return await handleRequest(req);
43+
} catch (error: unknown) {
44+
const e = error as { message?: string; stack?: string };
45+
return NextResponse.json(
46+
{ error: e.message, stack: e.stack },
47+
{ status: 500 },
48+
);
49+
}
50+
};

0 commit comments

Comments
 (0)