Next camp refactor live (#5706)

This commit is contained in:
Zane
2025-11-21 14:10:34 -07:00
committed by GitHub
parent c1c772b267
commit d54a06afda
35 changed files with 1105 additions and 2601 deletions
@@ -4,10 +4,13 @@ import React, { useEffect, useRef, useState } from 'react';
import { Button } from './ui/button';
import { ToolCallArguments, ToolCallArgumentValue } from './ToolCallArguments';
import MarkdownContent from './MarkdownContent';
import { ToolRequestMessageContent, ToolResponseMessageContent } from '../types/message';
import {
ToolRequestMessageContent,
ToolResponseMessageContent,
NotificationEvent,
} from '../types/message';
import { cn, snakeToTitleCase } from '../utils';
import { LoadingStatus } from './ui/Dot';
import { NotificationEvent } from '../hooks/useMessageStream';
import { ChevronRight, FlaskConical } from 'lucide-react';
import { TooltipWrapper } from './settings/providers/subcomponents/buttons/TooltipWrapper';
import MCPUIResourceRenderer from './MCPUIResourceRenderer';
@@ -158,7 +161,8 @@ interface Progress {
}
const logToString = (logMessage: NotificationEvent) => {
const params = logMessage.message.params;
const message = logMessage.message as { method: string; params: unknown };
const params = message.params as Record<string, unknown>;
// Special case for the developer system shell logs
if (
@@ -174,8 +178,10 @@ const logToString = (logMessage: NotificationEvent) => {
return typeof params.data === 'string' ? params.data : JSON.stringify(params.data);
};
const notificationToProgress = (notification: NotificationEvent): Progress =>
notification.message.params as unknown as Progress;
const notificationToProgress = (notification: NotificationEvent): Progress => {
const message = notification.message as { method: string; params: unknown };
return message.params as Progress;
};
// Helper function to extract extension name for tooltip
const getExtensionTooltip = (toolCallName: string): string | null => {
@@ -256,11 +262,17 @@ function ToolCallView({
: [];
const logs = notifications
?.filter((notification) => notification.message.method === 'notifications/message')
?.filter((notification) => {
const message = notification.message as { method?: string };
return message.method === 'notifications/message';
})
.map(logToString);
const progress = notifications
?.filter((notification) => notification.message.method === 'notifications/progress')
?.filter((notification) => {
const message = notification.message as { method?: string };
return message.method === 'notifications/progress';
})
.map(notificationToProgress)
.reduce((map, item) => {
const key = item.progressToken;