mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-18 23:59:43 +01:00
Implement chatAgent2 proposal (#194635)
* Add notes on chat agent API * Add request ID to context * variables * Add partial implementation for another option for a chat agent API * update * Notes from api sync * More notes * Can invoke an agent and get the response * Provide a real request * Notes * add `slashCommandProvider` - not yet hooked up * add metadata properties inline, some comments * some more notes * Put the new API side-by-side with the old one * Fix agent title in response * Fix agent display * Send slashCommand to request * Hook up variables * Get rid of package.json registration option * Start to implement followups provider * Add comment * make it `slashCommandProvider` all the way, use updateAgent for updates icon, fullName, description * update docs * only ask for slash command completions when completing a slash-word * use complex completion item label for command/agent completions * add `promptText` to `IParsedChatRequestPart` so that some parts don't make it into the prompt (like agent and slash commands) * only allow agent and slash command at the beginning of the prompt * remove unused method * some jsdoc, many renames so that stuff starts with `ChatAgent...` * reduce `createChatAgent` to the minimum, let the rest be set via setters * in the renderer know if an agent has slash command and follow ups, safes IPC calls * use `iconPath` to align with other APIs * more jsdoc and more obvious TODOs * fix chat parser with "late" command * handle error so that the request stops. where is the rendering tho? * Show error message in response properly * Don't blow up global / list * Change proposal name * Inline followup types * fix type * Remove brace in error msg --------- Co-authored-by: Johannes <johannes.rieken@gmail.com>
This commit is contained in:
@@ -108,6 +108,7 @@ import { ExtHostChatVariables } from 'vs/workbench/api/common/extHostChatVariabl
|
||||
import { ExtHostRelatedInformation } from 'vs/workbench/api/common/extHostAiRelatedInformation';
|
||||
import { ExtHostAiEmbeddingVector } from 'vs/workbench/api/common/extHostEmbeddingVector';
|
||||
import { ExtHostChatAgents } from 'vs/workbench/api/common/extHostChatAgents';
|
||||
import { ExtHostChatAgents2 } from 'vs/workbench/api/common/extHostChatAgents2';
|
||||
|
||||
export interface IExtensionRegistries {
|
||||
mine: ExtensionDescriptionRegistry;
|
||||
@@ -209,6 +210,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
const extHostInteractiveEditor = rpcProtocol.set(ExtHostContext.ExtHostInlineChat, new ExtHostInteractiveEditor(rpcProtocol, extHostCommands, extHostDocuments, extHostLogService));
|
||||
const extHostChatProvider = rpcProtocol.set(ExtHostContext.ExtHostChatProvider, new ExtHostChatProvider(rpcProtocol, extHostLogService));
|
||||
const extHostChatAgents = rpcProtocol.set(ExtHostContext.ExtHostChatAgents, new ExtHostChatAgents(rpcProtocol, extHostChatProvider, extHostLogService));
|
||||
const extHostChatAgents2 = rpcProtocol.set(ExtHostContext.ExtHostChatAgents2, new ExtHostChatAgents2(rpcProtocol, extHostChatProvider, extHostLogService));
|
||||
const extHostChatVariables = rpcProtocol.set(ExtHostContext.ExtHostChatVariables, new ExtHostChatVariables(rpcProtocol));
|
||||
const extHostChat = rpcProtocol.set(ExtHostContext.ExtHostChat, new ExtHostChat(rpcProtocol, extHostLogService));
|
||||
const extHostAiRelatedInformation = rpcProtocol.set(ExtHostContext.ExtHostAiRelatedInformation, new ExtHostRelatedInformation(rpcProtocol));
|
||||
@@ -1366,11 +1368,14 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
checkProposedApiEnabled(extension, 'mappedEditsProvider');
|
||||
return extHostLanguageFeatures.registerMappedEditsProvider(extension, selector, provider);
|
||||
},
|
||||
createChatAgent(name: string, handler: vscode.ChatAgentHandler) {
|
||||
checkProposedApiEnabled(extension, 'chatAgents2');
|
||||
return extHostChatAgents2.createChatAgent(extension.identifier, name, handler);
|
||||
},
|
||||
registerAgent(name: string, agent: vscode.ChatAgent, metadata: vscode.ChatAgentMetadata) {
|
||||
checkProposedApiEnabled(extension, 'chatAgents');
|
||||
return extHostChatAgents.registerAgent(extension.identifier, name, agent, metadata);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return <typeof vscode>{
|
||||
|
||||
Reference in New Issue
Block a user