mcp-adr-analysis-server 2.7.29 → 2.7.31
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/.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/resources/adrs-review-resource.d.ts +0 -82
- package/dist/src/resources/adrs-review-resource.d.ts.map +0 -1
- package/dist/src/resources/adrs-review-resource.js +0 -160
- package/dist/src/resources/adrs-review-resource.js.map +0 -1
- package/dist/src/resources/architectural-context-resource.d.ts +0 -95
- package/dist/src/resources/architectural-context-resource.d.ts.map +0 -1
- package/dist/src/resources/architectural-context-resource.js +0 -428
- package/dist/src/resources/architectural-context-resource.js.map +0 -1
- package/dist/src/resources/memory-expand-resource.d.ts +0 -90
- package/dist/src/resources/memory-expand-resource.d.ts.map +0 -1
- package/dist/src/resources/memory-expand-resource.js +0 -176
- package/dist/src/resources/memory-expand-resource.js.map +0 -1
- package/dist/src/tools/tree-sitter-code-tools.d.ts +0 -189
- package/dist/src/tools/tree-sitter-code-tools.d.ts.map +0 -1
- package/dist/src/tools/tree-sitter-code-tools.js +0 -647
- package/dist/src/tools/tree-sitter-code-tools.js.map +0 -1
- package/dist/src/utils/apply-cot-enhancement.d.ts +0 -46
- package/dist/src/utils/apply-cot-enhancement.d.ts.map +0 -1
- package/dist/src/utils/apply-cot-enhancement.js +0 -165
- package/dist/src/utils/apply-cot-enhancement.js.map +0 -1
- package/dist/src/utils/deployment-type-registry.d.ts +0 -52
- package/dist/src/utils/deployment-type-registry.d.ts.map +0 -1
- package/dist/src/utils/deployment-type-registry.js +0 -543
- package/dist/src/utils/deployment-type-registry.js.map +0 -1
- package/dist/src/utils/index.d.ts +0 -9
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/index.js +0 -13
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/interactive-approval.d.ts +0 -63
- package/dist/src/utils/interactive-approval.d.ts.map +0 -1
- package/dist/src/utils/interactive-approval.js +0 -445
- package/dist/src/utils/interactive-approval.js.map +0 -1
- package/dist/src/utils/location-filter.d.ts +0 -104
- package/dist/src/utils/location-filter.d.ts.map +0 -1
- package/dist/src/utils/location-filter.js +0 -593
- package/dist/src/utils/location-filter.js.map +0 -1
- package/dist/src/utils/research-documentation.d.ts +0 -58
- package/dist/src/utils/research-documentation.d.ts.map +0 -1
- package/dist/src/utils/research-documentation.js +0 -438
- package/dist/src/utils/research-documentation.js.map +0 -1
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory Expand Resource - Detailed view of a specific memory entity
|
|
3
|
-
* URI Pattern: adr://memory/{key}
|
|
4
|
-
*/
|
|
5
|
-
import { McpAdrError } from '../types/index.js';
|
|
6
|
-
import { resourceCache, generateETag } from './resource-cache.js';
|
|
7
|
-
import { resourceRouter } from './resource-router.js';
|
|
8
|
-
/**
|
|
9
|
-
* Generate memory expand resource showing detailed entity information.
|
|
10
|
-
*
|
|
11
|
-
* Returns complete details about a specific memory entity including:
|
|
12
|
-
* - Full entity content and metadata
|
|
13
|
-
* - All relationships to other entities
|
|
14
|
-
* - Related entities by relevance
|
|
15
|
-
* - Access statistics
|
|
16
|
-
*
|
|
17
|
-
* **URI Pattern:** `adr://memory/{key}`
|
|
18
|
-
*
|
|
19
|
-
* **Query Parameters:**
|
|
20
|
-
* - `includeRelated`: Include related entities (default: true)
|
|
21
|
-
* - `relationshipDepth`: Depth of relationships to traverse (default: 2)
|
|
22
|
-
* - `maxRelated`: Maximum related entities to return (default: 10)
|
|
23
|
-
*
|
|
24
|
-
* @param params - URL path parameters containing:
|
|
25
|
-
* - key: Memory entity key/ID
|
|
26
|
-
* @param searchParams - URL query parameters for customization
|
|
27
|
-
* @param memoryManager - Optional memory entity manager instance
|
|
28
|
-
*
|
|
29
|
-
* @returns Promise resolving to resource generation result containing:
|
|
30
|
-
* - data: Complete memory entity data with relationships
|
|
31
|
-
* - contentType: "application/json"
|
|
32
|
-
* - lastModified: ISO timestamp of generation
|
|
33
|
-
* - cacheKey: Unique identifier "memory-expand:{key}"
|
|
34
|
-
* - ttl: Cache duration (60 seconds / 1 minute)
|
|
35
|
-
* - etag: Entity tag for cache validation
|
|
36
|
-
*
|
|
37
|
-
* @throws {McpAdrError} When memory expansion fails
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* // Get expanded memory entity
|
|
42
|
-
* const memory = await generateMemoryExpandResource(
|
|
43
|
-
* { key: 'adr-001' },
|
|
44
|
-
* new URLSearchParams()
|
|
45
|
-
* );
|
|
46
|
-
*
|
|
47
|
-
* console.log(`Entity type: ${memory.data.entity?.type}`);
|
|
48
|
-
* console.log(`Relationships: ${memory.data.relationships.length}`);
|
|
49
|
-
*
|
|
50
|
-
* // With custom depth
|
|
51
|
-
* const deep = await generateMemoryExpandResource(
|
|
52
|
-
* { key: 'architecture-context' },
|
|
53
|
-
* new URLSearchParams('relationshipDepth=3&maxRelated=20')
|
|
54
|
-
* );
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* @since v2.2.0
|
|
58
|
-
* @see {@link MemoryEntityManager} for memory management
|
|
59
|
-
*/
|
|
60
|
-
export async function generateMemoryExpandResource(params, searchParams, memoryManager) {
|
|
61
|
-
const key = params['key'];
|
|
62
|
-
if (!key) {
|
|
63
|
-
throw new McpAdrError('Missing required parameter: key', 'INVALID_PARAMS');
|
|
64
|
-
}
|
|
65
|
-
const includeRelated = searchParams.get('includeRelated') !== 'false';
|
|
66
|
-
const relationshipDepth = parseInt(searchParams.get('relationshipDepth') || '2', 10);
|
|
67
|
-
const maxRelated = parseInt(searchParams.get('maxRelated') || '10', 10);
|
|
68
|
-
const cacheKey = `memory-expand:${key}`;
|
|
69
|
-
// Check cache
|
|
70
|
-
const cached = await resourceCache.get(cacheKey);
|
|
71
|
-
if (cached) {
|
|
72
|
-
return cached;
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
// If no memory manager provided, return a not-found response
|
|
76
|
-
if (!memoryManager) {
|
|
77
|
-
const notFoundData = {
|
|
78
|
-
key,
|
|
79
|
-
entity: null,
|
|
80
|
-
relationships: [],
|
|
81
|
-
relatedEntities: [],
|
|
82
|
-
timestamp: new Date().toISOString(),
|
|
83
|
-
found: false,
|
|
84
|
-
};
|
|
85
|
-
const result = {
|
|
86
|
-
data: notFoundData,
|
|
87
|
-
contentType: 'application/json',
|
|
88
|
-
lastModified: new Date().toISOString(),
|
|
89
|
-
cacheKey,
|
|
90
|
-
ttl: 30, // Short cache for not-found
|
|
91
|
-
etag: generateETag(notFoundData),
|
|
92
|
-
};
|
|
93
|
-
return result;
|
|
94
|
-
}
|
|
95
|
-
// Try to get the entity from memory manager
|
|
96
|
-
let entity = null;
|
|
97
|
-
let relationships = [];
|
|
98
|
-
let relatedEntities = [];
|
|
99
|
-
try {
|
|
100
|
-
// Attempt to get entity by ID using queryEntities
|
|
101
|
-
const queryResult = await memoryManager.queryEntities({
|
|
102
|
-
textQuery: key,
|
|
103
|
-
limit: 1,
|
|
104
|
-
});
|
|
105
|
-
const foundEntity = queryResult.entities?.[0];
|
|
106
|
-
if (foundEntity) {
|
|
107
|
-
entity = {
|
|
108
|
-
id: foundEntity.id,
|
|
109
|
-
type: foundEntity.type,
|
|
110
|
-
name: foundEntity.title, // MemoryEntity uses 'title' not 'name'
|
|
111
|
-
content: foundEntity.description, // MemoryEntity uses 'description' not 'content'
|
|
112
|
-
metadata: foundEntity.context || {}, // MemoryEntity uses 'context' object
|
|
113
|
-
tags: foundEntity.tags || [],
|
|
114
|
-
confidence: foundEntity.confidence || 1.0,
|
|
115
|
-
lastModified: foundEntity.lastModified || new Date().toISOString(),
|
|
116
|
-
created: foundEntity.created || new Date().toISOString(),
|
|
117
|
-
accessCount: foundEntity.accessPattern?.accessCount || 0, // Nested in accessPattern
|
|
118
|
-
};
|
|
119
|
-
// Get relationships if requested
|
|
120
|
-
if (includeRelated) {
|
|
121
|
-
try {
|
|
122
|
-
const related = await memoryManager.findRelatedEntities(foundEntity.id, relationshipDepth);
|
|
123
|
-
// Map relationshipPaths to our relationships format
|
|
124
|
-
relationships =
|
|
125
|
-
related.relationshipPaths
|
|
126
|
-
?.flatMap((path) => path.relationships?.map((rel) => ({
|
|
127
|
-
targetId: rel.targetId,
|
|
128
|
-
targetName: rel.targetId,
|
|
129
|
-
relationshipType: rel.type || 'related',
|
|
130
|
-
strength: rel.strength || 0.5,
|
|
131
|
-
})) || [])
|
|
132
|
-
.slice(0, maxRelated) || [];
|
|
133
|
-
relatedEntities =
|
|
134
|
-
related.entities?.slice(0, maxRelated).map((ent) => ({
|
|
135
|
-
id: ent.id,
|
|
136
|
-
name: ent.title || ent.id, // MemoryEntity uses 'title' not 'name'
|
|
137
|
-
type: ent.type,
|
|
138
|
-
relevance: ent.relevance || 0.5, // Use relevance if available
|
|
139
|
-
})) || [];
|
|
140
|
-
}
|
|
141
|
-
catch {
|
|
142
|
-
// Relationships not available
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
catch {
|
|
148
|
-
// Entity not found
|
|
149
|
-
}
|
|
150
|
-
const expandData = {
|
|
151
|
-
key,
|
|
152
|
-
entity,
|
|
153
|
-
relationships,
|
|
154
|
-
relatedEntities: relatedEntities.slice(0, maxRelated),
|
|
155
|
-
timestamp: new Date().toISOString(),
|
|
156
|
-
found: entity !== null,
|
|
157
|
-
};
|
|
158
|
-
const result = {
|
|
159
|
-
data: expandData,
|
|
160
|
-
contentType: 'application/json',
|
|
161
|
-
lastModified: new Date().toISOString(),
|
|
162
|
-
cacheKey,
|
|
163
|
-
ttl: 60, // 1 minute cache
|
|
164
|
-
etag: generateETag(expandData),
|
|
165
|
-
};
|
|
166
|
-
// Cache result
|
|
167
|
-
resourceCache.set(cacheKey, result, result.ttl);
|
|
168
|
-
return result;
|
|
169
|
-
}
|
|
170
|
-
catch (error) {
|
|
171
|
-
throw new McpAdrError(`Failed to expand memory entity: ${error instanceof Error ? error.message : String(error)}`, 'RESOURCE_GENERATION_ERROR');
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
// Register route
|
|
175
|
-
resourceRouter.register('/memory/{key}', generateMemoryExpandResource, 'Detailed view of a specific memory entity');
|
|
176
|
-
//# sourceMappingURL=memory-expand-resource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-expand-resource.js","sourceRoot":"","sources":["../../../src/resources/memory-expand-resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAiCtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,MAA8B,EAC9B,YAA6B,EAC7B,aAAmC;IAEnC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE1B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,WAAW,CAAC,iCAAiC,EAAE,gBAAgB,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,cAAc,GAAG,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,OAAO,CAAC;IACtE,MAAM,iBAAiB,GAAG,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;IACrF,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;IAExE,MAAM,QAAQ,GAAG,iBAAiB,GAAG,EAAE,CAAC;IAExC,cAAc;IACd,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,GAA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,CAAC"}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tree-Sitter Code Analysis Tools
|
|
3
|
-
*
|
|
4
|
-
* Provides deterministic code structure analysis tools for MCP.
|
|
5
|
-
* These tools replace non-deterministic ripgrep-based search with
|
|
6
|
-
* AST-based structural analysis.
|
|
7
|
-
*
|
|
8
|
-
* Design Philosophy (per ADR-016):
|
|
9
|
-
* - Tools provide deterministic data
|
|
10
|
-
* - LLM handles reasoning and semantic matching
|
|
11
|
-
* - Same input always produces same output
|
|
12
|
-
*
|
|
13
|
-
* @see docs/adrs/adr-006-tree-sitter-integration-strategy.md
|
|
14
|
-
*
|
|
15
|
-
* NOTE: this previously cited adr-016-replace-ripgrep-with-tree-sitter.md, which has
|
|
16
|
-
* never existed. ADR-017 references it twice as a 'predecessor decision', so the
|
|
17
|
-
* ripgrep -> tree-sitter switch was decided and implemented but never recorded.
|
|
18
|
-
* ADR-006 is the closest real record. The gap itself is tracked in #1415.
|
|
19
|
-
*/
|
|
20
|
-
import { CodeAnalysisResult, type ImportAnalysis, type FunctionAnalysis } from '../utils/tree-sitter-analyzer.js';
|
|
21
|
-
/**
|
|
22
|
-
* File structure entry
|
|
23
|
-
*/
|
|
24
|
-
export interface FileEntry {
|
|
25
|
-
path: string;
|
|
26
|
-
relativePath: string;
|
|
27
|
-
type: 'file' | 'directory';
|
|
28
|
-
extension?: string;
|
|
29
|
-
language?: string;
|
|
30
|
-
size?: number;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Project structure result
|
|
34
|
-
*/
|
|
35
|
-
export interface ProjectStructureResult {
|
|
36
|
-
root: string;
|
|
37
|
-
totalFiles: number;
|
|
38
|
-
totalDirectories: number;
|
|
39
|
-
filesByLanguage: Record<string, number>;
|
|
40
|
-
entries: FileEntry[];
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Import extraction result
|
|
44
|
-
*/
|
|
45
|
-
export interface ImportExtractionResult {
|
|
46
|
-
file: string;
|
|
47
|
-
language: string;
|
|
48
|
-
imports: ImportAnalysis[];
|
|
49
|
-
externalDependencies: string[];
|
|
50
|
-
internalDependencies: string[];
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Function extraction result
|
|
54
|
-
*/
|
|
55
|
-
export interface FunctionExtractionResult {
|
|
56
|
-
file: string;
|
|
57
|
-
language: string;
|
|
58
|
-
functions: FunctionAnalysis[];
|
|
59
|
-
totalFunctions: number;
|
|
60
|
-
securitySensitiveFunctions: string[];
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Class/Module definition
|
|
64
|
-
*/
|
|
65
|
-
export interface ClassDefinition {
|
|
66
|
-
name: string;
|
|
67
|
-
type: 'class' | 'interface' | 'type' | 'enum';
|
|
68
|
-
methods: string[];
|
|
69
|
-
properties: string[];
|
|
70
|
-
location: {
|
|
71
|
-
line: number;
|
|
72
|
-
column: number;
|
|
73
|
-
};
|
|
74
|
-
exported: boolean;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Class extraction result
|
|
78
|
-
*/
|
|
79
|
-
export interface ClassExtractionResult {
|
|
80
|
-
file: string;
|
|
81
|
-
language: string;
|
|
82
|
-
classes: ClassDefinition[];
|
|
83
|
-
interfaces: ClassDefinition[];
|
|
84
|
-
types: ClassDefinition[];
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Dependency from package.json or requirements.txt
|
|
88
|
-
*/
|
|
89
|
-
export interface DependencyInfo {
|
|
90
|
-
name: string;
|
|
91
|
-
version: string;
|
|
92
|
-
type: 'production' | 'development' | 'peer' | 'optional';
|
|
93
|
-
source: string;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Project dependencies result
|
|
97
|
-
*/
|
|
98
|
-
export interface DependenciesResult {
|
|
99
|
-
projectPath: string;
|
|
100
|
-
dependencies: DependencyInfo[];
|
|
101
|
-
totalCount: number;
|
|
102
|
-
byType: Record<string, number>;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Export definition
|
|
106
|
-
*/
|
|
107
|
-
export interface ExportDefinition {
|
|
108
|
-
name: string;
|
|
109
|
-
type: 'function' | 'class' | 'const' | 'type' | 'interface' | 'default' | 'variable';
|
|
110
|
-
location: {
|
|
111
|
-
line: number;
|
|
112
|
-
column: number;
|
|
113
|
-
};
|
|
114
|
-
isDefault: boolean;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Export extraction result
|
|
118
|
-
*/
|
|
119
|
-
export interface ExportExtractionResult {
|
|
120
|
-
file: string;
|
|
121
|
-
language: string;
|
|
122
|
-
exports: ExportDefinition[];
|
|
123
|
-
hasDefaultExport: boolean;
|
|
124
|
-
namedExports: string[];
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Get deterministic file structure of a project
|
|
128
|
-
*
|
|
129
|
-
* Returns a complete file tree without any search or filtering.
|
|
130
|
-
* The LLM can then decide which files are relevant.
|
|
131
|
-
*/
|
|
132
|
-
export declare function getFileStructure(projectPath: string, options?: {
|
|
133
|
-
maxDepth?: number;
|
|
134
|
-
includeHidden?: boolean;
|
|
135
|
-
excludePatterns?: string[];
|
|
136
|
-
}): Promise<ProjectStructureResult>;
|
|
137
|
-
/**
|
|
138
|
-
* Get AST-extracted imports from a file
|
|
139
|
-
*
|
|
140
|
-
* Returns deterministic list of all imports/requires in a file.
|
|
141
|
-
*/
|
|
142
|
-
export declare function getImports(filePath: string): Promise<ImportExtractionResult>;
|
|
143
|
-
/**
|
|
144
|
-
* Get AST-extracted exports from a file
|
|
145
|
-
*
|
|
146
|
-
* Returns deterministic list of all exports in a file.
|
|
147
|
-
*/
|
|
148
|
-
export declare function getExports(filePath: string): Promise<ExportExtractionResult>;
|
|
149
|
-
/**
|
|
150
|
-
* Get AST-extracted functions from a file
|
|
151
|
-
*
|
|
152
|
-
* Returns deterministic list of all functions with signatures.
|
|
153
|
-
*/
|
|
154
|
-
export declare function getFunctions(filePath: string): Promise<FunctionExtractionResult>;
|
|
155
|
-
/**
|
|
156
|
-
* Get classes, interfaces, and types from a file
|
|
157
|
-
*
|
|
158
|
-
* Returns deterministic list of class/interface/type definitions.
|
|
159
|
-
*/
|
|
160
|
-
export declare function getClasses(filePath: string): Promise<ClassExtractionResult>;
|
|
161
|
-
/**
|
|
162
|
-
* Get project dependencies from manifest files
|
|
163
|
-
*
|
|
164
|
-
* Parses package.json, requirements.txt, etc. for dependencies.
|
|
165
|
-
*/
|
|
166
|
-
export declare function getDependencies(projectPath: string): Promise<DependenciesResult>;
|
|
167
|
-
/**
|
|
168
|
-
* Perform full tree-sitter analysis on a file
|
|
169
|
-
*
|
|
170
|
-
* Returns complete AST analysis result.
|
|
171
|
-
*/
|
|
172
|
-
export declare function analyzeFile(filePath: string): Promise<CodeAnalysisResult>;
|
|
173
|
-
/**
|
|
174
|
-
* Analyze multiple files in a directory
|
|
175
|
-
*
|
|
176
|
-
* Returns analysis results for all code files.
|
|
177
|
-
*/
|
|
178
|
-
export declare function analyzeDirectory(dirPath: string, options?: {
|
|
179
|
-
extensions?: string[];
|
|
180
|
-
maxFiles?: number;
|
|
181
|
-
recursive?: boolean;
|
|
182
|
-
}): Promise<{
|
|
183
|
-
files: Array<{
|
|
184
|
-
path: string;
|
|
185
|
-
analysis: CodeAnalysisResult;
|
|
186
|
-
}>;
|
|
187
|
-
errors: string[];
|
|
188
|
-
}>;
|
|
189
|
-
//# sourceMappingURL=tree-sitter-code-tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tree-sitter-code-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/tree-sitter-code-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAEL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAY1C;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MA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