agent-mp 0.5.27 → 0.5.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1085,6 +1085,41 @@ INSTRUCCIONES:
1085
1085
  async runImplementor(taskId, plan) {
1086
1086
  const taskDir = path.join(this.projectDir, '.agent', 'tasks', taskId);
1087
1087
  log.phase(2, 'Implementacion', this.config.roles.implementor.cli, this.config.roles.implementor.model);
1088
+ // VERIFICAR SI YA EXISTE UN RESULT.MD PREVIO (para detectar re-intentos)
1089
+ const resultPath = path.join(taskDir, 'result.md');
1090
+ if (await fileExists(resultPath)) {
1091
+ const prevResult = await readFile(resultPath);
1092
+ const isFail = prevResult.toUpperCase().includes('FAIL') || prevResult.includes('❌');
1093
+ if (isFail) {
1094
+ log.warn('⚠️ Esta tarea YA fue implementada antes y el REVIEWER marcó FAIL');
1095
+ console.log('');
1096
+ console.log(chalk.yellow(' Resultado previo:'));
1097
+ console.log(chalk.dim(' ' + prevResult.split('\n').slice(0, 15).join('\n ')));
1098
+ if (prevResult.split('\n').length > 15) {
1099
+ console.log(chalk.dim(' ... (ver result.md completo para más detalles)'));
1100
+ }
1101
+ console.log('');
1102
+ // Preguntar al usuario qué hacer
1103
+ const action = await ask(' La tarea falló antes. ¿Qué querés hacer?\n (r=reintentar arreglando el error / v=ver result.md completo / c=cancelar): ', this.rl, this.fi);
1104
+ if (action.toLowerCase() === 'v') {
1105
+ console.log('');
1106
+ console.log(chalk.cyan(' === result.md completo ==='));
1107
+ console.log(chalk.white(prevResult));
1108
+ console.log(chalk.cyan(' =========================='));
1109
+ console.log('');
1110
+ const retry = await ask(' ¿Reintentar igual? (y/n): ', this.rl, this.fi);
1111
+ if (retry.toLowerCase() !== 'y') {
1112
+ log.info('Implementación cancelada por el usuario.');
1113
+ throw new Error('USER_CANCELLED_AFTER_FAIL');
1114
+ }
1115
+ }
1116
+ else if (action.toLowerCase() === 'c' || action.toLowerCase() === 'n') {
1117
+ log.info('Implementación cancelada por el usuario.');
1118
+ throw new Error('USER_CANCELLED_AFTER_FAIL');
1119
+ }
1120
+ // Si es 'r', continúa con la implementación
1121
+ }
1122
+ }
1088
1123
  const structurePath = path.join(this.projectDir, '.agent', 'rules', 'structure.md');
1089
1124
  let structureRules = '';
1090
1125
  if (await fileExists(structurePath)) {
@@ -1099,6 +1134,14 @@ INSTRUCCIONES:
1099
1134
  }
1100
1135
  const allTargetFiles = [...new Set(plan.steps.flatMap((s) => s.files || []))];
1101
1136
  const stepsText = plan.steps.map((s) => `Step ${s.num}: ${s.description}${s.files?.length ? `\n Archivos: ${s.files.join(', ')}` : ''}`).join('\n');
1137
+ // Si existe result.md previo con FAIL, incluirlo en el prompt para que el implementor sepa qué corregir
1138
+ let failContext = '';
1139
+ if (await fileExists(resultPath)) {
1140
+ const prevResult = await readFile(resultPath);
1141
+ if (prevResult.toUpperCase().includes('FAIL') || prevResult.includes('❌')) {
1142
+ failContext = `\n\n⚠️ INTENTO PREVIO FALLIDO — El reviewer marcó estos errores:\n=== RESULT.MD PREVIO ===\n${prevResult}\n======================\n\nIMPORTANTE: Debés corregir ESPECÍFICAMENTE los puntos marcados como FAIL en el result.md previo. No vuelvas a implementar lo mismo sin corregir los errores señalados.\n`;
1143
+ }
1144
+ }
1102
1145
  // The engine writes files itself — ask the LLM to generate content in parseable blocks.
1103
1146
  // This avoids depending on CLI tool-use capabilities which are unavailable in API mode.
1104
1147
  const prompt = `TAREA: ${plan.description}
@@ -1111,7 +1154,7 @@ ${allTargetFiles.length ? `ARCHIVOS A CREAR/MODIFICAR:\n${allTargetFiles.map(f =
1111
1154
 
1112
1155
  ${context ? `CONTEXTO DEL PROYECTO:\n${context.slice(0, 2000)}\n` : ''}
1113
1156
  ${archContext ? `ARQUITECTURA EXISTENTE:\n${archContext}\n` : ''}
1114
- ${structureRules ? `REGLAS DE ESTRUCTURA:\n${structureRules}\n` : ''}
1157
+ ${structureRules ? `REGLAS DE ESTRUCTURA:\n${structureRules}\n` : ''}${failContext}
1115
1158
 
1116
1159
  INSTRUCCIONES CRITICAS:
1117
1160
  1. Para CADA archivo que debes crear/modificar, usa este formato EXACTO:
@@ -1124,7 +1167,8 @@ contenido completo del archivo aqui
1124
1167
  3. Genera TODOS los archivos necesarios — uno por bloque FILE.
1125
1168
  4. Incluye el contenido completo de cada archivo (no fragmentos).
1126
1169
  5. Si un step modifica un archivo existente, incluye el archivo completo con los cambios.
1127
- 6. NO incluyas explicaciones fuera de los bloques FILE.`;
1170
+ 6. NO incluyas explicaciones fuera de los bloques FILE.
1171
+ 7. Si hay un INTENTO PREVIO FALLIDO, leé atentamente los errores del reviewer y CORREGÍ ESPECÍFICAMENTE esos puntos.`;
1128
1172
  const res = await this.runWithFallback('implementor', prompt, 'Implementacion');
1129
1173
  const text = extractCliText(res);
1130
1174
  // Parse === FILE: path === ... === END FILE === blocks written by the LLM
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-mp",
3
- "version": "0.5.27",
3
+ "version": "0.5.28",
4
4
  "description": "Deterministic multi-agent CLI orchestrator — plan, code, review",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",