2026-07-10 14:51:33 +03:00
|
|
|
// Keep only tools with a direct in-app navigation destination compact. Every
|
|
|
|
|
// other tool uses ToolPart so custom, plugin, and MCP calls expose their input
|
|
|
|
|
// and output through the common expandable renderer.
|
|
|
|
|
const STATIC_TOOL_NAMES = new Set<string>(['read', 'skill']);
|
2026-03-12 23:45:45 +02:00
|
|
|
|
|
|
|
|
const STANDALONE_TOOL_NAMES = new Set<string>(['task']);
|
|
|
|
|
|
|
|
|
|
const normalizeToolName = (toolName: unknown): string => {
|
|
|
|
|
if (typeof toolName !== 'string') return '';
|
|
|
|
|
const trimmed = toolName.trim().toLowerCase();
|
|
|
|
|
if (!trimmed) return '';
|
|
|
|
|
|
|
|
|
|
const withoutIndex = trimmed.replace(/:\d+$/, '');
|
|
|
|
|
if (withoutIndex.includes('.')) {
|
|
|
|
|
const parts = withoutIndex.split('.').filter(Boolean);
|
|
|
|
|
return parts[parts.length - 1] ?? withoutIndex;
|
|
|
|
|
}
|
|
|
|
|
return withoutIndex;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const isExpandableTool = (toolName: unknown): boolean => {
|
2026-07-10 14:51:33 +03:00
|
|
|
return !isStaticTool(toolName);
|
2026-03-12 23:45:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const isStandaloneTool = (toolName: unknown): boolean => {
|
|
|
|
|
return STANDALONE_TOOL_NAMES.has(normalizeToolName(toolName));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const isStaticTool = (toolName: unknown): boolean => {
|
2026-07-10 14:51:33 +03:00
|
|
|
return STATIC_TOOL_NAMES.has(normalizeToolName(toolName));
|
2026-03-12 23:45:45 +02:00
|
|
|
};
|