feat: 일반 역할 및 슬롯 인터페이스 추가, 시나리오 파싱 및 부트스트랩 로직 개선

This commit is contained in:
2025-12-28 17:11:05 +00:00
parent 62c1c0f9c6
commit 8a2fc4fec5
10 changed files with 343 additions and 0 deletions
@@ -0,0 +1,35 @@
import type { CommandResolver as CommandResolverType } from './che_상업투자.js';
export type DomesticCommandKey = 'che_상업투자';
export type DomesticCommandImporter = () => Promise<{
CommandResolver: typeof CommandResolverType;
}>;
const defaultImporters: Record<DomesticCommandKey, DomesticCommandImporter> = {
che_상업투자: async () => import('./che_상업투자.js'),
};
export class DomesticCommandLoader {
constructor(
private readonly importers: Record<
DomesticCommandKey,
DomesticCommandImporter
> = defaultImporters
) {}
async load(
key: DomesticCommandKey
): Promise<{ CommandResolver: typeof CommandResolverType }> {
const importer = this.importers[key];
if (!importer) {
throw new Error(`Unknown domestic command key: ${key}`);
}
return importer();
}
async create(key: DomesticCommandKey, ...args: unknown[]): Promise<unknown> {
const { CommandResolver } = await this.load(key);
return new CommandResolver(...args);
}
}