Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8f7c7bf
ai-assistant: Add mcp adapter
ashu8912 Sep 4, 2025
e037852
ai-assistant: Add mcp setting and electron mcp client
ashu8912 Sep 8, 2025
faa06ee
ai-assistant: Use mcp settings
ashu8912 Sep 8, 2025
109e48b
ai-assistant: Add ability to approve a tool request
ashu8912 Sep 8, 2025
c687d7e
ai-assistant: Fix tool response and update MCPSettings
ashu8912 Sep 10, 2025
08ea96d
ai-assistant: Add MCP output formatting and display components
ashu8912 Sep 21, 2025
db6f0d3
ai-assistant: Add prompt width context for component state management
ashu8912 Sep 21, 2025
f7b8dd9
ai-assistant: Add inline tool approval system
ashu8912 Sep 21, 2025
ef0b3d7
ai-assistant: Add tools dialog for managing available tools
ashu8912 Sep 21, 2025
6bf746c
ai-assistant: Enhance tool manager with retry functionality and MCP i…
ashu8912 Sep 21, 2025
952644b
ai-assistant: Integrate MCP components with content rendering system
ashu8912 Sep 21, 2025
4192d4a
ai-assistant: Enhance AI modal with retry functionality and tool mana…
ashu8912 Sep 21, 2025
2b888fc
ai-assistant: Enhance LangChain manager with advanced tool processing
ashu8912 Sep 21, 2025
664a9d0
ai-assistant: Add advanced MCP configuration editor dialog
ashu8912 Sep 21, 2025
dedb99c
ai-assistant: Enhance MCP settings with editor dialog integration
ashu8912 Sep 21, 2025
9a58b9a
ai-assistant: Add utility enhancements and helper functions
ashu8912 Sep 21, 2025
361b91e
ai-assistant: Run formatter
ashu8912 Sep 21, 2025
7637745
ai-assistant: Markdown rendering for document responses and UI fixes
ashu8912 Sep 23, 2025
d017126
ai-assistant: Enhance tool arguments through ai calls
ashu8912 Sep 23, 2025
dc52d66
ai-assistant: Add search to mcp tools
ashu8912 Sep 29, 2025
fa58f00
ai-assistant: Fix rendering of messages especially with bullet points
joaquimrocha Sep 30, 2025
776fc35
ai-assistant: List MCP tools per MCP server in the tools dialog
joaquimrocha Sep 30, 2025
4de9f19
ai-assistant: Add shortDescription to the Tool class
joaquimrocha Sep 30, 2025
be4e0e8
ai-assistant: Properly look for whether we are running in-desktop
joaquimrocha Sep 30, 2025
207d6c1
ai-assistant: Add tool test prompts
joaquimrocha Sep 30, 2025
b4bf2d2
ai-assistant: Improve the tool UI and UX
joaquimrocha Sep 30, 2025
b2737af
ai-assistant: Fix k8s tool call working
ashu8912 Oct 9, 2025
2d8e3c4
ai-assistant: Fix log fetch failures
ashu8912 Oct 9, 2025
8c36d6f
ai-assistant: Add missing tool response
ashu8912 Oct 10, 2025
f299cc7
ai-assistant: Use mcp tools config update from electron main process
ashu8912 Oct 13, 2025
3b4332d
ai-assistant: Remove logs and cleanup
ashu8912 Oct 18, 2025
5eb61a1
ai-assistant: Fix tool args passing
ashu8912 Oct 19, 2025
e045702
ai-assistant: UI fixes
ashu8912 Oct 19, 2025
f24780f
ai-assistant: Format and lint fixes
ashu8912 Oct 19, 2025
863e343
ai-assistant: React to cluster change
ashu8912 Oct 27, 2025
c30331b
ai-assistant: Fix rendering issues
ashu8912 Oct 27, 2025
2cea132
ai-assistant: Remove unused code
ashu8912 Oct 27, 2025
90c7ce7
ai-assistant: Allow multiple tool calls to happen
ashu8912 Oct 29, 2025
87f69af
ai-assistant: Add a GUI for managing MCP servers
joaquimrocha Oct 31, 2025
af9fb7a
ai-assistant: Fix mcp tool selection and make it fast
ashu8912 Feb 17, 2026
2516dc6
ai-assistant: Format and lint fix
ashu8912 Feb 17, 2026
6dcf6e0
ai-assistant: Remove default mcp config setting
ashu8912 Mar 20, 2026
91ba7c5
ai-assistant: Run audit fix
ashu8912 Mar 20, 2026
82f7896
Update ai-assistant/src/components/mcpOutput/MCPArgumentProcessor.ts
ashu8912 Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,556 changes: 1,170 additions & 386 deletions ai-assistant/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions ai-assistant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
"@langchain/core": "^1.1.20",
"@langchain/deepseek": "1.0.8",
"@langchain/google-genai": "^2.1.16",
"@langchain/mcp-adapters": "^1.1.3",
"@langchain/mistralai": "^1.0.4",
"@langchain/ollama": "^1.2.2",
"@langchain/openai": "^1.2.6",
"@modelcontextprotocol/sdk": "^1.17.5",
"@monaco-editor/react": "^4.5.2",
"@types/prismjs": "^1.26.5",
"@types/react-syntax-highlighter": "^15.5.13",
Expand Down
41 changes: 32 additions & 9 deletions ai-assistant/src/ContentRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Link as RouterLink, useHistory } from 'react-router-dom';
import remarkGfm from 'remark-gfm';
import YAML from 'yaml';
import { LogsButton, YamlDisplay } from './components';
import MCPFormattedMessage from './components/chat/MCPFormattedMessage';
import { getHeadlampLink } from './utils/promptLinkHelper';
import { parseKubernetesYAML } from './utils/SampleYamlLibrary';

Expand Down Expand Up @@ -87,6 +88,8 @@ const parseLogsButtonData = (content: string, logsButtonIndex: number): ParseRes
interface ContentRendererProps {
content: string;
onYamlDetected?: (yaml: string, resourceType: string) => void;
promptWidth?: string; // Add width prop
onRetryTool?: (toolName: string, args: Record<string, any>) => void;
}

// Table wrapper component with show more functionality - moved outside to preserve state
Expand All @@ -96,7 +99,14 @@ const TableWrapper: React.FC<{ children: React.ReactNode }> = React.memo(({ chil

// Extract table rows from children
const tableElement = React.Children.only(children) as React.ReactElement;
const tbody = React.Children.toArray(tableElement.props.children).find(
const tableChildren = tableElement.props.children;

if (!tableChildren) {
// No children found, return table as is
return <Box sx={{ overflowX: 'auto', width: '100%', mb: 2 }}>{children}</Box>;
}

const tbody = React.Children.toArray(tableChildren).find(
(child: any) => child?.type === 'tbody' || child?.props?.component === 'tbody'
);

Expand All @@ -106,7 +116,8 @@ const TableWrapper: React.FC<{ children: React.ReactNode }> = React.memo(({ chil
}

const tbodyElement = tbody as React.ReactElement;
const rows = React.Children.toArray(tbodyElement.props.children);
const tbodyChildren = tbodyElement.props.children;
const rows = tbodyChildren ? React.Children.toArray(tbodyChildren) : [];
const hasMoreRows = rows.length > maxRows;
const visibleRows = showAll ? rows : rows.slice(0, maxRows);

Expand All @@ -117,7 +128,7 @@ const TableWrapper: React.FC<{ children: React.ReactNode }> = React.memo(({ chil

// Clone the table with the limited tbody
const limitedTable = React.cloneElement(tableElement, {
children: React.Children.map(tableElement.props.children, (child: any) => {
children: React.Children.map(tableChildren, (child: any) => {
if (child?.type === 'tbody' || child?.props?.component === 'tbody') {
return limitedTbody;
}
Expand Down Expand Up @@ -276,7 +287,7 @@ markdownComponents.li.displayName = 'MarkdownLi';
markdownComponents.blockquote.displayName = 'MarkdownBlockquote';

const ContentRenderer: React.FC<ContentRendererProps> = React.memo(
({ content, onYamlDetected }) => {
({ content, onYamlDetected, onRetryTool }) => {
const history = useHistory();
// Create code component that has access to onYamlDetected
const CodeComponent = React.useMemo(() => {
Expand Down Expand Up @@ -531,7 +542,18 @@ const ContentRenderer: React.FC<ContentRendererProps> = React.memo(
const processedContent = useMemo(() => {
if (!content) return null;

// First, check if content is a JSON response with error or success keys
// First, check if content is a formatted MCP output (pure JSON)
try {
const parsed = JSON.parse(content.trim());
if (parsed.formatted && parsed.mcpOutput) {
// This is a formatted MCP output, use our specialized component
return <MCPFormattedMessage content={content} isAssistant onRetryTool={onRetryTool} />;
}
} catch (error) {
// Not JSON or not formatted MCP output, continue with normal processing
}

// Second, check if content is a JSON response with error or success keys
const jsonParseResult = parseJsonContent(content.trim());
if (jsonParseResult.success) {
const parsedContent = jsonParseResult.data;
Expand Down Expand Up @@ -563,8 +585,8 @@ const ContentRenderer: React.FC<ContentRendererProps> = React.memo(
<Box
component="pre"
sx={{
backgroundColor: theme => theme.palette.grey[100],
color: theme => theme.palette.grey[900],
backgroundColor: (theme: any) => theme.palette.grey[100],
color: (theme: any) => theme.palette.grey[900],
padding: 2,
borderRadius: 1,
overflowX: 'auto',
Expand Down Expand Up @@ -640,7 +662,7 @@ const ContentRenderer: React.FC<ContentRendererProps> = React.memo(
{content}
</ReactMarkdown>
);
}, [content, onYamlDetected, processUnformattedYaml]);
}, [content, onYamlDetected, onRetryTool, processUnformattedYaml]);

return (
<Box sx={{ width: '100%', overflowWrap: 'break-word', wordWrap: 'break-word' }}>
Expand All @@ -652,7 +674,8 @@ const ContentRenderer: React.FC<ContentRendererProps> = React.memo(
// Only re-render if content or onYamlDetected actually changed
return (
prevProps.content === nextProps.content &&
prevProps.onYamlDetected === nextProps.onYamlDetected
prevProps.onYamlDetected === nextProps.onYamlDetected &&
prevProps.onRetryTool === nextProps.onRetryTool
);
}
);
Expand Down
11 changes: 10 additions & 1 deletion ai-assistant/src/ai/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export type ToolCall = {
name: string;
description?: string;
arguments: Record<string, any>;
type: 'regular';
type: 'mcp' | 'regular';
};

export type AgentThinkingStep = {
Expand All @@ -29,6 +29,15 @@ export type Prompt = {
agentThinkingSteps?: AgentThinkingStep[];
/** Whether the agent run is complete (thinking block should collapse) */
agentThinkingDone?: boolean;
// Add support for inline tool confirmations
toolConfirmation?: {
tools: ToolCall[];
onApprove: (approvedToolIds: string[]) => void;
onDeny: () => void;
loading?: boolean;
//TODO: added this, because there was no userContext
userContext?: any; // Additional context about the user or conversation for tool confirmation
};
};

export default abstract class AIManager {
Expand Down
Loading
Loading