@backendkit-labs/agent-coding 0.28.4 → 0.29.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/README.md +2 -2
- package/dist/__tests__/context-hooks.test.d.ts +2 -0
- package/dist/__tests__/context-hooks.test.d.ts.map +1 -0
- package/dist/__tests__/context-hooks.test.js +21 -0
- package/dist/__tests__/context-hooks.test.js.map +1 -0
- package/dist/__tests__/sandbox.test.js +1 -1
- package/dist/__tests__/sandbox.test.js.map +1 -1
- package/dist/context-hooks.d.ts +11 -0
- package/dist/context-hooks.d.ts.map +1 -0
- package/dist/context-hooks.js +23 -0
- package/dist/context-hooks.js.map +1 -0
- package/dist/context-services.d.ts +12 -0
- package/dist/context-services.d.ts.map +1 -0
- package/dist/context-services.js +20 -0
- package/dist/context-services.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -8
- package/dist/index.js.map +1 -1
- package/dist/orchestration/capability-matrix.d.ts +1 -1
- package/dist/orchestration/capability-matrix.d.ts.map +1 -1
- package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.d.ts +2 -0
- package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.js +42 -0
- package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.js.map +1 -0
- package/dist/pipeline/__tests__/coding-pipeline-hooks.test.d.ts +2 -0
- package/dist/pipeline/__tests__/coding-pipeline-hooks.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/coding-pipeline-hooks.test.js +64 -0
- package/dist/pipeline/__tests__/coding-pipeline-hooks.test.js.map +1 -0
- package/dist/pipeline/__tests__/engine-brief.test.d.ts +2 -0
- package/dist/pipeline/__tests__/engine-brief.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/engine-brief.test.js +159 -0
- package/dist/pipeline/__tests__/engine-brief.test.js.map +1 -0
- package/dist/pipeline/__tests__/qa-orchestrator.test.d.ts +2 -0
- package/dist/pipeline/__tests__/qa-orchestrator.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/qa-orchestrator.test.js +276 -0
- package/dist/pipeline/__tests__/qa-orchestrator.test.js.map +1 -0
- package/dist/pipeline/coding-pipeline-hooks.d.ts +28 -0
- package/dist/pipeline/coding-pipeline-hooks.d.ts.map +1 -0
- package/dist/pipeline/coding-pipeline-hooks.js +91 -0
- package/dist/pipeline/coding-pipeline-hooks.js.map +1 -0
- package/dist/pipeline/index.d.ts +13 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +44 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.d.ts +11 -0
- package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.js +105 -0
- package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.d.ts +2 -0
- package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.js +21 -0
- package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.d.ts +9 -0
- package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.js +101 -0
- package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.d.ts +2 -0
- package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.js +54 -0
- package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.d.ts +2 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.js +57 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.d.ts +9 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.js +43 -0
- package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.js.map +1 -0
- package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.d.ts +10 -0
- package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.d.ts.map +1 -0
- package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.js +264 -0
- package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-ci-blocker.d.ts +31 -0
- package/dist/pipeline/orchestration/audit/audit-ci-blocker.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-ci-blocker.js +120 -0
- package/dist/pipeline/orchestration/audit/audit-ci-blocker.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-finding-tracer.d.ts +33 -0
- package/dist/pipeline/orchestration/audit/audit-finding-tracer.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-finding-tracer.js +126 -0
- package/dist/pipeline/orchestration/audit/audit-finding-tracer.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-lessons-learned.d.ts +27 -0
- package/dist/pipeline/orchestration/audit/audit-lessons-learned.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-lessons-learned.js +155 -0
- package/dist/pipeline/orchestration/audit/audit-lessons-learned.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-pending-issues.d.ts +21 -0
- package/dist/pipeline/orchestration/audit/audit-pending-issues.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-pending-issues.js +110 -0
- package/dist/pipeline/orchestration/audit/audit-pending-issues.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-reflection-bridge.d.ts +39 -0
- package/dist/pipeline/orchestration/audit/audit-reflection-bridge.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-reflection-bridge.js +65 -0
- package/dist/pipeline/orchestration/audit/audit-reflection-bridge.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-report-renderer.d.ts +30 -0
- package/dist/pipeline/orchestration/audit/audit-report-renderer.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-report-renderer.js +249 -0
- package/dist/pipeline/orchestration/audit/audit-report-renderer.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-report-version-manager.d.ts +52 -0
- package/dist/pipeline/orchestration/audit/audit-report-version-manager.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-report-version-manager.js +144 -0
- package/dist/pipeline/orchestration/audit/audit-report-version-manager.js.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.d.ts +37 -0
- package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.js +129 -0
- package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.js.map +1 -0
- package/dist/pipeline/orchestration/audit/index.d.ts +17 -0
- package/dist/pipeline/orchestration/audit/index.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/index.js +26 -0
- package/dist/pipeline/orchestration/audit/index.js.map +1 -0
- package/dist/pipeline/orchestration/audit/types.d.ts +79 -0
- package/dist/pipeline/orchestration/audit/types.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit/types.js +10 -0
- package/dist/pipeline/orchestration/audit/types.js.map +1 -0
- package/dist/pipeline/orchestration/audit-reporter.d.ts +133 -0
- package/dist/pipeline/orchestration/audit-reporter.d.ts.map +1 -0
- package/dist/pipeline/orchestration/audit-reporter.js +322 -0
- package/dist/pipeline/orchestration/audit-reporter.js.map +1 -0
- package/dist/pipeline/orchestration/config-loader.d.ts +51 -0
- package/dist/pipeline/orchestration/config-loader.d.ts.map +1 -0
- package/dist/pipeline/orchestration/config-loader.js +215 -0
- package/dist/pipeline/orchestration/config-loader.js.map +1 -0
- package/dist/pipeline/orchestration/domain-detector.d.ts +36 -0
- package/dist/pipeline/orchestration/domain-detector.d.ts.map +1 -0
- package/dist/pipeline/orchestration/domain-detector.js +157 -0
- package/dist/pipeline/orchestration/domain-detector.js.map +1 -0
- package/dist/pipeline/orchestration/fsm.d.ts +92 -0
- package/dist/pipeline/orchestration/fsm.d.ts.map +1 -0
- package/dist/pipeline/orchestration/fsm.js +243 -0
- package/dist/pipeline/orchestration/fsm.js.map +1 -0
- package/dist/pipeline/orchestration/gate-resolver.d.ts +52 -0
- package/dist/pipeline/orchestration/gate-resolver.d.ts.map +1 -0
- package/dist/pipeline/orchestration/gate-resolver.js +120 -0
- package/dist/pipeline/orchestration/gate-resolver.js.map +1 -0
- package/dist/pipeline/orchestration/index.d.ts +16 -0
- package/dist/pipeline/orchestration/index.d.ts.map +1 -0
- package/dist/pipeline/orchestration/index.js +32 -0
- package/dist/pipeline/orchestration/index.js.map +1 -0
- package/dist/pipeline/orchestration/intent-detector.d.ts +37 -0
- package/dist/pipeline/orchestration/intent-detector.d.ts.map +1 -0
- package/dist/pipeline/orchestration/intent-detector.js +248 -0
- package/dist/pipeline/orchestration/intent-detector.js.map +1 -0
- package/dist/pipeline/orchestration/keyword-match.d.ts +17 -0
- package/dist/pipeline/orchestration/keyword-match.d.ts.map +1 -0
- package/dist/pipeline/orchestration/keyword-match.js +26 -0
- package/dist/pipeline/orchestration/keyword-match.js.map +1 -0
- package/dist/pipeline/orchestration/orchestrator.d.ts +158 -0
- package/dist/pipeline/orchestration/orchestrator.d.ts.map +1 -0
- package/dist/pipeline/orchestration/orchestrator.js +414 -0
- package/dist/pipeline/orchestration/orchestrator.js.map +1 -0
- package/dist/pipeline/orchestration/policy-engine.d.ts +54 -0
- package/dist/pipeline/orchestration/policy-engine.d.ts.map +1 -0
- package/dist/pipeline/orchestration/policy-engine.js +278 -0
- package/dist/pipeline/orchestration/policy-engine.js.map +1 -0
- package/dist/pipeline/orchestration/risk-scorer.d.ts +38 -0
- package/dist/pipeline/orchestration/risk-scorer.d.ts.map +1 -0
- package/dist/pipeline/orchestration/risk-scorer.js +145 -0
- package/dist/pipeline/orchestration/risk-scorer.js.map +1 -0
- package/dist/pipeline/orchestration/task-context.d.ts +205 -0
- package/dist/pipeline/orchestration/task-context.d.ts.map +1 -0
- package/dist/pipeline/orchestration/task-context.js +162 -0
- package/dist/pipeline/orchestration/task-context.js.map +1 -0
- package/dist/pipeline/orchestration/types.d.ts +111 -0
- package/dist/pipeline/orchestration/types.d.ts.map +1 -0
- package/dist/pipeline/orchestration/types.js +37 -0
- package/dist/pipeline/orchestration/types.js.map +1 -0
- package/dist/pipeline/qa/__tests__/QAService.test.d.ts +2 -0
- package/dist/pipeline/qa/__tests__/QAService.test.d.ts.map +1 -0
- package/dist/pipeline/qa/__tests__/QAService.test.js +170 -0
- package/dist/pipeline/qa/__tests__/QAService.test.js.map +1 -0
- package/dist/pipeline/qa/__tests__/QAService.verdict.test.d.ts +2 -0
- package/dist/pipeline/qa/__tests__/QAService.verdict.test.d.ts.map +1 -0
- package/dist/pipeline/qa/__tests__/QAService.verdict.test.js +39 -0
- package/dist/pipeline/qa/__tests__/QAService.verdict.test.js.map +1 -0
- package/dist/pipeline/qa/index.d.ts +3 -0
- package/dist/pipeline/qa/index.d.ts.map +1 -0
- package/dist/pipeline/qa/index.js +6 -0
- package/dist/pipeline/qa/index.js.map +1 -0
- package/dist/pipeline/qa/qa-service.d.ts +33 -0
- package/dist/pipeline/qa/qa-service.d.ts.map +1 -0
- package/dist/pipeline/qa/qa-service.js +239 -0
- package/dist/pipeline/qa/qa-service.js.map +1 -0
- package/dist/pipeline/qa-orchestrator.d.ts +60 -0
- package/dist/pipeline/qa-orchestrator.d.ts.map +1 -0
- package/dist/pipeline/qa-orchestrator.js +177 -0
- package/dist/pipeline/qa-orchestrator.js.map +1 -0
- package/dist/pipeline/reflection/domains/agent-domain.d.ts +40 -0
- package/dist/pipeline/reflection/domains/agent-domain.d.ts.map +1 -0
- package/dist/pipeline/reflection/domains/agent-domain.js +161 -0
- package/dist/pipeline/reflection/domains/agent-domain.js.map +1 -0
- package/dist/pipeline/reflection/domains/audit-domain.d.ts +46 -0
- package/dist/pipeline/reflection/domains/audit-domain.d.ts.map +1 -0
- package/dist/pipeline/reflection/domains/audit-domain.js +241 -0
- package/dist/pipeline/reflection/domains/audit-domain.js.map +1 -0
- package/dist/pipeline/reflection/domains/bootstrap-domain.d.ts +40 -0
- package/dist/pipeline/reflection/domains/bootstrap-domain.d.ts.map +1 -0
- package/dist/pipeline/reflection/domains/bootstrap-domain.js +156 -0
- package/dist/pipeline/reflection/domains/bootstrap-domain.js.map +1 -0
- package/dist/pipeline/reflection/domains/commit-domain.d.ts +40 -0
- package/dist/pipeline/reflection/domains/commit-domain.d.ts.map +1 -0
- package/dist/pipeline/reflection/domains/commit-domain.js +174 -0
- package/dist/pipeline/reflection/domains/commit-domain.js.map +1 -0
- package/dist/pipeline/reflection/domains/test-domain.d.ts +40 -0
- package/dist/pipeline/reflection/domains/test-domain.d.ts.map +1 -0
- package/dist/pipeline/reflection/domains/test-domain.js +194 -0
- package/dist/pipeline/reflection/domains/test-domain.js.map +1 -0
- package/dist/pipeline/reflection/historical-loader.d.ts +105 -0
- package/dist/pipeline/reflection/historical-loader.d.ts.map +1 -0
- package/dist/pipeline/reflection/historical-loader.js +462 -0
- package/dist/pipeline/reflection/historical-loader.js.map +1 -0
- package/dist/pipeline/reflection/hooks/agent-hook.d.ts +72 -0
- package/dist/pipeline/reflection/hooks/agent-hook.d.ts.map +1 -0
- package/dist/pipeline/reflection/hooks/agent-hook.js +98 -0
- package/dist/pipeline/reflection/hooks/agent-hook.js.map +1 -0
- package/dist/pipeline/reflection/hooks/audit-hook.d.ts +72 -0
- package/dist/pipeline/reflection/hooks/audit-hook.d.ts.map +1 -0
- package/dist/pipeline/reflection/hooks/audit-hook.js +112 -0
- package/dist/pipeline/reflection/hooks/audit-hook.js.map +1 -0
- package/dist/pipeline/reflection/hooks/bootstrap-hook.d.ts +71 -0
- package/dist/pipeline/reflection/hooks/bootstrap-hook.d.ts.map +1 -0
- package/dist/pipeline/reflection/hooks/bootstrap-hook.js +97 -0
- package/dist/pipeline/reflection/hooks/bootstrap-hook.js.map +1 -0
- package/dist/pipeline/reflection/hooks/commit-hook.d.ts +63 -0
- package/dist/pipeline/reflection/hooks/commit-hook.d.ts.map +1 -0
- package/dist/pipeline/reflection/hooks/commit-hook.js +90 -0
- package/dist/pipeline/reflection/hooks/commit-hook.js.map +1 -0
- package/dist/pipeline/reflection/hooks/test-hook.d.ts +65 -0
- package/dist/pipeline/reflection/hooks/test-hook.d.ts.map +1 -0
- package/dist/pipeline/reflection/hooks/test-hook.js +99 -0
- package/dist/pipeline/reflection/hooks/test-hook.js.map +1 -0
- package/dist/pipeline/reflection/lessons-memo-generator.d.ts +60 -0
- package/dist/pipeline/reflection/lessons-memo-generator.d.ts.map +1 -0
- package/dist/pipeline/reflection/lessons-memo-generator.js +286 -0
- package/dist/pipeline/reflection/lessons-memo-generator.js.map +1 -0
- package/dist/store/ProjectStore.d.ts +1 -1
- package/dist/store/ProjectStore.d.ts.map +1 -1
- package/dist/store/types.d.ts +28 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +3 -0
- package/dist/store/types.js.map +1 -0
- package/dist/tools/__tests__/command-parser.test.js +1 -1
- package/dist/tools/__tests__/command-parser.test.js.map +1 -1
- package/dist/tools/__tests__/declared-facts.test.d.ts +2 -0
- package/dist/tools/__tests__/declared-facts.test.d.ts.map +1 -0
- package/dist/tools/__tests__/declared-facts.test.js +21 -0
- package/dist/tools/__tests__/declared-facts.test.js.map +1 -0
- package/dist/tools/__tests__/package-install.test.d.ts +2 -0
- package/dist/tools/__tests__/package-install.test.d.ts.map +1 -0
- package/dist/tools/__tests__/package-install.test.js +56 -0
- package/dist/tools/__tests__/package-install.test.js.map +1 -0
- package/dist/tools/__tests__/save-tools.secrets.test.js +1 -1
- package/dist/tools/__tests__/save-tools.secrets.test.js.map +1 -1
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +1 -0
- package/dist/tools/edit-file.js.map +1 -1
- package/dist/tools/list-directory.d.ts.map +1 -1
- package/dist/tools/list-directory.js +1 -0
- package/dist/tools/list-directory.js.map +1 -1
- package/dist/tools/package-install.d.ts +11 -0
- package/dist/tools/package-install.d.ts.map +1 -0
- package/dist/tools/package-install.js +112 -0
- package/dist/tools/package-install.js.map +1 -0
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +1 -0
- package/dist/tools/read-file.js.map +1 -1
- package/dist/tools/run-command.d.ts.map +1 -1
- package/dist/tools/run-command.js +5 -1
- package/dist/tools/run-command.js.map +1 -1
- package/dist/tools/save-audit.d.ts.map +1 -1
- package/dist/tools/save-audit.js +7 -6
- package/dist/tools/save-audit.js.map +1 -1
- package/dist/tools/save-context.d.ts.map +1 -1
- package/dist/tools/save-context.js +3 -2
- package/dist/tools/save-context.js.map +1 -1
- package/dist/tools/save-learning.d.ts.map +1 -1
- package/dist/tools/save-learning.js +4 -3
- package/dist/tools/save-learning.js.map +1 -1
- package/dist/tools/save-user-preference.d.ts.map +1 -1
- package/dist/tools/save-user-preference.js +3 -2
- package/dist/tools/save-user-preference.js.map +1 -1
- package/dist/tools/search-files.d.ts.map +1 -1
- package/dist/tools/search-files.js +1 -0
- package/dist/tools/search-files.js.map +1 -1
- package/dist/tools/update-session.d.ts.map +1 -1
- package/dist/tools/update-session.js +3 -2
- package/dist/tools/update-session.js.map +1 -1
- package/dist/tools/write-file.d.ts.map +1 -1
- package/dist/tools/write-file.js +1 -0
- package/dist/tools/write-file.js.map +1 -1
- package/package.json +63 -44
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.advanceRequiredGates = advanceRequiredGates;
|
|
4
|
+
exports.activateQaEngineerIfNeeded = activateQaEngineerIfNeeded;
|
|
5
|
+
exports.processQaEngineerResponse = processQaEngineerResponse;
|
|
6
|
+
exports.processInlineQaReview = processInlineQaReview;
|
|
7
|
+
function normalizeFindings(raw) {
|
|
8
|
+
return raw.map((f, i) => ({
|
|
9
|
+
...f,
|
|
10
|
+
id: f.id ?? `finding-${i}`,
|
|
11
|
+
evidencia: f.evidencia ?? '',
|
|
12
|
+
recomendacion: f.recomendacion ?? '',
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
const MIN_CODE_LINES = 8;
|
|
16
|
+
const INFORMATIONAL_PATTERNS = [
|
|
17
|
+
/\bexplain\b/i, /\bexplica(me)?\b/i, /\bdescribe\b/i, /\bqué hace\b/i,
|
|
18
|
+
/\bcómo funciona\b/i, /\bwhat (is|does|are)\b/i, /\bhow does\b/i,
|
|
19
|
+
/\bwhat('s| is) this\b/i,
|
|
20
|
+
];
|
|
21
|
+
function isInformationalRequest(rawPrompt) {
|
|
22
|
+
if (!rawPrompt)
|
|
23
|
+
return false;
|
|
24
|
+
return INFORMATIONAL_PATTERNS.some(p => p.test(rawPrompt));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Avanza unicamente los gates que la tarea REQUIERE (segun sus flags
|
|
28
|
+
* requiresArchitectureReview / requiresSecurityReview / requiresQaApproval).
|
|
29
|
+
* Solo actua si la respuesta tiene codigo sustancial (>= 8 lineas).
|
|
30
|
+
*
|
|
31
|
+
* Un gate no requerido no se transiciona ni se registra: hacerlo contaminaba el
|
|
32
|
+
* audit trail con GO de gates que nunca aplicaban (H-003).
|
|
33
|
+
*
|
|
34
|
+
* Distincion clave por tipo de gate:
|
|
35
|
+
* - architecture / security: no tienen reviewer dedicado en este flujo, asi que
|
|
36
|
+
* un gate requerido se auto-pasa con GO silencioso.
|
|
37
|
+
* - qa: SIEMPRE lo decide un reviewer real (qa-engineer dedicado o review inline).
|
|
38
|
+
* Aqui solo posicionamos la tarea en qa_review; el veredicto lo registra ese
|
|
39
|
+
* reviewer. Si el reviewer no existe, la tarea queda en qa_review SIN un GO
|
|
40
|
+
* falso "sin revisiones pendientes", e isCommitAllowed la mantiene bloqueada.
|
|
41
|
+
*/
|
|
42
|
+
async function advanceRequiredGates(ctx) {
|
|
43
|
+
const { orchestrationResult, orchestrator, qaService, clean } = ctx;
|
|
44
|
+
if (qaService.countCodeLines(clean) < MIN_CODE_LINES)
|
|
45
|
+
return;
|
|
46
|
+
if (isInformationalRequest(orchestrationResult.task.rawPrompt))
|
|
47
|
+
return;
|
|
48
|
+
const { task } = orchestrationResult;
|
|
49
|
+
const architectureAgentId = ctx.reviewAgents?.architecture ?? 'architecture';
|
|
50
|
+
const securityAgentId = ctx.reviewAgents?.security ?? 'security';
|
|
51
|
+
// Gates auto-pasables: requeridos pero sin reviewer dedicado → GO silencioso.
|
|
52
|
+
const autoPassGates = [
|
|
53
|
+
{ status: 'design_review', gateName: 'architecture', agentId: architectureAgentId, required: task.requiresArchitectureReview },
|
|
54
|
+
{ status: 'security_review', gateName: 'security', agentId: securityAgentId, required: task.requiresSecurityReview },
|
|
55
|
+
];
|
|
56
|
+
const reporter = orchestrator.getAuditReporter();
|
|
57
|
+
for (const gate of autoPassGates) {
|
|
58
|
+
if (!gate.required)
|
|
59
|
+
continue;
|
|
60
|
+
const result = orchestrator.transitionTask(orchestrationResult.task, gate.status);
|
|
61
|
+
if (result.allowed && result.task) {
|
|
62
|
+
orchestrationResult.task = result.task;
|
|
63
|
+
reporter.recordGate(gate.gateName, gate.agentId, 'GO', [], orchestrationResult.task, `Gate automatico: ${gate.gateName} (sin revisiones pendientes)`, true).catch(() => undefined);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// QA: solo posicionar en qa_review. El GO/NO-GO lo emite el reviewer real
|
|
67
|
+
// (processQaEngineerResponse o processInlineQaReview), nunca este auto-avance.
|
|
68
|
+
if (task.requiresQaApproval) {
|
|
69
|
+
const toQa = orchestrator.transitionTask(orchestrationResult.task, 'qa_review');
|
|
70
|
+
if (toQa.allowed && toQa.task)
|
|
71
|
+
orchestrationResult.task = toQa.task;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Pide la pasada del agente qa-engineer cuando el estado de la tarea es qa_review
|
|
76
|
+
* y el agente actual no es qa-engineer. Retorna el agente y el mensaje que debe
|
|
77
|
+
* recibir, o null si no es necesario.
|
|
78
|
+
*/
|
|
79
|
+
function activateQaEngineerIfNeeded(ctx) {
|
|
80
|
+
const { orchestrationResult, noQA, clean, qaService, effectiveAgentId } = ctx;
|
|
81
|
+
const qaAgentId = ctx.qaAgentId ?? 'qa-engineer';
|
|
82
|
+
if (orchestrationResult.task.status !== 'qa_review' ||
|
|
83
|
+
effectiveAgentId === qaAgentId ||
|
|
84
|
+
noQA ||
|
|
85
|
+
qaService.countCodeLines(clean) < MIN_CODE_LINES ||
|
|
86
|
+
isInformationalRequest(orchestrationResult.task.rawPrompt))
|
|
87
|
+
return null;
|
|
88
|
+
if (!ctx.hasAgent(qaAgentId))
|
|
89
|
+
return null;
|
|
90
|
+
return {
|
|
91
|
+
agentId: qaAgentId,
|
|
92
|
+
message: `Review the following generated code and determine whether it is ready to commit. ` +
|
|
93
|
+
`Your review is final and will be shown to the user.
|
|
94
|
+
|
|
95
|
+
${clean}`,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/** Shared FSM transition + sprint completion logic for both QA paths. */
|
|
99
|
+
async function applyQaDecision(ctx, approved, findings, gateNote, prependQaReview = false) {
|
|
100
|
+
const { orchestrationResult, orchestrator } = ctx;
|
|
101
|
+
const qaAgentId = ctx.qaAgentId ?? 'qa-engineer';
|
|
102
|
+
const reporter = orchestrator.getAuditReporter();
|
|
103
|
+
reporter.recordGate('qa', qaAgentId, approved ? 'GO' : 'NO-GO condicional', findings, orchestrationResult.task, gateNote, true).catch(() => undefined);
|
|
104
|
+
if (approved) {
|
|
105
|
+
// Solo empujar por qa_review hacia approved cuando la tarea REQUIERE QA.
|
|
106
|
+
// Una tarea sin gates requeridos puede commitear directamente (isCommitAllowed),
|
|
107
|
+
// asi que no debemos fabricar un estado 'approved' a traves de un qa_review
|
|
108
|
+
// que la tarea nunca necesito (H-004). La review inline igual queda registrada.
|
|
109
|
+
if (prependQaReview &&
|
|
110
|
+
orchestrationResult.task.requiresQaApproval &&
|
|
111
|
+
orchestrationResult.task.status !== 'qa_review') {
|
|
112
|
+
const toQa = orchestrator.transitionTask(orchestrationResult.task, 'qa_review');
|
|
113
|
+
if (toQa.allowed && toQa.task)
|
|
114
|
+
orchestrationResult.task = toQa.task;
|
|
115
|
+
}
|
|
116
|
+
const toApproved = orchestrator.transitionTask(orchestrationResult.task, 'approved');
|
|
117
|
+
if (toApproved.allowed && toApproved.task) {
|
|
118
|
+
orchestrationResult.task = toApproved.task;
|
|
119
|
+
reporter.completeSprint({
|
|
120
|
+
name: orchestrationResult.task.rawPrompt?.slice(0, 48) ?? 'sprint',
|
|
121
|
+
version: '1.0.0',
|
|
122
|
+
purpose: orchestrationResult.task.rawPrompt ?? 'Implementacion automatica',
|
|
123
|
+
newFiles: [],
|
|
124
|
+
modifiedFiles: [],
|
|
125
|
+
testCount: 0,
|
|
126
|
+
testTime: '0s',
|
|
127
|
+
}).catch(() => undefined);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
const rework = orchestrator.transitionTask(orchestrationResult.task, 'rework_required');
|
|
132
|
+
if (rework.allowed && rework.task) {
|
|
133
|
+
orchestrationResult.task = rework.task;
|
|
134
|
+
}
|
|
135
|
+
else if (rework.error?.startsWith('Límite de rework')) {
|
|
136
|
+
// Rework agotado: la tarea se rechaza en lugar de quedar en qa_review para siempre
|
|
137
|
+
const rejected = orchestrator.transitionTask(orchestrationResult.task, 'rejected');
|
|
138
|
+
if (rejected.allowed && rejected.task)
|
|
139
|
+
orchestrationResult.task = rejected.task;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Procesa la respuesta del agente qa-engineer: registra el gate en AuditReporter,
|
|
145
|
+
* transiciona el FSM a approved o rework_required y completa el sprint si aprueba.
|
|
146
|
+
*/
|
|
147
|
+
async function processQaEngineerResponse(ctx) {
|
|
148
|
+
const { qaService, clean } = ctx;
|
|
149
|
+
ctx.onQAReview?.(clean);
|
|
150
|
+
const findings = normalizeFindings(qaService.extractFindings(clean));
|
|
151
|
+
const approved = qaService.evaluateReview(clean);
|
|
152
|
+
await applyQaDecision(ctx, approved, findings, 'QA review del agente qa-engineer (auto-activado)');
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Procesa QA review inline (sin activar qa-engineer como agente dedicado).
|
|
156
|
+
* Usa QAService.reviewResponse() para obtener la revision y registra el gate.
|
|
157
|
+
* Fallback para cuando qa-engineer no esta disponible o noQA es false.
|
|
158
|
+
*/
|
|
159
|
+
async function processInlineQaReview(ctx) {
|
|
160
|
+
const { qaService, orchestrationResult, noQA } = ctx;
|
|
161
|
+
// Apply the same guards as activateQaEngineerIfNeeded — skip for analysis/explanation
|
|
162
|
+
// responses that have no substantial code, to avoid the QA agent saying "nothing to review"
|
|
163
|
+
if (noQA)
|
|
164
|
+
return;
|
|
165
|
+
if (qaService.countCodeLines(ctx.clean) < MIN_CODE_LINES)
|
|
166
|
+
return;
|
|
167
|
+
if (isInformationalRequest(orchestrationResult.task.rawPrompt))
|
|
168
|
+
return;
|
|
169
|
+
const review = await qaService.reviewResponse(ctx.clean);
|
|
170
|
+
if (!review)
|
|
171
|
+
return;
|
|
172
|
+
ctx.onQAReview?.(review);
|
|
173
|
+
const findings = normalizeFindings(qaService.extractFindings(review));
|
|
174
|
+
const approved = qaService.evaluateReview(review);
|
|
175
|
+
await applyQaDecision(ctx, approved, findings, 'QA review inline post-respuesta', true);
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=qa-orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa-orchestrator.js","sourceRoot":"","sources":["../../src/pipeline/qa-orchestrator.ts"],"names":[],"mappings":";;AA8DA,oDAoCC;AAOD,gEAqBC;AAiED,8DASC;AAOD,sDAkBC;AA1ND,SAAS,iBAAiB,CAAC,GAAwB;IAC/C,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACtB,GAAG,CAAC;QACJ,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,WAAW,CAAC,EAAE;QAC1B,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,EAAE;QAC5B,aAAa,EAAE,CAAC,CAAC,aAAa,IAAI,EAAE;KACvC,CAAC,CAAC,CAAC;AACR,CAAC;AAED,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB,MAAM,sBAAsB,GAAG;IAC3B,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe;IACrE,oBAAoB,EAAE,yBAAyB,EAAE,eAAe;IAChE,wBAAwB;CAC3B,CAAC;AAEF,SAAS,sBAAsB,CAAC,SAAkB;IAC9C,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IAC7B,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/D,CAAC;AAmBD;;;;;;;;;;;;;;;GAeG;AACI,KAAK,UAAU,oBAAoB,CAAC,GAAc;IACrD,MAAM,EAAE,mBAAmB,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC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AAE,IAAI,EAAE,GAAG,GAAG,CAAC;IAErD,sFAAsF;IACtF,4FAA4F;IAC5F,IAAI,IAAI;QAAE,OAAO;IACjB,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,cAAc;QAAE,OAAO;IACjE,IAAI,sBAAsB,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC;QAAE,OAAO;IAEvE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzD,IAAI,CAAC,MAAM;QAAE,OAAO;IAEpB,GAAG,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC;IAEzB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAElD,MAAM,eAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iCAAiC,EAAE,IAAI,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description AgentDomain — failureTypes específicos del dominio de agentes.
|
|
3
|
+
*
|
|
4
|
+
* Define los tipos de fallos que el evaluator (y otros sistemas) pueden capturar
|
|
5
|
+
* sobre el comportamiento de los agentes del sistema multi-agente.
|
|
6
|
+
*
|
|
7
|
+
* Cada failureType tiene:
|
|
8
|
+
* - Una expresión regular de detección (keywords en el hallazgo)
|
|
9
|
+
* - Una dimensión por defecto
|
|
10
|
+
* - Una severidad sugerida
|
|
11
|
+
* - Una recomendación genérica
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const failureType = detectAgentFailureType('agente incorrecto seleccionado para dominio seguridad');
|
|
16
|
+
* // → 'wrong_agent_selected'
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import { FailureType } from '@backendkit-labs/agent-core';
|
|
20
|
+
export interface AgentFailureTypeMeta {
|
|
21
|
+
failureType: FailureType;
|
|
22
|
+
dimension: string;
|
|
23
|
+
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
24
|
+
detectionPatterns: RegExp[];
|
|
25
|
+
genericRecommendation: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const AGENT_FAILURE_TYPES: AgentFailureTypeMeta[];
|
|
28
|
+
/**
|
|
29
|
+
* @description Detecta el failureType más probable basado en el contenido del hallazgo.
|
|
30
|
+
*/
|
|
31
|
+
export declare function detectAgentFailureType(hallazgo: string): FailureType;
|
|
32
|
+
/**
|
|
33
|
+
* @description Obtiene la metadata completa para un failureType.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getAgentFailureTypeMeta(failureType: FailureType): AgentFailureTypeMeta | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* @description Obtiene la metadata basada en el contenido del hallazgo.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getAgentFailureTypeMetaFromHallazgo(hallazgo: string): AgentFailureTypeMeta;
|
|
40
|
+
//# sourceMappingURL=agent-domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-domain.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/reflection/domains/agent-domain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI1D,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACjD,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAID,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,EA2GrD,CAAC;AAIF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAWpE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,oBAAoB,GAAG,SAAS,CAElG;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB,CAG1F"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description AgentDomain — failureTypes específicos del dominio de agentes.
|
|
4
|
+
*
|
|
5
|
+
* Define los tipos de fallos que el evaluator (y otros sistemas) pueden capturar
|
|
6
|
+
* sobre el comportamiento de los agentes del sistema multi-agente.
|
|
7
|
+
*
|
|
8
|
+
* Cada failureType tiene:
|
|
9
|
+
* - Una expresión regular de detección (keywords en el hallazgo)
|
|
10
|
+
* - Una dimensión por defecto
|
|
11
|
+
* - Una severidad sugerida
|
|
12
|
+
* - Una recomendación genérica
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const failureType = detectAgentFailureType('agente incorrecto seleccionado para dominio seguridad');
|
|
17
|
+
* // → 'wrong_agent_selected'
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.AGENT_FAILURE_TYPES = void 0;
|
|
22
|
+
exports.detectAgentFailureType = detectAgentFailureType;
|
|
23
|
+
exports.getAgentFailureTypeMeta = getAgentFailureTypeMeta;
|
|
24
|
+
exports.getAgentFailureTypeMetaFromHallazgo = getAgentFailureTypeMetaFromHallazgo;
|
|
25
|
+
// ── Catálogo de failureTypes de agentes ─────────────────────────────────────
|
|
26
|
+
exports.AGENT_FAILURE_TYPES = [
|
|
27
|
+
{
|
|
28
|
+
failureType: 'wrong_agent_selected',
|
|
29
|
+
dimension: 'arquitectura',
|
|
30
|
+
severity: 'medium',
|
|
31
|
+
detectionPatterns: [
|
|
32
|
+
/wrong\s*agent/i,
|
|
33
|
+
/agente\s*incorrecto/i,
|
|
34
|
+
/agente\s*equivocado/i,
|
|
35
|
+
/no\s*era\s*el\s*agente\s*adecuado/i,
|
|
36
|
+
/wrong\s*profile/i,
|
|
37
|
+
/perfil\s*incorrecto/i,
|
|
38
|
+
/selecci[oó]n\s*incorrecta/i,
|
|
39
|
+
/deber[ií]a\s*haber\s*ido\s*(a|con)/i,
|
|
40
|
+
],
|
|
41
|
+
genericRecommendation: 'Revisar la lógica de selección de agente: verificar capability matrix y triggers de perfil',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
failureType: 'agent_timeout',
|
|
45
|
+
dimension: 'rendimiento',
|
|
46
|
+
severity: 'medium',
|
|
47
|
+
detectionPatterns: [
|
|
48
|
+
/agent\s*timeout/i,
|
|
49
|
+
/agente\s*timeout/i,
|
|
50
|
+
/agente\s*(sin|no)\s*responde/i,
|
|
51
|
+
/agente\s*demor[oó]\s*(mucho|demasiado)/i,
|
|
52
|
+
/timeout.*agente/i,
|
|
53
|
+
/agente\s*no\s*contest[oó]/i,
|
|
54
|
+
],
|
|
55
|
+
genericRecommendation: 'Aumentar el timeout del agente o dividir la tarea en subtareas más pequeñas',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
failureType: 'agent_hallucination',
|
|
59
|
+
dimension: 'confiabilidad',
|
|
60
|
+
severity: 'critical',
|
|
61
|
+
detectionPatterns: [
|
|
62
|
+
/alucinaci[oó]n/i,
|
|
63
|
+
/hallucination/i,
|
|
64
|
+
/informaci[oó]n\s*(incorrecta|falsa|inventada)/i,
|
|
65
|
+
/fabric[oó]\s*(datos|informaci[oó]n)/i,
|
|
66
|
+
/invent[oó]\s*(una|un)/i,
|
|
67
|
+
/respuesta\s*no\s*basada/i,
|
|
68
|
+
/no\s*existe\s*en\s*el\s*c[oód]igo/i,
|
|
69
|
+
/funci[oó]n\s*inexistente/i,
|
|
70
|
+
],
|
|
71
|
+
genericRecommendation: 'Revisar el contexto del agente (system prompt, herramientas disponibles) y reducir el espacio de búsqueda',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
failureType: 'missing_agent_for_domain',
|
|
75
|
+
dimension: 'arquitectura',
|
|
76
|
+
severity: 'high',
|
|
77
|
+
detectionPatterns: [
|
|
78
|
+
/missing\s*agent/i,
|
|
79
|
+
/agente\s*faltante/i,
|
|
80
|
+
/no\s*hay\s*agente\s*para/i,
|
|
81
|
+
/sin\s*agente\s*especializado/i,
|
|
82
|
+
/dominio\s*sin\s*agente/i,
|
|
83
|
+
/domain\s*without\s*agent/i,
|
|
84
|
+
/no\s*existe\s*agente\s*para/i,
|
|
85
|
+
],
|
|
86
|
+
genericRecommendation: 'Crear un perfil de agente para el dominio faltante o mapear a un agente general con instrucciones adicionales',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
failureType: 'tool_execution_failed',
|
|
90
|
+
dimension: 'confiabilidad',
|
|
91
|
+
severity: 'high',
|
|
92
|
+
detectionPatterns: [
|
|
93
|
+
/tool\s*execution/i,
|
|
94
|
+
/ejecuci[oó]n\s*de\s*herramienta/i,
|
|
95
|
+
/tool.*fail/i,
|
|
96
|
+
/herramienta.*fall[oó]/i,
|
|
97
|
+
/tool.*error/i,
|
|
98
|
+
/no\s*pudo\s*ejecutar/i,
|
|
99
|
+
/fall[oó]\s*al\s*ejecutar/i,
|
|
100
|
+
/comando\s*fallido/i,
|
|
101
|
+
],
|
|
102
|
+
genericRecommendation: 'Revisar los parámetros de la herramienta y el entorno: permisos, rutas, dependencias',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
failureType: 'delegation_failed',
|
|
106
|
+
dimension: 'arquitectura',
|
|
107
|
+
severity: 'high',
|
|
108
|
+
detectionPatterns: [
|
|
109
|
+
/delegaci[oó]n.*fall/i,
|
|
110
|
+
/delegation.*fail/i,
|
|
111
|
+
/no\s*pudo\s*delegar/i,
|
|
112
|
+
/agente\s*(hijo|subordinado).*fall[oó]/i,
|
|
113
|
+
/sub.?agente.*error/i,
|
|
114
|
+
/fall[oó]\s*la\s*delegaci[oó]n/i,
|
|
115
|
+
],
|
|
116
|
+
genericRecommendation: 'Verificar que el agente destino existe y está disponible; implementar fallback al agente general',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
failureType: 'response_rejected_by_evaluator',
|
|
120
|
+
dimension: 'confiabilidad',
|
|
121
|
+
severity: 'medium',
|
|
122
|
+
detectionPatterns: [
|
|
123
|
+
/rechazad[oa]\s*por\s*evaluador/i,
|
|
124
|
+
/rejected\s*by\s*evaluator/i,
|
|
125
|
+
/respuesta\s*rechazada/i,
|
|
126
|
+
/evaluator.*reject/i,
|
|
127
|
+
/evaluador.*rechaz/i,
|
|
128
|
+
/response.*not\s*approved/i,
|
|
129
|
+
/calidad\s*insuficiente/i,
|
|
130
|
+
],
|
|
131
|
+
genericRecommendation: 'Revisar la respuesta del agente: verificar que cumple con los criterios de calidad y no contiene alucinaciones',
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
// ── Funciones helper ─────────────────────────────────────────────────────────
|
|
135
|
+
/**
|
|
136
|
+
* @description Detecta el failureType más probable basado en el contenido del hallazgo.
|
|
137
|
+
*/
|
|
138
|
+
function detectAgentFailureType(hallazgo) {
|
|
139
|
+
const lower = hallazgo.toLowerCase();
|
|
140
|
+
for (const meta of exports.AGENT_FAILURE_TYPES) {
|
|
141
|
+
const matches = meta.detectionPatterns.some(pattern => pattern.test(lower));
|
|
142
|
+
if (matches) {
|
|
143
|
+
return meta.failureType;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return 'unknown_agent';
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @description Obtiene la metadata completa para un failureType.
|
|
150
|
+
*/
|
|
151
|
+
function getAgentFailureTypeMeta(failureType) {
|
|
152
|
+
return exports.AGENT_FAILURE_TYPES.find(meta => meta.failureType === failureType);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @description Obtiene la metadata basada en el contenido del hallazgo.
|
|
156
|
+
*/
|
|
157
|
+
function getAgentFailureTypeMetaFromHallazgo(hallazgo) {
|
|
158
|
+
const failureType = detectAgentFailureType(hallazgo);
|
|
159
|
+
return getAgentFailureTypeMeta(failureType) ?? exports.AGENT_FAILURE_TYPES[1]; // fallback a agent_timeout
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=agent-domain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-domain.js","sourceRoot":"","sources":["../../../../src/pipeline/reflection/domains/agent-domain.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAkIH,wDAWC;AAKD,0DAEC;AAKD,kFAGC;AA9ID,+EAA+E;AAElE,QAAA,mBAAmB,GAA2B;IACzD;QACE,WAAW,EAAE,sBAAsB;QACnC,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,QAAQ;QAClB,iBAAiB,EAAE;YACjB,gBAAgB;YAChB,sBAAsB;YACtB,sBAAsB;YACtB,oCAAoC;YACpC,kBAAkB;YAClB,sBAAsB;YACtB,4BAA4B;YAC5B,qCAAqC;SACtC;QACD,qBAAqB,EAAE,4FAA4F;KACpH;IACD;QACE,WAAW,EAAE,eAAe;QAC5B,SAAS,EAAE,aAAa;QACxB,QAAQ,EAAE,QAAQ;QAClB,iBAAiB,EAAE;YACjB,kBAAkB;YAClB,mBAAmB;YACnB,+BAA+B;YAC/B,yCAAyC;YACzC,kBAAkB;YAClB,4BAA4B;SAC7B;QACD,qBAAqB,EAAE,6EAA6E;KACrG;IACD;QACE,WAAW,EAAE,qBAAqB;QAClC,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,UAAU;QACpB,iBAAiB,EAAE;YACjB,iBAAiB;YACjB,gBAAgB;YAChB,gDAAgD;YAChD,sCAAsC;YACtC,wBAAwB;YACxB,0BAA0B;YAC1B,oCAAoC;YACpC,2BAA2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BAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5E,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,eAA8B,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,SAAgB,uBAAuB,CAAC,WAAwB;IAC9D,OAAO,2BAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;AAC5E,CAAC;AAED;;GAEG;AACH,SAAgB,mCAAmC,CAAC,QAAgB;IAClE,MAAM,WAAW,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACrD,OAAO,uBAAuB,CAAC,WAAW,CAAC,IAAI,2BAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,2BAA2B;AACpG,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description AuditDomain — failureTypes específicos del dominio de auditoría QA.
|
|
3
|
+
*
|
|
4
|
+
* Define los tipos de fallos que el AuditReporter puede capturar y mapear
|
|
5
|
+
* a FailureRecord para el Reflection Engine.
|
|
6
|
+
*
|
|
7
|
+
* Cada failureType tiene:
|
|
8
|
+
* - Una expresión regular de detección (keywords en el hallazgo)
|
|
9
|
+
* - Una dimensión por defecto
|
|
10
|
+
* - Una severidad sugerida
|
|
11
|
+
* - Una recomendación genérica
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const failureType = detectAuditFailureType('QueryRunner sin release en finally block');
|
|
16
|
+
* // → 'connection_leak'
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import { FailureType } from '@backendkit-labs/agent-core';
|
|
20
|
+
export interface AuditFailureTypeMeta {
|
|
21
|
+
failureType: FailureType;
|
|
22
|
+
dimension: string;
|
|
23
|
+
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
24
|
+
detectionPatterns: RegExp[];
|
|
25
|
+
genericRecommendation: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const AUDIT_FAILURE_TYPES: AuditFailureTypeMeta[];
|
|
28
|
+
/**
|
|
29
|
+
* @description Detecta el failureType más probable basado en el contenido del hallazgo.
|
|
30
|
+
* Recorre los patrones de detección en orden y devuelve el primero que coincide.
|
|
31
|
+
* Si no hay coincidencia, devuelve un fallback genérico.
|
|
32
|
+
*
|
|
33
|
+
* @param hallazgo - Texto del hallazgo de auditoría
|
|
34
|
+
* @returns failureType detectado
|
|
35
|
+
*/
|
|
36
|
+
export declare function detectAuditFailureType(hallazgo: string): FailureType;
|
|
37
|
+
/**
|
|
38
|
+
* @description Obtiene la metadata completa para un failureType.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getAuditFailureTypeMeta(failureType: FailureType): AuditFailureTypeMeta | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* @description Obtiene la metadata basada en el contenido del hallazgo.
|
|
43
|
+
* Útil cuando se quiere obtener dimensión y severidad sugerida.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getAuditFailureTypeMetaFromHallazgo(hallazgo: string): AuditFailureTypeMeta;
|
|
46
|
+
//# sourceMappingURL=audit-domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-domain.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/reflection/domains/audit-domain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI1D,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACjD,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAID,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,EAsKrD,CAAC;AAiBF;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAcpE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,oBAAoB,GAAG,SAAS,CAElG;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB,CAG1F"}
|