wegho-agentes 5.0.0 → 6.0.0

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.
Files changed (31) hide show
  1. package/.agents/cli.ts +25 -8
  2. package/.agents/memory/ai-agents-agent/specialty.md +13 -0
  3. package/.agents/memory/architecture-agent/failures.json +26 -1
  4. package/.agents/memory/architecture-agent/successes.json +14 -0
  5. package/.agents/memory/automation-agent/specialty.md +13 -0
  6. package/.agents/memory/backend-agent/specialty.md +13 -0
  7. package/.agents/memory/cloud-agent/specialty.md +13 -0
  8. package/.agents/memory/cro-agent/specialty.md +13 -0
  9. package/.agents/memory/database-agent/specialty.md +13 -0
  10. package/.agents/memory/devops-agent/specialty.md +13 -0
  11. package/.agents/memory/documentation-agent/failures.json +26 -1
  12. package/.agents/memory/documentation-agent/successes.json +14 -0
  13. package/.agents/memory/frontend-agent/failures.json +33 -33
  14. package/.agents/memory/frontend-agent/successes.json +131 -131
  15. package/.agents/memory/nextjs-agent/specialty.md +13 -0
  16. package/.agents/memory/pentest-agent/specialty.md +13 -0
  17. package/.agents/memory/planning-agent/specialty.md +13 -0
  18. package/.agents/memory/quality-agent/failures.json +38 -0
  19. package/.agents/memory/rag-agent/specialty.md +13 -0
  20. package/.agents/memory/security-agent/successes.json +61 -61
  21. package/.agents/memory/testing-agent/specialty.md +13 -0
  22. package/.agents/memory/uiux-agent/specialty.md +13 -0
  23. package/.agents/orchestrator.ts +93 -19
  24. package/.agents/validate.ts +17 -0
  25. package/.cursorrules +1114 -14
  26. package/README.md +33 -36
  27. package/docs/AGENT_RULES.md +1 -1
  28. package/docs/BUILD_HISTORY.md +21 -23
  29. package/docs/VERSION.md +1 -0
  30. package/docs/builds/v5.0.0/builds-log.md +14 -0
  31. package/package.json +2 -2
@@ -0,0 +1,13 @@
1
+ # rag-agent - Especialidade
2
+
3
+ ## Responsabilidades
4
+ - Definir responsabilidades específicas
5
+
6
+ ## Expertise
7
+ - Definir áreas de expertise
8
+
9
+ ## Regras
10
+ - Definir regras específicas
11
+
12
+ ## Tarefas Típicas
13
+ - Listar tarefas típicas
@@ -1,62 +1,62 @@
1
- [
2
- {
3
- "id": "1769137691455-ijx16j1pc",
4
- "timestamp": "2026-01-23T03:08:11.455Z",
5
- "taskDescription": "Inicializar memória do agente",
6
- "context": {
7
- "files": [],
8
- "areas": [
9
- "initialization"
10
- ],
11
- "complexity": "low"
12
- },
13
- "result": "success",
14
- "details": "Nenhuma vulnerabilidade detectada"
15
- },
16
- {
17
- "id": "1769254240571-w5klc3tl1",
18
- "timestamp": "2026-01-24T11:30:40.571Z",
19
- "taskDescription": "Detectar vulnerabilidades (XSS, CSRF, dados sensíveis)",
20
- "context": {
21
- "files": [],
22
- "areas": [
23
- "frontend",
24
- "auth",
25
- "security"
26
- ],
27
- "complexity": "medium"
28
- },
29
- "result": "success",
30
- "details": "Nenhuma vulnerabilidade detectada"
31
- },
32
- {
33
- "id": "1769254246021-h513rxol0",
34
- "timestamp": "2026-01-24T11:30:46.021Z",
35
- "taskDescription": "Detectar vulnerabilidades (XSS, CSRF, dados sensíveis)",
36
- "context": {
37
- "files": [],
38
- "areas": [
39
- "frontend",
40
- "security"
41
- ],
42
- "complexity": "medium"
43
- },
44
- "result": "success",
45
- "details": "Nenhuma vulnerabilidade detectada"
46
- },
47
- {
48
- "id": "1769254251458-m6fuqb1wt",
49
- "timestamp": "2026-01-24T11:30:51.458Z",
50
- "taskDescription": "Detectar vulnerabilidades (XSS, CSRF, dados sensíveis)",
51
- "context": {
52
- "files": [],
53
- "areas": [
54
- "frontend",
55
- "security"
56
- ],
57
- "complexity": "medium"
58
- },
59
- "result": "success",
60
- "details": "Nenhuma vulnerabilidade detectada"
61
- }
1
+ [
2
+ {
3
+ "id": "1769137691455-ijx16j1pc",
4
+ "timestamp": "2026-01-23T03:08:11.455Z",
5
+ "taskDescription": "Inicializar memória do agente",
6
+ "context": {
7
+ "files": [],
8
+ "areas": [
9
+ "initialization"
10
+ ],
11
+ "complexity": "low"
12
+ },
13
+ "result": "success",
14
+ "details": "Nenhuma vulnerabilidade detectada"
15
+ },
16
+ {
17
+ "id": "1769254240571-w5klc3tl1",
18
+ "timestamp": "2026-01-24T11:30:40.571Z",
19
+ "taskDescription": "Detectar vulnerabilidades (XSS, CSRF, dados sensíveis)",
20
+ "context": {
21
+ "files": [],
22
+ "areas": [
23
+ "frontend",
24
+ "auth",
25
+ "security"
26
+ ],
27
+ "complexity": "medium"
28
+ },
29
+ "result": "success",
30
+ "details": "Nenhuma vulnerabilidade detectada"
31
+ },
32
+ {
33
+ "id": "1769254246021-h513rxol0",
34
+ "timestamp": "2026-01-24T11:30:46.021Z",
35
+ "taskDescription": "Detectar vulnerabilidades (XSS, CSRF, dados sensíveis)",
36
+ "context": {
37
+ "files": [],
38
+ "areas": [
39
+ "frontend",
40
+ "security"
41
+ ],
42
+ "complexity": "medium"
43
+ },
44
+ "result": "success",
45
+ "details": "Nenhuma vulnerabilidade detectada"
46
+ },
47
+ {
48
+ "id": "1769254251458-m6fuqb1wt",
49
+ "timestamp": "2026-01-24T11:30:51.458Z",
50
+ "taskDescription": "Detectar vulnerabilidades (XSS, CSRF, dados sensíveis)",
51
+ "context": {
52
+ "files": [],
53
+ "areas": [
54
+ "frontend",
55
+ "security"
56
+ ],
57
+ "complexity": "medium"
58
+ },
59
+ "result": "success",
60
+ "details": "Nenhuma vulnerabilidade detectada"
61
+ }
62
62
  ]
@@ -0,0 +1,13 @@
1
+ # testing-agent - Especialidade
2
+
3
+ ## Responsabilidades
4
+ - Definir responsabilidades específicas
5
+
6
+ ## Expertise
7
+ - Definir áreas de expertise
8
+
9
+ ## Regras
10
+ - Definir regras específicas
11
+
12
+ ## Tarefas Típicas
13
+ - Listar tarefas típicas
@@ -0,0 +1,13 @@
1
+ # uiux-agent - Especialidade
2
+
3
+ ## Responsabilidades
4
+ - Definir responsabilidades específicas
5
+
6
+ ## Expertise
7
+ - Definir áreas de expertise
8
+
9
+ ## Regras
10
+ - Definir regras específicas
11
+
12
+ ## Tarefas Típicas
13
+ - Listar tarefas típicas
@@ -28,7 +28,7 @@ import { FeedbackCollector, UserFeedback } from './core/feedback-collector.js';
28
28
  import { PythonBridge } from './security/python-bridge.js';
29
29
  import { AgentConfig, DEFAULT_CONFIG } from './config.js';
30
30
  import { ProjectContext } from './context-loader.js';
31
- import { TaskContext, TaskResult } from './core/base-agent.js';
31
+ import { BaseAgent, TaskContext, TaskResult } from './core/base-agent.js';
32
32
  import { RetryUtility } from './core/retry-utility.js';
33
33
  import { AgentParallelizer } from './core/agent-parallelizer.js';
34
34
  import { PerformanceTracker } from './core/performance-tracker.js';
@@ -184,6 +184,7 @@ export class IntelligentOrchestrator {
184
184
  const startTime = Date.now();
185
185
  let checkpointId: string | null = null;
186
186
  let implementationPlan: ImplementationPlan | null = null;
187
+ const blockers: string[] = [];
187
188
 
188
189
  try {
189
190
  // 1. Analisar tarefa
@@ -210,7 +211,9 @@ export class IntelligentOrchestrator {
210
211
  const validationResult = await this.runValidation();
211
212
 
212
213
  if (!validationResult.passed) {
213
- throw new Error('Validação falhou: ' + validationResult.errors.join(', '));
214
+ console.log('⚠️ Validação falhou, mas prosseguindo para auditoria completa...');
215
+ validationResult.errors.forEach(err => blockers.push(err));
216
+ // Não lançar erro para permitir que os agentes de auditoria (Fase 6/7) rodem
214
217
  }
215
218
 
216
219
  // 6. Selecionar melhores agentes baseado em memória (para auditoria)
@@ -228,7 +231,6 @@ export class IntelligentOrchestrator {
228
231
  console.log(`⏱️ Redução estimada de tempo: ${timeEstimate.reduction}% (${timeEstimate.sequential}s → ${timeEstimate.parallel}s)\n`);
229
232
 
230
233
  const reports: AgentReport[] = [];
231
- const blockers: string[] = [];
232
234
  let success = true;
233
235
 
234
236
  // VERIFICAÇÃO ANTI-DUPLICAÇÃO PROATIVA
@@ -252,22 +254,26 @@ export class IntelligentOrchestrator {
252
254
 
253
255
  // 🆕 CRIAR BUILD se houve mudanças bem-sucedidas
254
256
  const successfulAgents = groupReports.filter(r => r.status === 'success');
255
- if (successfulAgents.length > 0 && implementationPlan?.files.create.length > 0) { // Assuming context.files refers to the files from the implementation plan
256
- try {
257
- const buildNumber = await this.buildManager.createBuild(
258
- implementationPlan.files.create.map(f => f.path), // Use files from implementation plan
259
- `orchestrator (${successfulAgents.map(a => a.agentName).join(', ')})`,
260
- true,
261
- taskDescription // Pass taskDescription instead of 'task'
262
- );
263
- console.log(`\n📦 Build ${buildNumber} criado automaticamente`);
264
- console.log(` Arquivos rastreados: ${implementationPlan.files.create.length}`);
265
- console.log(` Agentes envolvidos: ${successfulAgents.length}`);
266
-
267
- // Adicionar informação do build ao report (assuming AgentReport can be extended or a separate report is generated later)
268
- // For now, just log it. If a final report object is built, this info can be added there.
269
- } catch (error) {
270
- console.warn('⚠️ Erro ao criar build:', error);
257
+ if (successfulAgents.length > 0 && implementationPlan) {
258
+ const allFiles = [
259
+ ...implementationPlan.files.create.map(f => f.path),
260
+ ...implementationPlan.files.modify.map(f => f.path)
261
+ ];
262
+
263
+ if (allFiles.length > 0) {
264
+ try {
265
+ const buildNumber = await this.buildManager.createBuild(
266
+ allFiles,
267
+ `orchestrator (${successfulAgents.map(a => a.agentName).join(', ')})`,
268
+ true,
269
+ taskDescription
270
+ );
271
+ console.log(`\n📦 Build ${buildNumber} criado automaticamente`);
272
+ console.log(` Arquivos rastreados: ${allFiles.length}`);
273
+ console.log(` Agentes envolvidos: ${successfulAgents.map(a => a.agentName).join(', ')}`);
274
+ } catch (error) {
275
+ console.warn('⚠️ Erro ao criar build:', error);
276
+ }
271
277
  }
272
278
  }
273
279
 
@@ -310,6 +316,43 @@ export class IntelligentOrchestrator {
310
316
  // 5. Decisão final
311
317
  const status = success ? 'GO' : 'NO-GO';
312
318
 
319
+ // 🆕 APRENDIZADO AUTOMÁTICO: Atualizar memória dos agentes baseados no resultado FINAL (Build/Audit)
320
+ console.log('\n🧠 Fase Final: Sincronizando Memória e Aprendizado...');
321
+ for (const report of reports) {
322
+ const agent = this.getAgentByName(report.agentName);
323
+ if (agent && agent instanceof BaseAgent) {
324
+ const finalSuccess = success && report.status === 'success';
325
+ const context: TaskContext = {
326
+ files: implementationPlan?.files.create.map(f => f.path) || [],
327
+ areas: analysis.detectedAreas,
328
+ complexity: analysis.complexity,
329
+ };
330
+
331
+ // Se o projeto falhou no build/audit, o agente "falhou" em garantir a integridade global
332
+ await agent.recordOutcome(
333
+ report.summary,
334
+ context,
335
+ { success: finalSuccess, details: report.details },
336
+ {
337
+ satisfied: finalSuccess,
338
+ likes: finalSuccess ? ['Passou na validação final'] : [],
339
+ dislikes: !finalSuccess ? ['Falhou na validação global ou audit'] : [],
340
+ suggestions: !finalSuccess ? ['Revisar integração com o sistema de build'] : []
341
+ }
342
+ );
343
+
344
+ if (finalSuccess) {
345
+ // Promover a aprendizado automático se teve sucesso
346
+ await agent.learn(
347
+ taskDescription,
348
+ `Implementação bem-sucedida de: ${taskDescription}`,
349
+ `Repetir padrões usados em: ${implementationPlan?.title}`,
350
+ [this.generateTaskId()]
351
+ );
352
+ }
353
+ }
354
+ }
355
+
313
356
  console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
314
357
  console.log(`${success ? '✅ GO' : '❌ NO-GO'} - Execução ${success ? 'concluída' : 'bloqueada'}`);
315
358
  console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
@@ -707,6 +750,37 @@ export class IntelligentOrchestrator {
707
750
  const taskDescription = `${plan.title}: ${plan.description}`;
708
751
  return await this.orchestrateTask(taskDescription);
709
752
  }
753
+
754
+ /**
755
+ * Retorna a instância de um agente pelo nome
756
+ */
757
+ private getAgentByName(name: string): any {
758
+ const agentsMap: Record<string, any> = {
759
+ 'frontend-agent': this.frontendAgent,
760
+ 'security-agent': this.securityAgent,
761
+ 'architecture-agent': this.architectureAgent,
762
+ 'quality-agent': this.qualityAgent,
763
+ 'documentation-agent': this.documentationAgent,
764
+ 'inventory-agent': this.inventoryAgent,
765
+ 'cms-agent': this.cmsAgent,
766
+ 'seo-agent': this.seoAgent,
767
+ 'production-control-agent': this.productionControlAgent,
768
+ 'route-agent': this.routeAgent,
769
+ 'nextjs-agent': this.nextjsAgent,
770
+ 'uiux-agent': this.uiuxAgent,
771
+ 'backend-agent': this.backendAgent,
772
+ 'database-agent': this.databaseAgent,
773
+ 'ai-agents-agent': this.aiAgentsAgent,
774
+ 'rag-agent': this.ragAgent,
775
+ 'pentest-agent': this.pentestAgent,
776
+ 'devops-agent': this.devopsAgent,
777
+ 'cloud-agent': this.cloudAgent,
778
+ 'testing-agent': this.testingAgent,
779
+ 'cro-agent': this.croAgent,
780
+ 'automation-agent': this.automationAgent
781
+ };
782
+ return agentsMap[name];
783
+ }
710
784
  }
711
785
 
712
786
  // Manter compatibilidade com código existente
@@ -44,6 +44,8 @@ async function validateProject(): Promise<ValidationResult> {
44
44
  '.next/**',
45
45
  'dist/**',
46
46
  'build/**',
47
+ '.agents/**', // Agentes são neutros e isentos do limite de linhas
48
+ 'scripts/**', // Scripts de teste/utilitários são isentos
47
49
  '.agents/memory/**',
48
50
  'coverage/**'
49
51
  ]
@@ -51,10 +53,25 @@ async function validateProject(): Promise<ValidationResult> {
51
53
 
52
54
  let filesOverLimit = 0;
53
55
  for (const file of filesToCheck) {
56
+ // Ignore agents, scripts, node_modules, skills anywhere in the path if they are part of the system
57
+ const lowerFile = file.toLowerCase().replace(/\\/g, '/');
58
+ if (
59
+ lowerFile.includes('/node_modules/') ||
60
+ lowerFile.startsWith('.agents/') ||
61
+ lowerFile.includes('/.agents/') ||
62
+ lowerFile.startsWith('scripts/') ||
63
+ lowerFile.includes('/scripts/') ||
64
+ lowerFile.startsWith('skills/') ||
65
+ lowerFile.includes('/skills/')
66
+ ) {
67
+ continue;
68
+ }
69
+
54
70
  const fullPath = path.join(projectRoot, file);
55
71
  const validation = validateFileLines(fullPath, 500);
56
72
 
57
73
  if (!validation.valid) {
74
+ console.log(` ❌ ${file} excede o limite: ${validation.lineCount} linhas`);
58
75
  result.errors.push(validation.message || `${file} excede 500 linhas`);
59
76
  filesOverLimit++;
60
77
  result.passed = false;