diff options
| author | Olcan <[email protected]> | 2025-06-02 09:56:32 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-02 09:56:32 -0700 |
| commit | c5869db0806d04bc0d1f4da6823f9e13d22e476b (patch) | |
| tree | 6e5b4c112dd14f948f6deed7b80c2e10589967cc /packages/core/src/config/config.ts | |
| parent | 467dec4edf17abcb03784caadc1694aac29d0373 (diff) | |
enable async tool discovery by making the registry accessor async; remove call to discoverTools that caused duplicate discovery (#691)
Diffstat (limited to 'packages/core/src/config/config.ts')
| -rw-r--r-- | packages/core/src/config/config.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index d918de04..a6279e2e 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -60,7 +60,7 @@ export interface ConfigParameters { } export class Config { - private toolRegistry: ToolRegistry; + private toolRegistry: Promise<ToolRegistry>; private readonly apiKey: string; private readonly model: string; private readonly sandbox: boolean | string; @@ -124,7 +124,7 @@ export class Config { return this.targetDir; } - getToolRegistry(): ToolRegistry { + async getToolRegistry(): Promise<ToolRegistry> { return this.toolRegistry; } @@ -232,7 +232,7 @@ export function createServerConfig(params: ConfigParameters): Config { }); } -export function createToolRegistry(config: Config): ToolRegistry { +export function createToolRegistry(config: Config): Promise<ToolRegistry> { const registry = new ToolRegistry(config); const targetDir = config.getTargetDir(); const tools = config.getCoreTools() @@ -259,6 +259,8 @@ export function createToolRegistry(config: Config): ToolRegistry { registerCoreTool(ShellTool, config); registerCoreTool(MemoryTool); registerCoreTool(WebSearchTool, config); - registry.discoverTools(); - return registry; + return (async () => { + await registry.discoverTools(); + return registry; + })(); } |
