@barissozen/csns 0.6.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.
- package/.env.example +8 -0
- package/LICENSE +21 -0
- package/README.md +364 -0
- package/dist/agent/agent-runner.d.ts +48 -0
- package/dist/agent/agent-runner.d.ts.map +1 -0
- package/dist/agent/agent-runner.js +180 -0
- package/dist/agent/agent-runner.js.map +1 -0
- package/dist/agent/architect.d.ts +34 -0
- package/dist/agent/architect.d.ts.map +1 -0
- package/dist/agent/architect.js +156 -0
- package/dist/agent/architect.js.map +1 -0
- package/dist/agent/codebase-reader.d.ts +35 -0
- package/dist/agent/codebase-reader.d.ts.map +1 -0
- package/dist/agent/codebase-reader.js +305 -0
- package/dist/agent/codebase-reader.js.map +1 -0
- package/dist/agent/context-builder.d.ts +39 -0
- package/dist/agent/context-builder.d.ts.map +1 -0
- package/dist/agent/context-builder.js +163 -0
- package/dist/agent/context-builder.js.map +1 -0
- package/dist/agent/index.d.ts +14 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +12 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/output-parser.d.ts +27 -0
- package/dist/agent/output-parser.d.ts.map +1 -0
- package/dist/agent/output-parser.js +154 -0
- package/dist/agent/output-parser.js.map +1 -0
- package/dist/agent/process-spawner.d.ts +56 -0
- package/dist/agent/process-spawner.d.ts.map +1 -0
- package/dist/agent/process-spawner.js +153 -0
- package/dist/agent/process-spawner.js.map +1 -0
- package/dist/agent/tracer/index.d.ts +8 -0
- package/dist/agent/tracer/index.d.ts.map +1 -0
- package/dist/agent/tracer/index.js +6 -0
- package/dist/agent/tracer/index.js.map +1 -0
- package/dist/agent/tracer/reverse-engineer.d.ts +113 -0
- package/dist/agent/tracer/reverse-engineer.d.ts.map +1 -0
- package/dist/agent/tracer/reverse-engineer.js +695 -0
- package/dist/agent/tracer/reverse-engineer.js.map +1 -0
- package/dist/agent/tracer/runtime-tracer.d.ts +61 -0
- package/dist/agent/tracer/runtime-tracer.d.ts.map +1 -0
- package/dist/agent/tracer/runtime-tracer.js +484 -0
- package/dist/agent/tracer/runtime-tracer.js.map +1 -0
- package/dist/agent/tracer/semantic-analyzer.d.ts +24 -0
- package/dist/agent/tracer/semantic-analyzer.d.ts.map +1 -0
- package/dist/agent/tracer/semantic-analyzer.js +132 -0
- package/dist/agent/tracer/semantic-analyzer.js.map +1 -0
- package/dist/agent/tracer/static-analyzer.d.ts +44 -0
- package/dist/agent/tracer/static-analyzer.d.ts.map +1 -0
- package/dist/agent/tracer/static-analyzer.js +453 -0
- package/dist/agent/tracer/static-analyzer.js.map +1 -0
- package/dist/agent/tracer/tracer-agent.d.ts +61 -0
- package/dist/agent/tracer/tracer-agent.d.ts.map +1 -0
- package/dist/agent/tracer/tracer-agent.js +252 -0
- package/dist/agent/tracer/tracer-agent.js.map +1 -0
- package/dist/bin/csns.d.ts +24 -0
- package/dist/bin/csns.d.ts.map +1 -0
- package/dist/bin/csns.js +389 -0
- package/dist/bin/csns.js.map +1 -0
- package/dist/bin/pc.d.ts +13 -0
- package/dist/bin/pc.d.ts.map +1 -0
- package/dist/bin/pc.js +212 -0
- package/dist/bin/pc.js.map +1 -0
- package/dist/brief/brief-collector.d.ts +42 -0
- package/dist/brief/brief-collector.d.ts.map +1 -0
- package/dist/brief/brief-collector.js +228 -0
- package/dist/brief/brief-collector.js.map +1 -0
- package/dist/brief/index.d.ts +3 -0
- package/dist/brief/index.d.ts.map +1 -0
- package/dist/brief/index.js +3 -0
- package/dist/brief/index.js.map +1 -0
- package/dist/brief/smart-brief.d.ts +52 -0
- package/dist/brief/smart-brief.d.ts.map +1 -0
- package/dist/brief/smart-brief.js +440 -0
- package/dist/brief/smart-brief.js.map +1 -0
- package/dist/calculator/calculator.d.ts +7 -0
- package/dist/calculator/calculator.d.ts.map +1 -0
- package/dist/calculator/calculator.js +18 -0
- package/dist/calculator/calculator.js.map +1 -0
- package/dist/calculator/index.d.ts +2 -0
- package/dist/calculator/index.d.ts.map +1 -0
- package/dist/calculator/index.js +2 -0
- package/dist/calculator/index.js.map +1 -0
- package/dist/i18n/en.d.ts +6 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +136 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/index.d.ts +31 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +44 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/tr.d.ts +6 -0
- package/dist/i18n/tr.d.ts.map +1 -0
- package/dist/i18n/tr.js +136 -0
- package/dist/i18n/tr.js.map +1 -0
- package/dist/i18n/types.d.ts +86 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +9 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/anthropic-provider.d.ts +18 -0
- package/dist/llm/anthropic-provider.d.ts.map +1 -0
- package/dist/llm/anthropic-provider.js +55 -0
- package/dist/llm/anthropic-provider.js.map +1 -0
- package/dist/llm/factory.d.ts +21 -0
- package/dist/llm/factory.d.ts.map +1 -0
- package/dist/llm/factory.js +59 -0
- package/dist/llm/factory.js.map +1 -0
- package/dist/llm/index.d.ts +7 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +5 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/ollama-provider.d.ts +20 -0
- package/dist/llm/ollama-provider.d.ts.map +1 -0
- package/dist/llm/ollama-provider.js +62 -0
- package/dist/llm/ollama-provider.js.map +1 -0
- package/dist/llm/openai-provider.d.ts +20 -0
- package/dist/llm/openai-provider.d.ts.map +1 -0
- package/dist/llm/openai-provider.js +65 -0
- package/dist/llm/openai-provider.js.map +1 -0
- package/dist/llm/resolve.d.ts +10 -0
- package/dist/llm/resolve.d.ts.map +1 -0
- package/dist/llm/resolve.js +21 -0
- package/dist/llm/resolve.js.map +1 -0
- package/dist/llm/types.d.ts +45 -0
- package/dist/llm/types.d.ts.map +1 -0
- package/dist/llm/types.js +11 -0
- package/dist/llm/types.js.map +1 -0
- package/dist/memory/index.d.ts +2 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +2 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/memory-layer.d.ts +54 -0
- package/dist/memory/memory-layer.d.ts.map +1 -0
- package/dist/memory/memory-layer.js +297 -0
- package/dist/memory/memory-layer.js.map +1 -0
- package/dist/orchestrator/dependency-graph.d.ts +39 -0
- package/dist/orchestrator/dependency-graph.d.ts.map +1 -0
- package/dist/orchestrator/dependency-graph.js +134 -0
- package/dist/orchestrator/dependency-graph.js.map +1 -0
- package/dist/orchestrator/escalator.d.ts +42 -0
- package/dist/orchestrator/escalator.d.ts.map +1 -0
- package/dist/orchestrator/escalator.js +163 -0
- package/dist/orchestrator/escalator.js.map +1 -0
- package/dist/orchestrator/evaluator.d.ts +34 -0
- package/dist/orchestrator/evaluator.d.ts.map +1 -0
- package/dist/orchestrator/evaluator.js +335 -0
- package/dist/orchestrator/evaluator.js.map +1 -0
- package/dist/orchestrator/index.d.ts +9 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +9 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/integration-evaluator.d.ts +59 -0
- package/dist/orchestrator/integration-evaluator.d.ts.map +1 -0
- package/dist/orchestrator/integration-evaluator.js +405 -0
- package/dist/orchestrator/integration-evaluator.js.map +1 -0
- package/dist/orchestrator/milestone-manager.d.ts +28 -0
- package/dist/orchestrator/milestone-manager.d.ts.map +1 -0
- package/dist/orchestrator/milestone-manager.js +208 -0
- package/dist/orchestrator/milestone-manager.js.map +1 -0
- package/dist/orchestrator/orchestrator.d.ts +35 -0
- package/dist/orchestrator/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/orchestrator.js +338 -0
- package/dist/orchestrator/orchestrator.js.map +1 -0
- package/dist/orchestrator/planner.d.ts +15 -0
- package/dist/orchestrator/planner.d.ts.map +1 -0
- package/dist/orchestrator/planner.js +87 -0
- package/dist/orchestrator/planner.js.map +1 -0
- package/dist/orchestrator/recovery.d.ts +45 -0
- package/dist/orchestrator/recovery.d.ts.map +1 -0
- package/dist/orchestrator/recovery.js +98 -0
- package/dist/orchestrator/recovery.js.map +1 -0
- package/dist/run-calculator-test.d.ts +11 -0
- package/dist/run-calculator-test.d.ts.map +1 -0
- package/dist/run-calculator-test.js +212 -0
- package/dist/run-calculator-test.js.map +1 -0
- package/dist/run-real-task.d.ts +14 -0
- package/dist/run-real-task.d.ts.map +1 -0
- package/dist/run-real-task.js +185 -0
- package/dist/run-real-task.js.map +1 -0
- package/dist/run-todo-test.d.ts +6 -0
- package/dist/run-todo-test.d.ts.map +1 -0
- package/dist/run-todo-test.js +149 -0
- package/dist/run-todo-test.js.map +1 -0
- package/dist/todo/index.d.ts +2 -0
- package/dist/todo/index.d.ts.map +1 -0
- package/dist/todo/index.js +2 -0
- package/dist/todo/index.js.map +1 -0
- package/dist/todo/server.d.ts +2 -0
- package/dist/todo/server.d.ts.map +1 -0
- package/dist/todo/server.js +32 -0
- package/dist/todo/server.js.map +1 -0
- package/dist/types/index.d.ts +412 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +100 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator — Escalator
|
|
3
|
+
*
|
|
4
|
+
* İnsan müdahalesi gereken durumları yönetir.
|
|
5
|
+
* Terminal'den gerçek readline ile kullanıcı yanıtı alır.
|
|
6
|
+
*
|
|
7
|
+
* Tasarım ilkesi #2: Fail-Safe — şüphe durumunda insana sor
|
|
8
|
+
*/
|
|
9
|
+
import { createInterface } from 'node:readline';
|
|
10
|
+
import { t } from '../i18n/index.js';
|
|
11
|
+
export class Escalator {
|
|
12
|
+
/** Readline override (test injection) */
|
|
13
|
+
_askFn = null;
|
|
14
|
+
/**
|
|
15
|
+
* Test'ler için readline'ı override et
|
|
16
|
+
*/
|
|
17
|
+
setAskFn(fn) {
|
|
18
|
+
this._askFn = fn;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Değerlendirme sonucuna göre eskalasyon gerekip gerekmediğine karar verir
|
|
22
|
+
*/
|
|
23
|
+
shouldEscalate(evaluation) {
|
|
24
|
+
return evaluation.verdict === 'escalate';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Eskalasyon request'i oluşturur
|
|
28
|
+
*/
|
|
29
|
+
createEscalation(evaluation, retryCount) {
|
|
30
|
+
const criticalIssues = evaluation.issues.filter(i => i.severity === 'critical');
|
|
31
|
+
const hasScoreDrop = Math.min(evaluation.consistencyScore, evaluation.qualityScore, evaluation.missionAlignment) < 0.4;
|
|
32
|
+
return {
|
|
33
|
+
taskId: evaluation.taskId,
|
|
34
|
+
reason: this.formatReason(evaluation),
|
|
35
|
+
context: this.formatContext(evaluation, retryCount),
|
|
36
|
+
options: this.generateOptions(evaluation),
|
|
37
|
+
urgency: criticalIssues.length > 0 ? 'blocking' :
|
|
38
|
+
hasScoreDrop ? 'important' : 'informational',
|
|
39
|
+
retryCount,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Eskalasyonu terminal'e yaz ve kullanıcıdan yanıt al
|
|
44
|
+
*/
|
|
45
|
+
async promptUser(escalation) {
|
|
46
|
+
const formatted = this.formatForHuman(escalation);
|
|
47
|
+
console.log(formatted);
|
|
48
|
+
const answer = await this.ask(t().escalationPrompt);
|
|
49
|
+
return this.parseResponse(answer.trim());
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Eskalasyonu insan tarafından okunabilir formatta render eder
|
|
53
|
+
*/
|
|
54
|
+
formatForHuman(escalation) {
|
|
55
|
+
const locale = t();
|
|
56
|
+
const urgencyEmoji = {
|
|
57
|
+
blocking: '🚨',
|
|
58
|
+
important: '⚠️',
|
|
59
|
+
informational: 'ℹ️',
|
|
60
|
+
};
|
|
61
|
+
const retryInfo = escalation.retryCount != null
|
|
62
|
+
? `\n🔄 Retry: ${escalation.retryCount}`
|
|
63
|
+
: '';
|
|
64
|
+
return `
|
|
65
|
+
${urgencyEmoji[escalation.urgency]} ${locale.escalationTitle(escalation.taskId)}
|
|
66
|
+
${'═'.repeat(50)}
|
|
67
|
+
|
|
68
|
+
📋 ${locale.escalationReason}: ${escalation.reason}
|
|
69
|
+
${retryInfo}
|
|
70
|
+
📝 ${locale.escalationContext}:
|
|
71
|
+
${escalation.context}
|
|
72
|
+
|
|
73
|
+
🔀 ${locale.escalationOptions}:
|
|
74
|
+
1. ${locale.escalationOptionContinue}
|
|
75
|
+
2. ${locale.escalationOptionSkip}
|
|
76
|
+
3. ${locale.escalationOptionStop}
|
|
77
|
+
`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Kullanıcı yanıtını parse et
|
|
81
|
+
*/
|
|
82
|
+
parseResponse(input) {
|
|
83
|
+
const lower = input.toLowerCase();
|
|
84
|
+
// Numara ile seçim
|
|
85
|
+
if (lower === '1' || lower.startsWith('devam')) {
|
|
86
|
+
return { action: 'continue' };
|
|
87
|
+
}
|
|
88
|
+
if (lower === '2' || lower.startsWith('atla') || lower.startsWith('skip')) {
|
|
89
|
+
return { action: 'skip' };
|
|
90
|
+
}
|
|
91
|
+
if (lower === '3' || lower.startsWith('dur') || lower.startsWith('stop')) {
|
|
92
|
+
return { action: 'stop' };
|
|
93
|
+
}
|
|
94
|
+
if (lower.startsWith('retry') || lower.startsWith('tekrar')) {
|
|
95
|
+
return { action: 'retry', feedback: input };
|
|
96
|
+
}
|
|
97
|
+
// Default: devam et
|
|
98
|
+
return { action: 'continue', feedback: input };
|
|
99
|
+
}
|
|
100
|
+
// ── Private ─────────────────────────────────────────────
|
|
101
|
+
formatReason(evaluation) {
|
|
102
|
+
const issues = evaluation.issues
|
|
103
|
+
.filter(i => i.severity === 'critical' || i.severity === 'warning');
|
|
104
|
+
if (issues.length > 0) {
|
|
105
|
+
return issues.map(i => `[${i.category}] ${i.description}`).join('; ');
|
|
106
|
+
}
|
|
107
|
+
const scores = {
|
|
108
|
+
tutarlılık: evaluation.consistencyScore,
|
|
109
|
+
kalite: evaluation.qualityScore,
|
|
110
|
+
'misyon uyumu': evaluation.missionAlignment,
|
|
111
|
+
};
|
|
112
|
+
const lowScores = Object.entries(scores)
|
|
113
|
+
.filter(([_, v]) => v < 0.5)
|
|
114
|
+
.map(([k, v]) => `${k}: ${(v * 100).toFixed(0)}%`);
|
|
115
|
+
return `Düşük skorlar: ${lowScores.join(', ')}`;
|
|
116
|
+
}
|
|
117
|
+
formatContext(evaluation, retryCount) {
|
|
118
|
+
const parts = [
|
|
119
|
+
`Tutarlılık: ${(evaluation.consistencyScore * 100).toFixed(0)}%`,
|
|
120
|
+
`Kalite: ${(evaluation.qualityScore * 100).toFixed(0)}%`,
|
|
121
|
+
`Misyon Uyumu: ${(evaluation.missionAlignment * 100).toFixed(0)}%`,
|
|
122
|
+
];
|
|
123
|
+
if (retryCount != null) {
|
|
124
|
+
parts.push(`Retry: ${retryCount}/3 tamamlandı`);
|
|
125
|
+
}
|
|
126
|
+
if (evaluation.feedback) {
|
|
127
|
+
parts.push(`\nGeri bildirim: ${evaluation.feedback}`);
|
|
128
|
+
}
|
|
129
|
+
return parts.join('\n');
|
|
130
|
+
}
|
|
131
|
+
generateOptions(evaluation) {
|
|
132
|
+
const options = [];
|
|
133
|
+
options.push('Devam et — bu çıktıyı kabul et ve ilerle');
|
|
134
|
+
options.push('Atla — bu task\'ı atla, sonrakine geç');
|
|
135
|
+
const categories = new Set(evaluation.issues.map(i => i.category));
|
|
136
|
+
if (categories.has('scope-creep')) {
|
|
137
|
+
options.push('Kapsamı daralt — bu task\'ı küçült veya böl');
|
|
138
|
+
}
|
|
139
|
+
if (categories.has('architecture-violation')) {
|
|
140
|
+
options.push('Mimariyi güncelle — ARCHITECTURE.md\'yi revize et');
|
|
141
|
+
}
|
|
142
|
+
options.push('Durdur — projeyi duraklat');
|
|
143
|
+
return options;
|
|
144
|
+
}
|
|
145
|
+
ask(prompt) {
|
|
146
|
+
// Test injection
|
|
147
|
+
if (this._askFn) {
|
|
148
|
+
return this._askFn(prompt);
|
|
149
|
+
}
|
|
150
|
+
// Gerçek readline
|
|
151
|
+
return new Promise((resolve) => {
|
|
152
|
+
const rl = createInterface({
|
|
153
|
+
input: process.stdin,
|
|
154
|
+
output: process.stdout,
|
|
155
|
+
});
|
|
156
|
+
rl.question(prompt, (answer) => {
|
|
157
|
+
rl.close();
|
|
158
|
+
resolve(answer);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=escalator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escalator.js","sourceRoot":"","sources":["../../src/orchestrator/escalator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AAOrC,MAAM,OAAO,SAAS;IACpB,yCAAyC;IACjC,MAAM,GAAiD,IAAI,CAAC;IAEpE;;OAEG;IACH,QAAQ,CAAC,EAAuC;QAC9C,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,UAA4B;QACzC,OAAO,UAAU,CAAC,OAAO,KAAK,UAAU,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,gBAAgB,CAAC,UAA4B,EAAE,UAAmB;QAChE,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC;QAChF,MAAM,YAAY,G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QAC7B,CAAC;QAED,kBAAkB;QAClB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,MAAM,EAAE,GAAG,eAAe,CAAC;gBACzB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;YACH,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC7B,EAAE,CAAC,KAAK,EAAE,CAAC;gBACX,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator — Evaluator (v3)
|
|
3
|
+
*
|
|
4
|
+
* Two-layer evaluation:
|
|
5
|
+
* 1. Real checks: run tsc/npm test/pytest/go build based on stack
|
|
6
|
+
* 2. Anti-scope check: enforce MISSION.md constraints
|
|
7
|
+
* 3. LLM evaluation: consistency, quality, mission alignment (optional)
|
|
8
|
+
*
|
|
9
|
+
* Now uses LLMProvider abstraction + i18n.
|
|
10
|
+
*/
|
|
11
|
+
import type { RealEvaluationResult, CheckResult, AntiScopeViolation, AgentResult, MemorySnapshot, OrchestratorConfig, StackType } from '../types/index.js';
|
|
12
|
+
export declare class Evaluator {
|
|
13
|
+
private provider;
|
|
14
|
+
private escalationThreshold;
|
|
15
|
+
private projectRoot;
|
|
16
|
+
constructor(config: OrchestratorConfig);
|
|
17
|
+
/**
|
|
18
|
+
* Full evaluation: real checks + anti-scope + LLM
|
|
19
|
+
*/
|
|
20
|
+
evaluate(agentResult: AgentResult, memory: MemorySnapshot): Promise<RealEvaluationResult>;
|
|
21
|
+
detectStack(memory: MemorySnapshot): Promise<StackType>;
|
|
22
|
+
runStackChecks(stack: StackType, agentArtifacts?: string[]): Promise<CheckResult[]>;
|
|
23
|
+
private resolveCommand;
|
|
24
|
+
private runLintCheck;
|
|
25
|
+
private runCommand;
|
|
26
|
+
private checkFileExists;
|
|
27
|
+
checkAntiScope(agentResult: AgentResult, memory: MemorySnapshot): AntiScopeViolation[];
|
|
28
|
+
private computeScores;
|
|
29
|
+
private buildIssues;
|
|
30
|
+
private buildFeedback;
|
|
31
|
+
private llmEvaluate;
|
|
32
|
+
private applyThresholds;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../src/orchestrator/evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,OAAO,KAAK,EACV,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,SAAS,EAEV,MAAM,mBAAmB,CAAC;AAmC3B,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE,kBAAkB;IAMtC;;OAEG;IACG,QAAQ,CACZ,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,oBAAoB,CAAC;IA8C1B,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IA8BvD,cAAc,CAClB,KAAK,EAAE,SAAS,EAChB,cAAc,GAAE,MAAM,EAAO,GAC5B,OAAO,CAAC,WAAW,EAAE,CAAC;IA0BzB,OAAO,CAAC,cAAc;YAyBR,YAAY;IAuC1B,OAAO,CAAC,UAAU;YAiBJ,eAAe;IAW7B,cAAc,CACZ,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,cAAc,GACrB,kBAAkB,EAAE;IA4CvB,OAAO,CAAC,aAAa;IAsBrB,OAAO,CAAC,WAAW;IA4BnB,OAAO,CAAC,aAAa;YA2BP,WAAW;IAsBzB,OAAO,CAAC,eAAe;CAoBxB"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator — Evaluator (v3)
|
|
3
|
+
*
|
|
4
|
+
* Two-layer evaluation:
|
|
5
|
+
* 1. Real checks: run tsc/npm test/pytest/go build based on stack
|
|
6
|
+
* 2. Anti-scope check: enforce MISSION.md constraints
|
|
7
|
+
* 3. LLM evaluation: consistency, quality, mission alignment (optional)
|
|
8
|
+
*
|
|
9
|
+
* Now uses LLMProvider abstraction + i18n.
|
|
10
|
+
*/
|
|
11
|
+
import { exec } from 'node:child_process';
|
|
12
|
+
import { readFile, access } from 'node:fs/promises';
|
|
13
|
+
import { join } from 'node:path';
|
|
14
|
+
import { resolveProvider } from '../llm/resolve.js';
|
|
15
|
+
import { t } from '../i18n/index.js';
|
|
16
|
+
import { BriefCollector } from '../brief/brief-collector.js';
|
|
17
|
+
const STACK_CHECKS = {
|
|
18
|
+
'typescript-node': [
|
|
19
|
+
{ name: 'TypeScript compile', command: 'npx tsc --noEmit', required: true },
|
|
20
|
+
{ name: 'Unit tests', command: 'npm test', required: true },
|
|
21
|
+
{ name: 'Lint', command: 'npx eslint src/ --quiet', required: false },
|
|
22
|
+
],
|
|
23
|
+
'react': [
|
|
24
|
+
{ name: 'TypeScript compile', command: 'npx tsc --noEmit', required: true },
|
|
25
|
+
{ name: 'Unit tests', command: 'npm test', required: true },
|
|
26
|
+
{ name: 'Build', command: 'npm run build', required: true },
|
|
27
|
+
{ name: 'Lint', command: 'npx eslint src/ --quiet', required: false },
|
|
28
|
+
],
|
|
29
|
+
'python': [
|
|
30
|
+
{ name: 'Pytest', command: 'pytest', required: true },
|
|
31
|
+
{ name: 'Type check', command: 'mypy .', required: false },
|
|
32
|
+
{ name: 'Lint', command: 'flake8', required: false },
|
|
33
|
+
],
|
|
34
|
+
'go': [
|
|
35
|
+
{ name: 'Go build', command: 'go build ./...', required: true },
|
|
36
|
+
{ name: 'Go test', command: 'go test ./...', required: true },
|
|
37
|
+
{ name: 'Go vet', command: 'go vet ./...', required: false },
|
|
38
|
+
],
|
|
39
|
+
'other': [],
|
|
40
|
+
};
|
|
41
|
+
export class Evaluator {
|
|
42
|
+
provider;
|
|
43
|
+
escalationThreshold;
|
|
44
|
+
projectRoot;
|
|
45
|
+
constructor(config) {
|
|
46
|
+
this.provider = resolveProvider(config);
|
|
47
|
+
this.escalationThreshold = config.escalationThreshold;
|
|
48
|
+
this.projectRoot = config.projectRoot;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Full evaluation: real checks + anti-scope + LLM
|
|
52
|
+
*/
|
|
53
|
+
async evaluate(agentResult, memory) {
|
|
54
|
+
// 1. Stack detection
|
|
55
|
+
const stackDetected = await this.detectStack(memory);
|
|
56
|
+
// 2. Run real checks
|
|
57
|
+
const checks = await this.runStackChecks(stackDetected, agentResult.artifacts);
|
|
58
|
+
// 3. Anti-scope check
|
|
59
|
+
const antiScopeViolations = this.checkAntiScope(agentResult, memory);
|
|
60
|
+
// 4. Compute scores
|
|
61
|
+
const scores = this.computeScores(checks, antiScopeViolations, agentResult);
|
|
62
|
+
// 5. Build issues
|
|
63
|
+
const issues = this.buildIssues(checks, antiScopeViolations);
|
|
64
|
+
// 6. LLM evaluation (optional)
|
|
65
|
+
let llmFeedback;
|
|
66
|
+
if (this.provider) {
|
|
67
|
+
try {
|
|
68
|
+
const llmResult = await this.llmEvaluate(agentResult, memory);
|
|
69
|
+
llmFeedback = llmResult.feedback;
|
|
70
|
+
issues.push(...llmResult.issues);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
llmFeedback = 'LLM evaluation failed — real checks only.';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const result = {
|
|
77
|
+
taskId: agentResult.taskId,
|
|
78
|
+
consistencyScore: scores.consistency,
|
|
79
|
+
qualityScore: scores.quality,
|
|
80
|
+
missionAlignment: scores.mission,
|
|
81
|
+
issues,
|
|
82
|
+
verdict: 'accept',
|
|
83
|
+
feedback: this.buildFeedback(checks, antiScopeViolations, llmFeedback),
|
|
84
|
+
checks,
|
|
85
|
+
antiScopeViolations,
|
|
86
|
+
stackDetected,
|
|
87
|
+
};
|
|
88
|
+
return this.applyThresholds(result);
|
|
89
|
+
}
|
|
90
|
+
// ── Stack Detection ─────────────────────────────────────
|
|
91
|
+
async detectStack(memory) {
|
|
92
|
+
const missionStack = BriefCollector.parseStackType(memory.files.mission);
|
|
93
|
+
if (missionStack)
|
|
94
|
+
return missionStack;
|
|
95
|
+
const indicators = [
|
|
96
|
+
{ file: 'tsconfig.json', stack: 'typescript-node' },
|
|
97
|
+
{ file: 'package.json', stack: 'typescript-node' },
|
|
98
|
+
{ file: 'requirements.txt', stack: 'python' },
|
|
99
|
+
{ file: 'pyproject.toml', stack: 'python' },
|
|
100
|
+
{ file: 'go.mod', stack: 'go' },
|
|
101
|
+
];
|
|
102
|
+
for (const { file, stack } of indicators) {
|
|
103
|
+
try {
|
|
104
|
+
await access(join(this.projectRoot, file));
|
|
105
|
+
if (file === 'package.json' && stack === 'typescript-node') {
|
|
106
|
+
try {
|
|
107
|
+
const pkg = await readFile(join(this.projectRoot, 'package.json'), 'utf-8');
|
|
108
|
+
if (pkg.includes('"react"'))
|
|
109
|
+
return 'react';
|
|
110
|
+
}
|
|
111
|
+
catch { /* ignore */ }
|
|
112
|
+
}
|
|
113
|
+
return stack;
|
|
114
|
+
}
|
|
115
|
+
catch { /* file not found, continue */ }
|
|
116
|
+
}
|
|
117
|
+
return 'other';
|
|
118
|
+
}
|
|
119
|
+
// ── Real Stack Checks ──────────────────────────────────
|
|
120
|
+
async runStackChecks(stack, agentArtifacts = []) {
|
|
121
|
+
const checks = STACK_CHECKS[stack] ?? [];
|
|
122
|
+
const results = [];
|
|
123
|
+
for (const check of checks) {
|
|
124
|
+
const command = this.resolveCommand(check, agentArtifacts);
|
|
125
|
+
if (check.name.includes('Lint')) {
|
|
126
|
+
const lintResult = await this.runLintCheck(check.name, command);
|
|
127
|
+
results.push(lintResult);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const result = await this.runCommand(check.name, command);
|
|
131
|
+
results.push(result);
|
|
132
|
+
}
|
|
133
|
+
// Memory file existence checks
|
|
134
|
+
results.push(await this.checkFileExists('MISSION.md'));
|
|
135
|
+
results.push(await this.checkFileExists('ARCHITECTURE.md'));
|
|
136
|
+
results.push(await this.checkFileExists('DECISIONS.md'));
|
|
137
|
+
results.push(await this.checkFileExists('STATE.md'));
|
|
138
|
+
return results;
|
|
139
|
+
}
|
|
140
|
+
resolveCommand(check, artifacts) {
|
|
141
|
+
if (!check.name.toLowerCase().includes('test')) {
|
|
142
|
+
return check.command;
|
|
143
|
+
}
|
|
144
|
+
const testFiles = artifacts.filter(a => a.match(/\.(test|spec)\.(ts|tsx|js|jsx)$/) ||
|
|
145
|
+
a.startsWith('tests/') ||
|
|
146
|
+
a.startsWith('test/'));
|
|
147
|
+
if (testFiles.length === 0) {
|
|
148
|
+
return check.command;
|
|
149
|
+
}
|
|
150
|
+
if (check.command.includes('vitest') || check.command.includes('npm test')) {
|
|
151
|
+
return `npx vitest run ${testFiles.join(' ')}`;
|
|
152
|
+
}
|
|
153
|
+
if (check.command.includes('pytest')) {
|
|
154
|
+
return `pytest ${testFiles.join(' ')}`;
|
|
155
|
+
}
|
|
156
|
+
return check.command;
|
|
157
|
+
}
|
|
158
|
+
async runLintCheck(name, command) {
|
|
159
|
+
const eslintConfigs = [
|
|
160
|
+
'eslint.config.js', 'eslint.config.mjs', 'eslint.config.cjs',
|
|
161
|
+
'.eslintrc.js', '.eslintrc.json', '.eslintrc.yml', '.eslintrc',
|
|
162
|
+
];
|
|
163
|
+
let hasConfig = false;
|
|
164
|
+
for (const cfg of eslintConfigs) {
|
|
165
|
+
try {
|
|
166
|
+
await access(join(this.projectRoot, cfg));
|
|
167
|
+
hasConfig = true;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
catch { /* not found */ }
|
|
171
|
+
}
|
|
172
|
+
if (command.includes('flake8')) {
|
|
173
|
+
try {
|
|
174
|
+
await access(join(this.projectRoot, '.flake8'));
|
|
175
|
+
hasConfig = true;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
try {
|
|
179
|
+
await access(join(this.projectRoot, 'setup.cfg'));
|
|
180
|
+
hasConfig = true;
|
|
181
|
+
}
|
|
182
|
+
catch { /* not found */ }
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (!hasConfig) {
|
|
186
|
+
return {
|
|
187
|
+
name,
|
|
188
|
+
command,
|
|
189
|
+
passed: true,
|
|
190
|
+
output: 'SKIPPED — lint config not found, skipping check',
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
return this.runCommand(name, command);
|
|
194
|
+
}
|
|
195
|
+
runCommand(name, command) {
|
|
196
|
+
const start = Date.now();
|
|
197
|
+
return new Promise((resolve) => {
|
|
198
|
+
exec(command, { cwd: this.projectRoot, timeout: 60_000 }, (error, stdout, stderr) => {
|
|
199
|
+
resolve({
|
|
200
|
+
name,
|
|
201
|
+
command,
|
|
202
|
+
passed: !error,
|
|
203
|
+
output: error
|
|
204
|
+
? `${stderr || stdout}`.slice(0, 500)
|
|
205
|
+
: `OK (${stdout.split('\n').length} lines)`.slice(0, 200),
|
|
206
|
+
duration: Date.now() - start,
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
async checkFileExists(filename) {
|
|
212
|
+
try {
|
|
213
|
+
await access(join(this.projectRoot, filename));
|
|
214
|
+
return { name: `File: ${filename}`, passed: true };
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
return { name: `File: ${filename}`, passed: false, output: 'Not found' };
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// ── Anti-Scope Check ───────────────────────────────────
|
|
221
|
+
checkAntiScope(agentResult, memory) {
|
|
222
|
+
const violations = [];
|
|
223
|
+
const antiScope = BriefCollector.parseAntiScope(memory.files.mission);
|
|
224
|
+
for (const protectedFile of antiScope.protectedFiles) {
|
|
225
|
+
const touched = agentResult.artifacts.some(a => a === protectedFile || a.endsWith(`/${protectedFile}`));
|
|
226
|
+
if (touched) {
|
|
227
|
+
violations.push({
|
|
228
|
+
type: 'protected-file',
|
|
229
|
+
detail: t().protectedFileViolation(protectedFile),
|
|
230
|
+
file: protectedFile,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
for (const dep of antiScope.forbiddenDeps) {
|
|
235
|
+
const inOutput = agentResult.output.toLowerCase().includes(dep.toLowerCase());
|
|
236
|
+
const inArtifacts = agentResult.artifacts.some(a => a.toLowerCase().includes(dep.toLowerCase()));
|
|
237
|
+
if (inOutput || inArtifacts) {
|
|
238
|
+
violations.push({
|
|
239
|
+
type: 'forbidden-dep',
|
|
240
|
+
detail: t().forbiddenDepViolation(dep),
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
for (const bc of antiScope.breakingChanges) {
|
|
245
|
+
if (agentResult.output.toLowerCase().includes(bc.toLowerCase())) {
|
|
246
|
+
violations.push({
|
|
247
|
+
type: 'breaking-change',
|
|
248
|
+
detail: t().breakingChangeViolation(bc),
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return violations;
|
|
253
|
+
}
|
|
254
|
+
// ── Score Computation ──────────────────────────────────
|
|
255
|
+
computeScores(checks, violations, agentResult) {
|
|
256
|
+
const requiredChecks = checks.filter(c => c.command);
|
|
257
|
+
const passedRequired = requiredChecks.filter(c => c.passed).length;
|
|
258
|
+
const totalRequired = requiredChecks.length || 1;
|
|
259
|
+
const quality = passedRequired / totalRequired;
|
|
260
|
+
const violationPenalty = violations.length * 0.3;
|
|
261
|
+
const mission = Math.max(0, agentResult.success ? 1.0 - violationPenalty : 0.2);
|
|
262
|
+
const memoryChecks = checks.filter(c => c.name.startsWith('File:'));
|
|
263
|
+
const memoryOk = memoryChecks.filter(c => c.passed).length;
|
|
264
|
+
const consistency = memoryChecks.length > 0 ? memoryOk / memoryChecks.length : 0.5;
|
|
265
|
+
return { consistency, quality, mission };
|
|
266
|
+
}
|
|
267
|
+
// ── Issue Building ─────────────────────────────────────
|
|
268
|
+
buildIssues(checks, violations) {
|
|
269
|
+
const issues = [];
|
|
270
|
+
for (const check of checks.filter(c => !c.passed)) {
|
|
271
|
+
issues.push({
|
|
272
|
+
severity: check.command ? 'warning' : 'info',
|
|
273
|
+
category: 'architecture-violation',
|
|
274
|
+
description: `Check failed: ${check.name}${check.output ? ' — ' + check.output.slice(0, 100) : ''}`,
|
|
275
|
+
reference: check.command,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
for (const v of violations) {
|
|
279
|
+
issues.push({
|
|
280
|
+
severity: 'critical',
|
|
281
|
+
category: v.type === 'protected-file' ? 'scope-creep' :
|
|
282
|
+
v.type === 'forbidden-dep' ? 'decision-conflict' : 'mission-drift',
|
|
283
|
+
description: v.detail,
|
|
284
|
+
reference: v.file,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
return issues;
|
|
288
|
+
}
|
|
289
|
+
buildFeedback(checks, violations, llmFeedback) {
|
|
290
|
+
const parts = [];
|
|
291
|
+
const passed = checks.filter(c => c.passed).length;
|
|
292
|
+
parts.push(t().checksResult(passed, checks.length));
|
|
293
|
+
if (violations.length > 0) {
|
|
294
|
+
parts.push(t().antiScopeViolation(violations.map(v => v.detail).join('; ')));
|
|
295
|
+
}
|
|
296
|
+
const failed = checks.filter(c => !c.passed && c.command);
|
|
297
|
+
if (failed.length > 0) {
|
|
298
|
+
parts.push(`Failed: ${failed.map(c => c.name).join(', ')}`);
|
|
299
|
+
}
|
|
300
|
+
if (llmFeedback) {
|
|
301
|
+
parts.push(`LLM: ${llmFeedback}`);
|
|
302
|
+
}
|
|
303
|
+
return parts.join('\n');
|
|
304
|
+
}
|
|
305
|
+
// ── LLM Evaluation (optional) ──────────────────────────
|
|
306
|
+
async llmEvaluate(agentResult, memory) {
|
|
307
|
+
if (!this.provider)
|
|
308
|
+
return { issues: [] };
|
|
309
|
+
const response = await this.provider.chat([{
|
|
310
|
+
role: 'user',
|
|
311
|
+
content: `Task: ${agentResult.taskId}\nSuccess: ${agentResult.success}\nOutput: ${agentResult.output.slice(0, 2000)}\nMISSION: ${memory.files.mission.slice(0, 1000)}\n\nBriefly evaluate (2-3 sentences).`,
|
|
312
|
+
}], {
|
|
313
|
+
system: t().evaluatorSystemPrompt,
|
|
314
|
+
maxTokens: 1024,
|
|
315
|
+
});
|
|
316
|
+
return { feedback: response.text.slice(0, 500), issues: [] };
|
|
317
|
+
}
|
|
318
|
+
// ── Threshold Application ──────────────────────────────
|
|
319
|
+
applyThresholds(result) {
|
|
320
|
+
const minScore = Math.min(result.consistencyScore, result.qualityScore, result.missionAlignment);
|
|
321
|
+
const hasCritical = result.issues.some(i => i.severity === 'critical');
|
|
322
|
+
const hasAntiScopeViolation = result.antiScopeViolations.length > 0;
|
|
323
|
+
if (hasCritical || hasAntiScopeViolation || minScore < this.escalationThreshold) {
|
|
324
|
+
result.verdict = 'escalate';
|
|
325
|
+
}
|
|
326
|
+
else if (minScore < 0.7 || result.issues.some(i => i.severity === 'warning')) {
|
|
327
|
+
result.verdict = 'revise';
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
result.verdict = 'accept';
|
|
331
|
+
}
|
|
332
|
+
return result;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluator.js","sourceRoot":"","sources":["../../src/orchestrator/evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE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AC;YACN,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC;QAC5B,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Orchestrator } from './orchestrator.js';
|
|
2
|
+
export { Planner } from './planner.js';
|
|
3
|
+
export { Evaluator } from './evaluator.js';
|
|
4
|
+
export { Escalator } from './escalator.js';
|
|
5
|
+
export { DependencyGraph } from './dependency-graph.js';
|
|
6
|
+
export { MilestoneManager } from './milestone-manager.js';
|
|
7
|
+
export { RecoveryManager } from './recovery.js';
|
|
8
|
+
export { IntegrationEvaluator } from './integration-evaluator.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Orchestrator } from './orchestrator.js';
|
|
2
|
+
export { Planner } from './planner.js';
|
|
3
|
+
export { Evaluator } from './evaluator.js';
|
|
4
|
+
export { Escalator } from './escalator.js';
|
|
5
|
+
export { DependencyGraph } from './dependency-graph.js';
|
|
6
|
+
export { MilestoneManager } from './milestone-manager.js';
|
|
7
|
+
export { RecoveryManager } from './recovery.js';
|
|
8
|
+
export { IntegrationEvaluator } from './integration-evaluator.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration Evaluator — Kod Yazıldıktan Sonra Gerçekten Çalışıyor mu Testi
|
|
3
|
+
*
|
|
4
|
+
* HTTP endpoint'leri test eder:
|
|
5
|
+
* 1. Server başlat (npm run dev / node dist/index.js)
|
|
6
|
+
* 2. Hazır olana kadar bekle
|
|
7
|
+
* 3. HTTP istekleri at, response kontrol et
|
|
8
|
+
* 4. Server'ı durdur
|
|
9
|
+
*
|
|
10
|
+
* D013: Evaluator v2 — gerçek kontroller
|
|
11
|
+
* Yeni: Integration test katmanı
|
|
12
|
+
*/
|
|
13
|
+
import type { EndpointTest, EndpointTestResult, IntegrationTestResult } from '../types/index.js';
|
|
14
|
+
export declare class IntegrationEvaluator {
|
|
15
|
+
private serverProcess;
|
|
16
|
+
private port;
|
|
17
|
+
private log;
|
|
18
|
+
constructor(port?: number, log?: (message: string) => void);
|
|
19
|
+
/**
|
|
20
|
+
* Server'ı başlat. package.json'dan script çöz.
|
|
21
|
+
* Öncelik: npm start > node dist/index.js > npm run dev
|
|
22
|
+
*/
|
|
23
|
+
startServer(projectRoot: string): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Server hazır olana kadar bekle (port polling).
|
|
26
|
+
*/
|
|
27
|
+
waitForReady(port?: number, timeout?: number): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Tek bir endpoint'i test et.
|
|
30
|
+
*/
|
|
31
|
+
testEndpoint(test: EndpointTest): Promise<EndpointTestResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Server'ı durdur.
|
|
34
|
+
*/
|
|
35
|
+
stopServer(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Task açıklamasından otomatik test senaryoları çıkar.
|
|
38
|
+
*/
|
|
39
|
+
inferTestsFromTask(taskDescription: string): EndpointTest[];
|
|
40
|
+
/**
|
|
41
|
+
* Tam integration test akışı:
|
|
42
|
+
* 1. Server başlat
|
|
43
|
+
* 2. Hazır olana kadar bekle
|
|
44
|
+
* 3. Testleri çalıştır
|
|
45
|
+
* 4. Server'ı durdur
|
|
46
|
+
* 5. Sonuçları döndür
|
|
47
|
+
*/
|
|
48
|
+
runFullTest(projectRoot: string, tests: EndpointTest[]): Promise<IntegrationTestResult>;
|
|
49
|
+
/** package.json'dan start komutu çöz */
|
|
50
|
+
private resolveStartCommand;
|
|
51
|
+
/** Port açık mı kontrol et */
|
|
52
|
+
private checkPort;
|
|
53
|
+
/** HTTP request helper */
|
|
54
|
+
private httpRequest;
|
|
55
|
+
/** Beklenen body'nin gerçek body'de olup olmadığını kontrol et (shallow) */
|
|
56
|
+
private deepIncludes;
|
|
57
|
+
private delay;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=integration-evaluator.d.ts.map
|