window: promote chat session focus events to stable API#306518
Closed
RockyWearsAHat wants to merge 6 commits intomicrosoft:mainfrom
Closed
window: promote chat session focus events to stable API#306518RockyWearsAHat wants to merge 6 commits intomicrosoft:mainfrom
RockyWearsAHat wants to merge 6 commits intomicrosoft:mainfrom
Conversation
Add activeChatSessionUri getter and onDidChangeActiveChatSession event to the stable window namespace. These delegate to the existing extHostChatAgents2 implementation (activeChatPanelSessionResource). The proposed API versions (chatParticipantPrivate) remain unchanged for backward compatibility. Extensions that maintain per-conversation state need to detect chat session switches without requiring proposed API access and manual argv.json configuration. Fixes microsoft#306497
Contributor
There was a problem hiding this comment.
Pull request overview
This PR promotes chat session focus tracking from a proposed API to the stable vscode.window namespace so extensions can react to chat panel focus/session changes without enabling proposed APIs.
Changes:
- Add stable
vscode.window.activeChatSessionUrito expose the currently active chat session URI (orundefined). - Add stable
vscode.window.onDidChangeActiveChatSessionto notify extensions when the active chat session changes. - Wire both stable members to the existing
ExtHostChatAgents2active chat panel session resource and event.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/vscode-dts/vscode.d.ts | Adds stable type declarations for activeChatSessionUri and onDidChangeActiveChatSession on window. |
| src/vs/workbench/api/common/extHost.api.impl.ts | Implements the new stable window members by delegating to extHostChatAgents2. |
…tSession Verify the window.activeChatSessionUri property and window.onDidChangeActiveChatSession event are accessible and fire correctly when a new chat session is opened.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Promote
activeChatSessionUriandonDidChangeActiveChatSessionfrom proposed API to stablewindownamespace, enabling extensions to react to chat panel focus changes without adopting a proposed API.Closes #306497
Problem
Extensions that manage per-chat state — such as branch-per-chat workflows, session-scoped terminals, or context-aware tooling — need to know which chat panel the user is interacting with. The
activeChatPanelSessionResourceandonDidChangeChatPanelActiveSessionevents exist onExtHostChatAgents2but are gated behind a proposed API. This means:chatParticipantAdditionsproposed API to access the eventsvscode.windowAPI surfaceApproach
Expose two new members on the
windownamespace, ungated:Implementation:
extHost.api.impl.ts: AddedactiveChatSessionUrigetter andonDidChangeActiveChatSessionevent to thewindownamespace object, delegating toextHostChatAgents2.activeChatPanelSessionResourceand the corresponding event.vscode.d.ts: Stable type declarations in thewindownamespace (placed afteronDidChangeActiveTerminalfor logical grouping with other focus-change events).Design notes:
ExtHostChatAgents2infrastructure, so there is no new IPC channel or protocol change.Uri | undefinedconsistent with otheractive*properties onwindow.Use Cases
Testing
Manual verification that:
vscode.window.activeChatSessionUrireturns the URI of the focused chat panelvscode.window.onDidChangeActiveChatSessionfires when switching between chat panelsundefinedwhen no chat panel is focused