mycontext-cli 1.0.94 → 2.0.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.
Files changed (98) hide show
  1. package/README.md +446 -130
  2. package/dist/agents/implementations/ClaudeAgentWorkflow.d.ts +110 -0
  3. package/dist/agents/implementations/ClaudeAgentWorkflow.d.ts.map +1 -0
  4. package/dist/agents/implementations/ClaudeAgentWorkflow.js +590 -0
  5. package/dist/agents/implementations/ClaudeAgentWorkflow.js.map +1 -0
  6. package/dist/agents/implementations/WorkflowAgent.d.ts +5 -0
  7. package/dist/agents/implementations/WorkflowAgent.d.ts.map +1 -1
  8. package/dist/agents/implementations/WorkflowAgent.js +98 -10
  9. package/dist/agents/implementations/WorkflowAgent.js.map +1 -1
  10. package/dist/agents/interfaces/SubAgent.d.ts +5 -0
  11. package/dist/agents/interfaces/SubAgent.d.ts.map +1 -1
  12. package/dist/commands/build-app.d.ts +5 -0
  13. package/dist/commands/build-app.d.ts.map +1 -1
  14. package/dist/commands/build-app.js +127 -4
  15. package/dist/commands/build-app.js.map +1 -1
  16. package/dist/commands/compile-prd.d.ts.map +1 -1
  17. package/dist/commands/compile-prd.js +18 -54
  18. package/dist/commands/compile-prd.js.map +1 -1
  19. package/dist/commands/enhance.d.ts +21 -0
  20. package/dist/commands/enhance.d.ts.map +1 -1
  21. package/dist/commands/enhance.js +155 -12
  22. package/dist/commands/enhance.js.map +1 -1
  23. package/dist/commands/generate-components.d.ts +43 -0
  24. package/dist/commands/generate-components.d.ts.map +1 -1
  25. package/dist/commands/generate-components.js +270 -0
  26. package/dist/commands/generate-components.js.map +1 -1
  27. package/dist/constants/fileNames.d.ts +68 -0
  28. package/dist/constants/fileNames.d.ts.map +1 -0
  29. package/dist/constants/fileNames.js +102 -0
  30. package/dist/constants/fileNames.js.map +1 -0
  31. package/dist/interfaces/AIClient.d.ts +198 -0
  32. package/dist/interfaces/AIClient.d.ts.map +1 -0
  33. package/dist/interfaces/AIClient.js +40 -0
  34. package/dist/interfaces/AIClient.js.map +1 -0
  35. package/dist/package.json +5 -3
  36. package/dist/types/index.d.ts +423 -0
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/utils/agentDefinitions.d.ts +60 -0
  39. package/dist/utils/agentDefinitions.d.ts.map +1 -0
  40. package/dist/utils/agentDefinitions.js +344 -0
  41. package/dist/utils/agentDefinitions.js.map +1 -0
  42. package/dist/utils/aiClientFactory.d.ts +93 -0
  43. package/dist/utils/aiClientFactory.d.ts.map +1 -0
  44. package/dist/utils/aiClientFactory.js +290 -0
  45. package/dist/utils/aiClientFactory.js.map +1 -0
  46. package/dist/utils/aiClientRouter.d.ts +121 -0
  47. package/dist/utils/aiClientRouter.d.ts.map +1 -0
  48. package/dist/utils/aiClientRouter.js +401 -0
  49. package/dist/utils/aiClientRouter.js.map +1 -0
  50. package/dist/utils/claudeAgentClient.d.ts +166 -0
  51. package/dist/utils/claudeAgentClient.d.ts.map +1 -0
  52. package/dist/utils/claudeAgentClient.js +714 -0
  53. package/dist/utils/claudeAgentClient.js.map +1 -0
  54. package/dist/utils/claudeClient.d.ts +7 -3
  55. package/dist/utils/claudeClient.d.ts.map +1 -1
  56. package/dist/utils/claudeClient.js +28 -5
  57. package/dist/utils/claudeClient.js.map +1 -1
  58. package/dist/utils/completeArchitectureEngine.d.ts +67 -0
  59. package/dist/utils/completeArchitectureEngine.d.ts.map +1 -0
  60. package/dist/utils/completeArchitectureEngine.js +329 -0
  61. package/dist/utils/completeArchitectureEngine.js.map +1 -0
  62. package/dist/utils/contextLoader.d.ts +1 -12
  63. package/dist/utils/contextLoader.d.ts.map +1 -1
  64. package/dist/utils/contextLoader.js +29 -150
  65. package/dist/utils/contextLoader.js.map +1 -1
  66. package/dist/utils/contextManager.d.ts +76 -0
  67. package/dist/utils/contextManager.d.ts.map +1 -0
  68. package/dist/utils/contextManager.js +327 -0
  69. package/dist/utils/contextManager.js.map +1 -0
  70. package/dist/utils/hybridAIClient.d.ts +25 -1
  71. package/dist/utils/hybridAIClient.d.ts.map +1 -1
  72. package/dist/utils/hybridAIClient.js +69 -2
  73. package/dist/utils/hybridAIClient.js.map +1 -1
  74. package/dist/utils/mcpAgentIntegration.d.ts +104 -0
  75. package/dist/utils/mcpAgentIntegration.d.ts.map +1 -0
  76. package/dist/utils/mcpAgentIntegration.js +382 -0
  77. package/dist/utils/mcpAgentIntegration.js.map +1 -0
  78. package/dist/utils/mcpTools.d.ts +164 -0
  79. package/dist/utils/mcpTools.d.ts.map +1 -0
  80. package/dist/utils/mcpTools.js +385 -0
  81. package/dist/utils/mcpTools.js.map +1 -0
  82. package/dist/utils/routeGenerator.d.ts +56 -0
  83. package/dist/utils/routeGenerator.d.ts.map +1 -0
  84. package/dist/utils/routeGenerator.js +231 -0
  85. package/dist/utils/routeGenerator.js.map +1 -0
  86. package/dist/utils/serverActionGenerator.d.ts +56 -0
  87. package/dist/utils/serverActionGenerator.d.ts.map +1 -0
  88. package/dist/utils/serverActionGenerator.js +258 -0
  89. package/dist/utils/serverActionGenerator.js.map +1 -0
  90. package/dist/utils/streamingHandler.d.ts +98 -0
  91. package/dist/utils/streamingHandler.d.ts.map +1 -0
  92. package/dist/utils/streamingHandler.js +259 -0
  93. package/dist/utils/streamingHandler.js.map +1 -0
  94. package/dist/utils/toolPermissions.d.ts +105 -0
  95. package/dist/utils/toolPermissions.d.ts.map +1 -0
  96. package/dist/utils/toolPermissions.js +408 -0
  97. package/dist/utils/toolPermissions.js.map +1 -0
  98. package/package.json +5 -3
@@ -0,0 +1,344 @@
1
+ "use strict";
2
+ /**
3
+ * Agent Definitions for MyContext CLI
4
+ *
5
+ * Pre-configured agents for common tasks with specific tool access
6
+ * and custom system prompts.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.performanceAgent = exports.refactoringAgent = exports.securityAgent = exports.architectureAgent = exports.testingAgent = exports.documentationAgent = exports.codeReviewerAgent = exports.componentGeneratorAgent = void 0;
10
+ exports.getAllAgentDefinitions = getAllAgentDefinitions;
11
+ exports.getAgentDefinition = getAgentDefinition;
12
+ exports.getAgentsForTask = getAgentsForTask;
13
+ /**
14
+ * Component Generator Agent
15
+ * Specialized in creating production-ready React components
16
+ */
17
+ exports.componentGeneratorAgent = {
18
+ description: 'Generates production-ready React components with TypeScript, Shadcn UI, and Tailwind CSS',
19
+ tools: ['Read', 'Write', 'Glob', 'AnalyzeComponent'],
20
+ model: 'sonnet',
21
+ prompt: `You are an expert React/Next.js component developer specializing in:
22
+ - Next.js 15 App Router patterns
23
+ - TypeScript with strict typing
24
+ - Shadcn UI component library
25
+ - Tailwind CSS styling
26
+ - Responsive, mobile-first design
27
+ - Accessibility best practices (WCAG 2.1)
28
+
29
+ When generating components:
30
+ 1. Always use TypeScript with proper interfaces
31
+ 2. Include prop type definitions
32
+ 3. Add JSDoc comments for all props
33
+ 4. Use Shadcn UI components when appropriate
34
+ 5. Apply Tailwind CSS for styling
35
+ 6. Ensure mobile responsiveness
36
+ 7. Add ARIA labels and roles for accessibility
37
+ 8. Include error boundaries where needed
38
+ 9. Add loading states for async operations
39
+ 10. Follow the project's established patterns
40
+
41
+ Output format: Provide complete, production-ready code in TSX format.`,
42
+ };
43
+ /**
44
+ * Code Reviewer Agent
45
+ * Analyzes code quality and suggests improvements
46
+ */
47
+ exports.codeReviewerAgent = {
48
+ description: 'Reviews code for quality, best practices, and potential issues',
49
+ tools: ['Read', 'Grep', 'Glob', 'AnalyzeComponent', 'CheckTypes'],
50
+ model: 'opus',
51
+ prompt: `You are a senior software engineer conducting thorough code reviews. Focus on:
52
+
53
+ **Code Quality:**
54
+ - Clean code principles
55
+ - DRY (Don't Repeat Yourself)
56
+ - SOLID principles
57
+ - Proper error handling
58
+ - Performance optimizations
59
+
60
+ **Security:**
61
+ - Input validation
62
+ - XSS prevention
63
+ - CSRF protection
64
+ - Secure data handling
65
+
66
+ **TypeScript:**
67
+ - Proper type usage (avoid 'any')
68
+ - Type safety
69
+ - Interface design
70
+
71
+ **React Best Practices:**
72
+ - Component composition
73
+ - Hook usage
74
+ - State management
75
+ - Performance (memo, useMemo, useCallback)
76
+
77
+ **Testing:**
78
+ - Test coverage
79
+ - Edge cases
80
+ - Error scenarios
81
+
82
+ Provide constructive feedback with specific examples and actionable suggestions.`,
83
+ };
84
+ /**
85
+ * Documentation Agent
86
+ * Creates comprehensive documentation
87
+ */
88
+ exports.documentationAgent = {
89
+ description: 'Generates comprehensive documentation for components and projects',
90
+ tools: ['Read', 'Write', 'Glob', 'GenerateDocs', 'AnalyzeComponent'],
91
+ model: 'sonnet',
92
+ prompt: `You are a technical writer specializing in developer documentation. Create:
93
+
94
+ **Component Documentation:**
95
+ - Clear descriptions
96
+ - Props/API reference
97
+ - Usage examples
98
+ - TypeScript interfaces
99
+ - Edge cases and gotchas
100
+
101
+ **Project Documentation:**
102
+ - Architecture overview
103
+ - Setup instructions
104
+ - Configuration guide
105
+ - API documentation
106
+ - Troubleshooting section
107
+
108
+ **Documentation Style:**
109
+ - Clear and concise
110
+ - Code examples for everything
111
+ - Visual diagrams (ASCII/Mermaid) where helpful
112
+ - Markdown formatting
113
+ - Developer-friendly tone
114
+
115
+ Prioritize clarity and usefulness for developers.`,
116
+ };
117
+ /**
118
+ * Testing Agent
119
+ * Creates unit and integration tests
120
+ */
121
+ exports.testingAgent = {
122
+ description: 'Generates comprehensive unit and integration tests',
123
+ tools: ['Read', 'Write', 'Glob', 'AnalyzeComponent'],
124
+ model: 'sonnet',
125
+ prompt: `You are a QA engineer specializing in automated testing for React applications. Create:
126
+
127
+ **Test Coverage:**
128
+ - Unit tests for all components
129
+ - Integration tests for workflows
130
+ - Edge case testing
131
+ - Error scenario testing
132
+ - Accessibility testing
133
+
134
+ **Testing Framework:**
135
+ - Jest for unit tests
136
+ - React Testing Library for component tests
137
+ - User-centric testing approach
138
+ - Mock external dependencies
139
+
140
+ **Test Structure:**
141
+ - Arrange-Act-Assert pattern
142
+ - Descriptive test names
143
+ - Clear test organization
144
+ - Proper setup/teardown
145
+
146
+ **Best Practices:**
147
+ - Test behavior, not implementation
148
+ - Avoid brittle tests
149
+ - Use data-testid sparingly
150
+ - Test accessibility
151
+ - Mock API calls
152
+
153
+ Generate comprehensive, maintainable tests that catch bugs early.`,
154
+ };
155
+ /**
156
+ * Architecture Agent
157
+ * Designs system architecture and makes structural decisions
158
+ */
159
+ exports.architectureAgent = {
160
+ description: 'Designs and reviews system architecture for scalability and maintainability',
161
+ tools: ['Read', 'Glob', 'Grep', 'ValidatePRD'],
162
+ model: 'opus',
163
+ prompt: `You are a software architect with deep experience in full-stack applications. Focus on:
164
+
165
+ **Architecture Design:**
166
+ - Scalable folder structure
167
+ - Component hierarchy
168
+ - Data flow patterns
169
+ - State management strategy
170
+ - API design
171
+ - Database schema
172
+
173
+ **Technology Choices:**
174
+ - Framework selection reasoning
175
+ - Library recommendations
176
+ - Infrastructure considerations
177
+ - Performance implications
178
+
179
+ **Best Practices:**
180
+ - Separation of concerns
181
+ - Dependency management
182
+ - Code reusability
183
+ - Testing strategy
184
+ - Error handling patterns
185
+
186
+ **Documentation:**
187
+ - Architecture diagrams
188
+ - Decision records (ADRs)
189
+ - Migration plans
190
+ - Security considerations
191
+
192
+ Provide well-reasoned architectural decisions with trade-offs explained.`,
193
+ };
194
+ /**
195
+ * Security Agent
196
+ * Identifies security vulnerabilities and suggests fixes
197
+ */
198
+ exports.securityAgent = {
199
+ description: 'Analyzes code for security vulnerabilities and provides remediation',
200
+ tools: ['Read', 'Grep', 'Glob'],
201
+ model: 'opus',
202
+ prompt: `You are a security engineer specializing in web application security. Check for:
203
+
204
+ **Common Vulnerabilities:**
205
+ - XSS (Cross-Site Scripting)
206
+ - CSRF (Cross-Site Request Forgery)
207
+ - SQL Injection
208
+ - Command Injection
209
+ - Path Traversal
210
+ - Insecure Direct Object References
211
+
212
+ **Authentication & Authorization:**
213
+ - Proper auth implementation
214
+ - Session management
215
+ - Token handling
216
+ - Role-based access control
217
+
218
+ **Data Protection:**
219
+ - Sensitive data exposure
220
+ - Encryption at rest/in transit
221
+ - Input validation
222
+ - Output encoding
223
+
224
+ **Dependencies:**
225
+ - Known vulnerabilities in packages
226
+ - Outdated dependencies
227
+ - Insecure configurations
228
+
229
+ Provide severity ratings and specific remediation steps for each issue found.`,
230
+ };
231
+ /**
232
+ * Refactoring Agent
233
+ * Improves code quality through refactoring
234
+ */
235
+ exports.refactoringAgent = {
236
+ description: 'Refactors code to improve quality, performance, and maintainability',
237
+ tools: ['Read', 'Write', 'Edit', 'AnalyzeComponent'],
238
+ model: 'sonnet',
239
+ prompt: `You are a refactoring specialist focused on improving code quality without changing behavior. Focus on:
240
+
241
+ **Code Smells to Address:**
242
+ - Long methods/components
243
+ - Duplicate code
244
+ - Large classes/components
245
+ - Too many parameters
246
+ - Poor naming
247
+ - Complex conditionals
248
+
249
+ **Refactoring Techniques:**
250
+ - Extract method/component
251
+ - Rename for clarity
252
+ - Simplify conditionals
253
+ - Remove duplication
254
+ - Improve data structures
255
+ - Extract custom hooks
256
+
257
+ **Principles:**
258
+ - Single Responsibility
259
+ - Keep changes small
260
+ - Maintain test coverage
261
+ - Improve readability
262
+ - Enhance performance where possible
263
+
264
+ Always preserve existing functionality while improving code quality.`,
265
+ };
266
+ /**
267
+ * Performance Agent
268
+ * Optimizes code for better performance
269
+ */
270
+ exports.performanceAgent = {
271
+ description: 'Analyzes and optimizes application performance',
272
+ tools: ['Read', 'Glob', 'Grep', 'AnalyzeComponent'],
273
+ model: 'sonnet',
274
+ prompt: `You are a performance optimization specialist for React/Next.js applications. Focus on:
275
+
276
+ **React Performance:**
277
+ - Unnecessary re-renders
278
+ - Missing memoization
279
+ - Large component trees
280
+ - Expensive computations
281
+ - Virtual DOM issues
282
+
283
+ **Next.js Optimizations:**
284
+ - Image optimization
285
+ - Font optimization
286
+ - Code splitting
287
+ - Dynamic imports
288
+ - Server vs Client components
289
+ - Streaming
290
+
291
+ **General Optimizations:**
292
+ - Bundle size reduction
293
+ - Lazy loading
294
+ - Caching strategies
295
+ - API optimization
296
+ - Database query optimization
297
+
298
+ **Metrics:**
299
+ - Core Web Vitals
300
+ - Time to Interactive
301
+ - First Contentful Paint
302
+ - Cumulative Layout Shift
303
+
304
+ Provide measurable improvements with before/after comparisons where possible.`,
305
+ };
306
+ /**
307
+ * Get all agent definitions
308
+ */
309
+ function getAllAgentDefinitions() {
310
+ return {
311
+ componentGenerator: exports.componentGeneratorAgent,
312
+ codeReviewer: exports.codeReviewerAgent,
313
+ documentation: exports.documentationAgent,
314
+ testing: exports.testingAgent,
315
+ architecture: exports.architectureAgent,
316
+ security: exports.securityAgent,
317
+ refactoring: exports.refactoringAgent,
318
+ performance: exports.performanceAgent,
319
+ };
320
+ }
321
+ /**
322
+ * Get agent definition by name
323
+ */
324
+ function getAgentDefinition(name) {
325
+ const agents = getAllAgentDefinitions();
326
+ return agents[name];
327
+ }
328
+ /**
329
+ * Get agent definitions for specific task
330
+ */
331
+ function getAgentsForTask(task) {
332
+ const taskMap = {
333
+ generate: exports.componentGeneratorAgent,
334
+ review: exports.codeReviewerAgent,
335
+ docs: exports.documentationAgent,
336
+ test: exports.testingAgent,
337
+ architect: exports.architectureAgent,
338
+ security: exports.securityAgent,
339
+ refactor: exports.refactoringAgent,
340
+ optimize: exports.performanceAgent,
341
+ };
342
+ return taskMap[task];
343
+ }
344
+ //# sourceMappingURL=agentDefinitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentDefinitions.js","sourceRoot":"","sources":["../../src/utils/agentDefinitions.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAoTH,wDAWC;AAKD,gDAGC;AAKD,4CAaC;AArVD;;;GAGG;AACU,QAAA,uBAAuB,GAAoB;IACtD,WAAW,EAAE,0FAA0F;IACvG,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,CAAC;IACpD,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;sEAoB4D;CACrE,CAAC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"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * AI Client Factory
3
+ *
4
+ * Factory for creating and managing AI client instances.
5
+ * Handles client selection, caching, and lifecycle management.
6
+ */
7
+ import { AIClient, AgentAIClient, AIClientFactoryConfig, OperationComplexity } from '../interfaces/AIClient';
8
+ /**
9
+ * Singleton factory for creating and managing AI clients
10
+ */
11
+ export declare class AIClientFactory {
12
+ private static instance;
13
+ private config;
14
+ private clientCache;
15
+ private workingDirectory;
16
+ private constructor();
17
+ /**
18
+ * Get singleton instance
19
+ */
20
+ static getInstance(config?: AIClientFactoryConfig): AIClientFactory;
21
+ /**
22
+ * Reset singleton (useful for testing)
23
+ */
24
+ static reset(): void;
25
+ /**
26
+ * Update factory configuration
27
+ */
28
+ configure(config: Partial<AIClientFactoryConfig>): void;
29
+ /**
30
+ * Get or create a client based on requirements
31
+ */
32
+ getClient(complexity?: OperationComplexity, requiresTools?: boolean, requiresStreaming?: boolean): Promise<AIClient>;
33
+ /**
34
+ * Get Agent SDK client specifically (for advanced operations)
35
+ */
36
+ getAgentClient(): Promise<AgentAIClient>;
37
+ /**
38
+ * Get Direct API client specifically (for simple operations)
39
+ */
40
+ getDirectClient(): Promise<AIClient>;
41
+ /**
42
+ * Select appropriate client type based on operation requirements
43
+ */
44
+ private selectClientType;
45
+ /**
46
+ * Create a new client instance
47
+ */
48
+ private createClient;
49
+ /**
50
+ * Check if any AI client is available and configured
51
+ */
52
+ isAvailable(): Promise<boolean>;
53
+ /**
54
+ * Test connection for a specific client type
55
+ */
56
+ testConnection(clientType?: 'direct-api' | 'agent-sdk'): Promise<boolean>;
57
+ /**
58
+ * Get current configuration
59
+ */
60
+ getConfig(): AIClientFactoryConfig;
61
+ /**
62
+ * Clear client cache
63
+ */
64
+ clearCache(): void;
65
+ /**
66
+ * Cleanup all cached clients
67
+ */
68
+ cleanup(): Promise<void>;
69
+ /**
70
+ * Get statistics about cached clients
71
+ */
72
+ getStats(): {
73
+ cachedClients: number;
74
+ clientTypes: Record<string, number>;
75
+ };
76
+ /**
77
+ * Log current factory state (for debugging)
78
+ */
79
+ logState(): void;
80
+ }
81
+ /**
82
+ * Convenience function to get factory instance
83
+ */
84
+ export declare function getAIClientFactory(config?: AIClientFactoryConfig): AIClientFactory;
85
+ /**
86
+ * Convenience function to get an AI client
87
+ */
88
+ export declare function getAIClient(complexity?: OperationComplexity, requiresTools?: boolean, requiresStreaming?: boolean): Promise<AIClient>;
89
+ /**
90
+ * Convenience function to get Agent SDK client
91
+ */
92
+ export declare function getAgentClient(): Promise<AgentAIClient>;
93
+ //# sourceMappingURL=aiClientFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aiClientFactory.d.ts","sourceRoot":"","sources":["../../src/utils/aiClientFactory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,qBAAqB,EAErB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAKhC;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,WAAW,CAAoC;IACvD,OAAO,CAAC,gBAAgB,CAAS;IAEjC,OAAO;IAaP;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,eAAe;IAOnE;;OAEG;IACH,MAAM,CAAC,KAAK,IAAI,IAAI;IAIpB;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,IAAI;IAOvD;;OAEG;IACG,SAAS,CACb,UAAU,CAAC,EAAE,mBAAmB,EAChC,aAAa,GAAE,OAAe,EAC9B,iBAAiB,GAAE,OAAe,GACjC,OAAO,CAAC,QAAQ,CAAC;IAqBpB;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,aAAa,CAAC;IAqC9C;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,QAA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