@backendkit-labs/agent-coding 0.28.5 → 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/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 @@
|
|
|
1
|
+
{"version":3,"file":"agent-hook.js","sourceRoot":"","sources":["../../../../src/pipeline/reflection/hooks/agent-hook.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,0DAA0F;AAE1F,gFAAgF;AAEhF,MAAa,SAAS;IACZ,MAAM,CAAmB;IAEjC,YAAY,MAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,kBAAkB,CACtB,QAAgB,EAChB,iBAAyB,EACzB,WAAqB,EAAE,EACvB,WAAyB,EACzB,SAA2B,OAAO;QAKlC,MAAM,YAAY,GAAG,WAAW,IAAI,IAAA,qCAAsB,EAAC,QAAQ,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,IAAA,sCAAuB,EAAC,YAAY,CAAC,CAAC;QAEnD,MAAM,MAAM,GAA8B;YACxC,MAAM;YACN,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,QAAQ;YACpC,SAAS,EAAE,IAAI,EAAE,SAAS,IAAI,eAAe;YAC7C,IAAI,EAAE,YAAY;YAClB,iBAAiB;YACjB,QAAQ;YACR,aAAa,EAAE,IAAI,EAAE,qBAAqB,IAAI,qEAAqE;YACnH,QAAQ;YACR,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SAChC,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CACvB,MAAc,EACd,iBAAyB,EACzB,OAAe;QAKf,OAAO,IAAI,CAAC,kBAAkB,CAC5B,wBAAwB,MAAM,MAAM,OAAO,kBAAkB,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AAO;YACL,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,eAAe,EAAE,UAAU,CAAC,MAAM;YAClC,qBAAqB;SACtB,CAAC;IACJ,CAAC;CACF;AAxID,8BAwIC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description AuditHook — Puente entre AuditReporter y ReflectionEngine.
|
|
3
|
+
*
|
|
4
|
+
* Este hook se encarga de transformar los hallazgos de auditoría (AuditFinding)
|
|
5
|
+
* en FailureRecord y reportarlos al ReflectionEngine para su análisis.
|
|
6
|
+
*
|
|
7
|
+
* Se integra en el método completeSprint() del AuditReporter, donde se
|
|
8
|
+
* dispara la reflexión automática al finalizar cada sprint de auditoría.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const hook = new AuditHook(engine);
|
|
13
|
+
* await hook.reportFinding(finding, gateName, agente);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { ReflectionEngine } from '@backendkit-labs/agent-core';
|
|
17
|
+
import type { AuditFinding } from '@backendkit-labs/agent-core';
|
|
18
|
+
import { FailureRecord, ReflectionDomain } from '@backendkit-labs/agent-core';
|
|
19
|
+
export declare class AuditHook {
|
|
20
|
+
private engine;
|
|
21
|
+
private onHighSeverityFinding?;
|
|
22
|
+
constructor(engine: ReflectionEngine, options?: {
|
|
23
|
+
onHighSeverityFinding?: (projectDir: string, issue: string) => Promise<void>;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* @description Reporta un hallazgo de auditoría al Reflection Engine.
|
|
27
|
+
* Convierte un AuditFinding en FailureRecord, detecta el failureType
|
|
28
|
+
* automáticamente según el contenido del hallazgo, y lo registra
|
|
29
|
+
* en el catálogo de fallos. Si se detecta un patrón (≥3 ocurrencias),
|
|
30
|
+
* se promueve automáticamente a policyRule.
|
|
31
|
+
*
|
|
32
|
+
* @param finding - Hallazgo de auditoría (AuditFinding)
|
|
33
|
+
* @param gateName - Nombre del gate que generó el hallazgo (ej: "security", "qa")
|
|
34
|
+
* @param domain - Dominio del Reflection Engine (default: "audit")
|
|
35
|
+
* @returns El FailureRecord creado y los patrones detectados
|
|
36
|
+
*/
|
|
37
|
+
reportFinding(finding: AuditFinding, gateName: string, domain?: ReflectionDomain): Promise<{
|
|
38
|
+
record: FailureRecord;
|
|
39
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* @description Reporta múltiples hallazgos de auditoría en lote.
|
|
43
|
+
* Útil cuando un gate produce varios hallazgos en una misma ejecución.
|
|
44
|
+
*
|
|
45
|
+
* @param findings - Lista de hallazgos de auditoría
|
|
46
|
+
* @param gateName - Nombre del gate que generó los hallazgos
|
|
47
|
+
* @param domain - Dominio del Reflection Engine (default: "audit")
|
|
48
|
+
* @returns Lista de resultados (FailureRecord + patrones detectados)
|
|
49
|
+
*/
|
|
50
|
+
reportFindings(findings: AuditFinding[], gateName: string, domain?: ReflectionDomain): Promise<Array<{
|
|
51
|
+
record: FailureRecord;
|
|
52
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
53
|
+
}>>;
|
|
54
|
+
/**
|
|
55
|
+
* @description Ejecuta una reflexión completa del dominio audit.
|
|
56
|
+
* Escanea todos los hallazgos registrados y promueve patrones.
|
|
57
|
+
* Útil para llamar al finalizar un ciclo de auditoría.
|
|
58
|
+
*/
|
|
59
|
+
reflectAuditDomain(): Promise<{
|
|
60
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
61
|
+
promotedRules: import('@backendkit-labs/agent-core').ManifestPolicyRule[];
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* @description Obtiene estadísticas de incidentes del dominio audit.
|
|
65
|
+
*/
|
|
66
|
+
getAuditStats(): Promise<{
|
|
67
|
+
totalIncidents: number;
|
|
68
|
+
unresolvedCount: number;
|
|
69
|
+
patternsByFailureType: Record<string, number>;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=audit-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-hook.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/reflection/hooks/audit-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAM9E,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,qBAAqB,CAAC,CAAuD;gBAGnF,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE;QACR,qBAAqB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KAC9E;IAMH;;;;;;;;;;;OAWG;IACG,aAAa,CACjB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,gBAA0B,GACjC,OAAO,CAAC;QACT,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;KACnE,CAAC;IA+BF;;;;;;;;OAQG;IACG,cAAc,CAClB,QAAQ,EAAE,YAAY,EAAE,EACxB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,gBAA0B,GACjC,OAAO,CAAC,KAAK,CAAC;QACf,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;KACnE,CAAC,CAAC;IAcH;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC;QAClC,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;QAClE,aAAa,EAAE,OAAO,6BAA6B,EAAE,kBAAkB,EAAE,CAAC;KAC3E,CAAC;IAIF;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC;QAC7B,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;QACxB,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/C,CAAC;CAkBH"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description AuditHook — Puente entre AuditReporter y ReflectionEngine.
|
|
4
|
+
*
|
|
5
|
+
* Este hook se encarga de transformar los hallazgos de auditoría (AuditFinding)
|
|
6
|
+
* en FailureRecord y reportarlos al ReflectionEngine para su análisis.
|
|
7
|
+
*
|
|
8
|
+
* Se integra en el método completeSprint() del AuditReporter, donde se
|
|
9
|
+
* dispara la reflexión automática al finalizar cada sprint de auditoría.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const hook = new AuditHook(engine);
|
|
14
|
+
* await hook.reportFinding(finding, gateName, agente);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AuditHook = void 0;
|
|
19
|
+
const audit_domain_1 = require("../domains/audit-domain");
|
|
20
|
+
// ── AuditHook ────────────────────────────────────────────────────────────────
|
|
21
|
+
class AuditHook {
|
|
22
|
+
engine;
|
|
23
|
+
onHighSeverityFinding;
|
|
24
|
+
constructor(engine, options) {
|
|
25
|
+
this.engine = engine;
|
|
26
|
+
this.onHighSeverityFinding = options?.onHighSeverityFinding;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @description Reporta un hallazgo de auditoría al Reflection Engine.
|
|
30
|
+
* Convierte un AuditFinding en FailureRecord, detecta el failureType
|
|
31
|
+
* automáticamente según el contenido del hallazgo, y lo registra
|
|
32
|
+
* en el catálogo de fallos. Si se detecta un patrón (≥3 ocurrencias),
|
|
33
|
+
* se promueve automáticamente a policyRule.
|
|
34
|
+
*
|
|
35
|
+
* @param finding - Hallazgo de auditoría (AuditFinding)
|
|
36
|
+
* @param gateName - Nombre del gate que generó el hallazgo (ej: "security", "qa")
|
|
37
|
+
* @param domain - Dominio del Reflection Engine (default: "audit")
|
|
38
|
+
* @returns El FailureRecord creado y los patrones detectados
|
|
39
|
+
*/
|
|
40
|
+
async reportFinding(finding, gateName, domain = 'audit') {
|
|
41
|
+
// Detectar failureType automáticamente desde el texto del hallazgo
|
|
42
|
+
const failureType = (0, audit_domain_1.detectAuditFailureType)(finding.hallazgo);
|
|
43
|
+
const meta = (0, audit_domain_1.getAuditFailureTypeMeta)(failureType);
|
|
44
|
+
// Construir el FailureRecord a partir del AuditFinding
|
|
45
|
+
const record = {
|
|
46
|
+
domain,
|
|
47
|
+
failureType,
|
|
48
|
+
severity: finding.severidad,
|
|
49
|
+
dimension: finding.dimension,
|
|
50
|
+
gate: gateName,
|
|
51
|
+
agenteResponsable: finding.agenteResponsable,
|
|
52
|
+
hallazgo: finding.hallazgo,
|
|
53
|
+
recomendacion: finding.recomendacion ?? meta?.genericRecommendation ?? '',
|
|
54
|
+
archivos: finding.evidencia ? [finding.evidencia] : [],
|
|
55
|
+
fecha: finding.resolvedAt ?? new Date().toISOString(),
|
|
56
|
+
};
|
|
57
|
+
// Reportar al Reflection Engine (esto detecta patrones automáticamente)
|
|
58
|
+
const result = await this.engine.reportIncident(record);
|
|
59
|
+
const projectDir = this.engine.getProjectDir();
|
|
60
|
+
if (projectDir && (finding.severidad === 'high' || finding.severidad === 'critical') && this.onHighSeverityFinding) {
|
|
61
|
+
await this.onHighSeverityFinding(projectDir, `[${finding.severidad}] ${finding.hallazgo} (gate: ${gateName})`)
|
|
62
|
+
.catch(() => { });
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @description Reporta múltiples hallazgos de auditoría en lote.
|
|
68
|
+
* Útil cuando un gate produce varios hallazgos en una misma ejecución.
|
|
69
|
+
*
|
|
70
|
+
* @param findings - Lista de hallazgos de auditoría
|
|
71
|
+
* @param gateName - Nombre del gate que generó los hallazgos
|
|
72
|
+
* @param domain - Dominio del Reflection Engine (default: "audit")
|
|
73
|
+
* @returns Lista de resultados (FailureRecord + patrones detectados)
|
|
74
|
+
*/
|
|
75
|
+
async reportFindings(findings, gateName, domain = 'audit') {
|
|
76
|
+
const results = [];
|
|
77
|
+
for (const finding of findings) {
|
|
78
|
+
const result = await this.reportFinding(finding, gateName, domain);
|
|
79
|
+
results.push(result);
|
|
80
|
+
}
|
|
81
|
+
return results;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @description Ejecuta una reflexión completa del dominio audit.
|
|
85
|
+
* Escanea todos los hallazgos registrados y promueve patrones.
|
|
86
|
+
* Útil para llamar al finalizar un ciclo de auditoría.
|
|
87
|
+
*/
|
|
88
|
+
async reflectAuditDomain() {
|
|
89
|
+
return this.engine.reflect({ domain: 'audit', autoPromote: true });
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @description Obtiene estadísticas de incidentes del dominio audit.
|
|
93
|
+
*/
|
|
94
|
+
async getAuditStats() {
|
|
95
|
+
const stats = await this.engine.getStats();
|
|
96
|
+
const catalog = this.engine.getCatalog();
|
|
97
|
+
const unresolved = await catalog.findUnresolved();
|
|
98
|
+
// Contar por failureType
|
|
99
|
+
const auditRecords = await catalog.findByDomain('audit');
|
|
100
|
+
const patternsByFailureType = {};
|
|
101
|
+
for (const record of auditRecords) {
|
|
102
|
+
patternsByFailureType[record.failureType] = (patternsByFailureType[record.failureType] ?? 0) + 1;
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
totalIncidents: stats.totalIncidents,
|
|
106
|
+
unresolvedCount: unresolved.length,
|
|
107
|
+
patternsByFailureType,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.AuditHook = AuditHook;
|
|
112
|
+
//# sourceMappingURL=audit-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-hook.js","sourceRoot":"","sources":["../../../../src/pipeline/reflection/hooks/audit-hook.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH,0DAA0F;AAG1F,gFAAgF;AAEhF,MAAa,SAAS;IACZ,MAAM,CAAmB;IACzB,qBAAqB,CAAwD;IAErF,YACE,MAAwB,EACxB,OAEC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,qBAAqB,GAAG,OAAO,EAAE,qBAAqB,CAAC;IAC9D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,aAAa,CACjB,OAAqB,EACrB,QAAgB,EAChB,SAA2B,OAAO;QAKlC,mEAAmE;QACnE,MAAM,WAAW,GAAG,IAAA,qCAAsB,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,IAAA,sCAAuB,EAAC,WAAW,CAAC,CAAC;QAElD,uDAAuD;QACvD,MAAM,MAAM,GAA8B;YACxC,MAAM;YACN,WAAW;YACX,QAAQ,EAAE,OAAO,CAAC,SAAS;YAC3B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI,EAAE,QAAQ;YACd,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,IAAI,EAAE,qBAAqB,IAAI,EAAE;YACzE,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;YACtD,KAAK,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtD,C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C,UAAU,EAAE,CAAC;QACzC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC;QAElD,yBAAyB;QACzB,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACzD,MAAM,qBAAqB,GAA2B,EAAE,CAAC;QACzD,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE,CAAC;YAClC,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACnG,CAAC;QAED,OAAO;YACL,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,eAAe,EAAE,UAAU,CAAC,MAAM;YAClC,qBAAqB;SACtB,CAAC;IACJ,CAAC;CACF;AAnID,8BAmIC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description BootstrapHook — Puente entre el proceso de inicialización (bootstrap) y el ReflectionEngine.
|
|
3
|
+
*
|
|
4
|
+
* Captura incidentes durante el arranque del sistema (configuración faltante,
|
|
5
|
+
* manifest corrupto, fallos de carga de memoria) y los reporta al
|
|
6
|
+
* ReflectionEngine para análisis y promoción a políticas.
|
|
7
|
+
*
|
|
8
|
+
* Se integra en bootstrap/index.ts (detector.ts, config-loader.ts, memory-loader.ts).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const hook = new BootstrapHook(engine);
|
|
13
|
+
* await hook.reportBootstrapFailure('missing_config_yaml', 'No se encontró config.yaml');
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { ReflectionEngine } from '@backendkit-labs/agent-core';
|
|
17
|
+
import { FailureRecord, ReflectionDomain, FailureType } from '@backendkit-labs/agent-core';
|
|
18
|
+
export declare class BootstrapHook {
|
|
19
|
+
private engine;
|
|
20
|
+
constructor(engine: ReflectionEngine);
|
|
21
|
+
/**
|
|
22
|
+
* @description Reporta un incidente de bootstrap al Reflection Engine.
|
|
23
|
+
*
|
|
24
|
+
* @param failureType - Tipo de fallo (opcional, se auto-detecta)
|
|
25
|
+
* @param hallazgo - Descripción del incidente
|
|
26
|
+
* @param archivos - Archivos relacionados
|
|
27
|
+
* @param domain - Dominio del Reflection Engine (default: "bootstrap")
|
|
28
|
+
* @returns El FailureRecord creado y los patrones detectados
|
|
29
|
+
*/
|
|
30
|
+
reportBootstrapFailure(hallazgo: string, archivos?: string[], failureType?: FailureType, domain?: ReflectionDomain): Promise<{
|
|
31
|
+
record: FailureRecord;
|
|
32
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* @description Reporta un manifest.yaml corrupto.
|
|
36
|
+
*/
|
|
37
|
+
reportManifestCorrupt(parseError: string, manifestPath: string): Promise<{
|
|
38
|
+
record: FailureRecord;
|
|
39
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* @description Reporta un fallo de carga de archivo de configuración.
|
|
43
|
+
*/
|
|
44
|
+
reportMissingConfig(configPath: string): Promise<{
|
|
45
|
+
record: FailureRecord;
|
|
46
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* @description Reporta un fallo de carga de archivo de memoria.
|
|
50
|
+
*/
|
|
51
|
+
reportMemoryLoadFailure(memoryPath: string, errorDetail: string): Promise<{
|
|
52
|
+
record: FailureRecord;
|
|
53
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* @description Ejecuta una reflexión completa del dominio bootstrap.
|
|
57
|
+
*/
|
|
58
|
+
reflectBootstrapDomain(): Promise<{
|
|
59
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
60
|
+
promotedRules: import('@backendkit-labs/agent-core').ManifestPolicyRule[];
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* @description Obtiene estadísticas de incidentes del dominio bootstrap.
|
|
64
|
+
*/
|
|
65
|
+
getBootstrapStats(): Promise<{
|
|
66
|
+
totalIncidents: number;
|
|
67
|
+
unresolvedCount: number;
|
|
68
|
+
patternsByFailureType: Record<string, number>;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=bootstrap-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap-hook.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/reflection/hooks/bootstrap-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAK3F,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAmB;gBAErB,MAAM,EAAE,gBAAgB;IAIpC;;;;;;;;OAQG;IACG,sBAAsB,CAC1B,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,MAAM,EAAO,EACvB,WAAW,CAAC,EAAE,WAAW,EACzB,MAAM,GAAE,gBAA8B,GACrC,OAAO,CAAC;QACT,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;KACnE,CAAC;IAqBF;;OAEG;IACG,qBAAqB,CACzB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;QACT,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;KACnE,CAAC;IAQF;;OAEG;IACG,mBAAmB,CACvB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;QACT,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;KACnE,CAAC;IAQF;;OAEG;IACG,uBAAuB,CAC3B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;QACT,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;KACnE,CAAC;IAQF;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC;QACtC,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;QAClE,aAAa,EAAE,OAAO,6BAA6B,EAAE,kBAAkB,EAAE,CAAC;KAC3E,CAAC;IAIF;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC;QACjC,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;QACxB,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/C,CAAC;CAiBH"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description BootstrapHook — Puente entre el proceso de inicialización (bootstrap) y el ReflectionEngine.
|
|
4
|
+
*
|
|
5
|
+
* Captura incidentes durante el arranque del sistema (configuración faltante,
|
|
6
|
+
* manifest corrupto, fallos de carga de memoria) y los reporta al
|
|
7
|
+
* ReflectionEngine para análisis y promoción a políticas.
|
|
8
|
+
*
|
|
9
|
+
* Se integra en bootstrap/index.ts (detector.ts, config-loader.ts, memory-loader.ts).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const hook = new BootstrapHook(engine);
|
|
14
|
+
* await hook.reportBootstrapFailure('missing_config_yaml', 'No se encontró config.yaml');
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.BootstrapHook = void 0;
|
|
19
|
+
const bootstrap_domain_1 = require("../domains/bootstrap-domain");
|
|
20
|
+
// ── BootstrapHook ────────────────────────────────────────────────────────────
|
|
21
|
+
class BootstrapHook {
|
|
22
|
+
engine;
|
|
23
|
+
constructor(engine) {
|
|
24
|
+
this.engine = engine;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @description Reporta un incidente de bootstrap al Reflection Engine.
|
|
28
|
+
*
|
|
29
|
+
* @param failureType - Tipo de fallo (opcional, se auto-detecta)
|
|
30
|
+
* @param hallazgo - Descripción del incidente
|
|
31
|
+
* @param archivos - Archivos relacionados
|
|
32
|
+
* @param domain - Dominio del Reflection Engine (default: "bootstrap")
|
|
33
|
+
* @returns El FailureRecord creado y los patrones detectados
|
|
34
|
+
*/
|
|
35
|
+
async reportBootstrapFailure(hallazgo, archivos = [], failureType, domain = 'bootstrap') {
|
|
36
|
+
const detectedType = failureType ?? (0, bootstrap_domain_1.detectBootstrapFailureType)(hallazgo);
|
|
37
|
+
const meta = (0, bootstrap_domain_1.getBootstrapFailureTypeMeta)(detectedType);
|
|
38
|
+
const record = {
|
|
39
|
+
domain,
|
|
40
|
+
failureType: detectedType,
|
|
41
|
+
severity: meta?.severity ?? 'high',
|
|
42
|
+
dimension: meta?.dimension ?? 'configuración',
|
|
43
|
+
gate: 'bootstrap',
|
|
44
|
+
agenteResponsable: 'system',
|
|
45
|
+
hallazgo,
|
|
46
|
+
recomendacion: meta?.genericRecommendation ?? 'Revisar la configuración de bootstrap y corregir el error antes de continuar',
|
|
47
|
+
archivos,
|
|
48
|
+
fecha: new Date().toISOString(),
|
|
49
|
+
};
|
|
50
|
+
const result = await this.engine.reportIncident(record);
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @description Reporta un manifest.yaml corrupto.
|
|
55
|
+
*/
|
|
56
|
+
async reportManifestCorrupt(parseError, manifestPath) {
|
|
57
|
+
return this.reportBootstrapFailure(`manifest_corrupt: Error al parsear ${manifestPath}: ${parseError}`, [manifestPath], 'manifest_corrupt');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @description Reporta un fallo de carga de archivo de configuración.
|
|
61
|
+
*/
|
|
62
|
+
async reportMissingConfig(configPath) {
|
|
63
|
+
return this.reportBootstrapFailure(`missing_config_yaml: No se encontró ${configPath}`, [configPath], 'missing_config_yaml');
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @description Reporta un fallo de carga de archivo de memoria.
|
|
67
|
+
*/
|
|
68
|
+
async reportMemoryLoadFailure(memoryPath, errorDetail) {
|
|
69
|
+
return this.reportBootstrapFailure(`memory_load_failure: Error cargando ${memoryPath}: ${errorDetail}`, [memoryPath], 'memory_load_failure');
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @description Ejecuta una reflexión completa del dominio bootstrap.
|
|
73
|
+
*/
|
|
74
|
+
async reflectBootstrapDomain() {
|
|
75
|
+
return this.engine.reflect({ domain: 'bootstrap', autoPromote: true });
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @description Obtiene estadísticas de incidentes del dominio bootstrap.
|
|
79
|
+
*/
|
|
80
|
+
async getBootstrapStats() {
|
|
81
|
+
const stats = await this.engine.getStats();
|
|
82
|
+
const catalog = this.engine.getCatalog();
|
|
83
|
+
const bootstrapRecords = await catalog.findByDomain('bootstrap');
|
|
84
|
+
const unresolved = await catalog.findUnresolved();
|
|
85
|
+
const patternsByFailureType = {};
|
|
86
|
+
for (const record of bootstrapRecords) {
|
|
87
|
+
patternsByFailureType[record.failureType] = (patternsByFailureType[record.failureType] ?? 0) + 1;
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
totalIncidents: stats.totalIncidents,
|
|
91
|
+
unresolvedCount: unresolved.length,
|
|
92
|
+
patternsByFailureType,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.BootstrapHook = BootstrapHook;
|
|
97
|
+
//# sourceMappingURL=bootstrap-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap-hook.js","sourceRoot":"","sources":["../../../../src/pipeline/reflection/hooks/bootstrap-hook.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,kEAAsG;AAEtG,gFAAgF;AAEhF,MAAa,aAAa;IAChB,MAAM,CAAmB;IAEjC,YAAY,MAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,sBAAsB,CAC1B,QAAgB,EAChB,WAAqB,EAAE,EACvB,WAAyB,EACzB,SAA2B,WAAW;QAKtC,MAAM,YAAY,GAAG,WAAW,IAAI,IAAA,6CAA0B,EAAC,QAAQ,CAAC,CAAC;QACzE,MAAM,IAAI,GAAG,IAAA,8CAA2B,EAAC,YAAY,CAAC,CAAC;QAEvD,MAAM,MAAM,GAA8B;YACxC,MAAM;YACN,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,MAAM;YAClC,SAAS,EAAE,IAAI,EAAE,SAAS,IAAI,eAAe;YAC7C,IAAI,EAAE,WAAW;YACjB,iBAAiB,EAAE,QAAQ;YAC3B,QAAQ;YACR,aAAa,EAAE,IAAI,EAAE,qBAAqB,IAAI,8EAA8E;YAC5H,QAAQ;YACR,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SAChC,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,qBAAqB,CACzB,UAAkB,EAClB,YAAoB;QAKpB,OAAO,IAAI,CAAC,sBAAsB,CAChC,sCAAsC,YAAY,KAAK,UAAU,EAAE,EACnE,CAAC,YAAY,CAAC,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ACJ,CAAC;CACF;AAjID,sCAiIC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description CommitHook — Puente entre el commit-workflow.ps1 y el ReflectionEngine.
|
|
3
|
+
*
|
|
4
|
+
* Captura incidentes durante el proceso de commit (validaciones de formato,
|
|
5
|
+
* typecheck, tests) y los reporta al ReflectionEngine para análisis.
|
|
6
|
+
*
|
|
7
|
+
* Se integra en el Test Validation Gate del commit-workflow.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const hook = new CommitHook(engine);
|
|
12
|
+
* await hook.reportCommitFailure('missing_type', 'Mensaje sin tipo Conventional Commits');
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
import { ReflectionEngine } from '@backendkit-labs/agent-core';
|
|
16
|
+
import { FailureRecord, ReflectionDomain, FailureType } from '@backendkit-labs/agent-core';
|
|
17
|
+
export declare class CommitHook {
|
|
18
|
+
private engine;
|
|
19
|
+
constructor(engine: ReflectionEngine);
|
|
20
|
+
/**
|
|
21
|
+
* @description Reporta un fallo de validación de commit.
|
|
22
|
+
*
|
|
23
|
+
* @param failureType - Tipo de fallo (opcional, se auto-detecta)
|
|
24
|
+
* @param hallazgo - Descripción del fallo
|
|
25
|
+
* @param archivos - Archivos involucrados en el commit
|
|
26
|
+
* @param domain - Dominio del Reflection Engine (default: "commit")
|
|
27
|
+
* @returns El FailureRecord creado y los patrones detectados
|
|
28
|
+
*/
|
|
29
|
+
reportCommitFailure(hallazgo: string, archivos: string[], failureType?: FailureType, domain?: ReflectionDomain): Promise<{
|
|
30
|
+
record: FailureRecord;
|
|
31
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* @description Reporta un error de typecheck durante el commit.
|
|
35
|
+
*/
|
|
36
|
+
reportTypecheckFailure(errorMessage: string, archivos: string[]): Promise<{
|
|
37
|
+
record: FailureRecord;
|
|
38
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* @description Reporta tests fallidos durante el commit.
|
|
42
|
+
*/
|
|
43
|
+
reportTestFailure(errorMessage: string, archivos: string[]): Promise<{
|
|
44
|
+
record: FailureRecord;
|
|
45
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* @description Ejecuta una reflexión completa del dominio commit.
|
|
49
|
+
*/
|
|
50
|
+
reflectCommitDomain(): Promise<{
|
|
51
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
52
|
+
promotedRules: import('@backendkit-labs/agent-core').ManifestPolicyRule[];
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* @description Obtiene estadísticas de incidentes del dominio commit.
|
|
56
|
+
*/
|
|
57
|
+
getCommitStats(): Promise<{
|
|
58
|
+
totalIncidents: number;
|
|
59
|
+
unresolvedCount: number;
|
|
60
|
+
patternsByFailureType: Record<string, number>;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=commit-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-hook.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/reflection/hooks/commit-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAK3F,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAmB;gBAErB,MAAM,EAAE,gBAAgB;IAIpC;;;;;;;;OAQG;IACG,mBAAmB,CACvB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAAE,EAClB,WAAW,CAAC,EAAE,WAAW,EACzB,MAAM,GAAE,gBAA2B,GAClC,OAAO,CAAC;QACT,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;KACnE,CAAC;IAqBF;;OAEG;IACG,sBAAsB,CAC1B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC;QACT,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;KACnE,CAAC;IAQF;;OAEG;IACG,iBAAiB,CACrB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC;QACT,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;KACnE,CAAC;IAQF;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC;QACnC,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;QAClE,aAAa,EAAE,OAAO,6BAA6B,EAAE,kBAAkB,EAAE,CAAC;KAC3E,CAAC;IAIF;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC;QAC9B,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;QACxB,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/C,CAAC;CAiBH"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description CommitHook — Puente entre el commit-workflow.ps1 y el ReflectionEngine.
|
|
4
|
+
*
|
|
5
|
+
* Captura incidentes durante el proceso de commit (validaciones de formato,
|
|
6
|
+
* typecheck, tests) y los reporta al ReflectionEngine para análisis.
|
|
7
|
+
*
|
|
8
|
+
* Se integra en el Test Validation Gate del commit-workflow.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const hook = new CommitHook(engine);
|
|
13
|
+
* await hook.reportCommitFailure('missing_type', 'Mensaje sin tipo Conventional Commits');
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.CommitHook = void 0;
|
|
18
|
+
const commit_domain_1 = require("../domains/commit-domain");
|
|
19
|
+
// ── CommitHook ───────────────────────────────────────────────────────────────
|
|
20
|
+
class CommitHook {
|
|
21
|
+
engine;
|
|
22
|
+
constructor(engine) {
|
|
23
|
+
this.engine = engine;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @description Reporta un fallo de validación de commit.
|
|
27
|
+
*
|
|
28
|
+
* @param failureType - Tipo de fallo (opcional, se auto-detecta)
|
|
29
|
+
* @param hallazgo - Descripción del fallo
|
|
30
|
+
* @param archivos - Archivos involucrados en el commit
|
|
31
|
+
* @param domain - Dominio del Reflection Engine (default: "commit")
|
|
32
|
+
* @returns El FailureRecord creado y los patrones detectados
|
|
33
|
+
*/
|
|
34
|
+
async reportCommitFailure(hallazgo, archivos, failureType, domain = 'commit') {
|
|
35
|
+
const detectedType = failureType ?? (0, commit_domain_1.detectCommitFailureType)(hallazgo);
|
|
36
|
+
const meta = (0, commit_domain_1.getCommitFailureTypeMeta)(detectedType);
|
|
37
|
+
const record = {
|
|
38
|
+
domain,
|
|
39
|
+
failureType: detectedType,
|
|
40
|
+
severity: meta?.severity ?? 'medium',
|
|
41
|
+
dimension: meta?.dimension ?? 'convenciones',
|
|
42
|
+
gate: 'commit-workflow',
|
|
43
|
+
agenteResponsable: 'system',
|
|
44
|
+
hallazgo,
|
|
45
|
+
recomendacion: meta?.genericRecommendation ?? 'Revisar las reglas de validación de commit y corregir',
|
|
46
|
+
archivos,
|
|
47
|
+
fecha: new Date().toISOString(),
|
|
48
|
+
};
|
|
49
|
+
const result = await this.engine.reportIncident(record);
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @description Reporta un error de typecheck durante el commit.
|
|
54
|
+
*/
|
|
55
|
+
async reportTypecheckFailure(errorMessage, archivos) {
|
|
56
|
+
return this.reportCommitFailure(`typecheck_failed_before_commit: ${errorMessage}`, archivos, 'typecheck_failed_before_commit');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @description Reporta tests fallidos durante el commit.
|
|
60
|
+
*/
|
|
61
|
+
async reportTestFailure(errorMessage, archivos) {
|
|
62
|
+
return this.reportCommitFailure(`test_failed_before_commit: ${errorMessage}`, archivos, 'test_failed_before_commit');
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @description Ejecuta una reflexión completa del dominio commit.
|
|
66
|
+
*/
|
|
67
|
+
async reflectCommitDomain() {
|
|
68
|
+
return this.engine.reflect({ domain: 'commit', autoPromote: true });
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @description Obtiene estadísticas de incidentes del dominio commit.
|
|
72
|
+
*/
|
|
73
|
+
async getCommitStats() {
|
|
74
|
+
const stats = await this.engine.getStats();
|
|
75
|
+
const catalog = this.engine.getCatalog();
|
|
76
|
+
const commitRecords = await catalog.findByDomain('commit');
|
|
77
|
+
const unresolved = await catalog.findUnresolved();
|
|
78
|
+
const patternsByFailureType = {};
|
|
79
|
+
for (const record of commitRecords) {
|
|
80
|
+
patternsByFailureType[record.failureType] = (patternsByFailureType[record.failureType] ?? 0) + 1;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
totalIncidents: stats.totalIncidents,
|
|
84
|
+
unresolvedCount: unresolved.length,
|
|
85
|
+
patternsByFailureType,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.CommitHook = CommitHook;
|
|
90
|
+
//# sourceMappingURL=commit-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-hook.js","sourceRoot":"","sources":["../../../../src/pipeline/refl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AC5C,QAAQ,EACR,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB;QAIvB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAKlB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACzC,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC3D,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC;QAElD,MAAM,qBAAqB,GAA2B,EAAE,CAAC;QACzD,KAAK,MAAM,MAAM,IAAI,aAAa,EAAE,CAAC;YACnC,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACnG,CAAC;QAED,OAAO;YACL,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,eAAe,EAAE,UAAU,CAAC,MAAM;YAClC,qBAAqB;SACtB,CAAC;IACJ,CAAC;CACF;AAjHD,gCAiHC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description TestHook — Puente entre el test runner (jest) y el ReflectionEngine.
|
|
3
|
+
*
|
|
4
|
+
* Transforma resultados de testing (fallos de typecheck, timeouts, cobertura baja)
|
|
5
|
+
* en FailureRecord y los reporta al ReflectionEngine.
|
|
6
|
+
*
|
|
7
|
+
* Se integra en el pipeline de test validation gate.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const hook = new TestHook(engine);
|
|
12
|
+
* await hook.reportTestFailure('tsc_noEmit_type_error', 'Error TS2345', files);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
import { ReflectionEngine } from '@backendkit-labs/agent-core';
|
|
16
|
+
import { FailureRecord, ReflectionDomain, FailureType } from '@backendkit-labs/agent-core';
|
|
17
|
+
export declare class TestHook {
|
|
18
|
+
private engine;
|
|
19
|
+
constructor(engine: ReflectionEngine);
|
|
20
|
+
/**
|
|
21
|
+
* @description Reporta un fallo de test al Reflection Engine.
|
|
22
|
+
* Convierte los datos en FailureRecord, detecta el failureType
|
|
23
|
+
* automáticamente según el mensaje de error.
|
|
24
|
+
*
|
|
25
|
+
* @param failureType - Tipo de fallo detectado (opcional, se auto-detecta si no se provee)
|
|
26
|
+
* @param errorMessage - Mensaje de error del test/typecheck
|
|
27
|
+
* @param archivos - Archivos involucrados en el fallo
|
|
28
|
+
* @param domain - Dominio del Reflection Engine (default: "test")
|
|
29
|
+
* @returns El FailureRecord creado y los patrones detectados
|
|
30
|
+
*/
|
|
31
|
+
reportTestFailure(errorMessage: string, archivos: string[], failureType?: FailureType, domain?: ReflectionDomain): Promise<{
|
|
32
|
+
record: FailureRecord;
|
|
33
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* @description Reporta un fallo de cobertura por debajo del umbral.
|
|
37
|
+
*/
|
|
38
|
+
reportCoverageFailure(threshold: string, actual: string, archivos: string[]): Promise<{
|
|
39
|
+
record: FailureRecord;
|
|
40
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* @description Reporta un test como flaky (intermitente).
|
|
44
|
+
*/
|
|
45
|
+
reportFlakyTest(testName: string, failureRate: string, archivos: string[]): Promise<{
|
|
46
|
+
record: FailureRecord;
|
|
47
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* @description Ejecuta una reflexión completa del dominio test.
|
|
51
|
+
*/
|
|
52
|
+
reflectTestDomain(): Promise<{
|
|
53
|
+
patterns: import('@backendkit-labs/agent-core').DetectedPattern[];
|
|
54
|
+
promotedRules: import('@backendkit-labs/agent-core').ManifestPolicyRule[];
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* @description Obtiene estadísticas de incidentes del dominio test.
|
|
58
|
+
*/
|
|
59
|
+
getTestStats(): Promise<{
|
|
60
|
+
totalIncidents: number;
|
|
61
|
+
unresolvedCount: number;
|
|
62
|
+
patternsByFailureType: Record<string, number>;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=test-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-hook.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/reflection/hooks/test-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAK3F,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAmB;gBAErB,MAAM,EAAE,gBAAgB;IAIpC;;;;;;;;;;OAUG;IACG,iBAAiB,CACrB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAAE,EAClB,WAAW,CAAC,EAAE,WAAW,EACzB,MAAM,GAAE,gBAAyB,GAChC,OAAO,CAAC;QACT,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,EAAE,OAAO,6BAA6B,EAAE,eAAe,EAAE,CAAC;KACnE,CAAC;IA2BF;;OAEG;IACG,qBAAqB,CACzB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAA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