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
2 changed files with 905 additions and 648 deletions
|
|
@ -14,10 +14,10 @@ const meta: Meta<typeof TaskCard> = {
|
|||
export default meta;
|
||||
type Story = StoryObj<typeof TaskCard>;
|
||||
|
||||
export const Running: Story = {
|
||||
export const Working: Story = {
|
||||
args: {
|
||||
taskId: "d0b22eba71fa36229ce5c4dfadeaa7de",
|
||||
status: "running",
|
||||
status: "working",
|
||||
method: "tools/call",
|
||||
target: "generate_report",
|
||||
progress: 80,
|
||||
|
|
@ -28,10 +28,10 @@ export const Running: Story = {
|
|||
},
|
||||
};
|
||||
|
||||
export const Waiting: Story = {
|
||||
export const InputRequired: Story = {
|
||||
args: {
|
||||
taskId: "4100b5e0b0ed9cd0023330342d1bf647",
|
||||
status: "waiting",
|
||||
status: "input_required",
|
||||
method: "resources/read",
|
||||
target: "file:///data/report.csv",
|
||||
startedAt: "3/29/2026, 8:17:55 PM",
|
||||
|
|
@ -84,7 +84,7 @@ export const Cancelled: Story = {
|
|||
export const Collapsed: Story = {
|
||||
args: {
|
||||
taskId: "d0b22eba71fa36229ce5c4dfadeaa7de",
|
||||
status: "running",
|
||||
status: "working",
|
||||
method: "tools/call",
|
||||
target: "generate_report",
|
||||
progress: 80,
|
||||
|
|
|
|||
|
|
@ -12,12 +12,8 @@ import { ContentViewer } from "../../elements/ContentViewer/ContentViewer";
|
|||
import { ProgressDisplay } from "../../elements/ProgressDisplay/ProgressDisplay";
|
||||
import { TaskStatusBadge } from "../../elements/TaskStatusBadge/TaskStatusBadge";
|
||||
|
||||
export type TaskStatus =
|
||||
| "waiting"
|
||||
| "running"
|
||||
| "completed"
|
||||
| "failed"
|
||||
| "cancelled";
|
||||
import type { TaskStatus } from "@modelcontextprotocol/sdk/types.js";
|
||||
export type { TaskStatus };
|
||||
|
||||
export interface TaskCardProps {
|
||||
taskId: string;
|
||||
|
|
@ -146,7 +142,7 @@ export function TaskCard(props: TaskCardProps) {
|
|||
} = props;
|
||||
|
||||
const [isExpanded, setIsExpanded] = useState(isListExpanded);
|
||||
const isActive = status === "waiting" || status === "running";
|
||||
const isActive = status === "working" || status === "input_required";
|
||||
|
||||
useEffect(() => {
|
||||
setIsExpanded(isListExpanded);
|
||||
|
|
@ -200,8 +196,11 @@ export function TaskCard(props: TaskCardProps) {
|
|||
|
||||
{progress !== undefined && isActive && (
|
||||
<ProgressDisplay
|
||||
progress={progress}
|
||||
description={progressDescription}
|
||||
params={{
|
||||
progressToken: taskId,
|
||||
progress,
|
||||
message: progressDescription,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
|
@ -225,8 +224,7 @@ export function TaskCard(props: TaskCardProps) {
|
|||
<Divider />
|
||||
<SectionTitle>Full Task Object</SectionTitle>
|
||||
<ContentViewer
|
||||
type="json"
|
||||
content={buildTaskObject(props)}
|
||||
block={{ type: "text", text: buildTaskObject(props) }}
|
||||
copyable
|
||||
/>
|
||||
</Stack>
|
||||
|
|
|
|||
Loading…
Reference in a new issue