mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 17:01:02 +00:00
feat(extensions): support async extension factory functions
Extensions can now use async initialization, enabling: - Dynamic imports (e.g., loading tools from external packages) - Async setup (config fetching, service connections) - Lazy-loaded dependencies Changes: - ExtensionFactory type now returns void | Promise<void> - loadExtensionFromFactory is now async, returns Promise<LoadedExtension> - All factory(api) calls are now awaited Backwards compatible: sync extensions continue to work unchanged.
This commit is contained in:
parent
282273e156
commit
aea9f8439d
3 changed files with 8 additions and 8 deletions
|
|
@ -488,7 +488,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|||
};
|
||||
for (let i = 0; i < options.extensions.length; i++) {
|
||||
const factory = options.extensions[i];
|
||||
const loaded = loadExtensionFromFactory(factory, cwd, eventBus, uiHolder, `<inline-${i}>`);
|
||||
const loaded = await loadExtensionFromFactory(factory, cwd, eventBus, uiHolder, `<inline-${i}>`);
|
||||
extensionsResult.extensions.push(loaded);
|
||||
}
|
||||
// Extend setUIContext to update inline extensions too
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue