@codemieai/code 0.0.37 → 0.0.40
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/agents/core/AgentCLI.d.ts.map +1 -1
- package/dist/agents/core/AgentCLI.js +9 -1
- package/dist/agents/core/AgentCLI.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts +15 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +80 -12
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/core/types.d.ts +34 -0
- package/dist/agents/core/types.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts +18 -0
- package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.js +104 -3
- package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
- package/dist/agents/plugins/claude/plugin/.claude-plugin/local-install.json +1 -0
- package/dist/agents/plugins/claude/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/agents/plugins/claude/plugin/README.md +96 -0
- package/dist/agents/plugins/claude/plugin/commands/README.md +103 -22
- package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +329 -18
- package/dist/agents/plugins/claude/plugin/hooks/hooks.json +16 -0
- package/dist/agents/plugins/claude/plugin/sounds/play-random-sound.ps1 +112 -0
- package/dist/agents/plugins/claude/plugin/sounds/play-random-sound.sh +58 -0
- package/dist/agents/plugins/claude/sounds-installer.d.ts +19 -0
- package/dist/agents/plugins/claude/sounds-installer.d.ts.map +1 -0
- package/dist/agents/plugins/claude/sounds-installer.js +164 -0
- package/dist/agents/plugins/claude/sounds-installer.js.map +1 -0
- package/dist/cli/commands/hook.d.ts +72 -0
- package/dist/cli/commands/hook.d.ts.map +1 -1
- package/dist/cli/commands/hook.js +290 -110
- package/dist/cli/commands/hook.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +13 -0
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/log/cleaner.d.ts +4 -0
- package/dist/cli/commands/log/cleaner.d.ts.map +1 -1
- package/dist/cli/commands/log/cleaner.js +4 -0
- package/dist/cli/commands/log/cleaner.js.map +1 -1
- package/dist/cli/commands/log/formatter.d.ts +1 -0
- package/dist/cli/commands/log/formatter.d.ts.map +1 -1
- package/dist/cli/commands/log/formatter.js +4 -13
- package/dist/cli/commands/log/formatter.js.map +1 -1
- package/dist/cli/commands/log/index.js +2 -0
- package/dist/cli/commands/log/index.js.map +1 -1
- package/dist/cli/commands/log/reader.d.ts +5 -0
- package/dist/cli/commands/log/reader.d.ts.map +1 -1
- package/dist/cli/commands/log/reader.js +47 -10
- package/dist/cli/commands/log/reader.js.map +1 -1
- package/dist/cli/commands/profile/display.d.ts +1 -0
- package/dist/cli/commands/profile/display.d.ts.map +1 -1
- package/dist/cli/commands/profile/display.js +10 -2
- package/dist/cli/commands/profile/display.js.map +1 -1
- package/dist/cli/commands/profile/index.js +58 -22
- package/dist/cli/commands/profile/index.js.map +1 -1
- package/dist/cli/commands/setup.js +296 -24
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/env/types.d.ts +12 -1
- package/dist/env/types.d.ts.map +1 -1
- package/dist/env/types.js.map +1 -1
- package/dist/hooks/types.d.ts +2 -0
- package/dist/hooks/types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/plugins/bedrock/bedrock.template.d.ts.map +1 -1
- package/dist/providers/plugins/bedrock/bedrock.template.js +12 -0
- package/dist/providers/plugins/bedrock/bedrock.template.js.map +1 -1
- package/dist/utils/config.d.ts +35 -8
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +249 -33
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +42 -0
- package/dist/utils/logger.js.map +1 -1
- package/package.json +1 -1
- package/dist/agents/plugins/claude/plugin/commands/memory-add.md +0 -325
- package/dist/agents/plugins/claude/plugin/commands/memory-init.md +0 -18
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sounds Installer
|
|
3
|
+
*
|
|
4
|
+
* Automated installation of the sound hooks system for Claude Code.
|
|
5
|
+
* Creates hook directories, installs play-random-sound.sh script, and configures hooks.
|
|
6
|
+
*/
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import ora from 'ora';
|
|
9
|
+
import { exec } from '../../../utils/exec.js';
|
|
10
|
+
import { getCodemiePath } from '../../../utils/paths.js';
|
|
11
|
+
import { existsSync } from 'fs';
|
|
12
|
+
import { mkdir } from 'fs/promises';
|
|
13
|
+
import { join } from 'path';
|
|
14
|
+
import { logger } from '../../../utils/logger.js';
|
|
15
|
+
import { createErrorContext } from '../../../utils/errors.js';
|
|
16
|
+
/**
|
|
17
|
+
* Check if required audio player is available
|
|
18
|
+
* @returns Audio player command name if found, null otherwise
|
|
19
|
+
*/
|
|
20
|
+
async function checkAudioPlayer() {
|
|
21
|
+
const players = ['afplay', 'aplay', 'paplay', 'mpg123'];
|
|
22
|
+
for (const player of players) {
|
|
23
|
+
try {
|
|
24
|
+
await exec('command', ['-v', player]);
|
|
25
|
+
logger.debug('Audio player found', { player, feature: 'sounds' });
|
|
26
|
+
return player;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
// Log the specific error for debugging
|
|
30
|
+
logger.debug('Audio player not available', {
|
|
31
|
+
player,
|
|
32
|
+
feature: 'sounds',
|
|
33
|
+
error: error instanceof Error ? error.message : String(error)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
logger.debug('No audio players found', {
|
|
38
|
+
checkedPlayers: players,
|
|
39
|
+
feature: 'sounds',
|
|
40
|
+
note: 'User needs to install an audio player for sounds to work'
|
|
41
|
+
});
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create hook directories for sound files
|
|
46
|
+
*/
|
|
47
|
+
async function createSoundDirectories() {
|
|
48
|
+
const soundsDir = getCodemiePath('sounds');
|
|
49
|
+
const directories = ['SessionStart', 'UserPromptSubmit', 'PermissionRequest', 'Stop'];
|
|
50
|
+
// Create directories in parallel for better performance
|
|
51
|
+
await Promise.all(directories.map(dir => mkdir(join(soundsDir, dir), { recursive: true })));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Display post-installation instructions
|
|
55
|
+
*
|
|
56
|
+
* NOTE: This function violates typical utils layer pattern by handling UI directly.
|
|
57
|
+
* This is an intentional exception because:
|
|
58
|
+
* 1. The instructions are tightly coupled to the installation implementation details
|
|
59
|
+
* 2. The installation function is only called from CLI contexts (setup command)
|
|
60
|
+
* 3. Extracting to CLI layer would require passing extensive path information
|
|
61
|
+
*
|
|
62
|
+
* Future refactor: Consider returning an InstallationResult data structure
|
|
63
|
+
* and moving display logic to CLI layer if this utility needs reuse in non-CLI contexts.
|
|
64
|
+
*/
|
|
65
|
+
function displayPostInstallInstructions() {
|
|
66
|
+
const soundsDir = getCodemiePath('sounds');
|
|
67
|
+
console.log();
|
|
68
|
+
console.log(chalk.bold.green('🎉 Sounds installed successfully!'));
|
|
69
|
+
console.log();
|
|
70
|
+
console.log(chalk.cyan('📂 Next Steps:'));
|
|
71
|
+
console.log();
|
|
72
|
+
console.log(chalk.white('1. Download your favorite sound effects (WAV or MP3 format)'));
|
|
73
|
+
console.log(chalk.white('2. Add them to these directories:'));
|
|
74
|
+
console.log(chalk.dim(` ${join(soundsDir, 'SessionStart')}/`), chalk.white('(plays when starting)'));
|
|
75
|
+
console.log(chalk.dim(` ${join(soundsDir, 'UserPromptSubmit')}/`), chalk.white('(plays when you send a message)'));
|
|
76
|
+
console.log(chalk.dim(` ${join(soundsDir, 'PermissionRequest')}/`), chalk.white('(plays when you claude asks for clarification or permission)'));
|
|
77
|
+
console.log(chalk.dim(` ${join(soundsDir, 'Stop')}/`), chalk.white('(plays when Claude completes)'));
|
|
78
|
+
console.log();
|
|
79
|
+
console.log(chalk.white('💡 Suggestions:'));
|
|
80
|
+
console.log(chalk.dim(' • SessionStart:'), chalk.white('Welcome sounds, greetings'));
|
|
81
|
+
console.log(chalk.dim(' • UserPromptSubmit:'), chalk.white('Acknowledgment sounds (e.g., "Roger")'));
|
|
82
|
+
console.log(chalk.dim(' • PermissionRequest:'), chalk.white('Question sounds (e.g., "Proceed?")'));
|
|
83
|
+
console.log(chalk.dim(' • Stop:'), chalk.white('Completion sounds (e.g., "Done")'));
|
|
84
|
+
console.log();
|
|
85
|
+
console.log(chalk.white('🎮 Example sound packs:'));
|
|
86
|
+
console.log(chalk.dim(' • Warcraft peon sounds (classic "Work work", "Yes milord")'));
|
|
87
|
+
console.log(chalk.dim(' • StarCraft unit acknowledgments'));
|
|
88
|
+
console.log(chalk.dim(' • Portal 2 GLaDOS quotes'));
|
|
89
|
+
console.log();
|
|
90
|
+
console.log(chalk.white('💾 Where to download sounds:'));
|
|
91
|
+
console.log(chalk.blueBright(' https://x.com/delba_oliveira/status/2020515010985005255'));
|
|
92
|
+
console.log();
|
|
93
|
+
console.log(chalk.dim(`⚙️ Hooks configuration saved in: ${getCodemiePath('claude-plugin/hooks/hooks.json')}`));
|
|
94
|
+
console.log(chalk.dim(`📜 Script location: ${join(soundsDir, 'play-random-sound.sh')}`));
|
|
95
|
+
console.log(chalk.dim(' Script would appear after codemie-claude first run'));
|
|
96
|
+
console.log(chalk.white('💡 If script did not appear, remove ~/.codemie/claude-plugin directory and restart codemie-claude'));
|
|
97
|
+
console.log();
|
|
98
|
+
console.log(chalk.bold.yellow('⚠️ WINDOWS USERS:'));
|
|
99
|
+
console.log(chalk.yellow(' After codemie-claude first run, edit ~/.codemie/claude-plugin/hooks/hooks.json'));
|
|
100
|
+
console.log(chalk.yellow(' Change all instances of "play-random-sound.sh" to "play-random-sound.ps1"'));
|
|
101
|
+
console.log();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Install fun sounds system
|
|
105
|
+
* Creates directories, installs script, and saves hooks configuration to ~/.claude/settings.json
|
|
106
|
+
*
|
|
107
|
+
* @returns Hooks configuration object if successful, null if installation failed
|
|
108
|
+
*/
|
|
109
|
+
export async function installSounds() {
|
|
110
|
+
try {
|
|
111
|
+
// 1. Pre-flight: Check audio player
|
|
112
|
+
const spinner = ora('Checking audio player...').start();
|
|
113
|
+
const audioPlayer = await checkAudioPlayer();
|
|
114
|
+
if (!audioPlayer) {
|
|
115
|
+
spinner.fail(chalk.red('No audio player found'));
|
|
116
|
+
logger.warn('Sounds installation skipped - no audio player available', {
|
|
117
|
+
operation: 'installSounds',
|
|
118
|
+
feature: 'sounds',
|
|
119
|
+
checkedPlayers: ['afplay', 'aplay', 'paplay', 'mpg123']
|
|
120
|
+
});
|
|
121
|
+
console.log();
|
|
122
|
+
console.log(chalk.yellow('⚠️ Sounds require an audio player to work.'));
|
|
123
|
+
console.log(chalk.white('Checked for: afplay, aplay, paplay, mpg123'));
|
|
124
|
+
console.log();
|
|
125
|
+
console.log(chalk.white('Install instructions:'));
|
|
126
|
+
console.log(chalk.white(' macOS:'), chalk.dim('afplay (built-in)'));
|
|
127
|
+
console.log(chalk.white(' Linux:'), chalk.dim('sudo apt install alsa-utils (aplay)'));
|
|
128
|
+
console.log(chalk.white(' '), chalk.dim('or sudo apt install pulseaudio-utils (paplay)'));
|
|
129
|
+
console.log(chalk.white(' Windows:'), chalk.dim('Install mpg123 via Chocolatey: choco install mpg123'));
|
|
130
|
+
console.log(chalk.white(' Alternative:'), chalk.dim('brew install mpg123 (macOS), sudo apt install mpg123 (Linux)'));
|
|
131
|
+
console.log();
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
spinner.succeed(chalk.green(`Audio player found: ${audioPlayer}`));
|
|
135
|
+
// 2. Create hook directories
|
|
136
|
+
const dirSpinner = ora('Creating sound directories...').start();
|
|
137
|
+
await createSoundDirectories();
|
|
138
|
+
dirSpinner.succeed(chalk.green('Sound directories created'));
|
|
139
|
+
// 3. Display post-install instructions
|
|
140
|
+
displayPostInstallInstructions();
|
|
141
|
+
return "success";
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
const errorContext = createErrorContext(error);
|
|
145
|
+
logger.error('Sounds installation failed', {
|
|
146
|
+
...errorContext,
|
|
147
|
+
operation: 'installSounds'
|
|
148
|
+
});
|
|
149
|
+
console.log();
|
|
150
|
+
console.log(chalk.red('❌ Sounds installation failed'));
|
|
151
|
+
console.log(chalk.yellow('You can try again later by running: codemie install claude --sounds'));
|
|
152
|
+
console.log();
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Check if sounds are already installed
|
|
158
|
+
* @returns true if exist sounds directory
|
|
159
|
+
*/
|
|
160
|
+
export function isSoundsInstalled() {
|
|
161
|
+
const soundsDir = getCodemiePath('sounds');
|
|
162
|
+
return existsSync(soundsDir);
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=sounds-installer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sounds-installer.js","sourceRoot":"","sources":["../../../../src/agents/plugins/claude/sounds-installer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MA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AC,CAAC,KAAK,EAAE,CAAC;QAChE,MAAM,sBAAsB,EAAE,CAAC;QAC/B,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;QAE7D,uCAAuC;QACvC,8BAA8B,EAAE,CAAC;QAEjC,OAAO,SAAS,CAAC;IAErB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE;YACvC,GAAG,YAAY;YACf,SAAS,EAAE,eAAe;SAC7B,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qEAAqE,CAAC,CAAC,CAAC;QACjG,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC7B,MAAM,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAE3C,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1,4 +1,76 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
import type { BaseHookEvent } from '../../agents/core/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Hook event handlers for agent lifecycle events
|
|
5
|
+
* Called by agent plugin hooks via stdin JSON
|
|
6
|
+
*
|
|
7
|
+
* This is a unified hook handler that routes based on hook_event_name
|
|
8
|
+
* from the JSON payload. All agent hooks send their event type.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* SessionStart event
|
|
12
|
+
*/
|
|
13
|
+
export interface SessionStartEvent extends BaseHookEvent {
|
|
14
|
+
hook_event_name: 'SessionStart';
|
|
15
|
+
source: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* SessionEnd event
|
|
19
|
+
*/
|
|
20
|
+
export interface SessionEndEvent extends BaseHookEvent {
|
|
21
|
+
hook_event_name: 'SessionEnd';
|
|
22
|
+
reason: string;
|
|
23
|
+
cwd: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* SubagentStop event
|
|
27
|
+
*/
|
|
28
|
+
export interface SubagentStopEvent extends BaseHookEvent {
|
|
29
|
+
hook_event_name: 'SubagentStop';
|
|
30
|
+
agent_id: string;
|
|
31
|
+
agent_transcript_path: string;
|
|
32
|
+
stop_hook_active: boolean;
|
|
33
|
+
cwd: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Configuration for hook event processing
|
|
37
|
+
* Used for programmatic API usage (when not using environment variables)
|
|
38
|
+
*/
|
|
39
|
+
export interface HookProcessingConfig {
|
|
40
|
+
/** Agent name (e.g., 'claude', 'gemini') */
|
|
41
|
+
agentName: string;
|
|
42
|
+
/** CodeMie session ID */
|
|
43
|
+
sessionId: string;
|
|
44
|
+
/** Provider name (e.g., 'ai-run-sso') */
|
|
45
|
+
provider?: string;
|
|
46
|
+
/** API base URL */
|
|
47
|
+
apiBaseUrl?: string;
|
|
48
|
+
/** SSO cookies for authentication */
|
|
49
|
+
cookies?: string;
|
|
50
|
+
/** API key for localhost development */
|
|
51
|
+
apiKey?: string;
|
|
52
|
+
/** Client type identifier (e.g., 'vscode-codemie', 'codemie-cli') */
|
|
53
|
+
clientType?: string;
|
|
54
|
+
/** Client version */
|
|
55
|
+
version?: string;
|
|
56
|
+
/** Profile name for logging */
|
|
57
|
+
profileName?: string;
|
|
58
|
+
/** Project name */
|
|
59
|
+
project?: string;
|
|
60
|
+
/** Model name */
|
|
61
|
+
model?: string;
|
|
62
|
+
/** SSO URL for credential loading */
|
|
63
|
+
ssoUrl?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Process a hook event programmatically
|
|
67
|
+
* Main entry point for programmatic API usage (e.g., VSCode plugin)
|
|
68
|
+
*
|
|
69
|
+
* @param event - Hook event to process
|
|
70
|
+
* @param config - Optional configuration object (if not provided, reads from environment variables)
|
|
71
|
+
* @throws Error if event processing fails and config is provided
|
|
72
|
+
*/
|
|
73
|
+
export declare function processEvent(event: BaseHookEvent, config?: HookProcessingConfig): Promise<void>;
|
|
2
74
|
/**
|
|
3
75
|
* Create unified hook command
|
|
4
76
|
* Routes to appropriate handler based on hook_event_name in JSON payload
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,KAAK,EAAE,aAAa,EAAqC,MAAM,4BAA4B,CAAC;AAGnG;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,eAAe,EAAE,cAAc,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,eAAe,EAAE,YAAY,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,eAAe,EAAE,cAAc,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,oB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