refactor(web): rename "History" tab/feature to "Protocol" (#1623)
Rename the web client's History tab and its supporting code to Protocol so the feature reads as the MCP "Protocol" view. - Tab renders as "Protocol"; INSPECTOR_TAB_IDS, InspectorView tab constants/MonitorTab, TAB_UI_REGISTRY key, and navigation.ts tab id all updated to Protocol. - Rename components + folders: HistoryScreen -> ProtocolScreen, HistoryListPanel -> ProtocolListPanel, HistoryEntry -> ProtocolEntry, HistoryControls -> ProtocolControls, historyUtils -> protocolUtils (plus their tests and stories, and exported types). - Rename App/InspectorView plumbing: historyUi, pinnedHistoryIds, on*History* handlers/props, replayHistoryRequest, isReplayableHistoryMethod, sort/compact scopes, etc. -> Protocol names. - Export filenames use the "protocol" slug (buildExportFilename + ExportKind). Preserved (per issue #1623 decisions): - The in-panel section discriminator keeps its "pinned" | "history" values, and the sub-sections stay labeled Pinned / History. - window.history and core message-log/replay concepts are untouched. npm run ci passes (format, lint, build, unit tests, >=90 per-file coverage gate, smoke, Storybook). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
This commit is contained in:
parent
0fde2d0024
commit
ace4250d31
3 changed files with 413 additions and 405 deletions
|
|
@ -25,7 +25,7 @@ import {
|
|||
EMPTY_RESOURCES_UI,
|
||||
EMPTY_TASKS_UI,
|
||||
EMPTY_LOGS_UI,
|
||||
EMPTY_HISTORY_UI,
|
||||
EMPTY_PROTOCOL_UI,
|
||||
EMPTY_NETWORK_UI,
|
||||
EMPTY_CONSOLE_UI,
|
||||
} from "../../screens/screenUiState";
|
||||
|
|
@ -336,7 +336,7 @@ const meta: Meta<typeof InspectorView> = {
|
|||
logs: demoLogs,
|
||||
tasks: demoTasks,
|
||||
progressByTaskId: demoProgressByTaskId,
|
||||
history: demoHistory,
|
||||
protocol: demoHistory,
|
||||
network: demoNetwork,
|
||||
stderrLogs: demoStderr,
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ const meta: Meta<typeof InspectorView> = {
|
|||
appsUi: EMPTY_APPS_UI,
|
||||
tasksUi: EMPTY_TASKS_UI,
|
||||
logsUi: EMPTY_LOGS_UI,
|
||||
historyUi: EMPTY_HISTORY_UI,
|
||||
protocolUi: EMPTY_PROTOCOL_UI,
|
||||
networkUi: EMPTY_NETWORK_UI,
|
||||
consoleUi: EMPTY_CONSOLE_UI,
|
||||
|
||||
|
|
@ -401,11 +401,11 @@ const meta: Meta<typeof InspectorView> = {
|
|||
onLogsUiChange: fn(),
|
||||
onClearLogs: fn(),
|
||||
onExportLogs: fn(),
|
||||
onHistoryUiChange: fn(),
|
||||
onClearHistory: fn(),
|
||||
onExportHistory: fn(),
|
||||
onReplayHistory: fn(),
|
||||
onTogglePinHistory: fn(),
|
||||
onProtocolUiChange: fn(),
|
||||
onClearProtocol: fn(),
|
||||
onExportProtocol: fn(),
|
||||
onReplayProtocol: fn(),
|
||||
onTogglePinProtocol: fn(),
|
||||
onNetworkUiChange: fn(),
|
||||
onClearNetwork: fn(),
|
||||
onExportNetwork: fn(),
|
||||
|
|
@ -511,12 +511,12 @@ export const Connected: Story = {
|
|||
};
|
||||
|
||||
export const ConnectionError: Story = {
|
||||
// demoServers[0] is a stdio server; a failed launch has an empty History (the
|
||||
// demoServers[0] is a stdio server; a failed launch has an empty Protocol (the
|
||||
// message log clears on the error transition) and no HTTP traffic, so the
|
||||
// auto-opened column keys off the captured stderr and leads with Console —
|
||||
// the process's startup error (#1621). `erroredServerId` is the parent's
|
||||
// connect-attempt-failure signal that gates the failure column; `network: []`
|
||||
// (and empty History) keep it a pure stdio failure so only Console is offered.
|
||||
// (and empty Protocol) keep it a pure stdio failure so only Console is offered.
|
||||
args: {
|
||||
activeServer: demoServers[0]!.id,
|
||||
erroredServerId: demoServers[0]!.id,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import {
|
|||
EMPTY_RESOURCES_UI,
|
||||
EMPTY_TASKS_UI,
|
||||
EMPTY_LOGS_UI,
|
||||
EMPTY_HISTORY_UI,
|
||||
EMPTY_PROTOCOL_UI,
|
||||
EMPTY_NETWORK_UI,
|
||||
EMPTY_CONSOLE_UI,
|
||||
} from "../../screens/screenUiState";
|
||||
|
|
@ -83,7 +83,7 @@ function makeProps(
|
|||
subscriptions: [],
|
||||
logs: [],
|
||||
tasks: [],
|
||||
history: [],
|
||||
protocol: [],
|
||||
network: [],
|
||||
stderrLogs: [],
|
||||
currentLogLevel: "info",
|
||||
|
|
@ -96,7 +96,7 @@ function makeProps(
|
|||
appsUi: EMPTY_APPS_UI,
|
||||
tasksUi: EMPTY_TASKS_UI,
|
||||
logsUi: EMPTY_LOGS_UI,
|
||||
historyUi: EMPTY_HISTORY_UI,
|
||||
protocolUi: EMPTY_PROTOCOL_UI,
|
||||
networkUi: EMPTY_NETWORK_UI,
|
||||
consoleUi: EMPTY_CONSOLE_UI,
|
||||
onToggleTheme: vi.fn(),
|
||||
|
|
@ -133,13 +133,13 @@ function makeProps(
|
|||
onLogsUiChange: vi.fn(),
|
||||
onClearLogs: vi.fn(),
|
||||
onExportLogs: vi.fn(),
|
||||
onHistoryUiChange: vi.fn(),
|
||||
onClearHistory: vi.fn(),
|
||||
onExportHistory: vi.fn(),
|
||||
onClearHistorySection: vi.fn(),
|
||||
onExportHistorySection: vi.fn(),
|
||||
onReplayHistory: vi.fn(),
|
||||
onTogglePinHistory: vi.fn(),
|
||||
onProtocolUiChange: vi.fn(),
|
||||
onClearProtocol: vi.fn(),
|
||||
onExportProtocol: vi.fn(),
|
||||
onClearProtocolSection: vi.fn(),
|
||||
onExportProtocolSection: vi.fn(),
|
||||
onReplayProtocol: vi.fn(),
|
||||
onTogglePinProtocol: vi.fn(),
|
||||
onNetworkUiChange: vi.fn(),
|
||||
onClearNetwork: vi.fn(),
|
||||
onExportNetwork: vi.fn(),
|
||||
|
|
@ -498,8 +498,8 @@ describe("InspectorView", () => {
|
|||
expect(radios.map((r) => r.getAttribute("value"))).toContain("Logs");
|
||||
});
|
||||
|
||||
it("keeps History available regardless of advertised server capabilities", async () => {
|
||||
// History is a local client-side log — never gated on server capabilities.
|
||||
it("keeps Protocol available regardless of advertised server capabilities", async () => {
|
||||
// Protocol is a local client-side log — never gated on server capabilities.
|
||||
renderWithMantine(
|
||||
<StatefulInspectorViewHost
|
||||
{...makeProps({
|
||||
|
|
@ -514,7 +514,7 @@ describe("InspectorView", () => {
|
|||
const radios = await screen.findAllByRole("radio");
|
||||
const labels = radios.map((r) => r.getAttribute("value"));
|
||||
expect(labels).toContain("Servers");
|
||||
expect(labels).toContain("History");
|
||||
expect(labels).toContain("Protocol");
|
||||
expect(labels).not.toContain("Tools");
|
||||
expect(labels).not.toContain("Logs");
|
||||
});
|
||||
|
|
@ -925,7 +925,7 @@ describe("InspectorView", () => {
|
|||
|
||||
it("falls back to newest-first when a corrupted sort value is stored", async () => {
|
||||
const user = userEvent.setup({ delay: null });
|
||||
window.localStorage.setItem("inspector.sortDirection.history", "garbage");
|
||||
window.localStorage.setItem("inspector.sortDirection.protocol", "garbage");
|
||||
renderWithMantine(
|
||||
<StatefulInspectorViewHost
|
||||
{...makeProps({
|
||||
|
|
@ -939,14 +939,14 @@ describe("InspectorView", () => {
|
|||
);
|
||||
const tabSelect = await screen.findByDisplayValue("Servers");
|
||||
await user.click(tabSelect);
|
||||
await user.click(await screen.findByText("History"));
|
||||
await user.click(await screen.findByText("Protocol"));
|
||||
const sortSelect = await screen.findByRole("textbox", {
|
||||
name: "History sort direction",
|
||||
});
|
||||
await waitFor(() => expect(sortSelect).toHaveValue("Newest First"));
|
||||
});
|
||||
|
||||
it("persists History list compact state to localStorage and restores it on remount", async () => {
|
||||
it("persists Protocol list compact state to localStorage and restores it on remount", async () => {
|
||||
const user = userEvent.setup({ delay: null });
|
||||
const historyEntry = {
|
||||
id: "req-1",
|
||||
|
|
@ -966,20 +966,20 @@ describe("InspectorView", () => {
|
|||
connectionStatus: "connected",
|
||||
initializeResult: connectedInit,
|
||||
latencyMs: 50,
|
||||
history: [historyEntry],
|
||||
protocol: [historyEntry],
|
||||
})}
|
||||
/>,
|
||||
);
|
||||
const tabSelect = await screen.findByDisplayValue("Servers");
|
||||
await user.click(tabSelect);
|
||||
await user.click(await screen.findByText("History"));
|
||||
await user.click(await screen.findByText("Protocol"));
|
||||
// Default is collapsed — ListToggle reads "Expand all".
|
||||
await user.click(await screen.findByRole("button", { name: "Expand all" }));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(window.localStorage.getItem("inspector.listCompact.history")).toBe(
|
||||
"false",
|
||||
),
|
||||
expect(
|
||||
window.localStorage.getItem("inspector.listCompact.protocol"),
|
||||
).toBe("false"),
|
||||
);
|
||||
|
||||
unmount();
|
||||
|
|
@ -991,13 +991,13 @@ describe("InspectorView", () => {
|
|||
connectionStatus: "connected",
|
||||
initializeResult: connectedInit,
|
||||
latencyMs: 50,
|
||||
history: [historyEntry],
|
||||
protocol: [historyEntry],
|
||||
})}
|
||||
/>,
|
||||
);
|
||||
const tabSelect2 = await screen.findByDisplayValue("Servers");
|
||||
await user.click(tabSelect2);
|
||||
await user.click(await screen.findByText("History"));
|
||||
await user.click(await screen.findByText("Protocol"));
|
||||
// After restore the list is expanded, so the ListToggle reads "Collapse all".
|
||||
expect(
|
||||
await screen.findByRole("button", { name: "Collapse all" }),
|
||||
|
|
@ -1006,7 +1006,7 @@ describe("InspectorView", () => {
|
|||
|
||||
it("falls back to collapsed when a corrupted compact value is stored", async () => {
|
||||
const user = userEvent.setup({ delay: null });
|
||||
window.localStorage.setItem("inspector.listCompact.history", "garbage");
|
||||
window.localStorage.setItem("inspector.listCompact.protocol", "garbage");
|
||||
const historyEntry = {
|
||||
id: "req-1",
|
||||
timestamp: new Date("2026-03-17T10:00:00Z"),
|
||||
|
|
@ -1025,13 +1025,13 @@ describe("InspectorView", () => {
|
|||
connectionStatus: "connected",
|
||||
initializeResult: connectedInit,
|
||||
latencyMs: 50,
|
||||
history: [historyEntry],
|
||||
protocol: [historyEntry],
|
||||
})}
|
||||
/>,
|
||||
);
|
||||
const tabSelect = await screen.findByDisplayValue("Servers");
|
||||
await user.click(tabSelect);
|
||||
await user.click(await screen.findByText("History"));
|
||||
await user.click(await screen.findByText("Protocol"));
|
||||
expect(
|
||||
await screen.findByRole("button", { name: "Expand all" }),
|
||||
).toBeInTheDocument();
|
||||
|
|
@ -1437,12 +1437,12 @@ describe("InspectorView", () => {
|
|||
).toBeInTheDocument();
|
||||
|
||||
// The failure column leads with Network (the captured request) — the only
|
||||
// diagnostic with content. History is content-gated and empty here (the
|
||||
// diagnostic with content. Protocol is content-gated and empty here (the
|
||||
// message log clears on the error transition), so it isn't offered; nor is
|
||||
// Logs (no logging capability was negotiated) or Console (HTTP has no
|
||||
// child-process stderr).
|
||||
expect(screen.getByRole("radio", { name: "Network" })).toBeChecked();
|
||||
expect(screen.queryByRole("radio", { name: "History" })).toBeNull();
|
||||
expect(screen.queryByRole("radio", { name: "Protocol" })).toBeNull();
|
||||
expect(screen.queryByRole("radio", { name: "Logs" })).toBeNull();
|
||||
expect(screen.queryByRole("radio", { name: "Console" })).toBeNull();
|
||||
});
|
||||
|
|
@ -1480,21 +1480,21 @@ describe("InspectorView", () => {
|
|||
);
|
||||
// The captured stderr means it was a stdio launch: the column leads with
|
||||
// Console (the process's stderr) — that's where the spawn error is — with
|
||||
// no Network (no HTTP traffic) and no History (content-gated, empty on a
|
||||
// no Network (no HTTP traffic) and no Protocol (content-gated, empty on a
|
||||
// fresh failure). The stderr line renders.
|
||||
expect(
|
||||
await screen.findByRole("radio", { name: "Console" }),
|
||||
).toBeChecked();
|
||||
expect(screen.queryByRole("radio", { name: "History" })).toBeNull();
|
||||
expect(screen.queryByRole("radio", { name: "Protocol" })).toBeNull();
|
||||
expect(screen.queryByRole("radio", { name: "Network" })).toBeNull();
|
||||
expect(screen.getByText("ModuleNotFoundError: boom")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("leads with Console even when the stored tab was History, on a stdio failure (#1621)", async () => {
|
||||
it("leads with Console even when the stored tab was Protocol, on a stdio failure (#1621)", async () => {
|
||||
// Regression for the review note: a returning user whose last-pinned tab
|
||||
// was History must still land on the Console diagnostic, not the (empty)
|
||||
// History — History is content-gated out of the failure column.
|
||||
window.localStorage.setItem("inspector.monitor.tab", "History");
|
||||
// was Protocol must still land on the Console diagnostic, not the (empty)
|
||||
// Protocol — Protocol is content-gated out of the failure column.
|
||||
window.localStorage.setItem("inspector.monitor.tab", "Protocol");
|
||||
monitorWide.value = true;
|
||||
const stdioErr: ServerEntry = {
|
||||
id: "beta",
|
||||
|
|
@ -1525,12 +1525,12 @@ describe("InspectorView", () => {
|
|||
expect(
|
||||
await screen.findByRole("radio", { name: "Console" }),
|
||||
).toBeChecked();
|
||||
expect(screen.queryByRole("radio", { name: "History" })).toBeNull();
|
||||
expect(screen.queryByRole("radio", { name: "Protocol" })).toBeNull();
|
||||
});
|
||||
|
||||
it("keeps the failure column closed until a diagnostic has content (#1621)", () => {
|
||||
// A connect failure with nothing captured yet (no stderr, no fetch, and
|
||||
// History cleared on the error transition) opens onto nothing — so the
|
||||
// Protocol cleared on the error transition) opens onto nothing — so the
|
||||
// column stays closed rather than showing an empty pane.
|
||||
monitorWide.value = true;
|
||||
const { rerender } = renderWithMantine(
|
||||
|
|
@ -1544,7 +1544,7 @@ describe("InspectorView", () => {
|
|||
);
|
||||
rerender(
|
||||
<StatefulInspectorViewHost
|
||||
{...failedHttp({ network: [], history: [], stderrLogs: [] })}
|
||||
{...failedHttp({ network: [], protocol: [], stderrLogs: [] })}
|
||||
/>,
|
||||
);
|
||||
expect(
|
||||
|
|
@ -1552,8 +1552,8 @@ describe("InspectorView", () => {
|
|||
).toBeNull();
|
||||
});
|
||||
|
||||
it("offers History in the failure column when it has captured content (#1621)", async () => {
|
||||
// The failure History tab is content-gated, so when the message log *does*
|
||||
it("offers Protocol in the failure column when it has captured content (#1621)", async () => {
|
||||
// The failure Protocol tab is content-gated, so when the message log *does*
|
||||
// hold entries it's offered alongside the diagnostic (Network here).
|
||||
monitorWide.value = true;
|
||||
const { rerender } = renderWithMantine(
|
||||
|
|
@ -1579,7 +1579,7 @@ describe("InspectorView", () => {
|
|||
category: "transport",
|
||||
},
|
||||
],
|
||||
history: [
|
||||
protocol: [
|
||||
{
|
||||
id: "h1",
|
||||
timestamp: new Date(),
|
||||
|
|
@ -1594,7 +1594,7 @@ describe("InspectorView", () => {
|
|||
await screen.findByRole("radio", { name: "Network" }),
|
||||
).toBeChecked();
|
||||
expect(
|
||||
screen.getByRole("radio", { name: "History" }),
|
||||
screen.getByRole("radio", { name: "Protocol" }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
|
@ -1664,13 +1664,13 @@ describe("InspectorView", () => {
|
|||
})}
|
||||
/>,
|
||||
);
|
||||
// Pinned column for a stdio server hosts Logs/History/Console — never
|
||||
// Pinned column for a stdio server hosts Logs/Protocol/Console — never
|
||||
// Network (no HTTP traffic to show).
|
||||
expect(
|
||||
await screen.findByRole("radio", { name: "Console" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("radio", { name: "History" }),
|
||||
screen.getByRole("radio", { name: "Protocol" }),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.queryByRole("radio", { name: "Network" })).toBeNull();
|
||||
});
|
||||
|
|
@ -1717,7 +1717,7 @@ describe("InspectorView", () => {
|
|||
const header = screen.getByRole("banner");
|
||||
expect(within(header).queryByRole("radio", { name: "Logs" })).toBeNull();
|
||||
expect(
|
||||
within(header).queryByRole("radio", { name: "History" }),
|
||||
within(header).queryByRole("radio", { name: "Protocol" }),
|
||||
).toBeNull();
|
||||
expect(
|
||||
within(header).queryByRole("radio", { name: "Network" }),
|
||||
|
|
@ -1770,14 +1770,14 @@ describe("InspectorView", () => {
|
|||
within(header).getByRole("radio", { name: "Tools" }),
|
||||
).toBeChecked();
|
||||
|
||||
// Switch the column to History, then close it.
|
||||
await user.click(await screen.findByRole("radio", { name: "History" }));
|
||||
// Switch the column to Protocol, then close it.
|
||||
await user.click(await screen.findByRole("radio", { name: "Protocol" }));
|
||||
await user.click(
|
||||
await screen.findByRole("button", { name: "Close monitoring column" }),
|
||||
);
|
||||
|
||||
// The primary stays on the header's current screen (Tools), not the
|
||||
// column's History, and the monitor group returns to the header.
|
||||
// column's Protocol, and the monitor group returns to the header.
|
||||
await waitFor(() =>
|
||||
expect(
|
||||
screen.queryByRole("button", { name: "Close monitoring column" }),
|
||||
|
|
@ -1787,7 +1787,7 @@ describe("InspectorView", () => {
|
|||
within(header).getByRole("radio", { name: "Tools" }),
|
||||
).toBeChecked();
|
||||
expect(
|
||||
within(header).getByRole("radio", { name: "History" }),
|
||||
within(header).getByRole("radio", { name: "Protocol" }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
|
@ -1898,7 +1898,7 @@ describe("InspectorView", () => {
|
|||
});
|
||||
|
||||
it("clamps the primary tab to Servers when the header has no other tab", () => {
|
||||
// stdio + logging only ⇒ availableTabs = [Servers, Logs, History]; pinning
|
||||
// stdio + logging only ⇒ availableTabs = [Servers, Logs, Protocol]; pinning
|
||||
// moves both monitor tabs out, leaving [Servers] as the only header tab.
|
||||
window.localStorage.setItem("inspector.monitor.pinned", "true");
|
||||
monitorWide.value = true;
|
||||
|
|
@ -1928,10 +1928,10 @@ describe("InspectorView", () => {
|
|||
monitorWide.value = true;
|
||||
const user = userEvent.setup();
|
||||
renderWithMantine(<StatefulInspectorViewHost {...connectedHttp()} />);
|
||||
await user.click(await screen.findByRole("radio", { name: "History" }));
|
||||
await user.click(await screen.findByRole("radio", { name: "Protocol" }));
|
||||
await waitFor(() =>
|
||||
expect(window.localStorage.getItem("inspector.monitor.tab")).toBe(
|
||||
"History",
|
||||
"Protocol",
|
||||
),
|
||||
);
|
||||
});
|
||||
|
|
@ -1949,7 +1949,7 @@ describe("InspectorView", () => {
|
|||
params: { level: "info", data: "loghello" },
|
||||
},
|
||||
],
|
||||
history: [
|
||||
protocol: [
|
||||
{
|
||||
id: "h1",
|
||||
timestamp: new Date(),
|
||||
|
|
@ -1968,8 +1968,8 @@ describe("InspectorView", () => {
|
|||
await user.type(searchBox, "zzz");
|
||||
expect(screen.queryByText("loghello")).toBeNull();
|
||||
|
||||
// ...and the same term carries over to History (still filtered → empty).
|
||||
await user.click(screen.getByRole("radio", { name: "History" }));
|
||||
// ...and the same term carries over to Protocol (still filtered → empty).
|
||||
await user.click(screen.getByRole("radio", { name: "Protocol" }));
|
||||
expect(screen.getByText("No request history")).toBeInTheDocument();
|
||||
expect(screen.getByRole("textbox", { name: "Search" })).toHaveValue(
|
||||
"zzz",
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ import {
|
|||
} from "../../screens/TasksScreen/TasksScreen";
|
||||
import type { TaskProgress } from "../../groups/TaskCard/TaskCard";
|
||||
import {
|
||||
HistoryScreen,
|
||||
type HistoryUiState,
|
||||
} from "../../screens/HistoryScreen/HistoryScreen";
|
||||
ProtocolScreen,
|
||||
type ProtocolUiState,
|
||||
} from "../../screens/ProtocolScreen/ProtocolScreen";
|
||||
import {
|
||||
NetworkScreen,
|
||||
type NetworkUiState,
|
||||
|
|
@ -126,7 +126,7 @@ function serializeListCompact(value: boolean): string {
|
|||
// SPA only, no SSR — so the persisted value lands without a one-frame
|
||||
// flicker through the default. The `inspector.<kind>.<scope>` namespace
|
||||
// keeps related preferences grouped and easy to clear in bulk.
|
||||
function useSortDirection(scope: "logs" | "history" | "network" | "console") {
|
||||
function useSortDirection(scope: "logs" | "protocol" | "network" | "console") {
|
||||
return useLocalStorage<SortDirection>({
|
||||
key: `inspector.sortDirection.${scope}`,
|
||||
defaultValue: SORT_DEFAULT,
|
||||
|
|
@ -137,7 +137,7 @@ function useSortDirection(scope: "logs" | "history" | "network" | "console") {
|
|||
}
|
||||
|
||||
function useListCompact(
|
||||
scope: "history" | "network" | "servers" | "resources",
|
||||
scope: "protocol" | "network" | "servers" | "resources",
|
||||
defaultValue: boolean,
|
||||
) {
|
||||
return useLocalStorage<boolean>({
|
||||
|
|
@ -151,7 +151,7 @@ function useListCompact(
|
|||
|
||||
const SERVERS_TAB = INSPECTOR_SERVERS_TAB;
|
||||
const LOGS_TAB = "Logs";
|
||||
const HISTORY_TAB = "History";
|
||||
const PROTOCOL_TAB = "Protocol";
|
||||
const NETWORK_TAB = "Network";
|
||||
const CONSOLE_TAB = "Console";
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ const ALL_TABS: string[] = [
|
|||
"Resources",
|
||||
"Tasks",
|
||||
LOGS_TAB,
|
||||
HISTORY_TAB,
|
||||
PROTOCOL_TAB,
|
||||
NETWORK_TAB,
|
||||
CONSOLE_TAB,
|
||||
];
|
||||
|
|
@ -173,10 +173,10 @@ const ALL_TABS: string[] = [
|
|||
// the header and hosts them in the column instead. Console (#1621) is the
|
||||
// stdio server's stderr stream — mutually exclusive with Network (Console shows
|
||||
// for stdio, Network for HTTP), but both live in the monitor group.
|
||||
type MonitorTab = "Logs" | "History" | "Network" | "Console";
|
||||
type MonitorTab = "Logs" | "Protocol" | "Network" | "Console";
|
||||
const MONITOR_TABS: string[] = [
|
||||
LOGS_TAB,
|
||||
HISTORY_TAB,
|
||||
PROTOCOL_TAB,
|
||||
NETWORK_TAB,
|
||||
CONSOLE_TAB,
|
||||
];
|
||||
|
|
@ -184,7 +184,7 @@ const MONITOR_TABS: string[] = [
|
|||
function isMonitorTab(tab: string): tab is MonitorTab {
|
||||
return (
|
||||
tab === LOGS_TAB ||
|
||||
tab === HISTORY_TAB ||
|
||||
tab === PROTOCOL_TAB ||
|
||||
tab === NETWORK_TAB ||
|
||||
tab === CONSOLE_TAB
|
||||
);
|
||||
|
|
@ -377,7 +377,7 @@ export interface InspectorViewProps {
|
|||
logs: LogEntryData[];
|
||||
tasks: Task[];
|
||||
progressByTaskId?: Record<string, TaskProgress>;
|
||||
history: MessageEntry[];
|
||||
protocol: MessageEntry[];
|
||||
network: FetchRequestEntry[];
|
||||
/** Captured stdio stderr (the Console screen). Empty for HTTP servers. (#1621) */
|
||||
stderrLogs: StderrLogEntry[];
|
||||
|
|
@ -398,7 +398,7 @@ export interface InspectorViewProps {
|
|||
appsUi: AppsUiState;
|
||||
tasksUi: TasksUiState;
|
||||
logsUi: LogsUiState;
|
||||
historyUi: HistoryUiState;
|
||||
protocolUi: ProtocolUiState;
|
||||
networkUi: NetworkUiState;
|
||||
consoleUi: ConsoleUiState;
|
||||
|
||||
|
|
@ -418,9 +418,9 @@ export interface InspectorViewProps {
|
|||
bridgeFactory: BridgeFactory;
|
||||
appRendererRef: Ref<AppRendererHandle>;
|
||||
|
||||
// History pinning. Optional because pin state isn't persisted yet (#1244
|
||||
// Protocol pinning. Optional because pin state isn't persisted yet (#1244
|
||||
// is single-PR; persistence is a separate concern).
|
||||
pinnedHistoryIds?: Set<string>;
|
||||
pinnedProtocolIds?: Set<string>;
|
||||
|
||||
// Theme toggle (lives in the parent so the color scheme can also flow
|
||||
// into other top-level UI later).
|
||||
|
|
@ -505,13 +505,13 @@ export interface InspectorViewProps {
|
|||
onClearLogs: () => void;
|
||||
onExportLogs: () => void;
|
||||
|
||||
onHistoryUiChange: (next: HistoryUiState) => void;
|
||||
onClearHistory: () => void;
|
||||
onExportHistory: () => void;
|
||||
onClearHistorySection: (section: "pinned" | "history") => void;
|
||||
onExportHistorySection: (section: "pinned" | "history") => void;
|
||||
onReplayHistory: (id: string) => void;
|
||||
onTogglePinHistory: (id: string) => void;
|
||||
onProtocolUiChange: (next: ProtocolUiState) => void;
|
||||
onClearProtocol: () => void;
|
||||
onExportProtocol: () => void;
|
||||
onClearProtocolSection: (section: "pinned" | "history") => void;
|
||||
onExportProtocolSection: (section: "pinned" | "history") => void;
|
||||
onReplayProtocol: (id: string) => void;
|
||||
onTogglePinProtocol: (id: string) => void;
|
||||
|
||||
onNetworkUiChange: (next: NetworkUiState) => void;
|
||||
onClearNetwork: () => void;
|
||||
|
|
@ -548,7 +548,7 @@ export function InspectorView({
|
|||
logs,
|
||||
tasks,
|
||||
progressByTaskId,
|
||||
history,
|
||||
protocol,
|
||||
network,
|
||||
stderrLogs,
|
||||
toolCallState,
|
||||
|
|
@ -560,14 +560,14 @@ export function InspectorView({
|
|||
appsUi,
|
||||
tasksUi,
|
||||
logsUi,
|
||||
historyUi,
|
||||
protocolUi,
|
||||
networkUi,
|
||||
consoleUi,
|
||||
currentLogLevel,
|
||||
sandboxPath,
|
||||
bridgeFactory,
|
||||
appRendererRef,
|
||||
pinnedHistoryIds,
|
||||
pinnedProtocolIds,
|
||||
onToggleTheme,
|
||||
onOpenClientSettings,
|
||||
onToggleConnection,
|
||||
|
|
@ -611,13 +611,13 @@ export function InspectorView({
|
|||
onLogsUiChange,
|
||||
onClearLogs,
|
||||
onExportLogs,
|
||||
onHistoryUiChange,
|
||||
onClearHistory,
|
||||
onExportHistory,
|
||||
onClearHistorySection,
|
||||
onExportHistorySection,
|
||||
onReplayHistory,
|
||||
onTogglePinHistory,
|
||||
onProtocolUiChange,
|
||||
onClearProtocol,
|
||||
onExportProtocol,
|
||||
onClearProtocolSection,
|
||||
onExportProtocolSection,
|
||||
onReplayProtocol,
|
||||
onTogglePinProtocol,
|
||||
onNetworkUiChange,
|
||||
onClearNetwork,
|
||||
onExportNetwork,
|
||||
|
|
@ -638,16 +638,16 @@ export function InspectorView({
|
|||
// toggles (sort direction, list compact). Tab selection is lifted (#1417).
|
||||
|
||||
const [logsSort, setLogsSort] = useSortDirection("logs");
|
||||
const [historySort, setHistorySort] = useSortDirection("history");
|
||||
const [protocolSort, setProtocolSort] = useSortDirection("protocol");
|
||||
const [networkSort, setNetworkSort] = useSortDirection("network");
|
||||
const [consoleSort, setConsoleSort] = useSortDirection("console");
|
||||
|
||||
// Servers and Resources default to expanded (collapsed=false) so new
|
||||
// users see content on first paint; History/Network default to
|
||||
// users see content on first paint; Protocol/Network default to
|
||||
// collapsed (the lists are long enough that compact is the better
|
||||
// first-paint state).
|
||||
const [historyCompact, setHistoryCompact] = useListCompact(
|
||||
"history",
|
||||
const [protocolCompact, setProtocolCompact] = useListCompact(
|
||||
"protocol",
|
||||
LIST_COMPACT_DEFAULT,
|
||||
);
|
||||
const [networkCompact, setNetworkCompact] = useListCompact(
|
||||
|
|
@ -660,7 +660,7 @@ export function InspectorView({
|
|||
false,
|
||||
);
|
||||
|
||||
// Monitoring-column state (#1616): whether Logs/History/Network are pinned to
|
||||
// Monitoring-column state (#1616): whether Logs/Protocol/Network are pinned to
|
||||
// the right column, which one is active there, and the column width. All
|
||||
// persisted (view-layout preferences), same shape as the sort/compact hooks.
|
||||
const [monitorPinned, setMonitorPinned] = useLocalStorage<boolean>({
|
||||
|
|
@ -761,7 +761,7 @@ export function InspectorView({
|
|||
// its "unavailable" message remains reachable.
|
||||
//
|
||||
// Network is hidden for stdio servers (no HTTP traffic to surface).
|
||||
// Servers and History are never capability-gated — History is a local
|
||||
// Servers and Protocol are never capability-gated — Protocol is a local
|
||||
// client-side log, and any future client capabilities (sampling /
|
||||
// elicitation / roots) are inspector-offered, not server-advertised, so
|
||||
// they must not be gated here either. These memo dependencies make the tabs
|
||||
|
|
@ -824,7 +824,7 @@ export function InspectorView({
|
|||
// • stdio → the process's stderr (Console): the spawn/startup error the
|
||||
// child printed before dying.
|
||||
// • HTTP → the failed requests (Network).
|
||||
// • History only if it has entries — the message log is cleared on the
|
||||
// • Protocol only if it has entries — the message log is cleared on the
|
||||
// error transition, so on a fresh connect failure it's empty; offering
|
||||
// it anyway would let an empty tab lead over (and hide) the real
|
||||
// diagnostic. Content-gating it keeps the actual diagnostic first.
|
||||
|
|
@ -835,11 +835,11 @@ export function InspectorView({
|
|||
const tabs: string[] = [];
|
||||
if (stderrLogs.length > 0) tabs.push(CONSOLE_TAB);
|
||||
if (network.length > 0) tabs.push(NETWORK_TAB);
|
||||
if (history.length > 0) tabs.push(HISTORY_TAB);
|
||||
if (protocol.length > 0) tabs.push(PROTOCOL_TAB);
|
||||
return tabs;
|
||||
}
|
||||
return [];
|
||||
}, [connected, failed, availableTabs, stderrLogs, network, history]);
|
||||
}, [connected, failed, availableTabs, stderrLogs, network, protocol]);
|
||||
const effectivePinned =
|
||||
monitorPinned &&
|
||||
!!isWide &&
|
||||
|
|
@ -907,7 +907,7 @@ export function InspectorView({
|
|||
}
|
||||
|
||||
// A single search shared across the column's tabs (kept as you move between
|
||||
// Logs/History/Network so it filters each one), distinct from the full-size
|
||||
// Logs/Protocol/Network so it filters each one), distinct from the full-size
|
||||
// screens' own searches. The embedded panels apply only this text; their other
|
||||
// filters (levels / categories / directions / method) have no control in the
|
||||
// column and are bypassed there.
|
||||
|
|
@ -975,21 +975,21 @@ export function InspectorView({
|
|||
sortDirection: logsSort,
|
||||
onSortChange: setLogsSort,
|
||||
};
|
||||
const historyScreenProps = {
|
||||
entries: history,
|
||||
pinnedIds: pinnedHistoryIds ?? new Set<string>(),
|
||||
ui: historyUi,
|
||||
onUiChange: onHistoryUiChange,
|
||||
onClearAll: onClearHistory,
|
||||
onExport: onExportHistory,
|
||||
onClearSection: onClearHistorySection,
|
||||
onExportSection: onExportHistorySection,
|
||||
onReplay: onReplayHistory,
|
||||
onTogglePin: onTogglePinHistory,
|
||||
sortDirection: historySort,
|
||||
onSortChange: setHistorySort,
|
||||
compact: historyCompact,
|
||||
onToggleCompact: () => setHistoryCompact((c) => !c),
|
||||
const protocolScreenProps = {
|
||||
entries: protocol,
|
||||
pinnedIds: pinnedProtocolIds ?? new Set<string>(),
|
||||
ui: protocolUi,
|
||||
onUiChange: onProtocolUiChange,
|
||||
onClearAll: onClearProtocol,
|
||||
onExport: onExportProtocol,
|
||||
onClearSection: onClearProtocolSection,
|
||||
onExportSection: onExportProtocolSection,
|
||||
onReplay: onReplayProtocol,
|
||||
onTogglePin: onTogglePinProtocol,
|
||||
sortDirection: protocolSort,
|
||||
onSortChange: setProtocolSort,
|
||||
compact: protocolCompact,
|
||||
onToggleCompact: () => setProtocolCompact((c) => !c),
|
||||
};
|
||||
const networkScreenProps = {
|
||||
entries: network,
|
||||
|
|
@ -1024,10 +1024,10 @@ export function InspectorView({
|
|||
embedded
|
||||
/>
|
||||
),
|
||||
[HISTORY_TAB]: (
|
||||
<HistoryScreen
|
||||
{...historyScreenProps}
|
||||
ui={{ ...historyUi, search: monitorSearch }}
|
||||
[PROTOCOL_TAB]: (
|
||||
<ProtocolScreen
|
||||
{...protocolScreenProps}
|
||||
ui={{ ...protocolUi, search: monitorSearch }}
|
||||
embedded
|
||||
/>
|
||||
),
|
||||
|
|
@ -1185,10 +1185,10 @@ export function InspectorView({
|
|||
onPin={canPin ? () => pinMonitor(LOGS_TAB) : undefined}
|
||||
/>
|
||||
</ScreenStage>
|
||||
<ScreenStage active={activeTab === HISTORY_TAB}>
|
||||
<HistoryScreen
|
||||
{...historyScreenProps}
|
||||
onPin={canPin ? () => pinMonitor(HISTORY_TAB) : undefined}
|
||||
<ScreenStage active={activeTab === PROTOCOL_TAB}>
|
||||
<ProtocolScreen
|
||||
{...protocolScreenProps}
|
||||
onPin={canPin ? () => pinMonitor(PROTOCOL_TAB) : undefined}
|
||||
/>
|
||||
</ScreenStage>
|
||||
<ScreenStage active={activeTab === NETWORK_TAB}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue