UNPKG

mcp-booster

Version:

Servidor MCP com CoConuT (Continuous Chain of Thought) para uso com Cursor IDE - Pacote Global NPM

158 lines (157 loc) 10.8 kB
"use strict"; /** * Tipos para o serviço CoConuT_Storage * Apenas tipos essenciais para operações de armazenamento de conclusões */ Object.defineProperty(exports, "__esModule", { value: true }); exports.BoosterStepsParamsSchema = exports.TaskStepSchema = exports.ErrorCode = exports.EventType = exports.CoConuTStorageParamsSchema = exports.InputType = exports.CoConuTParamsSchema = exports.DEFAULT_CONFIG = void 0; const zod_1 = require("zod"); /** * Configurações padrão */ exports.DEFAULT_CONFIG = { persistenceEnabled: true, projectPath: undefined, reflectionInterval: 5, cycleDetectionThreshold: 0.8, similarityAlgorithm: 'levenshtein', maxBranches: 10, maxHistorySize: 100, autoAnalyze: true }; /** * Esquema Zod para validação de parâmetros do CoConuT */ exports.CoConuTParamsSchema = zod_1.z.object({ thought: zod_1.z.string().describe("The current thought text in the reasoning process"), thoughtNumber: zod_1.z.number().positive().describe("Sequential number of this thought in the chain"), totalThoughts: zod_1.z.number().min(3).describe("Total estimated number of thoughts to solve the problem (minimum of 3 required)"), nextThoughtNeeded: zod_1.z.boolean().describe("Indicates if a next thought is needed (true) or if the chain is complete (false)"), isRevision: zod_1.z.boolean().optional().describe("Indicates if this thought revises a previous thought"), revisesThought: zod_1.z.number().positive().optional().describe("Number of the thought being revised"), branchFromThought: zod_1.z.number().positive().optional().describe("Number of the thought from which this branch starts"), branchId: zod_1.z.string().optional().describe("Unique identifier of the current branch"), needsMoreThoughts: zod_1.z.boolean().optional().describe("Indicates if the problem needs more thoughts than initially estimated"), score: zod_1.z.number().min(0).max(10).describe("Score or confidence associated with this thought (0-10)"), inputType: zod_1.z.string().optional().describe("Type of input expected from the user"), problemStatus: zod_1.z.string().describe("Description of the current status of problem solving"), options: zod_1.z.array(zod_1.z.string()).optional().describe("List of options for the user to choose from"), numberArray: zod_1.z.array(zod_1.z.number()).optional().describe("Array of numbers provided as input"), Call_Booster_Analyser: zod_1.z.boolean().describe("Indicates if the Booster_Analyser should be called"), Call_Booster_Steps: zod_1.z.boolean().describe("Indicates if the Booster_Steps should be called") // timezoneOffset removido - será criado automaticamente pelo servidor }); /** * Enumeração de tipos de entrada */ var InputType; (function (InputType) { InputType["TEXT"] = "text"; InputType["NUMBER_ARRAY"] = "number_array"; InputType["OPTIONS"] = "options"; InputType["BOOLEAN"] = "boolean"; })(InputType || (exports.InputType = InputType = {})); /** * Esquema Zod para validação de parâmetros do CoConuT_Storage */ exports.CoConuTStorageParamsSchema = zod_1.z.object({ projectPath: zod_1.z.string().describe("Absolute path to the project directory where files will be saved. This path will be used to create the necessary directory structure for storing thought chains, conclusions, and interaction history."), WhyChange: zod_1.z.string().describe("Explains why the change was necessary or what motivated the action. This text will be included in the conclusion file and helps provide context for future reference."), WhatChange: zod_1.z.string().describe("Describes what was modified or implemented in this action. This text will be included in the conclusion file and provides a clear summary of the changes made."), // Categorização category: zod_1.z.string().optional().describe("Main category of the change according to conventional commit types. Each category has its own emoji."), subCategories: zod_1.z.array(zod_1.z.string()).optional().describe("Subcategories for more specific classification (UI, performance, security, etc.)."), tags: zod_1.z.array(zod_1.z.string()).optional().describe("Tags for improved search and classification of changes."), impactLevel: zod_1.z.enum(["low", "medium", "high"]).optional().describe("Level of impact this change has on the system."), // Contexto affectedFiles: zod_1.z.array(zod_1.z.string()).optional().describe("List of files affected by this change for better context."), codeSnippets: zod_1.z.array(zod_1.z.object({ before: zod_1.z.string(), after: zod_1.z.string(), file: zod_1.z.string() })).optional().describe("Relevant code snippets showing the changes made."), relatedConclusions: zod_1.z.array(zod_1.z.string()).optional().describe("IDs of related conclusions to establish connections between changes."), ticketReference: zod_1.z.string().optional().describe("Reference to a ticket/issue in a tracking system (JIRA, GitHub Issues)."), businessContext: zod_1.z.string().optional().describe("Business context explaining the value or strategic motivation for the change."), technicalContext: zod_1.z.string().optional().describe("Additional technical context about the architecture or components affected."), alternativesConsidered: zod_1.z.array(zod_1.z.string()).optional().describe("Alternatives that were considered and reasons they were rejected."), testingPerformed: zod_1.z.string().optional().describe("Description of tests performed to validate the change.") }); /** * Enumeração de tipos de eventos */ var EventType; (function (EventType) { EventType["THOUGHT_ADDED"] = "thought_added"; EventType["THOUGHT_REVISED"] = "thought_revised"; EventType["CYCLE_DETECTED"] = "cycle_detected"; EventType["ANALYSIS_PERFORMED"] = "analysis_performed"; EventType["BRANCH_CREATED"] = "branch_created"; EventType["BRANCH_SWITCHED"] = "branch_switched"; })(EventType || (exports.EventType = EventType = {})); /** * Códigos de erro comuns para padronização */ var ErrorCode; (function (ErrorCode) { ErrorCode["VALIDATION_ERROR"] = "VALIDATION_ERROR"; ErrorCode["EXECUTION_ERROR"] = "EXECUTION_ERROR"; ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; ErrorCode["AUTHORIZATION_ERROR"] = "AUTHORIZATION_ERROR"; ErrorCode["NOT_FOUND_ERROR"] = "NOT_FOUND_ERROR"; ErrorCode["METHOD_NOT_ALLOWED"] = "METHOD_NOT_ALLOWED"; ErrorCode["INVALID_INPUT"] = "INVALID_INPUT"; ErrorCode["INVALID_STATE"] = "INVALID_STATE"; ErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR"; })(ErrorCode || (exports.ErrorCode = ErrorCode = {})); /** * Esquema Zod para validação de um TaskStep - Otimizado para AIs */ exports.TaskStepSchema = zod_1.z.object({ // === IDENTIFICAÇÃO E BÁSICOS === id: zod_1.z.string().describe("Unique ID for the card (e.g., 'TASK-001')"), title: zod_1.z.string().describe("Technical title of the task"), // === INFORMAÇÕES PARA AI (OBRIGATÓRIAS) === technicalContext: zod_1.z.string().describe("Detailed technical context for AI to understand the problem"), implementationGoal: zod_1.z.string().describe("Specific implementation objective"), // Especificações técnicas targetFiles: zod_1.z.array(zod_1.z.string()).describe("Files that should be modified/created"), referencePaths: zod_1.z.array(zod_1.z.string()).describe("Paths to files/directories for reference"), codePatterns: zod_1.z.array(zod_1.z.string()).describe("Specific code patterns to follow"), technicalRequirements: zod_1.z.array(zod_1.z.string()).describe("Specific technical requirements"), // Comandos e ações shellCommands: zod_1.z.array(zod_1.z.string()).describe("Required terminal commands"), installationSteps: zod_1.z.array(zod_1.z.string()).describe("Installation/configuration steps"), verificationSteps: zod_1.z.array(zod_1.z.string()).describe("How to verify correct implementation"), // Dependências técnicas codeDependencies: zod_1.z.array(zod_1.z.string()).describe("Code/library dependencies"), serviceDependencies: zod_1.z.array(zod_1.z.string()).describe("Service/API dependencies"), // === METADADOS TÉCNICOS (OBRIGATÓRIOS) === complexity: zod_1.z.enum(['low', 'medium', 'high', 'expert']).describe("Technical complexity level"), // === INFORMAÇÕES EDITÁVEIS PELO USUÁRIO (OPCIONAIS) === userNotes: zod_1.z.string().optional().describe("IMPORTANT: Complete user notes including special instructions, project context, implementation preferences, warnings, business rationale and any relevant user information"), // === INFORMAÇÕES EDITÁVEIS PELA AI (OPCIONAIS) === aiNotes: zod_1.z.string().optional().describe("AI specific notes for this task"), // === METADADOS TÉCNICOS OPCIONAIS === estimatedLines: zod_1.z.number().optional().describe("Estimated lines of code"), testingStrategy: zod_1.z.string().optional().describe("Recommended testing strategy"), rollbackPlan: zod_1.z.string().optional().describe("Rollback plan if needed"), // === CAMPOS OPCIONAIS PARA CONTEXTO ADICIONAL === relatedIssues: zod_1.z.array(zod_1.z.string()).optional().describe("Related issues"), apiEndpoints: zod_1.z.array(zod_1.z.string()).optional().describe("API endpoints involved"), databaseChanges: zod_1.z.array(zod_1.z.string()).optional().describe("Database changes"), environmentVars: zod_1.z.array(zod_1.z.string()).optional().describe("Required environment variables"), securityConsiderations: zod_1.z.array(zod_1.z.string()).optional().describe("Security considerations"), performanceConsiderations: zod_1.z.array(zod_1.z.string()).optional().describe("Performance considerations"), accessibilityNotes: zod_1.z.array(zod_1.z.string()).optional().describe("Accessibility notes"), monitoringAndLogs: zod_1.z.array(zod_1.z.string()).optional().describe("Required monitoring and logs") }); /** * Esquema Zod para validação de parâmetros do Booster_Steps */ exports.BoosterStepsParamsSchema = zod_1.z.object({ title: zod_1.z.string().min(3).max(100).describe("Title of the task for the filename. Should be descriptive and filesystem-safe."), taskDescription: zod_1.z.string().min(10).describe("General description of the task/project that will be broken down into detailed cards."), projectPath: zod_1.z.string().min(1).describe("Path to the project directory where the step cards will be saved. This parameter is required."), steps: zod_1.z.array(exports.TaskStepSchema).min(1).describe("Array of detailed step cards provided by the model. Each step should follow the card template structure.") });