Chat participant API
Problem
We have finalized the Language Model and Chat Participant API ๐ Thus, you can now publish your extensions to the VS Marketplace. This API is finalized in VS Code Insiders, and will be finalized in VS Code Stable in July. In your package.json, you should set [code block] and VS Code Stable will gracefully handle your extensions and ignore your usage of Language Model and Chat API until the API gets finalized in Stable in July. Full docs https://code.visualstudio.com/api/extension-guides/chat We are excited to see what you build โจ --- -- Proposal dts: https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.proposed.chatParticipant.d.ts - Sample: https://github.com/microsoft/vscode-extension-samples/tree/main/chat-sample - Docs: https://code.visualstudio.com/api/extension-guides/chat Extension authors can subscribe to this issue to get updates about the proposed chat agent API. There may still be breaking changes coming, and I will post here whenever a breaking change is made. I'm also interested in feedback about how you might use this API. Current TODOs - [x] Need to enable agents to identify sessions uniquely and store state, including across a window reload - [x] Should be able to use `shouldRepopulate` for agents - Maybe this should be the default behavior for agents - [x] `ChatAgentReplyFollowup` should parameterize the agent and slash command names, don't require the agent to include them in the prompt as text - Maybe this goes for variables to
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Update Package.json for Chat Participant API Compatibility
The Chat Participant API has been finalized in VS Code Insiders and is expected to be finalized in Stable by July. Extensions using this API need to ensure compatibility by updating their package.json file to avoid breaking changes when the API is officially released.
Awaiting Verification
Be the first to verify this fix
- 1
Update package.json for API Compatibility
Modify your package.json file to include the necessary configurations for the Chat Participant API. This ensures that your extension will be compatible with both Insiders and Stable versions of VS Code.
json{ "contributes": { "chat": { "enabled": true, "apiVersion": "1.0" } } } - 2
Implement Unique Session Identification
Ensure that your chat agents can uniquely identify sessions and maintain state across window reloads. This can be done by implementing a session management system within your extension.
typescriptconst sessionId = generateUniqueId(); storeSessionState(sessionId, state); - 3
Utilize shouldRepopulate for Agents
Modify your chat agent logic to use the `shouldRepopulate` flag by default. This will ensure that agents behave correctly when the user interacts with them.
typescriptagent.shouldRepopulate = true; - 4
Parameterize Agent and Command Names
Update the implementation of `ChatAgentReplyFollowup` to parameterize agent and slash command names, removing the need for these to be included in the prompt as text.
typescriptconst reply = new ChatAgentReplyFollowup({ agentName: 'MyAgent', commandName: '/start' });
Validation
To confirm the fix worked, run your extension in both VS Code Insiders and Stable versions. Ensure that the chat functionality operates without errors and that sessions are uniquely identified and maintained across reloads.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep