@nahisaho/musubix-agent-orchestrator 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application/ContextManager.d.ts +90 -0
- package/dist/application/ContextManager.d.ts.map +1 -0
- package/dist/application/ContextManager.js +130 -0
- package/dist/application/ContextManager.js.map +1 -0
- package/dist/application/ParallelExecutor.d.ts +65 -0
- package/dist/application/ParallelExecutor.d.ts.map +1 -0
- package/dist/application/ParallelExecutor.js +149 -0
- package/dist/application/ParallelExecutor.js.map +1 -0
- package/dist/application/ResultAggregator.d.ts +107 -0
- package/dist/application/ResultAggregator.d.ts.map +1 -0
- package/dist/application/ResultAggregator.js +142 -0
- package/dist/application/ResultAggregator.js.map +1 -0
- package/dist/application/SubagentDispatcher.d.ts +80 -0
- package/dist/application/SubagentDispatcher.d.ts.map +1 -0
- package/dist/application/SubagentDispatcher.js +199 -0
- package/dist/application/SubagentDispatcher.js.map +1 -0
- package/dist/application/index.d.ts +8 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +8 -0
- package/dist/application/index.js.map +1 -0
- package/dist/domain/entities/Artifact.d.ts +66 -0
- package/dist/domain/entities/Artifact.d.ts.map +1 -0
- package/dist/domain/entities/Artifact.js +58 -0
- package/dist/domain/entities/Artifact.js.map +1 -0
- package/dist/domain/entities/ExecutionContext.d.ts +79 -0
- package/dist/domain/entities/ExecutionContext.d.ts.map +1 -0
- package/dist/domain/entities/ExecutionContext.js +75 -0
- package/dist/domain/entities/ExecutionContext.js.map +1 -0
- package/dist/domain/entities/SubagentSpec.d.ts +100 -0
- package/dist/domain/entities/SubagentSpec.d.ts.map +1 -0
- package/dist/domain/entities/SubagentSpec.js +58 -0
- package/dist/domain/entities/SubagentSpec.js.map +1 -0
- package/dist/domain/entities/Task.d.ts +72 -0
- package/dist/domain/entities/Task.d.ts.map +1 -0
- package/dist/domain/entities/Task.js +41 -0
- package/dist/domain/entities/Task.js.map +1 -0
- package/dist/domain/entities/index.d.ts +8 -0
- package/dist/domain/entities/index.d.ts.map +1 -0
- package/dist/domain/entities/index.js +8 -0
- package/dist/domain/entities/index.js.map +1 -0
- package/dist/domain/index.d.ts +7 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +7 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/services/ComplexityAnalyzer.d.ts +67 -0
- package/dist/domain/services/ComplexityAnalyzer.d.ts.map +1 -0
- package/dist/domain/services/ComplexityAnalyzer.js +129 -0
- package/dist/domain/services/ComplexityAnalyzer.js.map +1 -0
- package/dist/domain/services/DependencyAnalyzer.d.ts +69 -0
- package/dist/domain/services/DependencyAnalyzer.d.ts.map +1 -0
- package/dist/domain/services/DependencyAnalyzer.js +147 -0
- package/dist/domain/services/DependencyAnalyzer.js.map +1 -0
- package/dist/domain/services/index.d.ts +6 -0
- package/dist/domain/services/index.d.ts.map +1 -0
- package/dist/domain/services/index.js +6 -0
- package/dist/domain/services/index.js.map +1 -0
- package/dist/domain/value-objects/AgentRole.d.ts +53 -0
- package/dist/domain/value-objects/AgentRole.d.ts.map +1 -0
- package/dist/domain/value-objects/AgentRole.js +78 -0
- package/dist/domain/value-objects/AgentRole.js.map +1 -0
- package/dist/domain/value-objects/ComplexityFactor.d.ts +47 -0
- package/dist/domain/value-objects/ComplexityFactor.d.ts.map +1 -0
- package/dist/domain/value-objects/ComplexityFactor.js +53 -0
- package/dist/domain/value-objects/ComplexityFactor.js.map +1 -0
- package/dist/domain/value-objects/ComplexityScore.d.ts +44 -0
- package/dist/domain/value-objects/ComplexityScore.d.ts.map +1 -0
- package/dist/domain/value-objects/ComplexityScore.js +56 -0
- package/dist/domain/value-objects/ComplexityScore.js.map +1 -0
- package/dist/domain/value-objects/TaskPriority.d.ts +42 -0
- package/dist/domain/value-objects/TaskPriority.d.ts.map +1 -0
- package/dist/domain/value-objects/TaskPriority.js +39 -0
- package/dist/domain/value-objects/TaskPriority.js.map +1 -0
- package/dist/domain/value-objects/index.d.ts +8 -0
- package/dist/domain/value-objects/index.d.ts.map +1 -0
- package/dist/domain/value-objects/index.js +8 -0
- package/dist/domain/value-objects/index.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/SubagentAdapter.d.ts +40 -0
- package/dist/infrastructure/SubagentAdapter.d.ts.map +1 -0
- package/dist/infrastructure/SubagentAdapter.js +68 -0
- package/dist/infrastructure/SubagentAdapter.js.map +1 -0
- package/dist/infrastructure/YATAContextStore.d.ts +52 -0
- package/dist/infrastructure/YATAContextStore.d.ts.map +1 -0
- package/dist/infrastructure/YATAContextStore.js +87 -0
- package/dist/infrastructure/YATAContextStore.js.map +1 -0
- package/dist/infrastructure/index.d.ts +6 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +6 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ComplexityAnalyzer Domain Service
|
|
3
|
+
*
|
|
4
|
+
* Analyzes task complexity and recommends decomposition
|
|
5
|
+
*
|
|
6
|
+
* @see REQ-SDD-001 - Task Complexity Evaluation
|
|
7
|
+
* @see DES-SDD-001 - ComplexityAnalyzer
|
|
8
|
+
*/
|
|
9
|
+
import { createComplexityScore, shouldDecompose as checkShouldDecompose, } from '../value-objects/ComplexityScore.js';
|
|
10
|
+
import { DEFAULT_FACTORS, createComplexityFactor, getWeightedScore, } from '../value-objects/ComplexityFactor.js';
|
|
11
|
+
/**
|
|
12
|
+
* Create a complexity analyzer
|
|
13
|
+
*
|
|
14
|
+
* @param config - Optional configuration
|
|
15
|
+
* @returns IComplexityAnalyzer implementation
|
|
16
|
+
*/
|
|
17
|
+
export function createComplexityAnalyzer(config = {}) {
|
|
18
|
+
const threshold = config.threshold ?? 7;
|
|
19
|
+
/**
|
|
20
|
+
* Calculate factor score based on task properties
|
|
21
|
+
*/
|
|
22
|
+
function calculateFactorScore(factorName, task) {
|
|
23
|
+
switch (factorName) {
|
|
24
|
+
case 'scope':
|
|
25
|
+
// Score based on estimated scope (1-10 components → 1-10 score)
|
|
26
|
+
return Math.min(10, Math.max(1, task.estimatedScope));
|
|
27
|
+
case 'dependencies':
|
|
28
|
+
// Score based on dependency count (0-9+ → 1-10 score)
|
|
29
|
+
return Math.min(10, Math.max(1, task.dependencyCount + 1));
|
|
30
|
+
case 'fileCount':
|
|
31
|
+
// Score based on estimated file count (1-10+ files → 1-10 score)
|
|
32
|
+
return Math.min(10, Math.max(1, task.estimatedFileCount));
|
|
33
|
+
case 'testCoverage':
|
|
34
|
+
// Higher test requirement = higher complexity
|
|
35
|
+
// 80% → 5, 90% → 7, 100% → 10
|
|
36
|
+
return Math.min(10, Math.max(1, Math.floor(task.testCoverageRequired / 10)));
|
|
37
|
+
case 'uncertainty':
|
|
38
|
+
// Direct mapping of uncertainty level
|
|
39
|
+
return Math.min(10, Math.max(1, task.uncertaintyLevel));
|
|
40
|
+
default:
|
|
41
|
+
return 5; // Default middle score
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build complexity factors from task
|
|
46
|
+
*/
|
|
47
|
+
function buildFactors(task) {
|
|
48
|
+
return DEFAULT_FACTORS.map((defaultFactor) => {
|
|
49
|
+
const weight = config.factorWeights?.[defaultFactor.name] ?? defaultFactor.weight;
|
|
50
|
+
const score = calculateFactorScore(defaultFactor.name, task);
|
|
51
|
+
return createComplexityFactor(defaultFactor.name, weight, score, defaultFactor.description);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Calculate total weighted score
|
|
56
|
+
*/
|
|
57
|
+
function calculateTotalScore(factors) {
|
|
58
|
+
const totalWeight = factors.reduce((sum, f) => sum + f.weight, 0);
|
|
59
|
+
const weightedSum = factors.reduce((sum, f) => sum + getWeightedScore(f), 0);
|
|
60
|
+
// Normalize to 1-10 scale
|
|
61
|
+
const normalized = weightedSum / totalWeight;
|
|
62
|
+
return Math.round(normalized * 10) / 10;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get primary contributing factors
|
|
66
|
+
*/
|
|
67
|
+
function getPrimaryFactors(factors) {
|
|
68
|
+
// Sort by weighted score and return top 3
|
|
69
|
+
return [...factors]
|
|
70
|
+
.sort((a, b) => getWeightedScore(b) - getWeightedScore(a))
|
|
71
|
+
.slice(0, 3);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Generate reasoning text
|
|
75
|
+
*/
|
|
76
|
+
function generateReasoning(score, primaryFactors) {
|
|
77
|
+
const level = score.value >= threshold ? '高' : '低〜中';
|
|
78
|
+
const factorList = primaryFactors
|
|
79
|
+
.map((f) => `${f.description}(${f.score}/10)`)
|
|
80
|
+
.join('、');
|
|
81
|
+
if (score.value >= threshold) {
|
|
82
|
+
return `複雑度は${level}(${score.value}/10)です。主な要因: ${factorList}。タスク分解を推奨します。`;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
return `複雑度は${level}(${score.value}/10)です。主な要因: ${factorList}。単一タスクとして実行可能です。`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Suggest subtask count based on complexity
|
|
90
|
+
*/
|
|
91
|
+
function suggestSubtaskCount(score) {
|
|
92
|
+
if (score.value < 4)
|
|
93
|
+
return 1;
|
|
94
|
+
if (score.value < 6)
|
|
95
|
+
return 2;
|
|
96
|
+
if (score.value < 8)
|
|
97
|
+
return 3;
|
|
98
|
+
if (score.value < 9)
|
|
99
|
+
return 4;
|
|
100
|
+
return 5;
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
analyze(task) {
|
|
104
|
+
const factors = buildFactors(task);
|
|
105
|
+
const totalScore = calculateTotalScore(factors);
|
|
106
|
+
return createComplexityScore(totalScore, factors, threshold);
|
|
107
|
+
},
|
|
108
|
+
shouldDecompose(score) {
|
|
109
|
+
return checkShouldDecompose(score);
|
|
110
|
+
},
|
|
111
|
+
getRecommendation(task) {
|
|
112
|
+
const score = this.analyze(task);
|
|
113
|
+
const shouldDecomp = this.shouldDecompose(score);
|
|
114
|
+
const primaryFactors = getPrimaryFactors([...score.factors]);
|
|
115
|
+
const reasoning = generateReasoning(score, primaryFactors);
|
|
116
|
+
const suggestedCount = shouldDecomp ? suggestSubtaskCount(score) : 1;
|
|
117
|
+
return Object.freeze({
|
|
118
|
+
shouldDecompose: shouldDecomp,
|
|
119
|
+
score,
|
|
120
|
+
reasoning,
|
|
121
|
+
suggestedSubtaskCount: suggestedCount,
|
|
122
|
+
primaryFactors: Object.freeze(primaryFactors),
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
// Re-export for convenience
|
|
128
|
+
export { shouldDecompose } from '../value-objects/ComplexityScore.js';
|
|
129
|
+
//# sourceMappingURL=ComplexityAnalyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComplexityAnalyzer.js","sourceRoot":"","sources":["../../../src/domain/services/ComplexityAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAEL,qBAAqB,EACrB,eAAe,IAAI,oBAAoB,GACxC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAGL,eAAe,EACf,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,sCAAsC,CAAC;AAsD9C;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,SAAmC,EAAE;IAErC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC;IAExC;;OAEG;IACH,SAAS,oBAAoB,CAC3B,UAAgC,EAChC,IAAU;QAEV,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,OAAO;gBACV,gEAAgE;gBAChE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAA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C,CAAC,CAAC,CAAC,CAAC,CAAC;YAErE,OAAO,MAAM,CAAC,MAAM,CAAC;gBACnB,eAAe,EAAE,YAAY;gBAC7B,KAAK;gBACL,SAAS;gBACT,qBAAqB,EAAE,cAAc;gBACrC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;aAC9C,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAED,4BAA4B;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DependencyAnalyzer Domain Service
|
|
3
|
+
*
|
|
4
|
+
* Analyzes dependencies between tasks
|
|
5
|
+
*
|
|
6
|
+
* @see REQ-PAD-001 - Dependency Analysis
|
|
7
|
+
* @see DES-PAD-001 - DependencyAnalyzer
|
|
8
|
+
*/
|
|
9
|
+
import type { SubagentSpec } from '../entities/SubagentSpec.js';
|
|
10
|
+
/**
|
|
11
|
+
* Dependency graph node
|
|
12
|
+
*/
|
|
13
|
+
export interface DependencyNode {
|
|
14
|
+
/** Node ID (spec ID) */
|
|
15
|
+
readonly id: string;
|
|
16
|
+
/** Dependencies (IDs this node depends on) */
|
|
17
|
+
readonly dependencies: readonly string[];
|
|
18
|
+
/** Dependents (IDs that depend on this node) */
|
|
19
|
+
readonly dependents: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Dependency graph
|
|
23
|
+
*/
|
|
24
|
+
export interface DependencyGraph {
|
|
25
|
+
/** All nodes */
|
|
26
|
+
readonly nodes: ReadonlyMap<string, DependencyNode>;
|
|
27
|
+
/** Execution levels (parallel groups) */
|
|
28
|
+
readonly levels: readonly (readonly string[])[];
|
|
29
|
+
/** Has circular dependencies */
|
|
30
|
+
readonly hasCircular: boolean;
|
|
31
|
+
/** Circular dependency path if found */
|
|
32
|
+
readonly circularPath?: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Dependency analyzer interface
|
|
36
|
+
*/
|
|
37
|
+
export interface IDependencyAnalyzer {
|
|
38
|
+
/**
|
|
39
|
+
* Build dependency graph from specs
|
|
40
|
+
* @param specs - Subagent specifications
|
|
41
|
+
* @returns Dependency graph
|
|
42
|
+
*/
|
|
43
|
+
buildGraph(specs: SubagentSpec[]): DependencyGraph;
|
|
44
|
+
/**
|
|
45
|
+
* Get independent specs (no dependencies)
|
|
46
|
+
* @param specs - Subagent specifications
|
|
47
|
+
* @returns Independent specs
|
|
48
|
+
*/
|
|
49
|
+
getIndependentSpecs(specs: SubagentSpec[]): SubagentSpec[];
|
|
50
|
+
/**
|
|
51
|
+
* Get execution order (topological sort)
|
|
52
|
+
* @param graph - Dependency graph
|
|
53
|
+
* @returns Ordered spec IDs
|
|
54
|
+
*/
|
|
55
|
+
getExecutionOrder(graph: DependencyGraph): string[];
|
|
56
|
+
/**
|
|
57
|
+
* Check for circular dependencies
|
|
58
|
+
* @param specs - Subagent specifications
|
|
59
|
+
* @returns Circular path or null
|
|
60
|
+
*/
|
|
61
|
+
findCircularDependencies(specs: SubagentSpec[]): string[] | null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create a dependency analyzer
|
|
65
|
+
*
|
|
66
|
+
* @returns IDependencyAnalyzer implementation
|
|
67
|
+
*/
|
|
68
|
+
export declare function createDependencyAnalyzer(): IDependencyAnalyzer;
|
|
69
|
+
//# sourceMappingURL=DependencyAnalyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DependencyAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/domain/services/DependencyAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,wBAAwB;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gBAAgB;IAChB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACpD,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC;IAChD,gCAAgC;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,wCAAwC;IACxC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,eAAe,CAAC;IAEnD;;;;OAIG;IACH,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAAC;IAE3D;;;;OAIG;IACH,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,EAAE,CAAC;IAEpD;;;;OAIG;IACH,wBAAwB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;CAClE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,mBAAmB,CA2J9D"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DependencyAnalyzer Domain Service
|
|
3
|
+
*
|
|
4
|
+
* Analyzes dependencies between tasks
|
|
5
|
+
*
|
|
6
|
+
* @see REQ-PAD-001 - Dependency Analysis
|
|
7
|
+
* @see DES-PAD-001 - DependencyAnalyzer
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Create a dependency analyzer
|
|
11
|
+
*
|
|
12
|
+
* @returns IDependencyAnalyzer implementation
|
|
13
|
+
*/
|
|
14
|
+
export function createDependencyAnalyzer() {
|
|
15
|
+
/**
|
|
16
|
+
* Build nodes from specs
|
|
17
|
+
*/
|
|
18
|
+
function buildNodes(specs) {
|
|
19
|
+
const nodes = new Map();
|
|
20
|
+
// First pass: create all nodes
|
|
21
|
+
for (const spec of specs) {
|
|
22
|
+
nodes.set(spec.id, {
|
|
23
|
+
id: spec.id,
|
|
24
|
+
dependencies: [...spec.dependencies],
|
|
25
|
+
dependents: [],
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
// Second pass: populate dependents
|
|
29
|
+
for (const spec of specs) {
|
|
30
|
+
for (const depId of spec.dependencies) {
|
|
31
|
+
const depNode = nodes.get(depId);
|
|
32
|
+
if (depNode) {
|
|
33
|
+
nodes.set(depId, {
|
|
34
|
+
...depNode,
|
|
35
|
+
dependents: [...depNode.dependents, spec.id],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return nodes;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Detect circular dependencies using DFS
|
|
44
|
+
*/
|
|
45
|
+
function detectCircular(nodes) {
|
|
46
|
+
const visited = new Set();
|
|
47
|
+
const recursionStack = new Set();
|
|
48
|
+
const path = [];
|
|
49
|
+
function dfs(nodeId) {
|
|
50
|
+
visited.add(nodeId);
|
|
51
|
+
recursionStack.add(nodeId);
|
|
52
|
+
path.push(nodeId);
|
|
53
|
+
const node = nodes.get(nodeId);
|
|
54
|
+
if (node) {
|
|
55
|
+
for (const depId of node.dependencies) {
|
|
56
|
+
if (!visited.has(depId)) {
|
|
57
|
+
const result = dfs(depId);
|
|
58
|
+
if (result)
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
else if (recursionStack.has(depId)) {
|
|
62
|
+
// Found circular dependency
|
|
63
|
+
const cycleStart = path.indexOf(depId);
|
|
64
|
+
return [...path.slice(cycleStart), depId];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
path.pop();
|
|
69
|
+
recursionStack.delete(nodeId);
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
for (const nodeId of nodes.keys()) {
|
|
73
|
+
if (!visited.has(nodeId)) {
|
|
74
|
+
const circular = dfs(nodeId);
|
|
75
|
+
if (circular)
|
|
76
|
+
return circular;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Build execution levels using Kahn's algorithm
|
|
83
|
+
*/
|
|
84
|
+
function buildLevels(nodes) {
|
|
85
|
+
const levels = [];
|
|
86
|
+
const inDegree = new Map();
|
|
87
|
+
const remaining = new Set();
|
|
88
|
+
// Calculate initial in-degrees
|
|
89
|
+
for (const [id, node] of nodes) {
|
|
90
|
+
inDegree.set(id, node.dependencies.length);
|
|
91
|
+
remaining.add(id);
|
|
92
|
+
}
|
|
93
|
+
while (remaining.size > 0) {
|
|
94
|
+
// Find nodes with no remaining dependencies
|
|
95
|
+
const level = [];
|
|
96
|
+
for (const id of remaining) {
|
|
97
|
+
if ((inDegree.get(id) ?? 0) === 0) {
|
|
98
|
+
level.push(id);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (level.length === 0) {
|
|
102
|
+
// Circular dependency - break
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
levels.push(level);
|
|
106
|
+
// Remove processed nodes and update in-degrees
|
|
107
|
+
for (const id of level) {
|
|
108
|
+
remaining.delete(id);
|
|
109
|
+
const node = nodes.get(id);
|
|
110
|
+
if (node) {
|
|
111
|
+
for (const depId of node.dependents) {
|
|
112
|
+
const current = inDegree.get(depId) ?? 0;
|
|
113
|
+
inDegree.set(depId, current - 1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return levels;
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
buildGraph(specs) {
|
|
122
|
+
const nodes = buildNodes(specs);
|
|
123
|
+
const circular = detectCircular(nodes);
|
|
124
|
+
const levels = circular ? [] : buildLevels(nodes);
|
|
125
|
+
return Object.freeze({
|
|
126
|
+
nodes,
|
|
127
|
+
levels: Object.freeze(levels.map((l) => Object.freeze(l))),
|
|
128
|
+
hasCircular: circular !== null,
|
|
129
|
+
circularPath: circular ? Object.freeze(circular) : undefined,
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
getIndependentSpecs(specs) {
|
|
133
|
+
return specs.filter((spec) => spec.dependencies.length === 0);
|
|
134
|
+
},
|
|
135
|
+
getExecutionOrder(graph) {
|
|
136
|
+
if (graph.hasCircular) {
|
|
137
|
+
throw new Error(`Cannot determine execution order: circular dependency detected: ${graph.circularPath?.join(' → ')}`);
|
|
138
|
+
}
|
|
139
|
+
return graph.levels.flat();
|
|
140
|
+
},
|
|
141
|
+
findCircularDependencies(specs) {
|
|
142
|
+
const nodes = buildNodes(specs);
|
|
143
|
+
return detectCircular(nodes);
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=DependencyAnalyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DependencyAnalyzer.js","sourceRoot":"","sources":["../../../src/domain/services/DependencyAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+DH;;;;GAIG;AACH,MAAM,UAAU,wBAAwB;IACtC;;OAEG;IACH,SAAS,UAAU,CAAC,KAAqB;QACvC,MAAM,KAAK,GAAG,IAAI,GAAG,EAA0B,CAAC;QAEhD,+BAA+B;QAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE;gBACjB,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,YAAY,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;g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,CAAC,CAAC;gBAC1D,WAAW,EAAE,QAAQ,KAAK,IAAI;gBAC9B,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;aAC7D,CAAC,CAAC;QACL,CAAC;QAED,mBAAmB,CAAC,KAAqB;YACvC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;QAChE,CAAC;QAED,iBAAiB,CAAC,KAAsB;YACtC,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CACb,mEAAmE,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CACrG,CAAC;YACJ,CAAC;YAED,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC7B,CAAC;QAED,wBAAwB,CAAC,KAAqB;YAC5C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;YAChC,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/services/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/services/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentRole Value Object
|
|
3
|
+
*
|
|
4
|
+
* Represents the role of a subagent in task execution
|
|
5
|
+
*
|
|
6
|
+
* @see REQ-SDD-002 - Subagent Decomposition
|
|
7
|
+
* @see DES-SDD-002 - SubagentDispatcher
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Available agent role names
|
|
11
|
+
*/
|
|
12
|
+
export type AgentRoleName = 'requirements' | 'design' | 'implementation' | 'test' | 'review';
|
|
13
|
+
/**
|
|
14
|
+
* Immutable agent role value object
|
|
15
|
+
*/
|
|
16
|
+
export interface AgentRole {
|
|
17
|
+
/** Role name */
|
|
18
|
+
readonly name: AgentRoleName;
|
|
19
|
+
/** Role capabilities */
|
|
20
|
+
readonly capabilities: readonly string[];
|
|
21
|
+
/** Role constraints */
|
|
22
|
+
readonly constraints: readonly string[];
|
|
23
|
+
/** Role description */
|
|
24
|
+
readonly description: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Default role definitions
|
|
28
|
+
*/
|
|
29
|
+
export declare const DEFAULT_ROLES: ReadonlyMap<AgentRoleName, AgentRole>;
|
|
30
|
+
/**
|
|
31
|
+
* Get agent role by name
|
|
32
|
+
*
|
|
33
|
+
* @param name - Role name
|
|
34
|
+
* @returns AgentRole or undefined
|
|
35
|
+
*/
|
|
36
|
+
export declare function getAgentRole(name: AgentRoleName): AgentRole | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Get all available role names
|
|
39
|
+
*
|
|
40
|
+
* @returns Array of role names
|
|
41
|
+
*/
|
|
42
|
+
export declare function getAllRoleNames(): AgentRoleName[];
|
|
43
|
+
/**
|
|
44
|
+
* Create a custom agent role
|
|
45
|
+
*
|
|
46
|
+
* @param name - Role name
|
|
47
|
+
* @param capabilities - Role capabilities
|
|
48
|
+
* @param constraints - Role constraints
|
|
49
|
+
* @param description - Role description
|
|
50
|
+
* @returns AgentRole
|
|
51
|
+
*/
|
|
52
|
+
export declare function createAgentRole(name: AgentRoleName, capabilities: string[], constraints: string[], description: string): AgentRole;
|
|
53
|
+
//# sourceMappingURL=AgentRole.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentRole.d.ts","sourceRoot":"","sources":["../../../src/domain/value-objects/AgentRole.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,cAAc,GACd,QAAQ,GACR,gBAAgB,GAChB,MAAM,GACN,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,wBAAwB;IACxB,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,uBAAuB;IACvB,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,uBAAuB;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,aAAa,EAAE,SAAS,CA+B9D,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,aAAa,EAAE,CAEjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,MAAM,EAAE,EACtB,WAAW,EAAE,MAAM,EAAE,EACrB,WAAW,EAAE,MAAM,GAClB,SAAS,CAOX"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentRole Value Object
|
|
3
|
+
*
|
|
4
|
+
* Represents the role of a subagent in task execution
|
|
5
|
+
*
|
|
6
|
+
* @see REQ-SDD-002 - Subagent Decomposition
|
|
7
|
+
* @see DES-SDD-002 - SubagentDispatcher
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Default role definitions
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_ROLES = new Map([
|
|
13
|
+
['requirements', {
|
|
14
|
+
name: 'requirements',
|
|
15
|
+
capabilities: ['EARS analysis', 'requirement decomposition', 'priority assessment'],
|
|
16
|
+
constraints: ['must follow EARS format', 'must include traceability IDs'],
|
|
17
|
+
description: '要件分析・EARS形式変換を担当',
|
|
18
|
+
}],
|
|
19
|
+
['design', {
|
|
20
|
+
name: 'design',
|
|
21
|
+
capabilities: ['C4 modeling', 'pattern selection', 'interface design'],
|
|
22
|
+
constraints: ['must maintain REQ traceability', 'must follow SOLID principles'],
|
|
23
|
+
description: '設計・C4モデル作成を担当',
|
|
24
|
+
}],
|
|
25
|
+
['implementation', {
|
|
26
|
+
name: 'implementation',
|
|
27
|
+
capabilities: ['code generation', 'refactoring', 'optimization'],
|
|
28
|
+
constraints: ['must follow design specs', 'must include tests'],
|
|
29
|
+
description: 'コード実装を担当',
|
|
30
|
+
}],
|
|
31
|
+
['test', {
|
|
32
|
+
name: 'test',
|
|
33
|
+
capabilities: ['test generation', 'coverage analysis', 'edge case identification'],
|
|
34
|
+
constraints: ['must achieve 80%+ coverage', 'must test edge cases'],
|
|
35
|
+
description: 'テスト作成・検証を担当',
|
|
36
|
+
}],
|
|
37
|
+
['review', {
|
|
38
|
+
name: 'review',
|
|
39
|
+
capabilities: ['code review', 'quality assessment', 'improvement suggestions'],
|
|
40
|
+
constraints: ['must check constitution compliance', 'must verify traceability'],
|
|
41
|
+
description: 'レビュー・品質チェックを担当',
|
|
42
|
+
}],
|
|
43
|
+
]);
|
|
44
|
+
/**
|
|
45
|
+
* Get agent role by name
|
|
46
|
+
*
|
|
47
|
+
* @param name - Role name
|
|
48
|
+
* @returns AgentRole or undefined
|
|
49
|
+
*/
|
|
50
|
+
export function getAgentRole(name) {
|
|
51
|
+
return DEFAULT_ROLES.get(name);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get all available role names
|
|
55
|
+
*
|
|
56
|
+
* @returns Array of role names
|
|
57
|
+
*/
|
|
58
|
+
export function getAllRoleNames() {
|
|
59
|
+
return Array.from(DEFAULT_ROLES.keys());
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a custom agent role
|
|
63
|
+
*
|
|
64
|
+
* @param name - Role name
|
|
65
|
+
* @param capabilities - Role capabilities
|
|
66
|
+
* @param constraints - Role constraints
|
|
67
|
+
* @param description - Role description
|
|
68
|
+
* @returns AgentRole
|
|
69
|
+
*/
|
|
70
|
+
export function createAgentRole(name, capabilities, constraints, description) {
|
|
71
|
+
return Object.freeze({
|
|
72
|
+
name,
|
|
73
|
+
capabilities: Object.freeze([...capabilities]),
|
|
74
|
+
constraints: Object.freeze([...constraints]),
|
|
75
|
+
description,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=AgentRole.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentRole.js","sourceRoot":"","sources":["../../../src/domain/value-objects/AgentRole.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0BH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA0C,IAAI,GAAG,CAAC;IAC1E,CAAC,cAAc,EAAE;YACf,IAAI,EAAE,cAAc;YACpB,YAAY,EAAE,CAAC,eAAe,EAAE,2BAA2B,EAAE,qBAAqB,CAAC;YACnF,WAAW,EAAE,CAAC,yBAAyB,EAAE,+BAA+B,CAAC;YACzE,WAAW,EAAE,kBAAkB;SAChC,CAAC;IACF,CAAC,QAAQ,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,CAAC,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,CAAC;YACtE,WAAW,EAAE,CAAC,gCAAgC,EAAE,8BAA8B,CAAC;YAC/E,WAAW,EAAE,eAAe;SAC7B,CAAC;IACF,CAAC,gBAAgB,EAAE;YACjB,IAAI,EAAE,gBAAgB;YACtB,YAAY,EAAE,CAAC,iBAAiB,EAAE,aAAa,EAAE,cAAc,CAAC;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|
6
|
+
* @see REQ-SDD-001 - Task Complexity Evaluation
|
|
7
|
+
* @see DES-SDD-001 - ComplexityAnalyzer
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Factor names for complexity analysis
|
|
11
|
+
*/
|
|
12
|
+
export type ComplexityFactorName = 'scope' | 'dependencies' | 'fileCount' | 'testCoverage' | 'uncertainty';
|
|
13
|
+
/**
|
|
14
|
+
* Immutable complexity factor value object
|
|
15
|
+
*/
|
|
16
|
+
export interface ComplexityFactor {
|
|
17
|
+
/** Factor name */
|
|
18
|
+
readonly name: ComplexityFactorName;
|
|
19
|
+
/** Weight in total score (0-1) */
|
|
20
|
+
readonly weight: number;
|
|
21
|
+
/** Individual factor score (1-10) */
|
|
22
|
+
readonly score: number;
|
|
23
|
+
/** Human-readable description */
|
|
24
|
+
readonly description: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Default factor definitions with weights
|
|
28
|
+
*/
|
|
29
|
+
export declare const DEFAULT_FACTORS: readonly Omit<ComplexityFactor, 'score'>[];
|
|
30
|
+
/**
|
|
31
|
+
* Create a ComplexityFactor value object
|
|
32
|
+
*
|
|
33
|
+
* @param name - Factor name
|
|
34
|
+
* @param weight - Weight (0-1)
|
|
35
|
+
* @param score - Score (1-10)
|
|
36
|
+
* @param description - Description
|
|
37
|
+
* @returns ComplexityFactor
|
|
38
|
+
*/
|
|
39
|
+
export declare function createComplexityFactor(name: ComplexityFactorName, weight: number, score: number, description: string): ComplexityFactor;
|
|
40
|
+
/**
|
|
41
|
+
* Calculate weighted score contribution
|
|
42
|
+
*
|
|
43
|
+
* @param factor - Complexity factor
|
|
44
|
+
* @returns Weighted score contribution
|
|
45
|
+
*/
|
|
46
|
+
export declare function getWeightedScore(factor: ComplexityFactor): number;
|
|
47
|
+
//# sourceMappingURL=ComplexityFactor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComplexityFactor.d.ts","sourceRoot":"","sources":["../../../src/domain/value-objects/ComplexityFactor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC5B,OAAO,GACP,cAAc,GACd,WAAW,GACX,cAAc,GACd,aAAa,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB;IAClB,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,kCAAkC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,EAMpE,CAAC;AAEH;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,oBAAoB,EAC1B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,gBAAgB,CAiBlB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAEjE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ComplexityFactor Value Object
|
|
3
|
+
*
|
|
4
|
+
* Represents a single factor contributing to task complexity
|
|
5
|
+
*
|
|
6
|
+
* @see REQ-SDD-001 - Task Complexity Evaluation
|
|
7
|
+
* @see DES-SDD-001 - ComplexityAnalyzer
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Default factor definitions with weights
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_FACTORS = Object.freeze([
|
|
13
|
+
{ name: 'scope', weight: 0.30, description: '影響範囲(変更の広がり)' },
|
|
14
|
+
{ name: 'dependencies', weight: 0.25, description: '依存関係数(外部・内部)' },
|
|
15
|
+
{ name: 'fileCount', weight: 0.20, description: '変更ファイル数' },
|
|
16
|
+
{ name: 'testCoverage', weight: 0.15, description: 'テスト必要量' },
|
|
17
|
+
{ name: 'uncertainty', weight: 0.10, description: '不確実性(未知の要素)' },
|
|
18
|
+
]);
|
|
19
|
+
/**
|
|
20
|
+
* Create a ComplexityFactor value object
|
|
21
|
+
*
|
|
22
|
+
* @param name - Factor name
|
|
23
|
+
* @param weight - Weight (0-1)
|
|
24
|
+
* @param score - Score (1-10)
|
|
25
|
+
* @param description - Description
|
|
26
|
+
* @returns ComplexityFactor
|
|
27
|
+
*/
|
|
28
|
+
export function createComplexityFactor(name, weight, score, description) {
|
|
29
|
+
// Validate weight
|
|
30
|
+
if (weight < 0 || weight > 1) {
|
|
31
|
+
throw new Error(`Weight must be between 0 and 1, got: ${weight}`);
|
|
32
|
+
}
|
|
33
|
+
// Validate score
|
|
34
|
+
if (score < 1 || score > 10) {
|
|
35
|
+
throw new Error(`Score must be between 1 and 10, got: ${score}`);
|
|
36
|
+
}
|
|
37
|
+
return Object.freeze({
|
|
38
|
+
name,
|
|
39
|
+
weight,
|
|
40
|
+
score,
|
|
41
|
+
description,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Calculate weighted score contribution
|
|
46
|
+
*
|
|
47
|
+
* @param factor - Complexity factor
|
|
48
|
+
* @returns Weighted score contribution
|
|
49
|
+
*/
|
|
50
|
+
export function getWeightedScore(factor) {
|
|
51
|
+
return factor.weight * factor.score;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=ComplexityFactor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComplexityFactor.js","sourceRoot":"","sources":["../../../src/domain/value-objects/ComplexityFactor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0BH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA+C,MAAM,CAAC,MAAM,CAAC;IACvF,EAAE,I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