@jsayubi/ccgram 1.0.0 → 1.0.2

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,94 +0,0 @@
1
- /**
2
- * Command Relay Service
3
- * Manages email listening and command execution for Claude Code
4
- */
5
- import EventEmitter from 'events';
6
- import EmailListener from './email-listener';
7
- import ClaudeCommandBridge from './claude-command-bridge';
8
- import Logger from '../core/logger';
9
- interface RelayConfig {
10
- imap?: {
11
- auth: {
12
- user: string;
13
- pass: string;
14
- };
15
- host: string;
16
- port: number;
17
- secure: boolean;
18
- };
19
- sentMessagesPath?: string;
20
- template?: {
21
- checkInterval?: number;
22
- };
23
- [key: string]: unknown;
24
- }
25
- interface CommandData {
26
- sessionId: string;
27
- command: string;
28
- [key: string]: unknown;
29
- }
30
- interface QueueItem extends CommandData {
31
- id: string;
32
- queuedAt: string;
33
- status: string;
34
- retries: number;
35
- maxRetries: number;
36
- executedAt?: string;
37
- completedAt?: string;
38
- failedAt?: string;
39
- error?: string;
40
- retryAt?: string;
41
- }
42
- interface ClaudeProcess {
43
- pid: number | null;
44
- command?: string;
45
- available?: boolean;
46
- }
47
- interface RelayStatus {
48
- isRunning: boolean;
49
- queueLength: number;
50
- processing: boolean;
51
- emailListener: {
52
- connected: boolean;
53
- listening: boolean;
54
- } | null;
55
- recentCommands: Array<{
56
- id: string;
57
- status: string;
58
- queuedAt: string;
59
- command: string;
60
- }>;
61
- }
62
- declare class CommandRelayService extends EventEmitter {
63
- logger: Logger;
64
- config: RelayConfig;
65
- emailListener: EmailListener | null;
66
- commandBridge: ClaudeCommandBridge;
67
- clipboardAutomation: any;
68
- simpleAutomation: any;
69
- claudeAutomation: any;
70
- isRunning: boolean;
71
- commandQueue: QueueItem[];
72
- processingQueue: boolean;
73
- stateFile: string;
74
- constructor(config: RelayConfig);
75
- _ensureDirectories(): void;
76
- _loadState(): void;
77
- _saveState(): void;
78
- start(): Promise<void>;
79
- stop(): Promise<void>;
80
- _queueCommand(commandData: CommandData): void;
81
- _startCommandProcessor(): void;
82
- _processCommandQueue(): Promise<void>;
83
- _executeCommand(commandItem: QueueItem): Promise<void>;
84
- _findClaudeCodeProcess(): Promise<ClaudeProcess>;
85
- _sendCommandToClaudeCode(command: string, claudeProcess: ClaudeProcess, sessionId: string): Promise<boolean>;
86
- _sendCommandViaMacOS(command: string): Promise<boolean>;
87
- _sendCommandViaNotification(command: string): Promise<boolean>;
88
- _handleCommandError(commandItem: QueueItem, error: Error): void;
89
- _generateId(): string;
90
- getStatus(): RelayStatus;
91
- cleanupCompletedCommands(): void;
92
- }
93
- export = CommandRelayService;
94
- //# sourceMappingURL=command-relay.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-relay.d.ts","sourceRoot":"","sources":["../../../src/relay/command-relay.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAC1D,OAAO,MAAM,MAAM,gBAAgB,CAAC;AAUpC,UAAU,WAAW;IACjB,IAAI,CAAC,EAAE;QACH,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QACrC,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,UAAU,WAAW;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED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AAE,OAAO,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;gBAEN,MAAM,EAAE,WAAW;IAkB/B,kBAAkB,IAAI,IAAI;IAO1B,UAAU,IAAI,IAAI;IAalB,UAAU,IAAI,IAAI;IAYZ,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAsCtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB3B,aAAa,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAsB7C,sBAAsB,IAAI,IAAI;IAYxB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBrC,eAAe,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAiDtD,sBAAsB,IAAI,OAAO,CAAC,aAAa,CAAC;IAgDhD,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA8D5G,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAuEvD,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA6CpE,mBAAmB,CAAC,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAiB/D,WAAW,IAAI,MAAM;IAIrB,SAAS,IAAI,WAAW;IAmBxB,wBAAwB,IAAI,IAAI;CAanC;AAED,SAAS,mBAAmB,CAAC"}
@@ -1,463 +0,0 @@
1
- "use strict";
2
- /**
3
- * Command Relay Service
4
- * Manages email listening and command execution for Claude Code
5
- */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- const events_1 = __importDefault(require("events"));
10
- const email_listener_1 = __importDefault(require("./email-listener"));
11
- const claude_command_bridge_1 = __importDefault(require("./claude-command-bridge"));
12
- const logger_1 = __importDefault(require("../core/logger"));
13
- const child_process_1 = require("child_process");
14
- const fs_1 = __importDefault(require("fs"));
15
- const path_1 = __importDefault(require("path"));
16
- // Automation classes are not yet migrated to TypeScript
17
- const ClipboardAutomation = require('../automation/clipboard-automation');
18
- const SimpleAutomation = require('../automation/simple-automation');
19
- const ClaudeAutomation = require('../automation/claude-automation');
20
- class CommandRelayService extends events_1.default {
21
- logger;
22
- config;
23
- emailListener;
24
- commandBridge;
25
- clipboardAutomation;
26
- simpleAutomation;
27
- claudeAutomation;
28
- isRunning;
29
- commandQueue;
30
- processingQueue;
31
- stateFile;
32
- constructor(config) {
33
- super();
34
- this.logger = new logger_1.default('CommandRelay');
35
- this.config = config;
36
- this.emailListener = null;
37
- this.commandBridge = new claude_command_bridge_1.default();
38
- this.clipboardAutomation = new ClipboardAutomation();
39
- this.simpleAutomation = new SimpleAutomation();
40
- this.claudeAutomation = new ClaudeAutomation();
41
- this.isRunning = false;
42
- this.commandQueue = [];
43
- this.processingQueue = false;
44
- this.stateFile = path_1.default.join(__dirname, '../data/relay-state.json');
45
- this._ensureDirectories();
46
- this._loadState();
47
- }
48
- _ensureDirectories() {
49
- const dataDir = path_1.default.join(__dirname, '../data');
50
- if (!fs_1.default.existsSync(dataDir)) {
51
- fs_1.default.mkdirSync(dataDir, { recursive: true });
52
- }
53
- }
54
- _loadState() {
55
- try {
56
- if (fs_1.default.existsSync(this.stateFile)) {
57
- const state = JSON.parse(fs_1.default.readFileSync(this.stateFile, 'utf8'));
58
- this.commandQueue = state.commandQueue || [];
59
- this.logger.debug(`Loaded ${this.commandQueue.length} queued commands`);
60
- }
61
- }
62
- catch (error) {
63
- this.logger.warn('Failed to load relay state:', error.message);
64
- this.commandQueue = [];
65
- }
66
- }
67
- _saveState() {
68
- try {
69
- const state = {
70
- commandQueue: this.commandQueue,
71
- lastSaved: new Date().toISOString()
72
- };
73
- fs_1.default.writeFileSync(this.stateFile, JSON.stringify(state, null, 2));
74
- }
75
- catch (error) {
76
- this.logger.error('Failed to save relay state:', error.message);
77
- }
78
- }
79
- async start() {
80
- if (this.isRunning) {
81
- this.logger.warn('Command relay service already running');
82
- return;
83
- }
84
- try {
85
- // Validate email configuration
86
- if (!this.config.imap) {
87
- throw new Error('IMAP configuration required for command relay');
88
- }
89
- // Start email listener
90
- this.emailListener = new email_listener_1.default(this.config);
91
- // Listen for command events
92
- this.emailListener.on('command', (commandData) => {
93
- this._queueCommand(commandData);
94
- });
95
- // Start email listening
96
- await this.emailListener.start();
97
- // Start command processing
98
- this._startCommandProcessor();
99
- this.isRunning = true;
100
- this.logger.info('Command relay service started successfully');
101
- // Send startup notification
102
- this.emit('started');
103
- }
104
- catch (error) {
105
- this.logger.error('Failed to start command relay service:', error.message);
106
- throw error;
107
- }
108
- }
109
- async stop() {
110
- if (!this.isRunning) {
111
- return;
112
- }
113
- this.isRunning = false;
114
- // Stop email listener
115
- if (this.emailListener) {
116
- await this.emailListener.stop();
117
- this.emailListener = null;
118
- }
119
- // Save state
120
- this._saveState();
121
- this.logger.info('Command relay service stopped');
122
- this.emit('stopped');
123
- }
124
- _queueCommand(commandData) {
125
- const queueItem = {
126
- id: this._generateId(),
127
- ...commandData,
128
- queuedAt: new Date().toISOString(),
129
- status: 'queued',
130
- retries: 0,
131
- maxRetries: 3
132
- };
133
- this.commandQueue.push(queueItem);
134
- this._saveState();
135
- this.logger.info(`Command queued:`, {
136
- id: queueItem.id,
137
- sessionId: queueItem.sessionId,
138
- command: queueItem.command.substring(0, 50) + '...'
139
- });
140
- this.emit('commandQueued', queueItem);
141
- }
142
- _startCommandProcessor() {
143
- // Process queue immediately
144
- this._processCommandQueue();
145
- // Process queue periodically
146
- setInterval(() => {
147
- if (this.isRunning) {
148
- this._processCommandQueue();
149
- }
150
- }, 5000); // Check every 5 seconds
151
- }
152
- async _processCommandQueue() {
153
- if (this.processingQueue || this.commandQueue.length === 0) {
154
- return;
155
- }
156
- this.processingQueue = true;
157
- try {
158
- const pendingCommands = this.commandQueue.filter(cmd => cmd.status === 'queued');
159
- for (const command of pendingCommands) {
160
- try {
161
- await this._executeCommand(command);
162
- }
163
- catch (error) {
164
- this.logger.error(`Failed to execute command ${command.id}:`, error.message);
165
- this._handleCommandError(command, error);
166
- }
167
- }
168
- }
169
- finally {
170
- this.processingQueue = false;
171
- }
172
- }
173
- async _executeCommand(commandItem) {
174
- this.logger.info(`Executing command ${commandItem.id}:`, {
175
- sessionId: commandItem.sessionId,
176
- command: commandItem.command.substring(0, 100)
177
- });
178
- commandItem.status = 'executing';
179
- commandItem.executedAt = new Date().toISOString();
180
- try {
181
- // Check if Claude Code process is running
182
- const claudeProcess = await this._findClaudeCodeProcess();
183
- if (!claudeProcess || !claudeProcess.available) {
184
- throw new Error('Claude Code not available');
185
- }
186
- // Execute command - try multiple methods
187
- const success = await this._sendCommandToClaudeCode(commandItem.command, claudeProcess, commandItem.sessionId);
188
- if (success) {
189
- commandItem.status = 'completed';
190
- commandItem.completedAt = new Date().toISOString();
191
- // Update session command count
192
- if (this.emailListener) {
193
- await this.emailListener.updateSessionCommandCount(commandItem.sessionId);
194
- }
195
- this.logger.info(`Command ${commandItem.id} executed successfully`);
196
- this.emit('commandExecuted', commandItem);
197
- }
198
- else {
199
- throw new Error('Failed to send command to Claude Code');
200
- }
201
- }
202
- catch (error) {
203
- commandItem.status = 'failed';
204
- commandItem.error = error.message;
205
- commandItem.failedAt = new Date().toISOString();
206
- this.logger.error(`Command ${commandItem.id} failed:`, error.message);
207
- this.emit('commandFailed', commandItem, error);
208
- throw error;
209
- }
210
- finally {
211
- this._saveState();
212
- }
213
- }
214
- async _findClaudeCodeProcess() {
215
- return new Promise((resolve) => {
216
- // Find Claude Code related processes
217
- const ps = (0, child_process_1.spawn)('ps', ['aux']);
218
- let output = '';
219
- ps.stdout.on('data', (data) => {
220
- output += data.toString();
221
- });
222
- ps.on('close', (code) => {
223
- const lines = output.split('\n');
224
- const claudeProcesses = lines.filter(line => (line.includes('claude') ||
225
- line.includes('anthropic') ||
226
- line.includes('Claude') ||
227
- line.includes('node') && line.includes('claude')) &&
228
- !line.includes('grep') &&
229
- !line.includes('taskping') &&
230
- !line.includes('ps aux'));
231
- if (claudeProcesses.length > 0) {
232
- // Parse process ID
233
- const processLine = claudeProcesses[0];
234
- const parts = processLine.trim().split(/\s+/);
235
- const pid = parseInt(parts[1]);
236
- this.logger.debug('Found Claude Code process:', processLine);
237
- resolve({
238
- pid,
239
- command: processLine
240
- });
241
- }
242
- else {
243
- // If no process found, assume Claude Code can be accessed via desktop automation
244
- this.logger.debug('No Claude Code process found, will try desktop automation');
245
- resolve({ pid: null, available: true });
246
- }
247
- });
248
- ps.on('error', (error) => {
249
- this.logger.error('Error finding Claude Code process:', error.message);
250
- // Even if error occurs, try desktop automation
251
- resolve({ pid: null, available: true });
252
- });
253
- });
254
- }
255
- async _sendCommandToClaudeCode(command, claudeProcess, sessionId) {
256
- return new Promise(async (resolve) => {
257
- try {
258
- // Method 1: Claude Code dedicated automation (most direct and reliable)
259
- this.logger.info('Attempting to send command via Claude automation...');
260
- const claudeSuccess = await this.claudeAutomation.sendCommand(command, sessionId);
261
- if (claudeSuccess) {
262
- this.logger.info('Command sent and executed successfully via Claude automation');
263
- resolve(true);
264
- return;
265
- }
266
- // Method 2: Clipboard automation (requires permissions)
267
- if (this.clipboardAutomation.isSupported()) {
268
- this.logger.info('Attempting to send command via clipboard automation...');
269
- const clipboardSuccess = await this.clipboardAutomation.sendCommand(command);
270
- if (clipboardSuccess) {
271
- this.logger.info('Command sent successfully via clipboard automation');
272
- resolve(true);
273
- return;
274
- }
275
- this.logger.warn('Clipboard automation failed, trying other methods...');
276
- }
277
- // Method 3: Simple automation solution (includes multiple fallback options)
278
- this.logger.info('Attempting to send command via simple automation...');
279
- const simpleSuccess = await this.simpleAutomation.sendCommand(command, sessionId);
280
- if (simpleSuccess) {
281
- this.logger.info('Command sent successfully via simple automation');
282
- resolve(true);
283
- return;
284
- }
285
- // Method 4: Use command bridge (file-based approach)
286
- this.logger.info('Attempting to send command via bridge...');
287
- const bridgeSuccess = await this.commandBridge.sendCommand(command, sessionId);
288
- if (bridgeSuccess) {
289
- this.logger.info('Command sent successfully via bridge');
290
- resolve(true);
291
- return;
292
- }
293
- // Method 5: Send notification as final fallback
294
- this.logger.info('Using notification as final fallback...');
295
- this._sendCommandViaNotification(command)
296
- .then((success) => {
297
- this.logger.info('Command notification sent as fallback');
298
- resolve(success);
299
- })
300
- .catch(() => resolve(false));
301
- }
302
- catch (error) {
303
- this.logger.error('Error sending command to Claude Code:', error.message);
304
- resolve(false);
305
- }
306
- });
307
- }
308
- async _sendCommandViaMacOS(command) {
309
- return new Promise((resolve, reject) => {
310
- // Use AppleScript automation to input to active window
311
- const escapedCommand = command.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/'/g, "\\'");
312
- const script = `
313
- tell application "System Events"
314
- -- Get current active application
315
- set activeApp to name of first application process whose frontmost is true
316
-
317
- -- Try to find Claude Code, Terminal or other development tools
318
- set targetApps to {"Claude Code", "Terminal", "iTerm2", "iTerm", "Visual Studio Code", "Code"}
319
- set foundApp to null
320
-
321
- repeat with appName in targetApps
322
- try
323
- if application process appName exists then
324
- set foundApp to application process appName
325
- exit repeat
326
- end if
327
- end try
328
- end repeat
329
-
330
- if foundApp is not null then
331
- -- Switch to target application
332
- set frontmost of foundApp to true
333
- delay 1
334
-
335
- -- Send command
336
- keystroke "${escapedCommand}"
337
- delay 0.3
338
- keystroke return
339
-
340
- return "success"
341
- else
342
- -- If no specific application found, try current active window
343
- keystroke "${escapedCommand}"
344
- delay 0.3
345
- keystroke return
346
- return "fallback"
347
- end if
348
- end tell
349
- `;
350
- const osascript = (0, child_process_1.spawn)('osascript', ['-e', script]);
351
- let output = '';
352
- let errorOutput = '';
353
- osascript.stdout.on('data', (data) => {
354
- output += data.toString().trim();
355
- });
356
- osascript.stderr.on('data', (data) => {
357
- errorOutput += data.toString();
358
- });
359
- osascript.on('close', (code) => {
360
- if (code === 0 && (output === 'success' || output === 'fallback')) {
361
- this.logger.debug(`Command sent via macOS automation (${output})`);
362
- resolve(true);
363
- }
364
- else {
365
- this.logger.warn('AppleScript failed:', { code, output, error: errorOutput });
366
- reject(new Error(`macOS automation failed: ${errorOutput || output}`));
367
- }
368
- });
369
- osascript.on('error', (err) => {
370
- reject(err);
371
- });
372
- });
373
- }
374
- async _sendCommandViaNotification(command) {
375
- // As fallback option, send desktop notification to remind user
376
- return new Promise((resolve) => {
377
- try {
378
- const commandPreview = command.length > 50 ? command.substring(0, 50) + '...' : command;
379
- if (process.platform === 'darwin') {
380
- // macOS notification with more information
381
- const script = `
382
- display notification "Command: ${commandPreview.replace(/"/g, '\\"')}" with title "TaskPing - Email Command" subtitle "Click Terminal or Claude Code window, then paste command" sound name "default"
383
- `;
384
- const notification = (0, child_process_1.spawn)('osascript', ['-e', script]);
385
- notification.on('close', () => {
386
- this.logger.info('macOS notification sent to user');
387
- resolve(true);
388
- });
389
- notification.on('error', () => {
390
- resolve(false);
391
- });
392
- }
393
- else {
394
- // Linux notification
395
- const notification = (0, child_process_1.spawn)('notify-send', [
396
- 'TaskPing - Email Command',
397
- `Command: ${commandPreview}`
398
- ]);
399
- notification.on('close', () => {
400
- this.logger.info('Linux notification sent to user');
401
- resolve(true);
402
- });
403
- notification.on('error', () => {
404
- resolve(false);
405
- });
406
- }
407
- }
408
- catch (error) {
409
- this.logger.warn('Failed to send notification:', error.message);
410
- resolve(false);
411
- }
412
- });
413
- }
414
- _handleCommandError(commandItem, error) {
415
- commandItem.retries = (commandItem.retries || 0) + 1;
416
- if (commandItem.retries < commandItem.maxRetries) {
417
- // Retry
418
- commandItem.status = 'queued';
419
- commandItem.retryAt = new Date(Date.now() + (commandItem.retries * 60000)).toISOString(); // Delayed retry
420
- this.logger.info(`Command ${commandItem.id} will be retried (attempt ${commandItem.retries + 1})`);
421
- }
422
- else {
423
- // Reached maximum retry count
424
- commandItem.status = 'failed';
425
- this.logger.error(`Command ${commandItem.id} failed after ${commandItem.retries} retries`);
426
- }
427
- this._saveState();
428
- }
429
- _generateId() {
430
- return Date.now().toString(36) + Math.random().toString(36).substr(2);
431
- }
432
- getStatus() {
433
- return {
434
- isRunning: this.isRunning,
435
- queueLength: this.commandQueue.length,
436
- processing: this.processingQueue,
437
- emailListener: this.emailListener ? {
438
- connected: this.emailListener.isConnected,
439
- listening: this.emailListener.isListening
440
- } : null,
441
- recentCommands: this.commandQueue.slice(-5).map(cmd => ({
442
- id: cmd.id,
443
- status: cmd.status,
444
- queuedAt: cmd.queuedAt,
445
- command: cmd.command.substring(0, 50) + '...'
446
- }))
447
- };
448
- }
449
- // Manually cleanup completed commands
450
- cleanupCompletedCommands() {
451
- const beforeCount = this.commandQueue.length;
452
- this.commandQueue = this.commandQueue.filter(cmd => cmd.status !== 'completed' ||
453
- new Date(cmd.completedAt) > new Date(Date.now() - 24 * 60 * 60 * 1000) // Keep records within 24 hours
454
- );
455
- const removedCount = beforeCount - this.commandQueue.length;
456
- if (removedCount > 0) {
457
- this.logger.info(`Cleaned up ${removedCount} completed commands`);
458
- this._saveState();
459
- }
460
- }
461
- }
462
- module.exports = CommandRelayService;
463
- //# sourceMappingURL=command-relay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-relay.js","sourceRoot":"","sources":["../../../src/relay/command-relay.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,oDAAkC;AAClC,sEAA6C;AAC7C,oFAA0D;AAC1D,4DAAoC;AACpC,iDAAsC;AACtC,4CAAoB;AACpB,gDAAwB;AAExB,wDAAwD;AACxD,MAAM,mBAAmB,GAAG,OAAO,CAAC,oCAAoC,CAAQ,CAAC;AACjF,MAAM,gBAAgB,GAAG,OAAO,CAAC,iCAAiC,CAAQ,CAAC;AAC3E,MAAM,gBAAgB,GAAG,OAAO,CAAC,iCAAiC,CAAQ,CAAC;AAoD3E,MAAM,mBAAoB,SAAQ,gBAAY;IAC1C,MAAM,CAAS;IACf,MAAM,CAAc;IACpB,aAAa,CAAuB;IACpC,aAAa,CAAsB;IACnC,mBAAmB,CA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