Add Accept workflow infrastructure for AI code edits #1166
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements the infrastructure needed for the "Accept" workflow for AI code edits, as described in the issue. After receiving an AI response, users should be able to click an "Accept" button to accept the changes, clear the chat history, and continue with a fresh conversation.
Problem
Currently, there's no mechanism to:
Solution
This PR adds two new optional parameters to
VZCodeContextthat enable parent applications to implement the Accept workflow:1.
enableAIChatTextEntry(boolean, default:true)Controls whether the chat input is enabled or disabled:
true: Users can type in the chat input (default behavior)false: Chat textarea and send button are disabled2.
clearChatHistory(callback function)A callback function that parent applications can provide to clear chat messages when the Accept button is clicked.
Implementation Details
The implementation follows a clean separation of concerns:
Workflow Sequence
enableAIChatTextEntry={false}to disable inputadditionalWidgetsclearChatHistory()and setsenableAIChatTextEntry={true}Code Example
Parent applications can use the new parameters like this:
Changes Made
src/client/VZCodeContext/types.ts: Added type definitions forenableAIChatTextEntryandclearChatHistorysrc/client/VZCodeContext/useVZCodeState.ts: Accept and pass through new parameterssrc/client/VZSidebar/AIChat/ChatInput.tsx: Disable textarea and send button based onenableTextEntrypropsrc/client/VZSidebar/AIChat/index.tsx: ExtractenableAIChatTextEntryfrom context and pass to ChatInputACCEPT_WORKFLOW.md: Complete documentation with usage examplesScreenshots
Normal state - text entry enabled (default):
User can type messages:
When
enableAIChatTextEntry={false}, the textarea becomes disabled (grayed out) and the send button is disabled, preventing users from submitting new requests.Testing
Documentation
See
ACCEPT_WORKFLOW.mdfor complete implementation guide including:Next Steps
The actual "Accept" button rendering and chat clearing logic will be implemented in the parent project (VizHub) using the infrastructure provided by this PR.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.