mcp-adr-analysis-server 2.7.26 → 2.7.27

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.
@@ -1,202 +0,0 @@
1
- /**
2
- * LLM-Managed Cloud Management Tool
3
- *
4
- * Provides LLM-driven cloud provider operations with research-driven approach
5
- */
6
- import { McpAdrError } from '../types/index.js';
7
- import { ResearchOrchestrator } from '../utils/research-orchestrator.js';
8
- /**
9
- * LLM-managed cloud provider operations with research-driven approach
10
- *
11
- * @description Executes cloud operations using LLM to research best practices,
12
- * generate appropriate commands, and execute them. Supports AWS, Azure, GCP, Red Hat, Ubuntu, and macOS.
13
- *
14
- * @param {Object} args - Cloud management configuration parameters
15
- * @param {string} args.provider - Cloud provider (aws, azure, gcp, redhat, ubuntu, macos)
16
- * @param {string} args.action - Action to perform
17
- * @param {Object} [args.parameters] - Action parameters
18
- * @param {string} args.llmInstructions - LLM instructions for command generation
19
- * @param {boolean} [args.researchFirst] - Research best approach first (default: true)
20
- * @param {string} [args.projectPath] - Path to project root (defaults to cwd)
21
- * @param {string} [args.adrDirectory] - ADR directory relative to project (defaults to 'docs/adrs')
22
- *
23
- * @returns {Promise<any>} Cloud operation results with LLM analysis
24
- *
25
- * @throws {McpAdrError} When required parameters are missing or operation fails
26
- *
27
- * @example
28
- * ```typescript
29
- * // AWS EC2 instance creation
30
- * const result = await llmCloudManagement({
31
- * provider: 'aws',
32
- * action: 'create_ec2_instance',
33
- * parameters: { instanceType: 't3.micro', region: 'us-east-1' },
34
- * llmInstructions: 'Create a secure, cost-effective instance for development'
35
- * });
36
- * ```
37
- *
38
- * @example
39
- * ```typescript
40
- * // Red Hat OpenShift deployment
41
- * const result = await llmCloudManagement({
42
- * provider: 'redhat',
43
- * action: 'deploy_application',
44
- * parameters: { appName: 'my-app', namespace: 'production' },
45
- * llmInstructions: 'Deploy with high availability and monitoring'
46
- * });
47
- * ```
48
- *
49
- * @since 2.1.0
50
- * @category Cloud Management
51
- * @category LLM
52
- * @mcp-tool
53
- */
54
- export async function llmCloudManagement(args, context) {
55
- const { provider, action, parameters = {}, llmInstructions, researchFirst = true, projectPath, adrDirectory, } = args;
56
- if (!provider || !action || !llmInstructions) {
57
- throw new McpAdrError('Provider, action, and llmInstructions are required', 'MISSING_REQUIRED_PARAMS');
58
- }
59
- try {
60
- context?.info(`🔧 Initializing ${provider} cloud management for: ${action}`);
61
- context?.report_progress(0, 100);
62
- // Initialize research orchestrator
63
- const orchestrator = new ResearchOrchestrator(projectPath, adrDirectory);
64
- let researchResult = null;
65
- if (researchFirst) {
66
- context?.info('📚 Researching best practices and documentation...');
67
- context?.report_progress(20, 100);
68
- // Step 1: Research the best approach
69
- const researchQuery = `
70
- How to ${action} on ${provider} platform?
71
- Best practices for ${provider} ${action}
72
- ${provider} ${action} documentation and examples
73
- Security considerations for ${provider} ${action}
74
- ${llmInstructions}
75
- `;
76
- researchResult = await orchestrator.answerResearchQuestion(researchQuery);
77
- }
78
- // Step 2: Generate command using LLM
79
- context?.info('🤖 Generating commands with LLM guidance...');
80
- context?.report_progress(50, 100);
81
- const command = await generateCloudCommand({
82
- provider,
83
- action,
84
- parameters,
85
- research: researchResult,
86
- instructions: llmInstructions,
87
- });
88
- // Step 3: Execute the command (simulated for now)
89
- context?.info(`☁️ Executing ${provider} operation...`);
90
- context?.report_progress(80, 100);
91
- const executionResult = await executeCloudCommand(command);
92
- context?.info('✅ Cloud operation complete!');
93
- context?.report_progress(100, 100);
94
- return {
95
- content: [
96
- {
97
- type: 'text',
98
- text: `# LLM-Managed Cloud Operation
99
-
100
- ## Operation Details
101
- - **Provider**: ${provider}
102
- - **Action**: ${action}
103
- - **Parameters**: ${JSON.stringify(parameters, null, 2)}
104
-
105
- ## LLM Instructions
106
- ${llmInstructions}
107
-
108
- ${researchResult
109
- ? `
110
- ## Research Results
111
- - **Confidence**: ${(researchResult.confidence * 100).toFixed(1)}%
112
- - **Sources**: ${researchResult.metadata.sourcesQueried.join(', ')}
113
- - **Research Summary**: ${researchResult.answer}
114
-
115
- `
116
- : ''}
117
-
118
- ## Generated Command
119
- \`\`\`bash
120
- ${command.generated}
121
- \`\`\`
122
-
123
- ## Execution Result
124
- ${executionResult.success ? '✅ Success' : '❌ Failed'}
125
- ${executionResult.output ? `\n\`\`\`\n${executionResult.output}\n\`\`\`` : ''}
126
-
127
- ## LLM Analysis
128
- ${command.analysis || 'No analysis available'}
129
-
130
- ## Metadata
131
- - **Command Confidence**: ${(command.confidence * 100).toFixed(1)}%
132
- - **Timestamp**: ${new Date().toISOString()}
133
- - **Research-Driven**: ${researchFirst ? 'Yes' : 'No'}
134
- `,
135
- },
136
- ],
137
- };
138
- }
139
- catch (error) {
140
- throw new McpAdrError(`Cloud management operation failed: ${error instanceof Error ? error.message : String(error)}`, 'CLOUD_MANAGEMENT_ERROR');
141
- }
142
- }
143
- /**
144
- * Generate cloud command using LLM
145
- */
146
- async function generateCloudCommand(context) {
147
- // const { loadAIConfig, getAIExecutor } = await import('../config/ai-config.js');
148
- // const aiConfig = loadAIConfig();
149
- // const executor = getAIExecutor();
150
- // const prompt = `
151
- // Generate a ${context.provider} command for the following operation:
152
- //
153
- // Action: ${context.action}
154
- // Parameters: ${JSON.stringify(context.parameters, null, 2)}
155
- // Instructions: ${context.instructions}
156
- //
157
- // ${context.research ? `
158
- // Research Context:
159
- // - Confidence: ${(context.research.confidence * 100).toFixed(1)}%
160
- // - Sources: ${context.research.metadata.sourcesQueried.join(', ')}
161
- // - Key Findings: ${context.research.answer}
162
- // ` : ''}
163
- //
164
- // Provider Context:
165
- // ${getProviderContext(context.provider)}
166
- //
167
- // Generate the CLI command and provide analysis of the approach.
168
- // `;
169
- // TODO: Implement LLM command generation when AI executor is available
170
- // const result = await executor.executeStructuredPrompt(prompt, {
171
- // type: 'object',
172
- // properties: {
173
- // command: { type: 'string' },
174
- // confidence: { type: 'number' },
175
- // analysis: { type: 'string' }
176
- // }
177
- // });
178
- // return {
179
- // generated: result.data.command || 'echo "Command generation failed"',
180
- // confidence: result.data.confidence || 0.5,
181
- // analysis: result.data.analysis || 'No analysis available'
182
- // };
183
- // Placeholder implementation
184
- return {
185
- generated: `echo "LLM command generation for ${context.provider} ${context.action} not yet implemented"`,
186
- confidence: 0.3,
187
- analysis: 'LLM command generation is not yet available. This is a placeholder implementation.',
188
- };
189
- }
190
- /**
191
- * Execute cloud command (simulated for now)
192
- */
193
- async function executeCloudCommand(command) {
194
- // For now, simulate command execution
195
- // In a real implementation, this would execute the actual command
196
- return {
197
- success: command.confidence > 0.7,
198
- output: `Simulated execution of: ${command.generated}\n\nThis is a simulation. In production, this would execute the actual command.`,
199
- };
200
- }
201
- // Provider context functions will be used when LLM integration is complete
202
- //# sourceMappingURL=llm-cloud-management-tool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"llm-cloud-management-tool.js","sourceRoot":"","sources":["../../../src/tools/llm-cloud-management-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,IAQC,EACD,OAAqB;IAErB,MAAM,EACJ,QAAQ,EACR,MAAM,EACN,UAAU,GAAG,EAAE,EACf,eAAe,EACf,aAAa,GAAG,IAAI,EACpB,WAAW,EACX,YAAY,GACb,GAAG,IAAI,CAAC;IAET,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC7C,MAAM,IAAI,WAAW,CACnB,oDAAoD,EACpD,yBAAyB,CAC1B,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,OAAO,EAAE,IAAI,CAAC,mBAAmB,QAAQ,0BAA0B,MAAM,EAAE,CAAC,CAAC;QAC7E,OAAO,EAAE,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BAAyB;IACzB,oBAAoB;IACpB,mEAAmE;IACnE,oEAAoE;IACpE,6CAA6C;IAC7C,UAAU;IACV,EAAE;IACF,oBAAoB;IACpB,0CAA0C;IAC1C,EAAE;IACF,iEAAiE;IACjE,KAAK;IAEL,uEAAuE;IACvE,kEAAkE;IAClE,oBAAoB;IACpB,kBAAkB;IAClB,mCAAmC;IACnC,sCAAsC;IACtC,mCAAmC;IACnC,MAAM;IACN,MAAM;IAEN,WAAW;IACX,0EAA0E;IAC1E,+CAA+C;IAC/C,8DAA8D;IAC9D,KAAK;IAEL,6BAA6B;IAC7B,OAAO;QACL,SAAS,EAAE,oCAAoC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,uBAAuB;QACxG,UAAU,EAAE,GAAG;QACf,QAAQ,EAAE,oFAAoF;KAC/F,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,mBAAmB,CAAC,OAGlC;IACC,sCAAsC;IACtC,kEAAkE;IAClE,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,UAAU,GAAG,GAAG;QACjC,MAAM,EAAE,2BAA2B,OAAO,CAAC,SAAS,iFAAiF;KACtI,CAAC;AACJ,CAAC;AAED,2EAA2E"}
@@ -1,62 +0,0 @@
1
- /**
2
- * LLM-Managed Database Management Tool
3
- *
4
- * Provides LLM-driven database operations with research-driven approach
5
- */
6
- import type { ToolContext } from '../types/tool-context.js';
7
- /**
8
- * LLM-managed database operations with research-driven approach
9
- *
10
- * @description Executes database operations using LLM to research best practices,
11
- * generate appropriate commands, and execute them. Supports PostgreSQL, MongoDB, Redis, MySQL, and MariaDB.
12
- *
13
- * @param {Object} args - Database management configuration parameters
14
- * @param {string} args.database - Database type (postgresql, mongodb, redis, mysql, mariadb)
15
- * @param {string} args.action - Action to perform
16
- * @param {Object} [args.parameters] - Action parameters
17
- * @param {string} args.llmInstructions - LLM instructions for command generation
18
- * @param {boolean} [args.researchFirst] - Research best approach first (default: true)
19
- * @param {string} [args.projectPath] - Path to project root (defaults to cwd)
20
- * @param {string} [args.adrDirectory] - ADR directory relative to project (defaults to 'docs/adrs')
21
- *
22
- * @returns {Promise<any>} Database operation results with LLM analysis
23
- *
24
- * @throws {McpAdrError} When required parameters are missing or operation fails
25
- *
26
- * @example
27
- * ```typescript
28
- * // PostgreSQL database creation
29
- * const result = await llmDatabaseManagement({
30
- * database: 'postgresql',
31
- * action: 'create_database',
32
- * parameters: { dbName: 'myapp', owner: 'myuser' },
33
- * llmInstructions: 'Create a secure database with proper permissions'
34
- * });
35
- * ```
36
- *
37
- * @example
38
- * ```typescript
39
- * // MongoDB collection optimization
40
- * const result = await llmDatabaseManagement({
41
- * database: 'mongodb',
42
- * action: 'optimize_collection',
43
- * parameters: { collection: 'users', indexFields: ['email', 'created_at'] },
44
- * llmInstructions: 'Optimize for read-heavy workloads with proper indexing'
45
- * });
46
- * ```
47
- *
48
- * @since 2.1.0
49
- * @category Database Management
50
- * @category LLM
51
- * @mcp-tool
52
- */
53
- export declare function llmDatabaseManagement(args: {
54
- database: 'postgresql' | 'mongodb' | 'redis' | 'mysql' | 'mariadb';
55
- action: string;
56
- parameters?: Record<string, any>;
57
- llmInstructions: string;
58
- researchFirst?: boolean;
59
- projectPath?: string;
60
- adrDirectory?: string;
61
- }, context?: ToolContext): Promise<any>;
62
- //# sourceMappingURL=llm-database-management-tool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"llm-database-management-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/llm-database-management-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE;IACJ,QAAQ,EAAE,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,EACD,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,GAAG,CAAC,CAmHd"}
@@ -1,203 +0,0 @@
1
- /**
2
- * LLM-Managed Database Management Tool
3
- *
4
- * Provides LLM-driven database operations with research-driven approach
5
- */
6
- import { McpAdrError } from '../types/index.js';
7
- import { ResearchOrchestrator } from '../utils/research-orchestrator.js';
8
- /**
9
- * LLM-managed database operations with research-driven approach
10
- *
11
- * @description Executes database operations using LLM to research best practices,
12
- * generate appropriate commands, and execute them. Supports PostgreSQL, MongoDB, Redis, MySQL, and MariaDB.
13
- *
14
- * @param {Object} args - Database management configuration parameters
15
- * @param {string} args.database - Database type (postgresql, mongodb, redis, mysql, mariadb)
16
- * @param {string} args.action - Action to perform
17
- * @param {Object} [args.parameters] - Action parameters
18
- * @param {string} args.llmInstructions - LLM instructions for command generation
19
- * @param {boolean} [args.researchFirst] - Research best approach first (default: true)
20
- * @param {string} [args.projectPath] - Path to project root (defaults to cwd)
21
- * @param {string} [args.adrDirectory] - ADR directory relative to project (defaults to 'docs/adrs')
22
- *
23
- * @returns {Promise<any>} Database operation results with LLM analysis
24
- *
25
- * @throws {McpAdrError} When required parameters are missing or operation fails
26
- *
27
- * @example
28
- * ```typescript
29
- * // PostgreSQL database creation
30
- * const result = await llmDatabaseManagement({
31
- * database: 'postgresql',
32
- * action: 'create_database',
33
- * parameters: { dbName: 'myapp', owner: 'myuser' },
34
- * llmInstructions: 'Create a secure database with proper permissions'
35
- * });
36
- * ```
37
- *
38
- * @example
39
- * ```typescript
40
- * // MongoDB collection optimization
41
- * const result = await llmDatabaseManagement({
42
- * database: 'mongodb',
43
- * action: 'optimize_collection',
44
- * parameters: { collection: 'users', indexFields: ['email', 'created_at'] },
45
- * llmInstructions: 'Optimize for read-heavy workloads with proper indexing'
46
- * });
47
- * ```
48
- *
49
- * @since 2.1.0
50
- * @category Database Management
51
- * @category LLM
52
- * @mcp-tool
53
- */
54
- export async function llmDatabaseManagement(args, context) {
55
- const { database, action, parameters = {}, llmInstructions, researchFirst = true, projectPath, adrDirectory, } = args;
56
- if (!database || !action || !llmInstructions) {
57
- throw new McpAdrError('Database, action, and llmInstructions are required', 'MISSING_REQUIRED_PARAMS');
58
- }
59
- try {
60
- context?.info(`🗄️ Initializing ${database} database management for: ${action}`);
61
- context?.report_progress(0, 100);
62
- // Initialize research orchestrator
63
- const orchestrator = new ResearchOrchestrator(projectPath, adrDirectory);
64
- let researchResult = null;
65
- if (researchFirst) {
66
- context?.info('📚 Researching best practices and optimization strategies...');
67
- context?.report_progress(20, 100);
68
- // Step 1: Research the best approach
69
- const researchQuery = `
70
- How to ${action} in ${database}?
71
- Best practices for ${database} ${action}
72
- ${database} ${action} documentation and examples
73
- Performance optimization for ${database} ${action}
74
- Security considerations for ${database} ${action}
75
- ${llmInstructions}
76
- `;
77
- researchResult = await orchestrator.answerResearchQuestion(researchQuery);
78
- }
79
- // Step 2: Generate command using LLM
80
- context?.info('🤖 Generating database commands with LLM guidance...');
81
- context?.report_progress(50, 100);
82
- const command = await generateDatabaseCommand({
83
- database,
84
- action,
85
- parameters,
86
- research: researchResult,
87
- instructions: llmInstructions,
88
- });
89
- // Step 3: Execute the command (simulated for now)
90
- context?.info(`🗄️ Executing ${database} operation...`);
91
- context?.report_progress(80, 100);
92
- const executionResult = await executeDatabaseCommand(command);
93
- context?.info('✅ Database operation complete!');
94
- context?.report_progress(100, 100);
95
- return {
96
- content: [
97
- {
98
- type: 'text',
99
- text: `# LLM-Managed Database Operation
100
-
101
- ## Operation Details
102
- - **Database**: ${database}
103
- - **Action**: ${action}
104
- - **Parameters**: ${JSON.stringify(parameters, null, 2)}
105
-
106
- ## LLM Instructions
107
- ${llmInstructions}
108
-
109
- ${researchResult
110
- ? `
111
- ## Research Results
112
- - **Confidence**: ${(researchResult.confidence * 100).toFixed(1)}%
113
- - **Sources**: ${researchResult.metadata.sourcesQueried.join(', ')}
114
- - **Research Summary**: ${researchResult.answer}
115
-
116
- `
117
- : ''}
118
-
119
- ## Generated Command
120
- \`\`\`sql
121
- ${command.generated}
122
- \`\`\`
123
-
124
- ## Execution Result
125
- ${executionResult.success ? '✅ Success' : '❌ Failed'}
126
- ${executionResult.output ? `\n\`\`\`\n${executionResult.output}\n\`\`\`` : ''}
127
-
128
- ## LLM Analysis
129
- ${command.analysis || 'No analysis available'}
130
-
131
- ## Metadata
132
- - **Command Confidence**: ${(command.confidence * 100).toFixed(1)}%
133
- - **Timestamp**: ${new Date().toISOString()}
134
- - **Research-Driven**: ${researchFirst ? 'Yes' : 'No'}
135
- `,
136
- },
137
- ],
138
- };
139
- }
140
- catch (error) {
141
- throw new McpAdrError(`Database management operation failed: ${error instanceof Error ? error.message : String(error)}`, 'DATABASE_MANAGEMENT_ERROR');
142
- }
143
- }
144
- /**
145
- * Generate database command using LLM
146
- */
147
- async function generateDatabaseCommand(context) {
148
- // const { loadAIConfig, getAIExecutor } = await import('../config/ai-config.js');
149
- // const aiConfig = loadAIConfig();
150
- // const executor = getAIExecutor();
151
- // const prompt = `
152
- // Generate a ${context.database} command for the following operation:
153
- //
154
- // Action: ${context.action}
155
- // Parameters: ${JSON.stringify(context.parameters, null, 2)}
156
- // Instructions: ${context.instructions}
157
- //
158
- // ${context.research ? `
159
- // Research Context:
160
- // - Confidence: ${(context.research.confidence * 100).toFixed(1)}%
161
- // - Sources: ${context.research.metadata.sourcesQueried.join(', ')}
162
- // - Key Findings: ${context.research.answer}
163
- // ` : ''}
164
- //
165
- // Database Context:
166
- // ${getDatabaseContext(context.database)}
167
- //
168
- // Generate the appropriate command (SQL, CLI, or API call) and provide analysis of the approach.
169
- // `;
170
- // TODO: Implement LLM command generation when AI executor is available
171
- // const result = await executor.executeStructuredPrompt(prompt, {
172
- // type: 'object',
173
- // properties: {
174
- // command: { type: 'string' },
175
- // confidence: { type: 'number' },
176
- // analysis: { type: 'string' }
177
- // }
178
- // });
179
- // return {
180
- // generated: result.data.command || '-- Command generation failed',
181
- // confidence: result.data.confidence || 0.5,
182
- // analysis: result.data.analysis || 'No analysis available'
183
- // };
184
- // Placeholder implementation
185
- return {
186
- generated: `-- LLM command generation for ${context.database} ${context.action} not yet implemented`,
187
- confidence: 0.3,
188
- analysis: 'LLM command generation is not yet available. This is a placeholder implementation.',
189
- };
190
- }
191
- /**
192
- * Execute database command (simulated for now)
193
- */
194
- async function executeDatabaseCommand(command) {
195
- // For now, simulate command execution
196
- // In a real implementation, this would execute the actual database command
197
- return {
198
- success: command.confidence > 0.7,
199
- output: `Simulated execution of: ${command.generated}\n\nThis is a simulation. In production, this would execute the actual database command.`,
200
- };
201
- }
202
- // Database context functions will be used when LLM integration is complete
203
- //# sourceMappingURL=llm-database-management-tool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"llm-database-management-tool.js","sourceRoot":"","sources":["../../../src/tools/llm-database-management-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,IAQC,EACD,OAAqB;IAErB,MAAM,EACJ,QAAQ,EACR,MAAM,EACN,UAAU,GAAG,EAAE,EACf,eAAe,EACf,aAAa,GAAG,IAAI,EACpB,WAAW,EACX,YAAY,GACb,GAAG,IAAI,CAAC;IAET,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC7C,MAAM,IAAI,WAAW,CACn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