Replace ad-hoc local type definitions in element components with real
MCP SDK types and Inspector wrapper types from core/mcp/types.ts:
Schema-typed primitives:
- LogLevelBadge: LogLevel → LoggingLevel (SDK)
- TransportBadge: "stdio"|"http" → ServerType (core), add sse/streamable-http
- TaskStatusBadge: local TaskStatus → SDK TaskStatus (working/input_required/...)
- ServerStatusIndicator: inline union → ConnectionStatus (core), "failed"→"error"
MCP wrapper consumers:
- AnnotationBadge: label+variant → facet+value with SDK Role type
- CapabilityItem: name:string → capability:keyof ServerCapabilities|ClientCapabilities
- LogEntry: flat props → entry:{receivedAt:Date, params:LoggingMessageNotification["params"]}
- MessageBubble: flat props → message:SamplingMessage|PromptMessage
- ProgressDisplay: flat props → params:ProgressNotification["params"]
Composite-input elements:
- ContentViewer: type+content+mimeType → block:ContentBlock (SDK discriminated union)
- InlineError: message+details → error:{message,data?}
- ConnectionToggle: checked+loading+onChange → status:ConnectionStatus+onConnect/onDisconnect
Also updates all group/screen/view consumers to keep the build green,
and renames CSS variable --inspector-status-failed → --inspector-status-error.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
import { MessageBubble } from "./MessageBubble";
|
|
|
|
const meta: Meta<typeof MessageBubble> = {
|
|
title: "Elements/MessageBubble",
|
|
component: MessageBubble,
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof MessageBubble>;
|
|
|
|
export const UserText: Story = {
|
|
args: {
|
|
index: 0,
|
|
message: {
|
|
role: "user",
|
|
content: { type: "text", text: "Hello, my name is John and I like cats" },
|
|
},
|
|
},
|
|
};
|
|
|
|
export const AssistantText: Story = {
|
|
args: {
|
|
index: 1,
|
|
message: {
|
|
role: "assistant",
|
|
content: {
|
|
type: "text",
|
|
text: "Nice to meet you, John! It's wonderful that you enjoy cats. They're such fascinating and independent creatures. Do you have any cats of your own?",
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
export const UserWithImage: Story = {
|
|
args: {
|
|
index: 0,
|
|
message: {
|
|
role: "user",
|
|
content: [
|
|
{ type: "text", text: "Check this out" },
|
|
{
|
|
type: "image",
|
|
data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
|
|
mimeType: "image/png",
|
|
},
|
|
],
|
|
},
|
|
},
|
|
};
|
|
|
|
export const LongMessage: Story = {
|
|
args: {
|
|
index: 0,
|
|
message: {
|
|
role: "user",
|
|
content: {
|
|
type: "text",
|
|
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
|
|
},
|
|
},
|
|
},
|
|
};
|