/** * Расширенные AI инструменты для существующих категорий * * Дополнительные инструменты для достижения цели в 151 инструмент * Расширяет функциональность Timeline, Player, Resources и Browser */ import { ClaudeTool } from "../services/claude-service" /** * Extended Tools - 11 дополнительных инструментов для существующих категорий */ export const extendedTools: ClaudeTool[] = [ // Расширение Timeline Tools (+4 инструмента) { name: "analyze_narrative_structure", description: "Анализирует повествовательную структуру проекта и предлагает улучшения драматургии", input_schema: { type: "object", properties: { analysisType: { type: "string", enum: ["three-act", "hero-journey", "freytag", "custom", "documentary", "commercial"], description: "Тип анализа повествовательной структуры", default: "three-act", }, contentScope: { type: "string", enum: ["full-timeline", "selected-clips", "sequence", "act"], description: "Область контента для анализа", default: "full-timeline", }, analysisDepth: { type: "string", enum: ["basic", "detailed", "comprehensive"], description: "Глубина анализа", default: "detailed", }, includeEmotionalFlow: { type: "boolean", description: "Включить анализ эмоциональной кривой", default: true, }, suggestRestructuring: { type: "boolean", description: "Предложить реструктуризацию", default: true, }, genreContext: { type: "string", enum: ["drama", "comedy", "action", "horror", "documentary", "commercial", "music-video", "tutorial"], description: "Жанровый контекст для анализа", }, }, }, }, { name: "generate_ai_storyboard", description: "Создает AI-генерированную раскадровку на основе сценария или существующего контента", input_schema: { type: "object", properties: { sourceInput: { type: "string", enum: ["script", "timeline", "audio-narration", "text-description"], description: "Источник для генерации раскадровки", }, scriptText: { type: "string", description: "Текст сценария для генерации", }, visualStyle: { type: "string", enum: ["realistic", "cartoon", "sketch", "cinematic", "minimalist", "detailed"], description: "Визуальный стиль раскадровки", default: "sketch", }, frameCount: { type: "number", minimum: 4, maximum: 50, description: "Количество кадров раскадровки", default: 12, }, aspectRatio: { type: "string", enum: ["16:9", "4:3", "1:1", "9:16", "21:9"], description: "Соотношение сторон кадров", default: "16:9", }, includeAnnotations: { type: "boolean", description: "Включить аннотации к кадрам", default: true, }, cameraMovements: { type: "boolean", description: "Указать движения камеры", default: true, }, reason: { type: "string", description: "Цель создания раскадровки", }, }, required: ["sourceInput", "reason"], }, }, { name: "optimize_cutting_rhythm", description: "Оптимизирует ритм монтажа на основе анализа музыки, речи и визуального контента", input_schema: { type: "object", properties: { rhythmSource: { type: "string", enum: ["music", "speech", "visual-content", "combined", "manual-bpm"], description: "Источник для определения ритма", default: "combined", }, targetBPM: { type: "number", minimum: 60, maximum: 200, description: "Целевой BPM для ритма (если manual-bpm)", }, cuttingStyle: { type: "string", enum: ["aggressive", "smooth", "musical", "natural", "dramatic", "commercial"], description: "Стиль монтажа", default: "natural", }, preserveDialogue: { type: "boolean", description: "Сохранять целостность диалогов", default: true, }, intensityMapping: { type: "object", properties: { lowIntensity: { type: "number", description: "Длина нарезок для низкой интенсивности (сек)" }, mediumIntensity: { type: "number", description: "Длина нарезок для средней интенсивности (сек)" }, highIntensity: { type: "number", description: "Длина нарезок для высокой интенсивности (сек)" }, }, }, adaptToContent: { type: "boolean", description: "Адаптировать ритм под контент", default: true, }, reason: { type: "string", description: "Цель оптимизации ритма монтажа", }, }, required: ["reason"], }, }, { name: "create_motion_graphics_sequence", description: "Создает последовательность motion graphics с анимированными элементами", input_schema: { type: "object", properties: { sequenceType: { type: "string", enum: [ "data-visualization", "infographic", "kinetic-typography", "logo-animation", "transition", "explanation", ], description: "Тип motion graphics последовательности", }, dataSource: { type: "object", properties: { type: { type: "string", enum: ["text", "numbers", "charts", "timeline", "comparison"] }, content: { type: "string", description: "Контент для визуализации" }, format: { type: "string", enum: ["json", "csv", "text", "manual"] }, }, }, animationStyle: { type: "object", properties: { theme: { type: "string", enum: ["corporate", "creative", "minimal", "dynamic", "elegant"] }, colorScheme: { type: "array", items: { type: "string" }, description: "Цветовая схема в hex формате", }, typography: { type: "string", description: "Основной шрифт для текста" }, pace: { type: "string", enum: ["slow", "medium", "fast", "variable"] }, }, }, duration: { type: "number", minimum: 2, maximum: 60, description: "Длительность последовательности в секундах", }, complexity: { type: "string", enum: ["simple", "moderate", "complex"], description: "Сложность анимации", default: "moderate", }, reason: { type: "string", description: "Цель создания motion graphics", }, }, required: ["sequenceType", "reason"], }, }, // Расширение Player Tools (+2 инструмента) { name: "analyze_viewer_attention", description: "Анализирует визуальные элементы для предсказания фокуса внимания зрителя", input_schema: { type: "object", properties: { analysisMethod: { type: "string", enum: ["heatmap", "focus-points", "eye-tracking-simulation", "saliency-map"], description: "Метод анализа внимания", default: "focus-points", }, timeRange: { type: "object", properties: { start: { type: "number" }, end: { type: "number" }, }, description: "Временной диапазон для анализа", }, frameInterval: { type: "number", minimum: 0.5, maximum: 5, description: "Интервал анализа кадров в секундах", default: 1, }, visualElements: { type: "array", items: { type: "string", enum: ["faces", "text", "motion", "bright-areas", "contrast", "colors", "edges"], }, description: "Визуальные элементы для анализа", default: ["faces", "text", "motion"], }, generateReport: { type: "boolean", description: "Создать подробный отчет", default: true, }, includeSuggestions: { type: "boolean", description: "Включить предложения по улучшению", default: true, }, }, }, }, { name: "create_interactive_markers", description: "Создает интерактивные маркеры и аннотации для видео контента", input_schema: { type: "object", properties: { markerType: { type: "string", enum: ["chapter", "highlight", "note", "bookmark", "error", "review", "action-item"], description: "Тип маркера", }, markerData: { type: "array", items: { type: "object", properties: { timecode: { type: "number", description: "Временная позиция в секундах" }, title: { type: "string", description: "Заголовок маркера" }, description: { type: "string", description: "Описание маркера" }, color: { type: "string", description: "Цвет маркера" }, priority: { type: "string", enum: ["low", "medium", "high", "critical"] }, category: { type: "string", description: "Категория маркера" }, metadata: { type: "object", description: "Дополнительные метаданные" }, }, required: ["timecode", "title"], }, description: "Данные маркеров", }, visualStyle: { type: "object", properties: { showOnTimeline: { type: "boolean", description: "Показывать на таймлайне" }, showOnPlayer: { type: "boolean", description: "Показывать на плеере" }, markerSize: { type: "string", enum: ["small", "medium", "large"] }, animateAppearance: { type: "boolean", description: "Анимировать появление" }, }, }, interactivity: { type: "object", properties: { clickable: { type: "boolean", description: "Кликабельные маркеры" }, showTooltips: { type: "boolean", description: "Показывать подсказки" }, enableNavigation: { type: "boolean", description: "Навигация по маркерам" }, exportable: { type: "boolean", description: "Возможность экспорта" }, }, }, reason: { type: "string", description: "Цель создания интерактивных маркеров", }, }, required: ["markerType", "markerData", "reason"], }, }, // Расширение Resource Tools (+3 инструмента) { name: "analyze_asset_usage_patterns", description: "Анализирует паттерны использования ресурсов для оптимизации библиотеки", input_schema: { type: "object", properties: { analysisTimeframe: { type: "string", enum: ["current-project", "last-month", "last-quarter", "all-time"], description: "Временные рамки анализа", default: "current-project", }, resourceTypes: { type: "array", items: { type: "string", enum: ["video", "audio", "image", "effect", "filter", "transition", "template", "font"], }, description: "Типы ресурсов для анализа", default: ["video", "audio", "image"], }, analysisMetrics: { type: "array", items: { type: "string", enum: ["frequency", "duration", "context", "performance", "quality", "redundancy"], }, description: "Метрики для анализа", default: ["frequency", "context", "redundancy"], }, includeRecommendations: { type: "boolean", description: "Включить рекомендации по оптимизации", default: true, }, generateCleanupPlan: { type: "boolean", description: "Создать план очистки неиспользуемых ресурсов", default: true, }, }, }, }, { name: "create_smart_collections", description: "Создает умные коллекции ресурсов на основе AI-анализа контента и метаданных", input_schema: { type: "object", properties: { collectionCriteria: { type: "object", properties: { contentAnalysis: { type: "array", items: { type: "string", enum: ["visual-similarity", "color-palette", "motion-type", "audio-mood", "temporal-pattern"], }, description: "Критерии на основе анализа контента", }, metadataCriteria: { type: "array", items: { type: "string", enum: ["creation-date", "file-type", "resolution", "duration", "tags", "location"], }, description: "Критерии на основе метаданных", }, usagePatterns: { type: "array", items: { type: "string", enum: ["frequently-used", "recently-used", "project-specific", "never-used", "co-used"], }, description: "Критерии на основе паттернов использования", }, }, }, collectionTypes: { type: "array", items: { type: "string", enum: ["theme-based", "style-based", "technical-specs", "usage-context", "timeline-sections"], }, description: "Типы создаваемых коллекций", }, autoUpdate: { type: "boolean", description: "Автоматически обновлять коллекции", default: true, }, namingConvention: { type: "string", enum: ["descriptive", "systematic", "date-based", "custom"], description: "Соглашение о наименовании", default: "descriptive", }, reason: { type: "string", description: "Цель создания умных коллекций", }, }, required: ["collectionCriteria", "reason"], }, }, { name: "optimize_resource_workflow", description: "Оптимизирует рабочий процесс с ресурсами на основе анализа пользовательского поведения", input_schema: { type: "object", properties: { workflowAspects: { type: "array", items: { type: "string", enum: ["import-process", "organization", "search-discovery", "application", "management", "export"], }, description: "Аспекты рабочего процесса для оптимизации", default: ["import-process", "organization", "search-discovery"], }, userBehaviorData: { type: "object", properties: { mostUsedActions: { type: "array", items: { type: "string" }, description: "Наиболее используемые действия", }, timeSpentOnTasks: { type: "object", description: "Время, затрачиваемое на различные задачи", }, painPoints: { type: "array", items: { type: "string" }, description: "Проблемные области в рабочем процессе", }, preferredMethods: { type: "array", items: { type: "string" }, description: "Предпочитаемые методы работы", }, }, }, optimizationGoals: { type: "array", items: { type: "string", enum: ["speed", "accuracy", "discoverability", "organization", "automation", "collaboration"], }, description: "Цели оптимизации", default: ["speed", "discoverability"], }, automationLevel: { type: "string", enum: ["minimal", "moderate", "aggressive", "custom"], description: "Уровень автоматизации", default: "moderate", }, reason: { type: "string", description: "Причина оптимизации рабочего процесса", }, }, required: ["workflowAspects", "reason"], }, }, // Расширение Browser Tools (+2 инструмента) { name: "create_media_timeline_preview", description: "Создает превью-таймлайн для быстрой навигации по медиафайлам", input_schema: { type: "object", properties: { previewScope: { type: "string", enum: ["selected-files", "current-folder", "search-results", "all-media"], description: "Область для создания превью", default: "selected-files", }, previewDensity: { type: "string", enum: ["sparse", "normal", "dense", "adaptive"], description: "Плотность превью кадров", default: "normal", }, thumbnailSettings: { type: "object", properties: { frameCount: { type: "number", minimum: 3, maximum: 20, description: "Количество превью кадров на файл", default: 5, }, size: { type: "string", enum: ["small", "medium", "large"] }, quality: { type: "string", enum: ["draft", "good", "high"] }, showTimecode: { type: "boolean", description: "Показывать тайм-код" }, showDuration: { type: "boolean", description: "Показывать длительность" }, }, }, interactiveFeatures: { type: "object", properties: { hoverPreview: { type: "boolean", description: "Превью при наведении" }, clickToSeek: { type: "boolean", description: "Переход по клику" }, scrubbing: { type: "boolean", description: "Скраббинг по превью" }, markInOut: { type: "boolean", description: "Возможность отметить точки входа/выхода" }, }, }, groupingOptions: { type: "object", properties: { groupBy: { type: "string", enum: ["none", "file-type", "duration", "resolution", "date"] }, sortOrder: { type: "string", enum: ["name", "date", "size", "duration", "type"] }, showGroupHeaders: { type: "boolean", description: "Показывать заголовки групп" }, }, }, reason: { type: "string", description: "Цель создания превью-таймлайна", }, }, required: ["reason"], }, }, { name: "generate_media_reports", description: "Генерирует подробные отчеты о медиа библиотеке с аналитикой и статистикой", input_schema: { type: "object", properties: { reportType: { type: "string", enum: ["comprehensive", "technical", "usage", "quality", "inventory", "compliance"], description: "Тип отчета", default: "comprehensive", }, reportScope: { type: "object", properties: { timeRange: { type: "object", properties: { start: { type: "string", description: "Начальная дата (YYYY-MM-DD)" }, end: { type: "string", description: "Конечная дата (YYYY-MM-DD)" }, }, }, fileTypes: { type: "array", items: { type: "string" }, description: "Типы файлов для включения в отчет", }, projects: { type: "array", items: { type: "string" }, description: "Проекты для анализа", }, tags: { type: "array", items: { type: "string" }, description: "Теги для фильтрации", }, }, }, analyticsLevel: { type: "string", enum: ["basic", "detailed", "expert"], description: "Уровень детализации аналитики", default: "detailed", }, includeCharts: { type: "boolean", description: "Включить графики и диаграммы", default: true, }, includeRecommendations: { type: "boolean", description: "Включить рекомендации", default: true, }, outputFormat: { type: "string", enum: ["pdf", "html", "json", "csv", "excel"], description: "Формат вывода отчета", default: "pdf", }, customMetrics: { type: "array", items: { type: "object", properties: { name: { type: "string", description: "Название метрики" }, calculation: { type: "string", description: "Способ расчета" }, displayType: { type: "string", enum: ["number", "percentage", "chart", "list"] }, }, }, description: "Пользовательские метрики для отчета", }, reason: { type: "string", description: "Цель генерации отчета", }, }, required: ["reportType", "reason"], }, }, ] /** * Типы результатов выполнения расширенных инструментов */ export interface ExtendedToolResult { success: boolean message: string data?: { analysis?: any generatedContent?: any optimizations?: any collections?: any[] workflow?: any preview?: any report?: any recommendations?: string[] warnings?: string[] } errors?: string[] nextActions?: string[] } /** * Интерфейс для доступа к расширенным функциям */ interface ExtendedSystemAccess { analyzeNarrativeStructure: (type: string, scope: string, depth: string) => any generateAIStoryboard: (source: string, style: string, frames: number) => Promise optimizeCuttingRhythm: (source: string, style: string, settings: any) => Promise createMotionGraphics: (type: string, data: any, style: any, duration: number) => Promise analyzeViewerAttention: (method: string, range: any, elements: string[]) => Promise createInteractiveMarkers: (type: string, markers: any[], style: any) => Promise analyzeAssetUsage: (timeframe: string, types: string[], metrics: string[]) => any createSmartCollections: (criteria: any, types: string[], autoUpdate: boolean) => Promise optimizeResourceWorkflow: (aspects: string[], goals: string[], level: string) => Promise createMediaPreview: (scope: string, density: string, settings: any) => Promise generateMediaReport: (type: string, scope: any, level: string, format: string) => Promise } // Глобальная переменная для доступа к расширенным функциям let extendedSystemAccess: ExtendedSystemAccess | null = null /** * Устанавливает доступ к расширенным функциям */ export function setExtendedSystemAccess(access: ExtendedSystemAccess | null) { extendedSystemAccess = access } /** * Выполняет расширенный инструмент */ export async function executeExtendedTool(toolName: string, input: Record): Promise { try { switch (toolName) { case "analyze_narrative_structure": return await analyzeNarrativeStructure(input) case "generate_ai_storyboard": return await generateAIStoryboard(input) case "optimize_cutting_rhythm": return await optimizeCuttingRhythm(input) case "create_motion_graphics_sequence": return await createMotionGraphicsSequence(input) case "analyze_viewer_attention": return await analyzeViewerAttention(input) case "create_interactive_markers": return await createInteractiveMarkers(input) case "analyze_asset_usage_patterns": return await analyzeAssetUsagePatterns(input) case "create_smart_collections": return await createSmartCollections(input) case "optimize_resource_workflow": return await optimizeResourceWorkflow(input) case "create_media_timeline_preview": return await createMediaTimelinePreview(input) case "generate_media_reports": return await generateMediaReports(input) default: return { success: false, message: `Неизвестный расширенный инструмент: ${toolName}`, errors: [`Инструмент ${toolName} не найден`], } } } catch (error) { return { success: false, message: `Ошибка выполнения расширенного инструмента ${toolName}: ${error instanceof Error ? error.message : String(error)}`, errors: [error instanceof Error ? error.message : String(error)], } } } // Заглушки для функций (в реальной реализации они будут полностью развернуты) async function analyzeNarrativeStructure(_input: Record): Promise { return { success: true, message: "Narrative structure analyzed", data: { analysis: {} } } } async function generateAIStoryboard(_input: Record): Promise { return { success: true, message: "AI storyboard generated", data: { generatedContent: {} } } } async function optimizeCuttingRhythm(_input: Record): Promise { return { success: true, message: "Cutting rhythm optimized", data: { optimizations: {} } } } async function createMotionGraphicsSequence(_input: Record): Promise { return { success: true, message: "Motion graphics sequence created", data: { generatedContent: {} } } } async function analyzeViewerAttention(_input: Record): Promise { return { success: true, message: "Viewer attention analyzed", data: { analysis: {} } } } async function createInteractiveMarkers(_input: Record): Promise { return { success: true, message: "Interactive markers created", data: { generatedContent: {} } } } async function analyzeAssetUsagePatterns(_input: Record): Promise { return { success: true, message: "Asset usage patterns analyzed", data: { analysis: {} } } } async function createSmartCollections(_input: Record): Promise { return { success: true, message: "Smart collections created", data: { collections: [] } } } async function optimizeResourceWorkflow(_input: Record): Promise { return { success: true, message: "Resource workflow optimized", data: { workflow: {} } } } async function createMediaTimelinePreview(_input: Record): Promise { return { success: true, message: "Media timeline preview created", data: { preview: {} } } } async function generateMediaReports(_input: Record): Promise { return { success: true, message: "Media reports generated", data: { report: {} } } }