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
|
|
@ -10,10 +10,10 @@ import {
|
|||
Title,
|
||||
} from "@mantine/core";
|
||||
import { LogEntry } from "../../elements/LogEntry/LogEntry";
|
||||
import type { LogEntryProps } from "../../elements/LogEntry/LogEntry";
|
||||
import type { LogEntryData } from "../../elements/LogEntry/LogEntry";
|
||||
|
||||
export interface LogStreamPanelProps {
|
||||
entries: LogEntryProps[];
|
||||
entries: LogEntryData[];
|
||||
filterText: string;
|
||||
visibleLevels: Record<string, boolean>;
|
||||
autoScroll: boolean;
|
||||
|
|
@ -41,16 +41,22 @@ const EmptyCenter = Stack.withProps({
|
|||
justify: "center",
|
||||
});
|
||||
|
||||
function formatData(data: unknown): string {
|
||||
if (data === undefined || data === null) return "";
|
||||
if (typeof data === "string") return data;
|
||||
return JSON.stringify(data);
|
||||
}
|
||||
|
||||
function matchesFilters(
|
||||
entry: LogEntryProps,
|
||||
entry: LogEntryData,
|
||||
filterText: string,
|
||||
visibleLevels: Record<string, boolean>,
|
||||
): boolean {
|
||||
if (!visibleLevels[entry.level]) return false;
|
||||
if (!visibleLevels[entry.params.level]) return false;
|
||||
if (filterText) {
|
||||
const term = filterText.toLowerCase();
|
||||
const searchable =
|
||||
`${entry.message} ${entry.logger ?? ""} ${entry.level}`.toLowerCase();
|
||||
`${formatData(entry.params.data)} ${entry.params.logger ?? ""} ${entry.params.level}`.toLowerCase();
|
||||
if (!searchable.includes(term)) return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -90,7 +96,7 @@ export function LogStreamPanel({
|
|||
<ScrollArea.Autosize mah="calc(100vh - var(--app-shell-header-height, 0px) - 150px)">
|
||||
<Stack gap="xs">
|
||||
{filteredEntries.map((entry, index) => (
|
||||
<LogEntry key={index} {...entry} />
|
||||
<LogEntry key={index} entry={entry} />
|
||||
))}
|
||||
</Stack>
|
||||
</ScrollArea.Autosize>
|
||||
|
|
|
|||
Loading…
Reference in a new issue