Phase 1: Refactor all 16 element component interfaces to use MCP SDK types
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>
This commit is contained in:
parent
f9a1aa4e3c
commit
2d4fca4fa6
1 changed files with 905 additions and 648 deletions
|
|
@ -11,77 +11,66 @@ type Story = StoryObj<typeof ContentViewer>;
|
|||
|
||||
export const PlainText: Story = {
|
||||
args: {
|
||||
type: "text",
|
||||
content: "Hello, world!\nThis is plain text.",
|
||||
block: { type: "text", text: "Hello, world!\nThis is plain text." },
|
||||
},
|
||||
};
|
||||
|
||||
export const JsonContent: Story = {
|
||||
args: {
|
||||
type: "json",
|
||||
content:
|
||||
'{"name":"my-app","version":"1.0.0","description":"Sample configuration file"}',
|
||||
block: {
|
||||
type: "text",
|
||||
text: '{"name":"my-app","version":"1.0.0","description":"Sample configuration file"}',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const ImagePreview: Story = {
|
||||
args: {
|
||||
type: "image",
|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CYF5BMK8gmFcQzCsI5hUE8wqCeYNJe5EtXkEwryCYVxDMKwjmFQTzCoJ5BcG8gmBeQTDvBaFNwZ0T5gfxAAAAAElFTkSuQmCC",
|
||||
mimeType: "image/png",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const LongContent: Story = {
|
||||
export const LongJson: Story = {
|
||||
args: {
|
||||
type: "json",
|
||||
content: JSON.stringify({
|
||||
name: "my-app",
|
||||
version: "2.5.0",
|
||||
description: "A comprehensive application configuration",
|
||||
author: "Inspector Team",
|
||||
license: "MIT",
|
||||
repository: "https://github.com/example/my-app",
|
||||
dependencies: {
|
||||
react: "^18.0.0",
|
||||
typescript: "^5.0.0",
|
||||
mantine: "^7.0.0",
|
||||
},
|
||||
devDependencies: {
|
||||
vitest: "^1.0.0",
|
||||
storybook: "^8.0.0",
|
||||
eslint: "^9.0.0",
|
||||
},
|
||||
scripts: {
|
||||
dev: "vite",
|
||||
build: "tsc && vite build",
|
||||
test: "vitest",
|
||||
lint: "eslint .",
|
||||
},
|
||||
settings: {
|
||||
theme: "dark",
|
||||
language: "en",
|
||||
notifications: true,
|
||||
maxRetries: 3,
|
||||
},
|
||||
}),
|
||||
block: {
|
||||
type: "text",
|
||||
text: JSON.stringify({
|
||||
name: "my-app",
|
||||
version: "2.5.0",
|
||||
description: "A comprehensive application configuration",
|
||||
dependencies: {
|
||||
react: "^18.0.0",
|
||||
typescript: "^5.0.0",
|
||||
},
|
||||
scripts: {
|
||||
dev: "vite",
|
||||
build: "tsc && vite build",
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const WithCopyButton: Story = {
|
||||
args: {
|
||||
type: "text",
|
||||
content: "Hello, world!\nThis text can be copied.",
|
||||
block: {
|
||||
type: "text",
|
||||
text: "Hello, world!\nThis text can be copied.",
|
||||
},
|
||||
copyable: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const JsonWithCopy: Story = {
|
||||
args: {
|
||||
type: "json",
|
||||
content:
|
||||
'{"name":"my-app","version":"1.0.0","description":"Sample configuration file"}',
|
||||
block: {
|
||||
type: "text",
|
||||
text: '{"name":"my-app","version":"1.0.0","description":"Sample configuration file"}',
|
||||
},
|
||||
copyable: true,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue