@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,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Cargador de configuracion del orquestador.
|
|
3
|
+
*
|
|
4
|
+
* Lee los archivos YAML desde ~/.deepseek-code/ (configuracion centralizada)
|
|
5
|
+
* y los combina con valores por defecto.
|
|
6
|
+
*
|
|
7
|
+
* Archivos que carga:
|
|
8
|
+
* - ~/.deepseek-code/orchestrator.yaml -> configuracion general
|
|
9
|
+
* - ~/.deepseek-code/capability-matrix.yaml -> matriz de capacidades
|
|
10
|
+
* - ~/.deepseek-code/policy-rules.yaml -> reglas de politicas
|
|
11
|
+
*
|
|
12
|
+
* Si un archivo no existe, usa los valores por defecto.
|
|
13
|
+
*/
|
|
14
|
+
import { OrchestratorConfig, CapabilityMatrix, PolicyRule } from './types';
|
|
15
|
+
/**
|
|
16
|
+
* @description Carga la configuracion del orquestador.
|
|
17
|
+
*
|
|
18
|
+
* Busca en orden:
|
|
19
|
+
* 1. ~/.deepseek-code/orchestrator.yaml
|
|
20
|
+
* 2. .deepseek-code/orchestrator.yaml (local al proyecto)
|
|
21
|
+
* 3. Valores por defecto
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadOrchestratorConfig(): OrchestratorConfig;
|
|
24
|
+
/**
|
|
25
|
+
* @description Carga la capability matrix.
|
|
26
|
+
*
|
|
27
|
+
* Busca en orden:
|
|
28
|
+
* 1. ~/.deepseek-code/capability-matrix.yaml
|
|
29
|
+
* 2. .deepseek-code/capability-matrix.yaml (local al proyecto)
|
|
30
|
+
* 3. null (se usa solo routing por politicas)
|
|
31
|
+
*/
|
|
32
|
+
export declare function loadCapabilityMatrix(): CapabilityMatrix | null;
|
|
33
|
+
/**
|
|
34
|
+
* @description Carga las policy rules.
|
|
35
|
+
*
|
|
36
|
+
* Busca en orden:
|
|
37
|
+
* 1. ~/.deepseek-code/policy-rules.yaml
|
|
38
|
+
* 2. .deepseek-code/policy-rules.yaml (local al proyecto)
|
|
39
|
+
* 3. null (se usan solo las reglas built-in)
|
|
40
|
+
*/
|
|
41
|
+
export declare function loadPolicyRules(): PolicyRule[] | null;
|
|
42
|
+
/**
|
|
43
|
+
* @description Carga toda la configuracion del orquestador de una vez.
|
|
44
|
+
* Util para inicializacion en startup.
|
|
45
|
+
*/
|
|
46
|
+
export declare function loadOrchestratorConfigAll(): {
|
|
47
|
+
config: OrchestratorConfig;
|
|
48
|
+
capabilityMatrix: CapabilityMatrix | null;
|
|
49
|
+
policyRules: PolicyRule[] | null;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../src/pipeline/orchestration/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EAEX,MAAM,SAAS,CAAC;AAqBjB;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,IAAI,kBAAkB,CA4B3D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,gBAAgB,GAAG,IAAI,CAwB9D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,UAAU,EAAE,GAAG,IAAI,CAwBrD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI;IAC3C,MAAM,EAAE,kBAAkB,CAAC;IAC3B,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;CAClC,CAMA"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description Cargador de configuracion del orquestador.
|
|
4
|
+
*
|
|
5
|
+
* Lee los archivos YAML desde ~/.deepseek-code/ (configuracion centralizada)
|
|
6
|
+
* y los combina con valores por defecto.
|
|
7
|
+
*
|
|
8
|
+
* Archivos que carga:
|
|
9
|
+
* - ~/.deepseek-code/orchestrator.yaml -> configuracion general
|
|
10
|
+
* - ~/.deepseek-code/capability-matrix.yaml -> matriz de capacidades
|
|
11
|
+
* - ~/.deepseek-code/policy-rules.yaml -> reglas de politicas
|
|
12
|
+
*
|
|
13
|
+
* Si un archivo no existe, usa los valores por defecto.
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
+
}) : function(o, v) {
|
|
29
|
+
o["default"] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
+
var ownKeys = function(o) {
|
|
33
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
+
var ar = [];
|
|
35
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
+
return ar;
|
|
37
|
+
};
|
|
38
|
+
return ownKeys(o);
|
|
39
|
+
};
|
|
40
|
+
return function (mod) {
|
|
41
|
+
if (mod && mod.__esModule) return mod;
|
|
42
|
+
var result = {};
|
|
43
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.loadOrchestratorConfig = loadOrchestratorConfig;
|
|
50
|
+
exports.loadCapabilityMatrix = loadCapabilityMatrix;
|
|
51
|
+
exports.loadPolicyRules = loadPolicyRules;
|
|
52
|
+
exports.loadOrchestratorConfigAll = loadOrchestratorConfigAll;
|
|
53
|
+
const fs = __importStar(require("fs"));
|
|
54
|
+
const path = __importStar(require("path"));
|
|
55
|
+
const yaml = __importStar(require("yaml"));
|
|
56
|
+
const types_1 = require("./types");
|
|
57
|
+
// -- Rutas -------------------------------------------------------------------
|
|
58
|
+
/**
|
|
59
|
+
* Obtiene la ruta al directorio de configuracion de DeepSeek Code.
|
|
60
|
+
* Prioriza DEEPSEEK_CODE_CONFIG_DIR si esta definido, sino usa ~/.deepseek-code/
|
|
61
|
+
*/
|
|
62
|
+
function getConfigDir() {
|
|
63
|
+
if (process.env.DEEPSEEK_CODE_CONFIG_DIR) {
|
|
64
|
+
return process.env.DEEPSEEK_CODE_CONFIG_DIR;
|
|
65
|
+
}
|
|
66
|
+
return path.join(require('os').homedir(), '.deepseek-code');
|
|
67
|
+
}
|
|
68
|
+
function getConfigPath(filename) {
|
|
69
|
+
return path.join(getConfigDir(), filename);
|
|
70
|
+
}
|
|
71
|
+
// -- Loaders -----------------------------------------------------------------
|
|
72
|
+
/**
|
|
73
|
+
* @description Carga la configuracion del orquestador.
|
|
74
|
+
*
|
|
75
|
+
* Busca en orden:
|
|
76
|
+
* 1. ~/.deepseek-code/orchestrator.yaml
|
|
77
|
+
* 2. .deepseek-code/orchestrator.yaml (local al proyecto)
|
|
78
|
+
* 3. Valores por defecto
|
|
79
|
+
*/
|
|
80
|
+
function loadOrchestratorConfig() {
|
|
81
|
+
const defaults = (0, types_1.defaultOrchestratorConfig)();
|
|
82
|
+
// Intentar global primero
|
|
83
|
+
const globalPath = getConfigPath('orchestrator.yaml');
|
|
84
|
+
if (fs.existsSync(globalPath)) {
|
|
85
|
+
try {
|
|
86
|
+
const content = fs.readFileSync(globalPath, 'utf-8');
|
|
87
|
+
const parsed = yaml.parse(content);
|
|
88
|
+
return mergeConfig(defaults, parsed);
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
console.warn(`[orchestrator] Error loading global config: ${err}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Intentar local al proyecto
|
|
95
|
+
const localPath = path.join(process.cwd(), '.deepseek-code', 'orchestrator.yaml');
|
|
96
|
+
if (fs.existsSync(localPath)) {
|
|
97
|
+
try {
|
|
98
|
+
const content = fs.readFileSync(localPath, 'utf-8');
|
|
99
|
+
const parsed = yaml.parse(content);
|
|
100
|
+
return mergeConfig(defaults, parsed);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
console.warn(`[orchestrator] Error loading local config: ${err}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return defaults;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @description Carga la capability matrix.
|
|
110
|
+
*
|
|
111
|
+
* Busca en orden:
|
|
112
|
+
* 1. ~/.deepseek-code/capability-matrix.yaml
|
|
113
|
+
* 2. .deepseek-code/capability-matrix.yaml (local al proyecto)
|
|
114
|
+
* 3. null (se usa solo routing por politicas)
|
|
115
|
+
*/
|
|
116
|
+
function loadCapabilityMatrix() {
|
|
117
|
+
// Intentar global primero
|
|
118
|
+
const globalPath = getConfigPath('capability-matrix.yaml');
|
|
119
|
+
if (fs.existsSync(globalPath)) {
|
|
120
|
+
try {
|
|
121
|
+
const content = fs.readFileSync(globalPath, 'utf-8');
|
|
122
|
+
return yaml.parse(content);
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
console.warn(`[orchestrator] Error loading global capability matrix: ${err}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// Intentar local al proyecto
|
|
129
|
+
const localPath = path.join(process.cwd(), '.deepseek-code', 'capability-matrix.yaml');
|
|
130
|
+
if (fs.existsSync(localPath)) {
|
|
131
|
+
try {
|
|
132
|
+
const content = fs.readFileSync(localPath, 'utf-8');
|
|
133
|
+
return yaml.parse(content);
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
console.warn(`[orchestrator] Error loading local capability matrix: ${err}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @description Carga las policy rules.
|
|
143
|
+
*
|
|
144
|
+
* Busca en orden:
|
|
145
|
+
* 1. ~/.deepseek-code/policy-rules.yaml
|
|
146
|
+
* 2. .deepseek-code/policy-rules.yaml (local al proyecto)
|
|
147
|
+
* 3. null (se usan solo las reglas built-in)
|
|
148
|
+
*/
|
|
149
|
+
function loadPolicyRules() {
|
|
150
|
+
// Intentar global primero
|
|
151
|
+
const globalPath = getConfigPath('policy-rules.yaml');
|
|
152
|
+
if (fs.existsSync(globalPath)) {
|
|
153
|
+
try {
|
|
154
|
+
const content = fs.readFileSync(globalPath, 'utf-8');
|
|
155
|
+
return yaml.parse(content);
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
console.warn(`[orchestrator] Error loading global policy rules: ${err}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// Intentar local al proyecto
|
|
162
|
+
const localPath = path.join(process.cwd(), '.deepseek-code', 'policy-rules.yaml');
|
|
163
|
+
if (fs.existsSync(localPath)) {
|
|
164
|
+
try {
|
|
165
|
+
const content = fs.readFileSync(localPath, 'utf-8');
|
|
166
|
+
return yaml.parse(content);
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
console.warn(`[orchestrator] Error loading local policy rules: ${err}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @description Carga toda la configuracion del orquestador de una vez.
|
|
176
|
+
* Util para inicializacion en startup.
|
|
177
|
+
*/
|
|
178
|
+
function loadOrchestratorConfigAll() {
|
|
179
|
+
return {
|
|
180
|
+
config: loadOrchestratorConfig(),
|
|
181
|
+
capabilityMatrix: loadCapabilityMatrix(),
|
|
182
|
+
policyRules: loadPolicyRules(),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
// -- Helpers -----------------------------------------------------------------
|
|
186
|
+
function mergeConfig(defaults, parsed) {
|
|
187
|
+
return {
|
|
188
|
+
features: {
|
|
189
|
+
...defaults.features,
|
|
190
|
+
...(parsed.features ?? {}),
|
|
191
|
+
},
|
|
192
|
+
riskThresholds: validateRiskThresholds({ ...defaults.riskThresholds, ...(parsed.riskThresholds ?? {}) }, defaults.riskThresholds),
|
|
193
|
+
riskWeights: validateRiskWeights({ ...defaults.riskWeights, ...(parsed.riskWeights ?? {}) }, defaults.riskWeights),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function validateRiskWeights(weights, defaults) {
|
|
197
|
+
const clean = { ...defaults };
|
|
198
|
+
for (const [k, v] of Object.entries(weights)) {
|
|
199
|
+
if (typeof v === 'number' && Number.isFinite(v) && v >= 0) {
|
|
200
|
+
clean[k] = v;
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
console.warn(`[OrchestratorConfig] Peso invalido para '${k}': ${v}. Se usa el default.`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return clean;
|
|
207
|
+
}
|
|
208
|
+
function validateRiskThresholds(t, defaults) {
|
|
209
|
+
if (!(t.low < t.medium && t.medium < t.high && t.high < t.critical)) {
|
|
210
|
+
console.warn('[OrchestratorConfig] Thresholds de riesgo fuera de orden — se usan los defaults.');
|
|
211
|
+
return defaults;
|
|
212
|
+
}
|
|
213
|
+
return t;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=config-loader.js.map
|
|
@@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ACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,sBAAsB,CAC7B,CAAuC,EACvC,QAA8C;IAE9C,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpE,OAAO,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAC;QACjG,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Domain Detector — Detecta los bounded contexts/dominios
|
|
3
|
+
* a partir del input del usuario.
|
|
4
|
+
*
|
|
5
|
+
* Usa keywords + bigramas para identificar dominios técnicos.
|
|
6
|
+
* Soporta detección de servicios objetivo y patrones relacionados.
|
|
7
|
+
*
|
|
8
|
+
* @see capability-matrix.yaml en ~/.deepseek-code/ para la lista completa
|
|
9
|
+
* de dominios por agente.
|
|
10
|
+
*/
|
|
11
|
+
import { TaskContext } from './task-context';
|
|
12
|
+
export interface DomainDetectionResult {
|
|
13
|
+
/** Dominios detectados, ordenados por relevancia */
|
|
14
|
+
domains: string[];
|
|
15
|
+
/** Servicios objetivo detectados */
|
|
16
|
+
targetServices: string[];
|
|
17
|
+
/** Patrones relacionados del vault */
|
|
18
|
+
relatedPatterns: string[];
|
|
19
|
+
/** Score de confianza por dominio */
|
|
20
|
+
scores: Record<string, number>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @description Detecta dominios a partir del input del usuario.
|
|
24
|
+
*
|
|
25
|
+
* Analiza el texto en busca de keywords técnicas y construye
|
|
26
|
+
* un mapa de dominios con sus puntuaciones.
|
|
27
|
+
*
|
|
28
|
+
* @param input - Texto del usuario
|
|
29
|
+
* @returns Dominios detectados con scores
|
|
30
|
+
*/
|
|
31
|
+
export declare function detectDomains(input: string): DomainDetectionResult;
|
|
32
|
+
/**
|
|
33
|
+
* @description Enriquce un TaskContext con los dominios detectados.
|
|
34
|
+
*/
|
|
35
|
+
export declare function enrichTaskWithDomains(task: TaskContext): TaskContext;
|
|
36
|
+
//# sourceMappingURL=domain-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-detector.d.ts","sourceRoot":"","sources":["../../../src/pipeline/orchestration/domain-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAkG7C,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oCAAoC;IACpC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,sCAAsC;IACtC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,CAiClE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAapE"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description Domain Detector — Detecta los bounded contexts/dominios
|
|
4
|
+
* a partir del input del usuario.
|
|
5
|
+
*
|
|
6
|
+
* Usa keywords + bigramas para identificar dominios técnicos.
|
|
7
|
+
* Soporta detección de servicios objetivo y patrones relacionados.
|
|
8
|
+
*
|
|
9
|
+
* @see capability-matrix.yaml en ~/.deepseek-code/ para la lista completa
|
|
10
|
+
* de dominios por agente.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.detectDomains = detectDomains;
|
|
14
|
+
exports.enrichTaskWithDomains = enrichTaskWithDomains;
|
|
15
|
+
const keyword_match_1 = require("./keyword-match");
|
|
16
|
+
/**
|
|
17
|
+
* Mapa de dominios con sus keywords.
|
|
18
|
+
* Este mapa base se puede extender desde ~/.deepseek-code/capability-matrix.yaml
|
|
19
|
+
*/
|
|
20
|
+
const DOMAIN_KEYWORDS = {
|
|
21
|
+
security: [
|
|
22
|
+
{ words: ['jwt', 'token', 'autenticación', 'autenticacion', 'auth'], pattern: 'jwt-auth' },
|
|
23
|
+
{ words: ['autorización', 'autorizacion', 'abac', 'rbac', 'permisos'], pattern: 'abac' },
|
|
24
|
+
{ words: ['api key', 'apikey', 'api-key'], pattern: 'api-key' },
|
|
25
|
+
{ words: ['oauth', 'oauth2', 'openid', 'oidc'], pattern: 'oauth2' },
|
|
26
|
+
{ words: ['cifrado', 'encriptación', 'hash', 'bcrypt', 'argon2'] },
|
|
27
|
+
{ words: ['xss', 'csrf', 'inyección', 'inyeccion', 'sql injection', 'owasp'] },
|
|
28
|
+
{ words: ['vulnerabilidad', 'vulnerabilidad', 'cve', 'pentest'] },
|
|
29
|
+
{ words: ['secrets', 'secretos', 'vault', 'hashicorp'] },
|
|
30
|
+
{ words: ['certificado', 'tls', 'ssl', 'https', 'mtls'] },
|
|
31
|
+
],
|
|
32
|
+
resilience: [
|
|
33
|
+
{ words: ['circuit breaker', 'circuitbreaker', 'breaker'], pattern: 'circuit-breaker' },
|
|
34
|
+
{ words: ['retry', 'reintento', 'backoff', 'exponential backoff'], pattern: 'retry-backoff' },
|
|
35
|
+
{ words: ['bulkhead', 'aislamiento'], pattern: 'bulkhead' },
|
|
36
|
+
{ words: ['timeout', 'time-out', 'latency', 'latencia'] },
|
|
37
|
+
{ words: ['fallover', 'failover', 'alta disponibilidad', 'high availability'] },
|
|
38
|
+
{ words: ['resiliencia', 'resilience', 'tolerancia a fallos'] },
|
|
39
|
+
],
|
|
40
|
+
messaging: [
|
|
41
|
+
{ words: ['rabbitmq', 'amqp', 'broker', 'cola', 'queue'], pattern: 'broker-tcp' },
|
|
42
|
+
{ words: ['kafka', 'evento', 'event streaming', 'topic'] },
|
|
43
|
+
{ words: ['sns', 'sqs', 'mensajería', 'mensajeria'] },
|
|
44
|
+
{ words: ['dlq', 'dead letter', 'reintento fallido'] },
|
|
45
|
+
{ words: ['pub/sub', 'publish', 'subscribe', 'suscripción'] },
|
|
46
|
+
],
|
|
47
|
+
database: [
|
|
48
|
+
{ words: ['base de datos', 'bd', 'database', 'db'] },
|
|
49
|
+
{ words: ['mysql', 'postgresql', 'postgres', 'sql server', 'oracle'] },
|
|
50
|
+
{ words: ['mongodb', 'nosql', 'documento', 'colección'] },
|
|
51
|
+
{ words: ['redis', 'caché', 'cache', 'memcached'] },
|
|
52
|
+
{ words: ['elasticsearch', 'búsqueda', 'search', 'índice', 'indice'] },
|
|
53
|
+
{ words: ['migración', 'migracion', 'schema', 'esquema'] },
|
|
54
|
+
{ words: ['query', 'consulta', 'sql', 'join', 'índice', 'indice'] },
|
|
55
|
+
{ words: ['orm', 'prisma', 'typeorm', 'sequelize', 'drizzle'] },
|
|
56
|
+
],
|
|
57
|
+
backend: [
|
|
58
|
+
{ words: ['backend', 'servidor', 'server-side'] },
|
|
59
|
+
{ words: ['api', 'rest', 'graphql', 'grpc', 'endpoint'] },
|
|
60
|
+
{ words: ['nestjs', 'nest', 'express', 'fastify', 'fastapi'] },
|
|
61
|
+
{ words: ['controlador', 'controller', 'servicio', 'service', 'repositorio'] },
|
|
62
|
+
{ words: ['middleware', 'interceptor', 'guard', 'pipe', 'filter'] },
|
|
63
|
+
{ words: ['dto', 'validator', 'validación', 'validacion', 'zod', 'class-validator'] },
|
|
64
|
+
{ words: ['inyección de dependencias', 'dependency injection', 'di'] },
|
|
65
|
+
],
|
|
66
|
+
frontend: [
|
|
67
|
+
{ words: ['react', 'vue', 'angular', 'svelte', 'solid'] },
|
|
68
|
+
{ words: ['componente', 'component', 'hook', 'useEffect', 'useState'] },
|
|
69
|
+
{ words: ['ui', 'interfaz', 'usuario', 'pantalla', 'vista'] },
|
|
70
|
+
{ words: ['css', 'tailwind', 'estilo', 'style', 'animación'] },
|
|
71
|
+
{ words: ['next.js', 'nextjs', 'nuxt', 'gatsby', 'astro'] },
|
|
72
|
+
{ words: ['formulario', 'form', 'input', 'botón', 'boton'] },
|
|
73
|
+
],
|
|
74
|
+
architecture: [
|
|
75
|
+
{ words: ['arquitectura', 'arquitectónico', 'arquitectonico'] },
|
|
76
|
+
{ words: ['ddd', 'domain driven', 'bounded context', 'agregado', 'aggregate'] },
|
|
77
|
+
{ words: ['microservicio', 'microservicios', 'monolito', 'modular'] },
|
|
78
|
+
{ words: ['event sourcing', 'cqrs', 'saga', 'outbox', 'inbox'] },
|
|
79
|
+
{ words: ['patrón', 'patron', 'design pattern', 'patrón de diseño'] },
|
|
80
|
+
{ words: ['c4', 'diagrama', 'adr', 'trade-off'] },
|
|
81
|
+
],
|
|
82
|
+
testing: [
|
|
83
|
+
{ words: ['test', 'tests', 'testing', 'prueba', 'pruebas'] },
|
|
84
|
+
{ words: ['unitario', 'unit test', 'integración', 'integration', 'e2e'] },
|
|
85
|
+
{ words: ['jest', 'vitest', 'playwright', 'cypress', 'mocha'] },
|
|
86
|
+
{ words: ['tdd', 'bdd', 'cobertura', 'coverage', 'mock'] },
|
|
87
|
+
{ words: ['contrato', 'contract', 'pact', 'mutation'] },
|
|
88
|
+
],
|
|
89
|
+
devops: [
|
|
90
|
+
{ words: ['docker', 'dockerfile', 'contenedor', 'container', 'imagen'] },
|
|
91
|
+
{ words: ['kubernetes', 'k8s', 'helm', 'pod', 'deployment', 'service'] },
|
|
92
|
+
{ words: ['ci/cd', 'pipeline', 'github actions', 'gitlab ci', 'jenkins'] },
|
|
93
|
+
{ words: ['terraform', 'pulumi', 'iac', 'infraestructura'] },
|
|
94
|
+
{ words: ['cloud', 'aws', 'gcp', 'azure', 'nube'] },
|
|
95
|
+
{ words: ['monitoreo', 'monitoring', 'prometheus', 'grafana', 'alertas'] },
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* @description Detecta dominios a partir del input del usuario.
|
|
100
|
+
*
|
|
101
|
+
* Analiza el texto en busca de keywords técnicas y construye
|
|
102
|
+
* un mapa de dominios con sus puntuaciones.
|
|
103
|
+
*
|
|
104
|
+
* @param input - Texto del usuario
|
|
105
|
+
* @returns Dominios detectados con scores
|
|
106
|
+
*/
|
|
107
|
+
function detectDomains(input) {
|
|
108
|
+
const lower = input.toLowerCase();
|
|
109
|
+
const scores = {};
|
|
110
|
+
const targetServices = new Set();
|
|
111
|
+
const relatedPatterns = new Set();
|
|
112
|
+
for (const [domain, keywords] of Object.entries(DOMAIN_KEYWORDS)) {
|
|
113
|
+
let total = 0;
|
|
114
|
+
for (const kw of keywords) {
|
|
115
|
+
for (const word of kw.words) {
|
|
116
|
+
if ((0, keyword_match_1.matchesKeyword)(lower, word)) {
|
|
117
|
+
total += 1;
|
|
118
|
+
if (kw.service)
|
|
119
|
+
targetServices.add(kw.service);
|
|
120
|
+
if (kw.pattern)
|
|
121
|
+
relatedPatterns.add(kw.pattern);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (total > 0) {
|
|
126
|
+
scores[domain] = total;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Ordenar por score descendente
|
|
130
|
+
const sorted = Object.entries(scores)
|
|
131
|
+
.sort(([, a], [, b]) => b - a)
|
|
132
|
+
.map(([domain]) => domain);
|
|
133
|
+
return {
|
|
134
|
+
domains: sorted,
|
|
135
|
+
targetServices: [...targetServices],
|
|
136
|
+
relatedPatterns: [...relatedPatterns],
|
|
137
|
+
scores,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* @description Enriquce un TaskContext con los dominios detectados.
|
|
142
|
+
*/
|
|
143
|
+
function enrichTaskWithDomains(task) {
|
|
144
|
+
const result = detectDomains(task.rawPrompt);
|
|
145
|
+
return {
|
|
146
|
+
...task,
|
|
147
|
+
domains: result.domains,
|
|
148
|
+
targetServices: [
|
|
149
|
+
...new Set([...task.targetServices, ...result.targetServices]),
|
|
150
|
+
],
|
|
151
|
+
relatedPatterns: [
|
|
152
|
+
...new Set([...task.relatedPatterns, ...result.relatedPatterns]),
|
|
153
|
+
],
|
|
154
|
+
updatedAt: new Date(),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=domain-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-detector.js","sourceRoot":"","sources":["../../../src/pipeline/orchestration/domain-detector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAwHH,sCAiCC;AAKD,sDAaC;AAxKD,mDAAiD;AAYjD;;;GAGG;AACH,MAAM,eAAe,GAAoC;IACvD,QAAQ,EAAE;QACR,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE;QAC1F,EAAE,KAAK,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE;QACxF,EAAE,KAAK,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE;QAC/D,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE;QACnE,EAAE,KAAK,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE;QAClE,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE;QAC9E,EAAE,KAAK,EAA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G,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IAE7B,OAAO;QACL,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,CAAC,GAAG,cAAc,CAAC;QACnC,eAAe,EAAE,CAAC,GAAG,eAAe,CAAC;QACrC,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAAC,IAAiB;IACrD,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,OAAO;QACL,GAAG,IAAI;QACP,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,cAAc,EAAE;YACd,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;SAC/D;QACD,eAAe,EAAE;YACf,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;SACjE;QACD,SAAS,EAAE,IAAI,IAAI,EAAE;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description FSM — Finite State Machine para el ciclo de vida de tareas.
|
|
3
|
+
*
|
|
4
|
+
* Define los estados válidos y las transiciones permitidas para un TaskContext.
|
|
5
|
+
* Cada tarea comienza en 'new' y progresa a través de gates (architecture,
|
|
6
|
+
* security, QA) hasta llegar a 'commit_allowed' o 'rejected'.
|
|
7
|
+
*
|
|
8
|
+
* El FSM se integra con el Orchestrator para validar que las transiciones
|
|
9
|
+
* sean legales según las políticas aplicadas.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const fsm = new TaskFSM();
|
|
14
|
+
* const task = createTaskContext('Implementar auth');
|
|
15
|
+
*
|
|
16
|
+
* // Transición válida
|
|
17
|
+
* const result = fsm.transition(task, 'classified');
|
|
18
|
+
* // result.allowed === true
|
|
19
|
+
* // result.task.status === 'classified'
|
|
20
|
+
*
|
|
21
|
+
* // Transición inválida
|
|
22
|
+
* const result2 = fsm.transition(task, 'commit_allowed');
|
|
23
|
+
* // result.allowed === false
|
|
24
|
+
* // result.error === 'Transición no permitida: new → commit_allowed'
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
import { TaskContext, TaskStatus } from './task-context';
|
|
28
|
+
export interface FSMTransitionResult {
|
|
29
|
+
/** Si la transición fue permitida */
|
|
30
|
+
allowed: boolean;
|
|
31
|
+
/** TaskContext actualizado (solo si allowed === true) */
|
|
32
|
+
task?: TaskContext;
|
|
33
|
+
/** Mensaje de error si no fue permitida */
|
|
34
|
+
error?: string;
|
|
35
|
+
/** Próximos estados válidos desde el estado actual */
|
|
36
|
+
availableTransitions: TaskStatus[];
|
|
37
|
+
}
|
|
38
|
+
/** Vueltas de rework_required permitidas por tarea antes de exigir rechazo o decisión humana. */
|
|
39
|
+
export declare const DEFAULT_MAX_REWORK = 5;
|
|
40
|
+
export declare class TaskFSM {
|
|
41
|
+
private readonly opts;
|
|
42
|
+
constructor(opts?: {
|
|
43
|
+
maxRework?: number;
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* @description Intenta transicionar una tarea a un nuevo estado.
|
|
47
|
+
* Valida que la transición esté en el mapa de transiciones permitidas
|
|
48
|
+
* y que pase todos los guards.
|
|
49
|
+
*
|
|
50
|
+
* @param task - Tarea actual
|
|
51
|
+
* @param to - Estado destino
|
|
52
|
+
* @returns Resultado con la tarea actualizada o error
|
|
53
|
+
*/
|
|
54
|
+
transition(task: TaskContext, to: TaskStatus): FSMTransitionResult;
|
|
55
|
+
/**
|
|
56
|
+
* @description Obtiene los estados destino válidos desde un estado dado.
|
|
57
|
+
*/
|
|
58
|
+
getAvailableTransitions(from: TaskStatus): TaskStatus[];
|
|
59
|
+
/**
|
|
60
|
+
* @description Determina si un estado es terminal (no tiene salidas).
|
|
61
|
+
*/
|
|
62
|
+
isTerminal(status: TaskStatus): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* @description Calcula la ruta crítica desde el estado actual hasta commit_allowed.
|
|
65
|
+
* Útil para mostrar al usuario qué gates faltan.
|
|
66
|
+
*/
|
|
67
|
+
getCriticalPath(task: TaskContext): TaskStatus[];
|
|
68
|
+
/**
|
|
69
|
+
* Verifica si la tarea definitivamente ha pasado por un gate específico.
|
|
70
|
+
*
|
|
71
|
+
* La verificacion es deliberadamente conservadora: prefiere falsos negativos
|
|
72
|
+
* (mostrar un gate como pendiente cuando ya paso) antes que falsos positivos
|
|
73
|
+
* (ocultarlo cuando no paso). getCriticalPath es una funcion de display, no
|
|
74
|
+
* de enforcement — el FSM ya se encarga de bloquear transiciones invalidas.
|
|
75
|
+
*
|
|
76
|
+
* Razon del cambio: el enfoque anterior con indice lineal daba falsos positivos.
|
|
77
|
+
* Ejemplo: classified → implementation con requiresArchitectureReview=true
|
|
78
|
+
* reportaba design_review como "ya pasado" porque implementation(idx=3) > design_review(idx=2),
|
|
79
|
+
* cuando en realidad el FSM permite saltarse design_review desde classified.
|
|
80
|
+
*
|
|
81
|
+
* Logica basada en guardas reales del FSM:
|
|
82
|
+
* - "approved" y estados posteriores garantizan que los gates requeridos se
|
|
83
|
+
* cumplieron (las guardas del FSM bloquean esos saltos).
|
|
84
|
+
* - security_review: si requiresSecurityReview=true y el task esta en qa_review
|
|
85
|
+
* o posterior, el FSM garantiza que security_review fue visitado.
|
|
86
|
+
* - design_review: no hay guarda que lo garantice en todos los caminos
|
|
87
|
+
* (classified → implementation esta permitido aunque requiresArchitectureReview=true),
|
|
88
|
+
* asi que solo retorna true si el task esta exactamente en ese estado.
|
|
89
|
+
*/
|
|
90
|
+
private hasPassedGate;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=fsm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fsm.d.ts","sourceRoot":"","sources":["../../../src/pipeline/orchestration/fsm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAkB,MAAM,gBAAgB,CAAC;AA2EzE,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,oBAAoB,EAAE,UAAU,EAAE,CAAC;CACpC;AAID,iGAAiG;AACjG,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO;IAE9D;;;;;;;;OAQG;IACH,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,UAAU,GAAG,mBAAmB;IA6ClE;;OAEG;IACH,uBAAuB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,EAAE;IAIvD;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAIvC;;;OAGG;IACH,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,EAAE;IAsChD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,aAAa;CA0BtB"}
|