From c00f3f5d5af9935a0c6af9d7d5d1c47db1a9abd8 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Sun, 10 Nov 2024 23:02:38 -0800 Subject: [PATCH] Enable async registration of chat participants (#233444) * Enable async registration of chat participants * Fix build * Revert "Fix build" This reverts commit c4b489b15eb1426039811013c49a3884396cea70. * Revert "Enable async registration of chat participants" This reverts commit 918fd7cfb19c9a432b9efcc6e15a05cd5549fa18. * Try it this way * Wait before checking registration --- src/vs/workbench/api/browser/mainThreadChatAgents2.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadChatAgents2.ts b/src/vs/workbench/api/browser/mainThreadChatAgents2.ts index ca1cc0c60418a..c207d1c2bcbbf 100644 --- a/src/vs/workbench/api/browser/mainThreadChatAgents2.ts +++ b/src/vs/workbench/api/browser/mainThreadChatAgents2.ts @@ -139,7 +139,8 @@ export class MainThreadChatAgents2 extends Disposable implements MainThreadChatA this._chatService.transferChatSession({ sessionId, inputValue }, URI.revive(toWorkspace)); } - $registerAgent(handle: number, extension: ExtensionIdentifier, id: string, metadata: IExtensionChatAgentMetadata, dynamicProps: IDynamicChatAgentProps | undefined): void { + async $registerAgent(handle: number, extension: ExtensionIdentifier, id: string, metadata: IExtensionChatAgentMetadata, dynamicProps: IDynamicChatAgentProps | undefined): Promise { + await this._extensionService.whenInstalledExtensionsRegistered(); const staticAgentRegistration = this._chatAgentService.getAgent(id, true); if (!staticAgentRegistration && !dynamicProps) { if (this._chatAgentService.getAgentsByName(id).length) { @@ -209,7 +210,8 @@ export class MainThreadChatAgents2 extends Disposable implements MainThreadChatA }); } - $updateAgent(handle: number, metadataUpdate: IExtensionChatAgentMetadata): void { + async $updateAgent(handle: number, metadataUpdate: IExtensionChatAgentMetadata): Promise { + await this._extensionService.whenInstalledExtensionsRegistered(); const data = this._agents.get(handle); if (!data) { this._logService.error(`MainThreadChatAgents2#$updateAgent: No agent with handle ${handle} registered`);