* Implement GitHub Copilot Memory service integration and enhance memory management features
* Enhance Copilot Memory integration: add configuration option, refactor memory service methods, and streamline memory fetching logic
* revert changes to context management
* move setting to a preview location and update tags for preview
* Refactor Copilot Memory configuration: rename setting to CopilotMemoryEnabled and update related method
* add warnings for repo memory operations when Copilot Memory is enabled, and introduce RepoMemoryInstructionsPrompt for better user guidance.
* Add memory tool integration: define memory parameters, implement memory storage, and enhance prompts for user guidance
* Refactor code structure for improved readability and maintainability
* Add memory tool to available tools and update new chat condition in AgentPrompt
* Update memory tool display names and descriptions for improved clarity
* Refactor AgentMemoryService: remove session management and related code for improved clarity and focus on repository memory handling
* Remove deduplicateMemories function and related tests for code simplification
* Remove memory tool from available tools in package.json
* Refactor memory tool and context prompt: remove unused code and simplify memory fetching logic
* Update tool instructions and available tools list in snapshots for improved clarity
* Refactor memory tool tests: simplify memory parameters and update mock services for improved clarity
* tools: remove explanation field from MultiReplaceStringTool
Removes the optional 'explanation' field from the multiReplaceString tool
input parameters. This simplifies the tool interface and aligns with the
latest tool design patterns.
- Removes 'explanation' from package.json tool definition
- Removes 'explanation' from IMultiReplaceStringToolParams interface
- Updates multiReplaceStringTool to use IAbstractReplaceStringInput directly
Fixes https://github.com/microsoft/vscode/issues/289907
(Commit message generated by Copilot)
* fix ci
* tools: add confirmation logic to CreateDirectoryTool
Adds user confirmation dialog to the CreateDirectoryTool via the standard
edit confirmation infrastructure. This ensures users are explicitly asked
before a directory is created.
- Makes prepareInvocation async to support confirmation dialog
- Integrates createEditConfirmation for consistent UX with other edit tools
- Displays directory path in a fenced code block for clarity
- Adds IInstantiationService dependency injection
(Commit message generated by Copilot)
* Update src/extension/tools/node/createDirectoryTool.tsx
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Improves file edit confirmation notifications by skipping diff display
when the only difference between old and new content is whitespace. This
prevents showing overly large diffs (e.g., >2500 lines) when the actual
changes are minimal or non-existent, making it clearer to users what
changes the agent is making.
- Adds early return in formatDiffAsUnified when content is identical
after trimming whitespace
- Displays a brief 'contents are identical' message instead of a large
diff
Fixes https://github.com/microsoft/vscode/issues/288781
(Commit message generated by Copilot)
* tools: add support for model-specific tool registration
This PR goes with https://github.com/microsoft/vscode/pull/287666
This allows the registration of tools that are scoped to specific
language models. These tools can be registered at runtime with
definitions derived from e.g. the server.
I think we should adopt this and go away from the current
`alternativeDefinitions` pattern which we have used previously.
Example of having tools specific for GPT 4.1 vs 4o:
```ts
ToolRegistry.registerModelSpecificTool(
{
name: 'gpt41_get_time',
inputSchema: {},
description: 'Get the current date and time (4.1)',
displayName: 'Get Time (GPT 4.1)',
toolReferenceName: 'get_time',
source: undefined,
tags: [],
models: [{ id: 'gpt-4.1' }],
},
class implements ICopilotTool<unknown> {
invoke() {
return new vscode.LanguageModelToolResult([new vscode.LanguageModelTextPart('Current year is 2041 (GPT 4.1)')]);
}
}
);
ToolRegistry.registerModelSpecificTool(
{
name: 'gpt4o_get_time',
inputSchema: {},
description: 'Get the current date and time (4o)',
displayName: 'Get Time (GPT 4o)',
toolReferenceName: 'get_time',
source: undefined,
tags: [],
models: [{ id: 'gpt-4o' }],
},
class implements ICopilotTool<unknown> {
invoke() {
return new vscode.LanguageModelToolResult([new vscode.LanguageModelTextPart('Current year is 2040 (GPT 4o)')]);
}
}
);
```
* demo
* fix
* overrides
* add overridesTool
* fix inverted logic
* test fixes and back compat
* make memory tool model specific
* fix tests and contribute memory to the vscode toolset
* verison
* fix unit tests
* rm config
* fix missing askquestions
---------
Co-authored-by: bhavyaus <bhavyau@microsoft.com>
Adds support for file deletion in the apply_patch tool by introducing
new VS Code API types for workspace-level file edits. The apply_patch
tool now properly reports deleted files through the new workspaceEdit()
response stream method.
- Introduces ChatWorkspaceFileEdit interface to represent file-level
operations (create, delete, rename) with optional oldResource and
newResource properties
- Adds ChatResponseWorkspaceEditPart class for workspace edits containing
file-level operations
- Updates ExtendedChatResponsePart type to include the new workspace edit
part type
- Adds workspaceEdit() method to ChatResponseStream for reporting
file-level edits
- Modifies applyPatchTool to track deleted files in a separate set and
report them through the new workspaceEdit() method
- Removes subagentInvocationId from ChatToolInvocationData base interface
and moves it to optional streamData parameter in beginToolInvocation()
- Changes chatStreamToolCallId from readonly to mutable in
LanguageModelToolInvocationOptions to allow modifications
Fixes https://github.com/microsoft/vscode/issues/275705
(Commit message generated by Copilot)
* search subagent tool added
* cleaning up description of search subagent
* additional changes
* update linting issue
* Exit early on search subagent call
* search subagent tool added
* cleaning up description of search subagent
* additional changes
* update linting issue
* Add fixes for subagent
* describe read file tool in its prompt
* fixing copilot cli issues?
* resolve merge conflicts with main
* explicit any pt 2
* update explicit any to unknown
* demo
* updating prompt to include description
* fixing newline bug
* added correct input params for subagent
* update to add final turn warning injection
* code snippet hydration
* adding details to toolMetadata (untested)
* commented out until testing
* remove exit from main PR
* actuallly terminate loop
* end loop after round is added and run
* remove early exit handling
* add experiment flags
* update code to check for exp + auto mode
* update to only use gpt 5 mini for search subagent
* Update src/extension/prompts/node/agent/searchSubagentPrompt.tsx
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update docs/tools.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update package.nls.json
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* update tests to handle new prompts
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* deleting vestigial file
* fix merge conflict
* update to default to using the main agent model as fallback for subagent, rather than hardcoding gpt4.1
* remove extra whitespace
* remove runSubagent from package.json and update prompt for final snippet clarity
* reset default to false
* add clearer injection prompt
* updating to work with main branch changes
* rewrite search subagent to have its own tool calling loop file + ensure no nested loops with codebase
* remove copilot-added search subagent doc
* update toolResultMessage
* handle exp configuration for search subagent in the right place
* use searchSubagentLoop instead of subagentLoop
* update to be in line with main
* remove CCA agents
* Some minor cleanup
* Update import for ChatToolInvocationPart in SearchSubagentTool
* Replace inSubAgent flag with subAgentInvocationId for tool calling loop checks
---------
Co-authored-by: Anisha Agarwal <anishaagarwal@Anishas-MacBook-Pro.local>
Co-authored-by: Vritant Bhardwaj <vrtoku@gmail.com>
Co-authored-by: root <root@perflens-vm7.e4rbrboag42enkzhvodo1frcqh.xx.internal.cloudapp.net>
Co-authored-by: Anisha Agarwal <anishaagarwal@MacBookPro.hsd1.ma.comcast.net>
Co-authored-by: Zhichao Li <zhichli@microsoft.com>
Co-authored-by: vritant24 <vritoku@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: bhavyaus <bhavyau@microsoft.com>
* Start work on handling tool calls as they stream in
* Explore partial tool streaming
* consume new proposal
* Match main PR
* Better partial json handling
* Plumb through tool call id to invoke
* Hack internal ids to be the stream id
* Add suppot for a few more stream handlers
* Accumulate args
* Show lines instead of characters
* Fix tests
* Leave debug string commented
* Feedback
* test commit
* update to create a flag that sends data to the new endpoint
* set config to true
* create helper function to dedupe
* habdling race condition
* instant apply: refactor: use the model name variable instead of a string literal
* instant apply: refactor: do not use ?? to get default model
this's because the setting already has that model as the default, so accessing the setting will already return that default model name
also, don't use typeof but its a type for the setting
remove type annotations when accessing the setting value because the setting value type is inferred from the config's type
---------
Co-authored-by: Anisha Agarwal <anisagarwal@microsoft.com>
* Track strings to calculate codeSurvivalRate
* Update test for the new telemetry adding
* Sends data to internal telemetry, adds more tests
* Also report survival rate after 0s and 5s
---------
Co-authored-by: xuga <xuga@MacBook-Pro-2.local>
Enables the same `no-unexternalized-strings` with have in `vscode` in this repo. This make sure we have a more consistent style across repos and when generating edits
* Remove explicit 'any'
* remove any
* fix typecheck failure
* export CopilotToolParamsBase
* replace any with unknown in toolsService
* fix typing for IEmbeddingsEndpoint
* fix tool types
* use `unknown` for tool contructor type
* feat: add option to include ignored files in search results
* Provide instruction of includeIgnoredFiles to models in case of missing match
* updated warnings
* edits: fix conflicting edits in multi-replace-string
- Minimize identical content in text edits to avoid potential conflicts in context
- Explicitly error any edits that still fail rather than garbling the file
Closes https://github.com/microsoft/vscode/issues/277154
* rm test.only
* fix whitespaces not being preserved in ws flex match