create-mushin 0.3.0 → 0.4.0-next.20261124175848
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/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -89,7 +89,7 @@ const PNPM_SETTINGS = `allowBuilds:
|
|
|
89
89
|
function agentsGuide(name) {
|
|
90
90
|
return `# ${name}
|
|
91
91
|
|
|
92
|
-
This folder is a [Mushin.js](https://github.com/mushinjs/mushin) app: a chatbot framework for QQ (through OneBot / NapCat) with LLM chat, conversation flows and
|
|
92
|
+
This folder is a [Mushin.js](https://github.com/mushinjs/mushin) app: a chatbot framework for QQ (through OneBot / NapCat) with LLM chat, conversation flows and a Fairy. Read this before changing anything here.
|
|
93
93
|
|
|
94
94
|
## Commands
|
|
95
95
|
|
|
@@ -118,7 +118,7 @@ This folder is a [Mushin.js](https://github.com/mushinjs/mushin) app: a chatbot
|
|
|
118
118
|
|
|
119
119
|
| Path | What it is | Who writes it |
|
|
120
120
|
| --- | --- | --- |
|
|
121
|
-
| \`mushin.config.json\` | Which plugins run, and their settings. Holds no secrets. | People, the dashboard,
|
|
121
|
+
| \`mushin.config.json\` | Which plugins run, and their settings. Holds no secrets. | People, the dashboard, Fairy |
|
|
122
122
|
| \`.mcp.json\` | Connects the AI tool opened here to Mushin.js. Holds no secrets. | create-mushin |
|
|
123
123
|
| \`.claude/skills/\` | The official skills for AI tools | Mushin.js (on create and upgrade) |
|
|
124
124
|
| \`.env\` | Secrets: the admin token, provider keys, bot tokens. Configuration refers to them as \`\${NAME}\`. | Mushin.js and people |
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { spawn } from 'node:child_process'\nimport { readFileSync } from 'node:fs'\nimport { mkdir, readdir, writeFile } from 'node:fs/promises'\nimport { basename, join, resolve } from 'node:path'\n\n/** The version of this package, which every `@mushinjs/*` package shares. */\nexport const VERSION: string = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version\n\nexport type PackageManager = 'npm' | 'pnpm'\n\n/** The package manager that ran `npm create` / `pnpm create`, from the user agent it sets. */\nexport function detectPackageManager(userAgent = process.env.npm_config_user_agent ?? ''): PackageManager {\n return userAgent.startsWith('pnpm') ? 'pnpm' : 'npm'\n}\n\n/** The version range the app depends on: a preview is pinned exactly, a release takes compatible updates. */\nexport function dependencyRange(version = VERSION) {\n return version.includes('-') ? version : `^${version}`\n}\n\n/** A package name made from a folder name: `My Bot` gives `my-bot`. */\nexport function packageName(dir: string) {\n const name = basename(resolve(dir)).toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^[._-]+|-+$/g, '')\n return name || 'mushin-app'\n}\n\n/** The files of a new app, by path relative to its folder. */\nexport function appFiles(name: string, version = VERSION, packageManager: PackageManager = 'npm'): Record<string, string> {\n const range = dependencyRange(version)\n const json = (value: unknown) => JSON.stringify(value, null, 2) + '\\n'\n return {\n 'package.json': json({\n name,\n private: true,\n type: 'module',\n scripts: {\n start: 'mushin start',\n upgrade: 'mushin upgrade',\n typecheck: 'tsc',\n },\n dependencies: {\n '@mushinjs/cli': range,\n // Local plugins in plugins/ import it; with pnpm they only see the app's own dependencies.\n '@mushinjs/core': range,\n },\n devDependencies: {\n '@types/node': '^22.13.0',\n typescript: '^6.0.3',\n },\n engines: { node: '>=22.13' },\n }),\n 'tsconfig.json': json({\n compilerOptions: {\n target: 'es2023',\n lib: ['es2023'],\n module: 'preserve',\n moduleResolution: 'bundler',\n types: ['node'],\n strict: true,\n noEmit: true,\n skipLibCheck: true,\n isolatedModules: true,\n verbatimModuleSyntax: true,\n },\n include: ['plugins/*/src'],\n }),\n '.gitignore': [\n 'node_modules/',\n '# Secrets: keys, tokens. Never commit or share this file.',\n '.env',\n '# Written by Mushin.js. Back up data/; cache/ and logs/ can be deleted.',\n 'data/',\n 'cache/',\n 'logs/',\n '',\n ].join('\\n'),\n 'AGENTS.md': agentsGuide(name),\n // Connects the AI tool opened in this folder to the running Mushin.js; the token stays in .env.\n '.mcp.json': json({\n mcpServers: {\n mushin: { type: 'stdio', command: 'node', args: ['node_modules/@mushinjs/cli/bin/mushin.js', 'mcp'] },\n },\n }),\n 'plugins/.gitkeep': '',\n 'skills/.gitkeep': '',\n ...(packageManager === 'pnpm' ? { 'pnpm-workspace.yaml': PNPM_SETTINGS } : {}),\n }\n}\n\n/**\n * pnpm runs no install scripts it was not told about, and stops the install over them. esbuild (through tsx,\n * for TypeScript plugins) needs its script; ssh2 (the terminal plugin) works without its optional native parts.\n */\nconst PNPM_SETTINGS = `allowBuilds:\n esbuild: true\n cpu-features: false\n ssh2: false\n`\n\nfunction agentsGuide(name: string) {\n return `# ${name}\n\nThis folder is a [Mushin.js](https://github.com/mushinjs/mushin) app: a chatbot framework for QQ (through OneBot / NapCat) with LLM chat, conversation flows and an Agent. Read this before changing anything here.\n\n## Commands\n\n- \\`npm start\\` starts Mushin.js and prints the dashboard sign-in link (\\`pnpm start\\` with pnpm).\n- \\`npm run upgrade\\` updates every \\`@mushinjs/*\\` package and moves the data to the new version's layout. Stop Mushin.js first.\n- \\`npx mushin new plugin <name>\\` creates a TypeScript plugin in \\`plugins/<name>/\\` and turns it on.\n- \\`npm run typecheck\\` checks the plugins in \\`plugins/\\`.\n- \\`npx mushin token reset\\` makes a new admin token for the dashboard.\n\n## Managing Mushin.js from an AI tool\n\n\\`.mcp.json\\` connects the AI tool you open in this folder (Claude Code and others that read it) to the running Mushin.js through \\`mushin mcp\\`. Start Mushin.js first. The tools are Mushin.js actions: list bots, read logs, build and test flows, and more. Dangerous ones wait for approval in the dashboard. The admin token is read from \\`.env\\`; do not copy it anywhere.\n\n## Skills\n\n\\`.claude/skills/\\` holds the official skills. Read the matching \\`SKILL.md\\` before you start one of these jobs, whichever AI tool you are:\n\n- \\`mushin-plugin-dev\\`: writing or changing a plugin in \\`plugins/\\`. It starts with the questions to ask the user first.\n- \\`mushin-flows\\`: building and testing conversation flows.\n- \\`mushin-troubleshoot\\`: finding out why a bot, command, flow or plugin does not work.\n- \\`mushin-operations\\`: upgrades, backups, restores, moving machines, the admin token.\n\n\\`npm run upgrade\\` replaces them with the new version's; put your own skills in other folders.\n\n## Layout\n\n| Path | What it is | Who writes it |\n| --- | --- | --- |\n| \\`mushin.config.json\\` | Which plugins run, and their settings. Holds no secrets. | People, the dashboard, the Agent |\n| \\`.mcp.json\\` | Connects the AI tool opened here to Mushin.js. Holds no secrets. | create-mushin |\n| \\`.claude/skills/\\` | The official skills for AI tools | Mushin.js (on create and upgrade) |\n| \\`.env\\` | Secrets: the admin token, provider keys, bot tokens. Configuration refers to them as \\`\\${NAME}\\`. | Mushin.js and people |\n| \\`plugins/\\` | Local plugins, run as TypeScript without a build step | People and AIs |\n| \\`skills/\\` | Your own skills, one folder each with a \\`SKILL.md\\` | People and AIs |\n| \\`data/\\` | Everything Mushin.js keeps: database, bots, providers, flows, message logs. Back up this folder. | Mushin.js only |\n| \\`cache/\\`, \\`logs/\\` | Safe to delete | Mushin.js only |\n\n## Rules\n\n- Do not edit files under \\`data/\\` by hand while Mushin.js runs. Change things through the dashboard or its actions.\n- Never print, commit or copy the contents of \\`.env\\`. To use a secret in a setting, write \\`\\${NAME}\\` and put \\`NAME=value\\` in \\`.env\\`.\n- A plugin is a package in \\`plugins/<name>/\\` with a \\`mushin\\` field in its \\`package.json\\`. It exports \\`name\\`, optionally \\`inject\\` and \\`Config\\` (a zod schema), and \\`apply(ctx, config)\\`. Import everything from \\`@mushinjs/core\\`.\n- After changing a plugin, reload it from the dashboard's Plugins page or restart Mushin.js.\n`\n}\n\n/** Writes a new app into `dir`, which must be missing or empty. */\nexport async function createApp(dir: string, options: { version?: string; packageManager?: PackageManager } = {}) {\n const target = resolve(dir)\n const existing = await readdir(target).catch(() => [] as string[])\n if (existing.length) throw new Error(`${target} is not empty. Choose a new folder name.`)\n const files = appFiles(packageName(target), options.version, options.packageManager)\n for (const [path, content] of Object.entries(files)) {\n const file = join(target, path)\n await mkdir(join(file, '..'), { recursive: true })\n await writeFile(file, content)\n }\n return { dir: target, files: Object.keys(files) }\n}\n\n/** Puts the official skills into the app, with the CLI that was just installed. */\nexport function addSkills(dir: string) {\n return new Promise<void>((done, reject) => {\n const bin = join(dir, 'node_modules', '@mushinjs', 'cli', 'bin', 'mushin.js')\n const child = spawn(process.execPath, [bin, 'skills', '--dir', dir], { cwd: dir, stdio: 'inherit' })\n child.on('error', reject)\n child.on('exit', (code) => (code ? reject(new Error(`mushin skills exited with ${code}`)) : done()))\n })\n}\n\n/** Runs the package manager's install in the app folder, with its output shown. */\nexport function install(dir: string, packageManager: PackageManager) {\n return new Promise<void>((done, reject) => {\n // npm and pnpm are .cmd files on Windows, which only start through a shell.\n const child = spawn(packageManager, ['install'], { cwd: dir, stdio: 'inherit', shell: process.platform === 'win32' })\n child.on('error', reject)\n child.on('exit', (code) => (code ? reject(new Error(`${packageManager} install exited with ${code}`)) : done()))\n })\n}\n"],"mappings":";;;;;;AAMA,MAAa,UAAkB,KAAK,MAAM,aAAa,IAAI,IAAI,mBAAmB,YAAY,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC;;AAK7G,SAAgB,qBAAqB,YAAY,QAAQ,IAAI,yBAAyB,IAAoB;CACxG,OAAO,UAAU,WAAW,MAAM,IAAI,SAAS;AACjD;;AAGA,SAAgB,gBAAgB,UAAU,SAAS;CACjD,OAAO,QAAQ,SAAS,GAAG,IAAI,UAAU,IAAI;AAC/C;;AAGA,SAAgB,YAAY,KAAa;CAEvC,OADa,SAAS,QAAQ,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,kBAAkB,GAAG,CAAC,CAAC,QAAQ,gBAAgB,EAC/F,KAAK;AACjB;;AAGA,SAAgB,SAAS,MAAc,UAAU,SAAS,iBAAiC,OAA+B;CACxH,MAAM,QAAQ,gBAAgB,OAAO;CACrC,MAA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S,QAAQ,cAAc;CACnF,KAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,KAAK,GAAG;EACnD,MAAM,OAAO,KAAK,QAAQ,IAAI;EAC9B,MAAM,MAAM,KAAK,MAAM,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;EACjD,MAAM,UAAU,MAAM,OAAO;CAC/B;CACA,OAAO;EAAE,KAAK;EAAQ,OAAO,OAAO,KAAK,KAAK;CAAE;AAClD;;AAGA,SAAgB,UAAU,KAAa;CACrC,OAAO,IAAI,SAAe,MAAM,WAAW;EACzC,MAAM,MAAM,KAAK,KAAK,gBAAgB,aAAa,OAAO,OAAO,WAAW;EAC5E,MAAM,QAAQ,MAAM,QAAQ,UAAU;GAAC;GAAK;GAAU;GAAS;EAAG,GAAG;GAAE,KAAK;GAAK,OAAO;EAAU,CAAC;EACnG,MAAM,GAAG,SAAS,MAAM;EACxB,MAAM,GAAG,SAAS,SAAU,OAAO,uBAAO,IAAI,MAAM,6BAA6B,MAAM,CAAC,IAAI,KAAK,CAAE;CACrG,CAAC;AACH;;AAGA,SAAgB,QAAQ,KAAa,gBAAgC;CACnE,OAAO,IAAI,SAAe,MAAM,WAAW;EAEzC,MAAM,QAAQ,MAAM,gBAAgB,CAAC,SAAS,GAAG;GAAE,KAAK;GAAK,OAAO;GAAW,OAAO,QAAQ,aAAa;EAAQ,CAAC;EACpH,MAAM,GAAG,SAAS,MAAM;EACxB,MAAM,GAAG,SAAS,SAAU,OAAO,uBAAO,IAAI,MAAM,GAAG,eAAe,uBAAuB,MAAM,CAAC,IAAI,KAAK,CAAE;CACjH,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { spawn } from 'node:child_process'\nimport { readFileSync } from 'node:fs'\nimport { mkdir, readdir, writeFile } from 'node:fs/promises'\nimport { basename, join, resolve } from 'node:path'\n\n/** The version of this package, which every `@mushinjs/*` package shares. */\nexport const VERSION: string = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version\n\nexport type PackageManager = 'npm' | 'pnpm'\n\n/** The package manager that ran `npm create` / `pnpm create`, from the user agent it sets. */\nexport function detectPackageManager(userAgent = process.env.npm_config_user_agent ?? ''): PackageManager {\n return userAgent.startsWith('pnpm') ? 'pnpm' : 'npm'\n}\n\n/** The version range the app depends on: a preview is pinned exactly, a release takes compatible updates. */\nexport function dependencyRange(version = VERSION) {\n return version.includes('-') ? version : `^${version}`\n}\n\n/** A package name made from a folder name: `My Bot` gives `my-bot`. */\nexport function packageName(dir: string) {\n const name = basename(resolve(dir)).toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^[._-]+|-+$/g, '')\n return name || 'mushin-app'\n}\n\n/** The files of a new app, by path relative to its folder. */\nexport function appFiles(name: string, version = VERSION, packageManager: PackageManager = 'npm'): Record<string, string> {\n const range = dependencyRange(version)\n const json = (value: unknown) => JSON.stringify(value, null, 2) + '\\n'\n return {\n 'package.json': json({\n name,\n private: true,\n type: 'module',\n scripts: {\n start: 'mushin start',\n upgrade: 'mushin upgrade',\n typecheck: 'tsc',\n },\n dependencies: {\n '@mushinjs/cli': range,\n // Local plugins in plugins/ import it; with pnpm they only see the app's own dependencies.\n '@mushinjs/core': range,\n },\n devDependencies: {\n '@types/node': '^22.13.0',\n typescript: '^6.0.3',\n },\n engines: { node: '>=22.13' },\n }),\n 'tsconfig.json': json({\n compilerOptions: {\n target: 'es2023',\n lib: ['es2023'],\n module: 'preserve',\n moduleResolution: 'bundler',\n types: ['node'],\n strict: true,\n noEmit: true,\n skipLibCheck: true,\n isolatedModules: true,\n verbatimModuleSyntax: true,\n },\n include: ['plugins/*/src'],\n }),\n '.gitignore': [\n 'node_modules/',\n '# Secrets: keys, tokens. Never commit or share this file.',\n '.env',\n '# Written by Mushin.js. Back up data/; cache/ and logs/ can be deleted.',\n 'data/',\n 'cache/',\n 'logs/',\n '',\n ].join('\\n'),\n 'AGENTS.md': agentsGuide(name),\n // Connects the AI tool opened in this folder to the running Mushin.js; the token stays in .env.\n '.mcp.json': json({\n mcpServers: {\n mushin: { type: 'stdio', command: 'node', args: ['node_modules/@mushinjs/cli/bin/mushin.js', 'mcp'] },\n },\n }),\n 'plugins/.gitkeep': '',\n 'skills/.gitkeep': '',\n ...(packageManager === 'pnpm' ? { 'pnpm-workspace.yaml': PNPM_SETTINGS } : {}),\n }\n}\n\n/**\n * pnpm runs no install scripts it was not told about, and stops the install over them. esbuild (through tsx,\n * for TypeScript plugins) needs its script; ssh2 (the terminal plugin) works without its optional native parts.\n */\nconst PNPM_SETTINGS = `allowBuilds:\n esbuild: true\n cpu-features: false\n ssh2: false\n`\n\nfunction agentsGuide(name: string) {\n return `# ${name}\n\nThis folder is a [Mushin.js](https://github.com/mushinjs/mushin) app: a chatbot framework for QQ (through OneBot / NapCat) with LLM chat, conversation flows and a Fairy. Read this before changing anything here.\n\n## Commands\n\n- \\`npm start\\` starts Mushin.js and prints the dashboard sign-in link (\\`pnpm start\\` with pnpm).\n- \\`npm run upgrade\\` updates every \\`@mushinjs/*\\` package and moves the data to the new version's layout. Stop Mushin.js first.\n- \\`npx mushin new plugin <name>\\` creates a TypeScript plugin in \\`plugins/<name>/\\` and turns it on.\n- \\`npm run typecheck\\` checks the plugins in \\`plugins/\\`.\n- \\`npx mushin token reset\\` makes a new admin token for the dashboard.\n\n## Managing Mushin.js from an AI tool\n\n\\`.mcp.json\\` connects the AI tool you open in this folder (Claude Code and others that read it) to the running Mushin.js through \\`mushin mcp\\`. Start Mushin.js first. The tools are Mushin.js actions: list bots, read logs, build and test flows, and more. Dangerous ones wait for approval in the dashboard. The admin token is read from \\`.env\\`; do not copy it anywhere.\n\n## Skills\n\n\\`.claude/skills/\\` holds the official skills. Read the matching \\`SKILL.md\\` before you start one of these jobs, whichever AI tool you are:\n\n- \\`mushin-plugin-dev\\`: writing or changing a plugin in \\`plugins/\\`. It starts with the questions to ask the user first.\n- \\`mushin-flows\\`: building and testing conversation flows.\n- \\`mushin-troubleshoot\\`: finding out why a bot, command, flow or plugin does not work.\n- \\`mushin-operations\\`: upgrades, backups, restores, moving machines, the admin token.\n\n\\`npm run upgrade\\` replaces them with the new version's; put your own skills in other folders.\n\n## Layout\n\n| Path | What it is | Who writes it |\n| --- | --- | --- |\n| \\`mushin.config.json\\` | Which plugins run, and their settings. Holds no secrets. | People, the dashboard, Fairy |\n| \\`.mcp.json\\` | Connects the AI tool opened here to Mushin.js. Holds no secrets. | create-mushin |\n| \\`.claude/skills/\\` | The official skills for AI tools | Mushin.js (on create and upgrade) |\n| \\`.env\\` | Secrets: the admin token, provider keys, bot tokens. Configuration refers to them as \\`\\${NAME}\\`. | Mushin.js and people |\n| \\`plugins/\\` | Local plugins, run as TypeScript without a build step | People and AIs |\n| \\`skills/\\` | Your own skills, one folder each with a \\`SKILL.md\\` | People and AIs |\n| \\`data/\\` | Everything Mushin.js keeps: database, bots, providers, flows, message logs. Back up this folder. | Mushin.js only |\n| \\`cache/\\`, \\`logs/\\` | Safe to delete | Mushin.js only |\n\n## Rules\n\n- Do not edit files under \\`data/\\` by hand while Mushin.js runs. Change things through the dashboard or its actions.\n- Never print, commit or copy the contents of \\`.env\\`. To use a secret in a setting, write \\`\\${NAME}\\` and put \\`NAME=value\\` in \\`.env\\`.\n- A plugin is a package in \\`plugins/<name>/\\` with a \\`mushin\\` field in its \\`package.json\\`. It exports \\`name\\`, optionally \\`inject\\` and \\`Config\\` (a zod schema), and \\`apply(ctx, config)\\`. Import everything from \\`@mushinjs/core\\`.\n- After changing a plugin, reload it from the dashboard's Plugins page or restart Mushin.js.\n`\n}\n\n/** Writes a new app into `dir`, which must be missing or empty. */\nexport async function createApp(dir: string, options: { version?: string; packageManager?: PackageManager } = {}) {\n const target = resolve(dir)\n const existing = await readdir(target).catch(() => [] as string[])\n if (existing.length) throw new Error(`${target} is not empty. Choose a new folder name.`)\n const files = appFiles(packageName(target), options.version, options.packageManager)\n for (const [path, content] of Object.entries(files)) {\n const file = join(target, path)\n await mkdir(join(file, '..'), { recursive: true })\n await writeFile(file, content)\n }\n return { dir: target, files: Object.keys(files) }\n}\n\n/** Puts the official skills into the app, with the CLI that was just installed. */\nexport function addSkills(dir: string) {\n return new Promise<void>((done, reject) => {\n const bin = join(dir, 'node_modules', '@mushinjs', 'cli', 'bin', 'mushin.js')\n const child = spawn(process.execPath, [bin, 'skills', '--dir', dir], { cwd: dir, stdio: 'inherit' })\n child.on('error', reject)\n child.on('exit', (code) => (code ? reject(new Error(`mushin skills exited with ${code}`)) : done()))\n })\n}\n\n/** Runs the package manager's install in the app folder, with its output shown. */\nexport function install(dir: string, packageManager: PackageManager) {\n return new Promise<void>((done, reject) => {\n // npm and pnpm are .cmd files on Windows, which only start through a shell.\n const child = spawn(packageManager, ['install'], { cwd: dir, stdio: 'inherit', shell: process.platform === 'win32' })\n child.on('error', reject)\n child.on('exit', (code) => (code ? reject(new Error(`${packageManager} install exited with ${code}`)) : done()))\n })\n}\n"],"mappings":";;;;;;AAMA,MAAa,UAAkB,KAAK,MAAM,aAAa,IAAI,IAAI,mBAAmB,YAAY,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC;;AAK7G,SAAgB,qBAAqB,YAAY,QAAQ,IAAI,yBAAyB,IAAoB;CACxG,OAAO,UAAU,WAAW,MAAM,IAAI,SAAS;AACjD;;AAGA,SAAgB,gBAAgB,UAAU,SAAS;CACjD,OAAO,QAAQ,SAAS,GAAG,IAAI,UAAU,IAAI;AAC/C;;AAGA,SAAgB,YAAY,KAAa;CAEvC,OADa,SAAS,QAAQ,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,kBAAkB,GAAG,CAAC,CAAC,QAAQ,gBAAgB,EAC/F,KAAK;AACjB;;AAGA,SAAgB,SAAS,MAAc,UAAU,SAAS,iBAAiC,OAA+B;CACxH,MAAM,QAAQ,gBAAgB,OAAO;CACrC,MAAM,QAAQ,UAAmB,KAAK,UAAU,OAAO,MAAM,CAAC,IAAI;CAClE,OAAO;EAC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