wegho-agentes 7.0.0 → 7.0.1
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.
- package/.agent/skills/wegho-global-rules/SKILL.md +20 -0
- package/.agent/workflows/PROMPT_GUIDE.md +7 -4
- package/.agents/cli.ts +29 -21
- package/.agents/core/base-agent.ts +28 -12
- package/.agents/core/memory-system.ts +45 -13
- package/.agents/core/report-generator.ts +26 -19
- package/.agents/orchestrator.ts +104 -74
- package/.clinerules +318 -1229
- package/.cursorrules +0 -189
- package/README.md +3 -3
- package/docs/VERSION.md +3 -2
- package/package.json +3 -3
- package/.agents/agents/ai-agents/README.md +0 -175
- package/.agents/agents/ai-agents/agent.ts +0 -83
- package/.agents/agents/ai-agents/specialty.md +0 -14
- package/.agents/agents/architecture/README.md +0 -61
- package/.agents/agents/architecture/agent.ts +0 -238
- package/.agents/agents/architecture/memory.md +0 -111
- package/.agents/agents/architecture/specialty.md +0 -31
- package/.agents/agents/automation/README.md +0 -60
- package/.agents/agents/automation/agent.ts +0 -61
- package/.agents/agents/automation/specialty.md +0 -14
- package/.agents/agents/backend/README.md +0 -155
- package/.agents/agents/backend/agent.ts +0 -100
- package/.agents/agents/backend/specialty.md +0 -14
- package/.agents/agents/cloud/README.md +0 -73
- package/.agents/agents/cloud/agent.ts +0 -53
- package/.agents/agents/cloud/specialty.md +0 -14
- package/.agents/agents/code-auditor/README.md +0 -37
- package/.agents/agents/code-auditor/agent.ts +0 -334
- package/.agents/agents/code-auditor/specialty.md +0 -14
- package/.agents/agents/cro/README.md +0 -200
- package/.agents/agents/cro/agent.ts +0 -61
- package/.agents/agents/cro/specialty.md +0 -14
- package/.agents/agents/database/README.md +0 -67
- package/.agents/agents/database/agent.ts +0 -93
- package/.agents/agents/database/specialty.md +0 -14
- package/.agents/agents/devops/README.md +0 -84
- package/.agents/agents/devops/agent.ts +0 -54
- package/.agents/agents/devops/specialty.md +0 -14
- package/.agents/agents/documentation/README.md +0 -107
- package/.agents/agents/documentation/agent.ts +0 -253
- package/.agents/agents/documentation/memory.md +0 -56
- package/.agents/agents/documentation/specialty.md +0 -33
- package/.agents/agents/frontend/README.md +0 -188
- package/.agents/agents/frontend/agent.ts +0 -211
- package/.agents/agents/frontend/memory.md +0 -139
- package/.agents/agents/frontend/specialty.md +0 -30
- package/.agents/agents/inventory/README.md +0 -35
- package/.agents/agents/inventory/agent.ts +0 -758
- package/.agents/agents/inventory/memory.md +0 -50
- package/.agents/agents/inventory/specialty.md +0 -129
- package/.agents/agents/nextjs/README.md +0 -58
- package/.agents/agents/nextjs/agent.ts +0 -114
- package/.agents/agents/nextjs/specialty.md +0 -14
- package/.agents/agents/pentest/README.md +0 -228
- package/.agents/agents/pentest/agent.ts +0 -96
- package/.agents/agents/pentest/specialty.md +0 -14
- package/.agents/agents/planning/README.md +0 -107
- package/.agents/agents/planning/agent.ts +0 -389
- package/.agents/agents/planning/specialty.md +0 -14
- package/.agents/agents/project-discovery/README.md +0 -35
- package/.agents/agents/project-discovery/agent.ts +0 -344
- package/.agents/agents/project-discovery/specialty.md +0 -14
- package/.agents/agents/quality/README.md +0 -81
- package/.agents/agents/quality/agent.ts +0 -269
- package/.agents/agents/quality/memory.md +0 -110
- package/.agents/agents/quality/specialty.md +0 -31
- package/.agents/agents/rag/README.md +0 -41
- package/.agents/agents/rag/agent.ts +0 -85
- package/.agents/agents/rag/specialty.md +0 -14
- package/.agents/agents/security/README.md +0 -152
- package/.agents/agents/security/agent.ts +0 -218
- package/.agents/agents/security/memory.md +0 -91
- package/.agents/agents/security/specialty.md +0 -31
- package/.agents/agents/task-analyzer/README.md +0 -36
- package/.agents/agents/task-analyzer/agent.ts +0 -462
- package/.agents/agents/task-analyzer/specialty.md +0 -14
- package/.agents/agents/testing/README.md +0 -161
- package/.agents/agents/testing/agent.ts +0 -61
- package/.agents/agents/testing/specialty.md +0 -14
- package/.agents/agents/uiux/README.md +0 -68
- package/.agents/agents/uiux/agent.ts +0 -95
- package/.agents/agents/uiux/specialty.md +0 -14
- package/.agents/base/base-agent.ts +0 -331
- package/.agents/base/memory-system.ts +0 -397
- package/.agents/base/skill-manager.ts +0 -95
- package/.agents/convert-memory.ps1 +0 -153
- package/.agents/examples/reporting-example.md +0 -203
- package/.agents/managers/build-manager.ts +0 -304
- package/.agents/managers/cache-manager.ts +0 -184
- package/.agents/managers/checkpoint-manager.ts +0 -299
- package/.agents/migrate-agents.ps1 +0 -117
- package/.agents/templates/change-report.md +0 -55
- package/.agents/templates/execution-plan.md +0 -36
- package/.agents/unmapped-skills.txt +0 -0
- package/.agents/utils/agent-migrator.ts +0 -360
- package/.agents/utils/agent-monitor.ts +0 -102
- package/.agents/utils/agent-parallelizer.ts +0 -108
- package/.agents/utils/context-monitor.ts +0 -140
- package/.agents/utils/feedback-collector.ts +0 -207
- package/.agents/utils/file-generator.ts +0 -304
- package/.agents/utils/memory-converter.ts +0 -217
- package/.agents/utils/memory-dashboard.ts +0 -147
- package/.agents/utils/performance-tracker.ts +0 -275
- package/.agents/utils/report-generator.ts +0 -193
- package/.agents/utils/retry-utility.ts +0 -140
- package/.agents/utils/workflow-validator.ts +0 -158
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Testing Agent - Especialidade
|
|
2
|
-
|
|
3
|
-
## Responsabilidades
|
|
4
|
-
- Definir responsabilidades especÃficas
|
|
5
|
-
|
|
6
|
-
## Expertise
|
|
7
|
-
- Definir áreas de expertise
|
|
8
|
-
|
|
9
|
-
## Regras
|
|
10
|
-
- Arquivos < 500 linhas
|
|
11
|
-
- Não alucinar APIs
|
|
12
|
-
|
|
13
|
-
## Tarefas TÃpicas
|
|
14
|
-
- Listar tarefas tÃpicas
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# UI/UX Agent
|
|
2
|
-
|
|
3
|
-
## 🎯 Responsabilidade
|
|
4
|
-
|
|
5
|
-
Especialista em design de interfaces, experiência do usuário, acessibilidade e usabilidade.
|
|
6
|
-
|
|
7
|
-
## 🛠️ Skills Disponíveis
|
|
8
|
-
|
|
9
|
-
### ♿ Acessibilidade
|
|
10
|
-
|
|
11
|
-
#### [web-accessibility](../../skills/web-accessibility/)
|
|
12
|
-
**Propósito**: WCAG 2.1 compliance
|
|
13
|
-
**Quando usar**: Garantir acessibilidade
|
|
14
|
-
**Capacidades**:
|
|
15
|
-
- ARIA attributes
|
|
16
|
-
- Keyboard navigation
|
|
17
|
-
- Screen reader support
|
|
18
|
-
- Color contrast
|
|
19
|
-
- Focus management
|
|
20
|
-
|
|
21
|
-
### 📐 Design
|
|
22
|
-
|
|
23
|
-
#### [responsive-design-principles](../../skills/responsive-design-principles/)
|
|
24
|
-
**Propósito**: Design responsivo
|
|
25
|
-
**Quando usar**: Criar layouts adaptáveis
|
|
26
|
-
**Capacidades**:
|
|
27
|
-
- Mobile-first approach
|
|
28
|
-
- Breakpoints
|
|
29
|
-
- Fluid layouts
|
|
30
|
-
- Media queries
|
|
31
|
-
|
|
32
|
-
#### [interactive-portfolio](../../skills/interactive-portfolio/)
|
|
33
|
-
**Propósito**: Port fólios interativos
|
|
34
|
-
**Quando usar**: Criar showcases
|
|
35
|
-
|
|
36
|
-
#### [algorithmic-art](../../skills/algorithmic-art/)
|
|
37
|
-
**Propósito**: Arte algorítmica
|
|
38
|
-
**Quando usar**: Arte generativa
|
|
39
|
-
|
|
40
|
-
#### [core-components](../../skills/core-components/)
|
|
41
|
-
**Propósito**: Componentes essenciais
|
|
42
|
-
**Quando usar**: Biblioteca de componentes base
|
|
43
|
-
|
|
44
|
-
## 📋 Tarefas Típicas
|
|
45
|
-
|
|
46
|
-
- ✅ Auditar acessibilidade (WCAG)
|
|
47
|
-
- ✅ Validar responsividade
|
|
48
|
-
- ✅ Revisar UX flows
|
|
49
|
-
- ✅ Testar usabilidade
|
|
50
|
-
- ✅ Validar contraste de cores
|
|
51
|
-
- ✅ Verificar navegação por teclado
|
|
52
|
-
|
|
53
|
-
## 🔗 Dependências
|
|
54
|
-
|
|
55
|
-
- `BaseAgent`
|
|
56
|
-
- `MemorySystem`
|
|
57
|
-
- `SkillManager`
|
|
58
|
-
|
|
59
|
-
## 🔄 Fluxo de Trabalho
|
|
60
|
-
|
|
61
|
-
1. **Consulta memória**: Busca padrões de UI similares
|
|
62
|
-
2. **Carrega skills**: acessibilidade, responsive
|
|
63
|
-
3. **Executa auditoria**: Valida WCAG e UX
|
|
64
|
-
4. **Registra resultado**: Salva findings em memory.md
|
|
65
|
-
|
|
66
|
-
## 📊 Memória
|
|
67
|
-
|
|
68
|
-
Ver [memory.md](./memory.md) para histórico de auditorias UI/UX.
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { BaseAgent, TaskContext, TaskResult } from '../../base/base-agent.js';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* UI/UX Agent - Especialista em Design de Interfaces
|
|
7
|
-
*
|
|
8
|
-
* Responsabilidades:
|
|
9
|
-
* - Design de interfaces e experiência do usuário
|
|
10
|
-
* - Mobile design e responsive design
|
|
11
|
-
* - Design systems e component libraries
|
|
12
|
-
* - Acessibilidade e usabilidade
|
|
13
|
-
*
|
|
14
|
-
* Skills: ui-ux-pro-max, mobile-design, canvas-design,
|
|
15
|
-
* web-design-guidelines, 3d-web-experience
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
export class UIUXAgent extends BaseAgent {
|
|
19
|
-
private skillsPath: string;
|
|
20
|
-
|
|
21
|
-
constructor(memoryPath: string) {
|
|
22
|
-
super('uiux-agent', memoryPath);
|
|
23
|
-
this.skillsPath = path.join(process.cwd(), 'skills');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async executeTask(taskDescription: string, context: TaskContext): Promise<TaskResult> {
|
|
27
|
-
console.log(`\n🎨 UI/UX Agent analisando tarefa...\n`);
|
|
28
|
-
|
|
29
|
-
const issues: string[] = [];
|
|
30
|
-
const recommendations: string[] = [];
|
|
31
|
-
|
|
32
|
-
// Análise de Design
|
|
33
|
-
if (taskDescription.toLowerCase().includes('design') ||
|
|
34
|
-
taskDescription.toLowerCase().includes('ui') ||
|
|
35
|
-
taskDescription.toLowerCase().includes('interface')) {
|
|
36
|
-
|
|
37
|
-
recommendations.push('✅ Seguir princÃpios de design system');
|
|
38
|
-
recommendations.push('✅ Manter consistência visual');
|
|
39
|
-
recommendations.push('✅ Usar hierarquia visual clara');
|
|
40
|
-
recommendations.push('✅ Implementar feedback visual para ações');
|
|
41
|
-
recommendations.push('✅ Considerar estados de loading e erro');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Análise de UX
|
|
45
|
-
if (taskDescription.toLowerCase().includes('ux') ||
|
|
46
|
-
taskDescription.toLowerCase().includes('experiência')) {
|
|
47
|
-
|
|
48
|
-
recommendations.push('✅ Minimizar steps no fluxo do usuário');
|
|
49
|
-
recommendations.push('✅ Fornecer feedback claro');
|
|
50
|
-
recommendations.push('✅ Implementar validação em tempo real');
|
|
51
|
-
recommendations.push('✅ Considerar casos de erro');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Análise de Mobile
|
|
55
|
-
if (taskDescription.toLowerCase().includes('mobile') ||
|
|
56
|
-
taskDescription.toLowerCase().includes('responsive')) {
|
|
57
|
-
|
|
58
|
-
recommendations.push('✅ Design mobile-first');
|
|
59
|
-
recommendations.push('✅ Touch targets de pelo menos 44x44px');
|
|
60
|
-
recommendations.push('✅ Testar em diferentes tamanhos de tela');
|
|
61
|
-
recommendations.push('✅ Otimizar para gestos touch');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Análise de Acessibilidade
|
|
65
|
-
if (taskDescription.toLowerCase().includes('acessibilidade') ||
|
|
66
|
-
taskDescription.toLowerCase().includes('a11y')) {
|
|
67
|
-
|
|
68
|
-
recommendations.push('✅ Usar semantic HTML');
|
|
69
|
-
recommendations.push('✅ Adicionar ARIA labels quando necessário');
|
|
70
|
-
recommendations.push('✅ Garantir contraste adequado (WCAG AA)');
|
|
71
|
-
recommendations.push('✅ Suportar navegação por teclado');
|
|
72
|
-
recommendations.push('✅ Testar com screen readers');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Análise de Performance Visual
|
|
76
|
-
if (taskDescription.toLowerCase().includes('performance')) {
|
|
77
|
-
recommendations.push('✅ Otimizar imagens e assets');
|
|
78
|
-
recommendations.push('✅ Usar lazy loading');
|
|
79
|
-
recommendations.push('✅ Minimizar layout shifts (CLS)');
|
|
80
|
-
recommendations.push('✅ Implementar skeleton screens');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const success = issues.length === 0;
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
success,
|
|
87
|
-
details: success
|
|
88
|
-
? `UI/UX Agent: ${recommendations.length} recomendações de design`
|
|
89
|
-
: `UI/UX Agent: ${issues.length} problemas encontrados`,
|
|
90
|
-
recommendations,
|
|
91
|
-
blockers: issues
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# UI/UX Agent - Especialidade
|
|
2
|
-
|
|
3
|
-
## Responsabilidades
|
|
4
|
-
- Definir responsabilidades especÃficas
|
|
5
|
-
|
|
6
|
-
## Expertise
|
|
7
|
-
- Definir áreas de expertise
|
|
8
|
-
|
|
9
|
-
## Regras
|
|
10
|
-
- Arquivos < 500 linhas
|
|
11
|
-
- Não alucinar APIs
|
|
12
|
-
|
|
13
|
-
## Tarefas TÃpicas
|
|
14
|
-
- Listar tarefas tÃpicas
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base Agent - Classe base para todos os agentes
|
|
3
|
-
*
|
|
4
|
-
* Responsabilidades:
|
|
5
|
-
* - Fornecer interface comum para todos os agentes
|
|
6
|
-
* - Integrar sistema de memória
|
|
7
|
-
* - Gerenciar consulta e registro de resultados
|
|
8
|
-
* - Implementar aprendizado contínuo
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { MemorySystem, MemoryEntry } from './memory-system.js';
|
|
12
|
-
import { WorkflowStep } from './workflow-validator.js';
|
|
13
|
-
import { SkillManager, Skill } from './skill-manager.js';
|
|
14
|
-
import * as fs from 'fs';
|
|
15
|
-
import * as path from 'path';
|
|
16
|
-
|
|
17
|
-
export interface TaskContext {
|
|
18
|
-
files: string[];
|
|
19
|
-
areas: string[];
|
|
20
|
-
complexity: 'low' | 'medium' | 'high';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface TaskResult {
|
|
24
|
-
success: boolean;
|
|
25
|
-
details: string;
|
|
26
|
-
issues?: string[];
|
|
27
|
-
warnings?: string[];
|
|
28
|
-
recommendations?: string[];
|
|
29
|
-
blockers?: string[];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface UserFeedback {
|
|
33
|
-
satisfied: boolean;
|
|
34
|
-
likes: string[];
|
|
35
|
-
dislikes: string[];
|
|
36
|
-
suggestions: string[];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Classe base abstrata para agentes
|
|
41
|
-
*/
|
|
42
|
-
export abstract class BaseAgent {
|
|
43
|
-
protected agentName: string;
|
|
44
|
-
protected memory: MemorySystem;
|
|
45
|
-
protected skillManager: SkillManager;
|
|
46
|
-
protected specialtyPath: string;
|
|
47
|
-
protected workflowSteps: WorkflowStep[] = [];
|
|
48
|
-
protected referenceReposPath: string;
|
|
49
|
-
|
|
50
|
-
constructor(agentName: string, memoryBasePath: string = '.agents/memory') {
|
|
51
|
-
this.agentName = agentName;
|
|
52
|
-
this.memory = new MemorySystem(memoryBasePath);
|
|
53
|
-
this.skillManager = new SkillManager();
|
|
54
|
-
this.specialtyPath = path.join(memoryBasePath, agentName, 'specialty.md');
|
|
55
|
-
this.referenceReposPath = path.join(memoryBasePath, 'reference-repositories.json');
|
|
56
|
-
this.ensureSpecialtyFile();
|
|
57
|
-
this.initializeWorkflowSteps();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Método abstrato: cada agente implementa sua lógica
|
|
62
|
-
*/
|
|
63
|
-
abstract executeTask(taskDescription: string, context: TaskContext): Promise<TaskResult>;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Executa tarefa consultando memória
|
|
67
|
-
*/
|
|
68
|
-
async executeWithMemory(taskDescription: string, context: TaskContext): Promise<TaskResult> {
|
|
69
|
-
console.log(`\n${'='.repeat(60)}`);
|
|
70
|
-
console.log(`🤖 AGENTE ATIVO: ${this.agentName.toUpperCase()}`);
|
|
71
|
-
console.log(`${'='.repeat(60)}`);
|
|
72
|
-
console.log(`📋 Tarefa: ${taskDescription}`);
|
|
73
|
-
console.log(`⏰ Início: ${new Date().toLocaleTimeString('pt-BR')}\n`);
|
|
74
|
-
|
|
75
|
-
// PASSO 1: Consultar casos similares
|
|
76
|
-
this.markStepCompleted('Consultar Memória', { count: 0 });
|
|
77
|
-
const similarCases = this.memory.getSimilarCases(this.agentName, taskDescription, 5);
|
|
78
|
-
|
|
79
|
-
if (similarCases.length > 0) {
|
|
80
|
-
console.log(`💭 [${this.agentName}] Encontrei ${similarCases.length} caso(s) similar(es):`);
|
|
81
|
-
similarCases.forEach((case_, index) => {
|
|
82
|
-
const emoji = case_.result === 'success' ? '✅' : '❌';
|
|
83
|
-
console.log(` ${index + 1}. ${emoji} ${case_.taskDescription}`);
|
|
84
|
-
if (case_.userFeedback) {
|
|
85
|
-
console.log(` Feedback: ${case_.userFeedback.satisfied ? '👍' : '👎'}`);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
this.updateStepDetails('Consultar Memória', { count: similarCases.length });
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// PASSO 2: Obter recomendações baseadas em aprendizados
|
|
92
|
-
this.markStepCompleted('Obter Recomendações', { count: 0 });
|
|
93
|
-
const recommendations = this.memory.getRecommendations(this.agentName, taskDescription);
|
|
94
|
-
|
|
95
|
-
if (recommendations.length > 0) {
|
|
96
|
-
console.log(`\n💡 [${this.agentName}] Recomendações baseadas em aprendizados:`);
|
|
97
|
-
recommendations.forEach((rec, index) => {
|
|
98
|
-
console.log(` ${index + 1}. ${rec}`);
|
|
99
|
-
});
|
|
100
|
-
this.updateStepDetails('Obter Recomendações', { count: recommendations.length });
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// PASSO 3: Consultar repositórios de referência
|
|
104
|
-
this.markStepCompleted('Consultar Repositórios');
|
|
105
|
-
await this.consultReferenceRepositories();
|
|
106
|
-
|
|
107
|
-
// PASSO 4: Aplicar aprendizados com alta confiança
|
|
108
|
-
this.markStepCompleted('Aplicar Aprendizados');
|
|
109
|
-
this.applyHighConfidenceLearnings(recommendations);
|
|
110
|
-
|
|
111
|
-
// PASSO 5: Carregar Skills relevantes
|
|
112
|
-
this.markStepCompleted('Carregar Skills');
|
|
113
|
-
const skills = await this.skillManager.getRelevantSkills(taskDescription);
|
|
114
|
-
|
|
115
|
-
if (skills.length === 1) {
|
|
116
|
-
console.log(`\n💬 [${this.agentName}] Sou o agente ${this.agentName}, vou usar a skill ${skills[0].metadata.name}.`);
|
|
117
|
-
} else if (skills.length > 1) {
|
|
118
|
-
console.log(`\n💬 [${this.agentName}] Sou o agente ${this.agentName}, vou usar as seguintes skills para esta tarefa:`);
|
|
119
|
-
skills.forEach(skill => {
|
|
120
|
-
console.log(` - ${skill.metadata.name}: ${skill.metadata.description}`);
|
|
121
|
-
});
|
|
122
|
-
} else {
|
|
123
|
-
console.log(`\nℹ️ [${this.agentName}] Nenhuma skill específica encontrada para esta tarefa.`);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Executar tarefa
|
|
127
|
-
console.log(`\n⚙️ [${this.agentName}] Executando tarefa...\n`);
|
|
128
|
-
const result = await this.executeTask(taskDescription, context);
|
|
129
|
-
|
|
130
|
-
// PASSO 5: Registrar resultado
|
|
131
|
-
this.markStepCompleted('Registrar Resultado');
|
|
132
|
-
await this.recordOutcome(taskDescription, context, result);
|
|
133
|
-
|
|
134
|
-
const status = result.success ? '✅ SUCESSO' : '❌ FALHA';
|
|
135
|
-
console.log(`\n${status} [${this.agentName}] Tarefa concluída`);
|
|
136
|
-
console.log(`⏰ Término: ${new Date().toLocaleTimeString('pt-BR')}`);
|
|
137
|
-
console.log(`${'='.repeat(60)}\n`);
|
|
138
|
-
|
|
139
|
-
return result;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Registra resultado na memória
|
|
144
|
-
*/
|
|
145
|
-
async recordOutcome(
|
|
146
|
-
taskDescription: string,
|
|
147
|
-
context: TaskContext,
|
|
148
|
-
result: TaskResult,
|
|
149
|
-
userFeedback?: UserFeedback
|
|
150
|
-
): Promise<void> {
|
|
151
|
-
if (result.success) {
|
|
152
|
-
this.memory.recordSuccess(
|
|
153
|
-
this.agentName,
|
|
154
|
-
taskDescription,
|
|
155
|
-
context,
|
|
156
|
-
result.details,
|
|
157
|
-
userFeedback
|
|
158
|
-
);
|
|
159
|
-
} else {
|
|
160
|
-
this.memory.recordFailure(
|
|
161
|
-
this.agentName,
|
|
162
|
-
taskDescription,
|
|
163
|
-
context,
|
|
164
|
-
result.details,
|
|
165
|
-
userFeedback
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Adiciona aprendizado baseado em feedback
|
|
172
|
-
*/
|
|
173
|
-
async learn(
|
|
174
|
-
pattern: string,
|
|
175
|
-
description: string,
|
|
176
|
-
recommendation: string,
|
|
177
|
-
exampleIds: string[] = []
|
|
178
|
-
): Promise<void> {
|
|
179
|
-
this.memory.addLearning(
|
|
180
|
-
this.agentName,
|
|
181
|
-
pattern,
|
|
182
|
-
description,
|
|
183
|
-
recommendation,
|
|
184
|
-
exampleIds
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Obtém estatísticas do agente
|
|
190
|
-
*/
|
|
191
|
-
getStats() {
|
|
192
|
-
return this.memory.getStats(this.agentName);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Lê arquivo de especialidade
|
|
197
|
-
*/
|
|
198
|
-
getSpecialty(): string {
|
|
199
|
-
if (fs.existsSync(this.specialtyPath)) {
|
|
200
|
-
return fs.readFileSync(this.specialtyPath, 'utf-8');
|
|
201
|
-
}
|
|
202
|
-
return 'Especialidade não definida';
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Garante que arquivo de especialidade existe
|
|
207
|
-
*/
|
|
208
|
-
private ensureSpecialtyFile(): void {
|
|
209
|
-
const agentDir = path.dirname(this.specialtyPath);
|
|
210
|
-
|
|
211
|
-
if (!fs.existsSync(agentDir)) {
|
|
212
|
-
fs.mkdirSync(agentDir, { recursive: true });
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (!fs.existsSync(this.specialtyPath)) {
|
|
216
|
-
const defaultSpecialty = this.getDefaultSpecialty();
|
|
217
|
-
fs.writeFileSync(this.specialtyPath, defaultSpecialty, 'utf-8');
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Retorna especialidade padrão (pode ser sobrescrito)
|
|
223
|
-
*/
|
|
224
|
-
protected getDefaultSpecialty(): string {
|
|
225
|
-
return `# ${this.agentName} - Especialidade
|
|
226
|
-
|
|
227
|
-
## Responsabilidades
|
|
228
|
-
- Definir responsabilidades específicas
|
|
229
|
-
|
|
230
|
-
## Expertise
|
|
231
|
-
- Definir áreas de expertise
|
|
232
|
-
|
|
233
|
-
## Regras
|
|
234
|
-
- Definir regras específicas
|
|
235
|
-
|
|
236
|
-
## Tarefas Típicas
|
|
237
|
-
- Listar tarefas típicas
|
|
238
|
-
`;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Inicializa os passos do workflow
|
|
243
|
-
*/
|
|
244
|
-
private initializeWorkflowSteps(): void {
|
|
245
|
-
this.workflowSteps = [
|
|
246
|
-
{ name: 'Consultar Memória', required: true, completed: false },
|
|
247
|
-
{ name: 'Obter Recomendações', required: true, completed: false },
|
|
248
|
-
{ name: 'Consultar Repositórios', required: true, completed: false },
|
|
249
|
-
{ name: 'Aplicar Aprendizados', required: true, completed: false },
|
|
250
|
-
{ name: 'Carregar Skills', required: true, completed: false },
|
|
251
|
-
{ name: 'Registrar Resultado', required: true, completed: false },
|
|
252
|
-
{ name: 'Gerar Aprendizados', required: false, completed: false }
|
|
253
|
-
];
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Marca um passo como completado
|
|
258
|
-
*/
|
|
259
|
-
protected markStepCompleted(stepName: string, details?: any): void {
|
|
260
|
-
const step = this.workflowSteps.find(s => s.name === stepName);
|
|
261
|
-
if (step) {
|
|
262
|
-
step.completed = true;
|
|
263
|
-
step.timestamp = new Date();
|
|
264
|
-
step.details = details;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Atualiza detalhes de um passo
|
|
270
|
-
*/
|
|
271
|
-
protected updateStepDetails(stepName: string, details: any): void {
|
|
272
|
-
const step = this.workflowSteps.find(s => s.name === stepName);
|
|
273
|
-
if (step) {
|
|
274
|
-
step.details = { ...step.details, ...details };
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Retorna os passos do workflow para validação
|
|
280
|
-
*/
|
|
281
|
-
getWorkflowSteps(): WorkflowStep[] {
|
|
282
|
-
return [...this.workflowSteps];
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Consulta repositórios de referência relevantes
|
|
287
|
-
*/
|
|
288
|
-
protected async consultReferenceRepositories(): Promise<void> {
|
|
289
|
-
try {
|
|
290
|
-
if (!fs.existsSync(this.referenceReposPath)) {
|
|
291
|
-
console.log(`⚠️ [${this.agentName}] Arquivo de repositórios não encontrado`);
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
const repos = JSON.parse(fs.readFileSync(this.referenceReposPath, 'utf-8'));
|
|
296
|
-
const relevantRepos = this.getRelevantRepositories(repos);
|
|
297
|
-
|
|
298
|
-
if (relevantRepos.length > 0) {
|
|
299
|
-
console.log(`\n📚 [${this.agentName}] Consultando repositórios de referência:`);
|
|
300
|
-
relevantRepos.forEach(repo => {
|
|
301
|
-
console.log(` - ${repo.name}: ${repo.url}`);
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
} catch (error: any) {
|
|
305
|
-
console.log(`⚠️ [${this.agentName}] Erro ao consultar repositórios:`, error.message);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Retorna repositórios relevantes para este agente (pode ser sobrescrito)
|
|
311
|
-
*/
|
|
312
|
-
protected getRelevantRepositories(repos: any): Array<{ name: string; url: string }> {
|
|
313
|
-
// Implementação padrão - pode ser sobrescrita por agentes específicos
|
|
314
|
-
return [];
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Aplica aprendizados com alta confiança
|
|
319
|
-
*/
|
|
320
|
-
protected applyHighConfidenceLearnings(recommendations: string[]): void {
|
|
321
|
-
const memory = this.memory.loadMemory(this.agentName);
|
|
322
|
-
const highConfidenceLearnings = memory.learnings.filter(l => l.confidence > 0.7);
|
|
323
|
-
|
|
324
|
-
if (highConfidenceLearnings.length > 0) {
|
|
325
|
-
console.log(`\n🎯 [${this.agentName}] Aplicando ${highConfidenceLearnings.length} aprendizado(s) de alta confiança:`);
|
|
326
|
-
highConfidenceLearnings.forEach((learning, index) => {
|
|
327
|
-
console.log(` ${index + 1}. ${learning.recommendation} (confiança: ${(learning.confidence * 100).toFixed(0)}%)`);
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|