Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3100,6 +3100,16 @@
"command": "pr.unresolveReviewThreadFromView",
"group": "context@1",
"when": "commentController =~ /^github-(browse|review)/ && commentThread =~ /canUnresolve/"
},
{
"command": "pr.applySuggestion",
"group": "context@2",
"when": "commentController =~ /^github-review/ && comment =~ /hasSuggestion/"
},
{
"command": "pr.applySuggestionWithCopilot",
"group": "context@2",
"when": "commentController =~ /^github-review/ && !(comment =~ /hasSuggestion/)"
}
],
"editor/title": [
Expand Down
13 changes: 10 additions & 3 deletions src/@types/vscode.proposed.chatContextProvider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ declare module 'vscode' {
* Providers registered without a selector will not be called for resource-based context.
* - Explicitly. These context items are shown as options when the user explicitly attaches context.
*
* To ensure your extension is activated when chat context is requested, make sure to include the `onChatContextProvider:<id>` activation event in your `package.json`.
* To ensure your extension is activated when chat context is requested, make sure to include the following activations events:
* - If your extension implements `provideWorkspaceChatContext` or `provideChatContextForResource`, find an activation event which is a good signal to activate.
* Ex: `onLanguage:<languageId>`, `onWebviewPanel:<viewType>`, etc.`
* - If your extension implements `provideChatContextExplicit`, your extension will be automatically activated when the user requests explicit context.
*
* @param selector Optional document selector to filter which resources the provider is called for. If omitted, the provider will only be called for explicit context requests.
* @param id Unique identifier for the provider.
Expand Down Expand Up @@ -49,7 +52,7 @@ declare module 'vscode' {
value?: string;
/**
* An optional command that is executed when the context item is clicked.
* The original context item will be passed as an argument to the command.
* The original context item will be passed as the first argument to the command.
*/
command?: Command;
}
Expand All @@ -62,7 +65,11 @@ declare module 'vscode' {
onDidChangeWorkspaceChatContext?: Event<void>;

/**
* Provide a list of chat context items to be included as workspace context for all chat sessions.
* TODO @API: should this be a separate provider interface?
*
* Provide a list of chat context items to be included as workspace context for all chat requests.
* This should be used very sparingly to avoid providing useless context and to avoid using up the context window.
* A good example use case is to provide information about which branch the user is working on in a source control context.
*
* @param token A cancellation token.
*/
Expand Down
62 changes: 56 additions & 6 deletions src/@types/vscode.proposed.chatParticipantAdditions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ declare module 'vscode' {
constructor(value: Uri, license: string, snippet: string);
}

export class ChatPrepareToolInvocationPart {
toolName: string;
constructor(toolName: string);
export interface ChatToolInvocationStreamData {
/**
* Partial or not-yet-validated arguments that have streamed from the language model.
* Tools may use this to render interim UI while the full invocation input is collected.
*/
readonly partialInput?: unknown;
}

export interface ChatTerminalToolInvocationData {
Expand All @@ -104,7 +107,7 @@ declare module 'vscode' {
isConfirmed?: boolean;
isComplete?: boolean;
toolSpecificData?: ChatTerminalToolInvocationData;
fromSubAgent?: boolean;
subAgentInvocationId?: string;
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;

constructor(toolName: string, toolCallId: string, isError?: boolean);
Expand Down Expand Up @@ -176,7 +179,7 @@ declare module 'vscode' {
constructor(uris: Uri[], callback: () => Thenable<unknown>);
}

export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart;
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart;
export class ChatResponseWarningPart {
value: MarkdownString;
constructor(value: string | MarkdownString);
Expand Down Expand Up @@ -349,7 +352,21 @@ declare module 'vscode' {

codeCitation(value: Uri, license: string, snippet: string): void;

prepareToolInvocation(toolName: string): void;
/**
* Begin a tool invocation in streaming mode. This creates a tool invocation that will
* display streaming progress UI until the tool is actually invoked.
* @param toolCallId Unique identifier for this tool call, used to correlate streaming updates and final invocation.
* @param toolName The name of the tool being invoked.
* @param streamData Optional initial streaming data with partial arguments.
*/
beginToolInvocation(toolCallId: string, toolName: string, streamData?: ChatToolInvocationStreamData & { subagentInvocationId?: string }): void;

/**
* Update the streaming data for a tool invocation that was started with `beginToolInvocation`.
* @param toolCallId The tool call ID that was passed to `beginToolInvocation`.
* @param streamData New streaming data with updated partial arguments.
*/
updateToolInvocation(toolCallId: string, streamData: ChatToolInvocationStreamData): void;

push(part: ExtendedChatResponsePart): void;

Expand Down Expand Up @@ -668,6 +685,39 @@ declare module 'vscode' {

export interface LanguageModelToolInvocationOptions<T> {
model?: LanguageModelChat;
chatStreamToolCallId?: string;
}

export interface LanguageModelToolInvocationStreamOptions<T> {
/**
* Raw argument payload, such as the streamed JSON fragment from the language model.
*/
readonly rawInput?: unknown;

readonly chatRequestId?: string;
/** @deprecated Use {@link chatSessionResource} instead */
readonly chatSessionId?: string;
readonly chatSessionResource?: Uri;
readonly chatInteractionId?: string;
}

export interface LanguageModelToolStreamResult {
/**
* A customized progress message to show while the tool runs.
*/
invocationMessage?: string | MarkdownString;
}

export interface LanguageModelTool<T> {
/**
* Called zero or more times before {@link LanguageModelTool.prepareInvocation} while the
* language model streams argument data for the invocation. Use this to update progress
* or UI with the partial arguments that have been generated so far.
*
* Implementations must be free of side-effects and should be resilient to receiving
* malformed or incomplete input.
*/
handleToolStream?(options: LanguageModelToolInvocationStreamOptions<T>, token: CancellationToken): ProviderResult<LanguageModelToolStreamResult>;
}

export interface ChatRequest {
Expand Down
89 changes: 24 additions & 65 deletions src/@types/vscode.proposed.chatParticipantPrivate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ declare module 'vscode' {
readonly attempt: number;

/**
* The session identifier for this chat request
* The session identifier for this chat request.
*
* @deprecated Use {@link chatSessionResource} instead.
*/
readonly sessionId: string;

/**
* The resource URI for the chat session this request belongs to.
*/
readonly sessionResource: Uri;

/**
* If automatic command detection is enabled.
*/
Expand Down Expand Up @@ -93,7 +100,16 @@ declare module 'vscode' {
*/
readonly editedFileEvents?: ChatRequestEditedFileEvent[];

readonly isSubagent?: boolean;
/**
* Unique ID for the subagent invocation, used to group tool calls from the same subagent run together.
* Pass this to tool invocations when calling tools from within a subagent context.
*/
readonly subAgentInvocationId?: string;

/**
* Display name of the subagent that is invoking this request.
*/
readonly subAgentName?: string;
}

export enum ChatRequestEditedFileEventKind {
Expand Down Expand Up @@ -230,13 +246,15 @@ declare module 'vscode' {

export interface LanguageModelToolInvocationOptions<T> {
chatRequestId?: string;
/** @deprecated Use {@link chatSessionResource} instead */
chatSessionId?: string;
chatSessionResource?: Uri;
chatInteractionId?: string;
terminalCommand?: string;
/**
* Lets us add some nicer UI to toolcalls that came from a sub-agent, but in the long run, this should probably just be rendered in a similar way to thinking text + tool call groups
* Unique ID for the subagent invocation, used to group tool calls from the same subagent run together.
*/
fromSubAgent?: boolean;
subAgentInvocationId?: string;
}

export interface LanguageModelToolInvocationPrepareOptions<T> {
Expand All @@ -245,7 +263,9 @@ declare module 'vscode' {
*/
input: T;
chatRequestId?: string;
/** @deprecated Use {@link chatSessionResource} instead */
chatSessionId?: string;
chatSessionResource?: Uri;
chatInteractionId?: string;
}

Expand Down Expand Up @@ -319,65 +339,4 @@ declare module 'vscode' {
}

// #endregion

// #region CustomAgentsProvider

/**
* Represents a custom agent resource file (e.g., .agent.md or .prompt.md) available for a repository.
*/
export interface CustomAgentResource {
/**
* The unique identifier/name of the custom agent resource.
*/
readonly name: string;

/**
* A description of what the custom agent resource does.
*/
readonly description: string;

/**
* The URI to the agent or prompt resource file.
*/
readonly uri: Uri;

/**
* Indicates whether the custom agent resource is editable. Defaults to false.
*/
readonly isEditable?: boolean;
}

/**
* Options for querying custom agents.
*/
export interface CustomAgentQueryOptions { }

/**
* A provider that supplies custom agent resources (from .agent.md and .prompt.md files) for repositories.
*/
export interface CustomAgentsProvider {
/**
* An optional event to signal that custom agents have changed.
*/
readonly onDidChangeCustomAgents?: Event<void>;

/**
* Provide the list of custom agent resources available for a given repository.
* @param options Optional query parameters.
* @param token A cancellation token.
* @returns An array of custom agent resources or a promise that resolves to such.
*/
provideCustomAgents(options: CustomAgentQueryOptions, token: CancellationToken): ProviderResult<CustomAgentResource[]>;
}

export namespace chat {
/**
* Register a provider for custom agents.
* @param provider The custom agents provider.
* @returns A disposable that unregisters the provider when disposed.
*/
export function registerCustomAgentsProvider(provider: CustomAgentsProvider): Disposable;
}

// #endregion
}
Loading