Skip to content

Commit dc133a7

Browse files
Copilotalexr00
andcommitted
Add clone offer when opening PR for repo not cloned locally
Co-authored-by: alexr00 <[email protected]>
1 parent b2a5b93 commit dc133a7

6 files changed

+196
-442
lines changed

src/@types/vscode.proposed.chatContextProvider.d.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ declare module 'vscode' {
1616
* Providers registered without a selector will not be called for resource-based context.
1717
* - Explicitly. These context items are shown as options when the user explicitly attaches context.
1818
*
19-
* To ensure your extension is activated when chat context is requested, make sure to include the following activations events:
20-
* - If your extension implements `provideWorkspaceChatContext` or `provideChatContextForResource`, find an activation event which is a good signal to activate.
21-
* Ex: `onLanguage:<languageId>`, `onWebviewPanel:<viewType>`, etc.`
22-
* - If your extension implements `provideChatContextExplicit`, your extension will be automatically activated when the user requests explicit context.
19+
* To ensure your extension is activated when chat context is requested, make sure to include the `onChatContextProvider:<id>` activation event in your `package.json`.
2320
*
2421
* @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.
2522
* @param id Unique identifier for the provider.
@@ -52,7 +49,7 @@ declare module 'vscode' {
5249
value?: string;
5350
/**
5451
* An optional command that is executed when the context item is clicked.
55-
* The original context item will be passed as the first argument to the command.
52+
* The original context item will be passed as an argument to the command.
5653
*/
5754
command?: Command;
5855
}
@@ -65,11 +62,7 @@ declare module 'vscode' {
6562
onDidChangeWorkspaceChatContext?: Event<void>;
6663

6764
/**
68-
* TODO @API: should this be a separate provider interface?
69-
*
70-
* Provide a list of chat context items to be included as workspace context for all chat requests.
71-
* This should be used very sparingly to avoid providing useless context and to avoid using up the context window.
72-
* A good example use case is to provide information about which branch the user is working on in a source control context.
65+
* Provide a list of chat context items to be included as workspace context for all chat sessions.
7366
*
7467
* @param token A cancellation token.
7568
*/

src/@types/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 8 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,6 @@ declare module 'vscode' {
6565
constructor(uri: Uri, edits: NotebookEdit | NotebookEdit[]);
6666
}
6767

68-
/**
69-
* Represents a file-level edit (creation, deletion, or rename).
70-
*/
71-
export interface ChatWorkspaceFileEdit {
72-
/**
73-
* The original file URI (undefined for new files).
74-
*/
75-
oldResource?: Uri;
76-
77-
/**
78-
* The new file URI (undefined for deleted files).
79-
*/
80-
newResource?: Uri;
81-
}
82-
83-
/**
84-
* Represents a workspace edit containing file-level operations.
85-
*/
86-
export class ChatResponseWorkspaceEditPart {
87-
edits: ChatWorkspaceFileEdit[];
88-
constructor(edits: ChatWorkspaceFileEdit[]);
89-
}
90-
9168
export class ChatResponseConfirmationPart {
9269
title: string;
9370
message: string | MarkdownString;
@@ -103,12 +80,9 @@ declare module 'vscode' {
10380
constructor(value: Uri, license: string, snippet: string);
10481
}
10582

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

11488
export interface ChatTerminalToolInvocationData {
@@ -118,48 +92,6 @@ declare module 'vscode' {
11892
toolEdited?: string;
11993
};
12094
language: string;
121-
122-
/**
123-
* Terminal command output. Displayed when the terminal is no longer available.
124-
*/
125-
output?: {
126-
/** The raw output text, may include ANSI escape codes. */
127-
text: string;
128-
};
129-
130-
/**
131-
* Command execution state.
132-
*/
133-
state?: {
134-
/** Exit code of the command. */
135-
exitCode?: number;
136-
/** Duration of execution in milliseconds. */
137-
duration?: number;
138-
};
139-
}
140-
141-
export class McpToolInvocationContentData {
142-
/**
143-
* The mime type which determines how the data property is interpreted.
144-
*/
145-
mimeType: string;
146-
147-
/**
148-
* The byte data for this part.
149-
*/
150-
data: Uint8Array;
151-
152-
/**
153-
* Construct a generic data part with the given content.
154-
* @param data The byte data for this part.
155-
* @param mimeType The mime type of the data.
156-
*/
157-
constructor(data: Uint8Array, mimeType: string);
158-
}
159-
160-
export interface ChatMcpToolInvocationData {
161-
input: string;
162-
output: McpToolInvocationContentData[];
16395
}
16496

16597
export class ChatToolInvocationPart {
@@ -171,8 +103,8 @@ declare module 'vscode' {
171103
pastTenseMessage?: string | MarkdownString;
172104
isConfirmed?: boolean;
173105
isComplete?: boolean;
174-
toolSpecificData?: ChatTerminalToolInvocationData | ChatMcpToolInvocationData;
175-
subAgentInvocationId?: string;
106+
toolSpecificData?: ChatTerminalToolInvocationData;
107+
fromSubAgent?: boolean;
176108
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;
177109

178110
constructor(toolName: string, toolCallId: string, isError?: boolean);
@@ -244,7 +176,7 @@ declare module 'vscode' {
244176
constructor(uris: Uri[], callback: () => Thenable<unknown>);
245177
}
246178

247-
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseWorkspaceEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart;
179+
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart;
248180
export class ChatResponseWarningPart {
249181
value: MarkdownString;
250182
constructor(value: string | MarkdownString);
@@ -378,12 +310,6 @@ declare module 'vscode' {
378310

379311
notebookEdit(target: Uri, isDone: true): void;
380312

381-
/**
382-
* Push a workspace edit containing file-level operations (create, delete, rename).
383-
* @param edits Array of file-level edits to apply
384-
*/
385-
workspaceEdit(edits: ChatWorkspaceFileEdit[]): void;
386-
387313
/**
388314
* Makes an external edit to one or more resources. Changes to the
389315
* resources made within the `callback` and before it resolves will be
@@ -423,21 +349,7 @@ declare module 'vscode' {
423349

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

426-
/**
427-
* Begin a tool invocation in streaming mode. This creates a tool invocation that will
428-
* display streaming progress UI until the tool is actually invoked.
429-
* @param toolCallId Unique identifier for this tool call, used to correlate streaming updates and final invocation.
430-
* @param toolName The name of the tool being invoked.
431-
* @param streamData Optional initial streaming data with partial arguments.
432-
*/
433-
beginToolInvocation(toolCallId: string, toolName: string, streamData?: ChatToolInvocationStreamData & { subagentInvocationId?: string }): void;
434-
435-
/**
436-
* Update the streaming data for a tool invocation that was started with `beginToolInvocation`.
437-
* @param toolCallId The tool call ID that was passed to `beginToolInvocation`.
438-
* @param streamData New streaming data with updated partial arguments.
439-
*/
440-
updateToolInvocation(toolCallId: string, streamData: ChatToolInvocationStreamData): void;
352+
prepareToolInvocation(toolName: string): void;
441353

442354
push(part: ExtendedChatResponsePart): void;
443355

@@ -492,7 +404,7 @@ declare module 'vscode' {
492404
/**
493405
* A map of all tools that should (`true`) and should not (`false`) be used in this request.
494406
*/
495-
readonly tools: Map<LanguageModelToolInformation, boolean>;
407+
readonly tools: Map<string, boolean>;
496408
}
497409

498410
export namespace lm {
@@ -582,47 +494,6 @@ declare module 'vscode' {
582494

583495
export type ChatExtendedRequestHandler = (request: ChatRequest, context: ChatContext, response: ChatResponseStream, token: CancellationToken) => ProviderResult<ChatResult | void>;
584496

585-
/**
586-
* Details about the prompt token usage by category and label.
587-
*/
588-
export interface ChatResultPromptTokenDetail {
589-
/**
590-
* The category this token usage belongs to (e.g., "System", "Context", "Conversation").
591-
*/
592-
readonly category: string;
593-
594-
/**
595-
* The label for this specific token usage (e.g., "System prompt", "Attached files").
596-
*/
597-
readonly label: string;
598-
599-
/**
600-
* The percentage of the total prompt tokens this represents (0-100).
601-
*/
602-
readonly percentageOfPrompt: number;
603-
}
604-
605-
/**
606-
* Token usage information for a chat request.
607-
*/
608-
export interface ChatResultUsage {
609-
/**
610-
* The number of prompt tokens used in this request.
611-
*/
612-
readonly promptTokens: number;
613-
614-
/**
615-
* The number of completion tokens generated in this response.
616-
*/
617-
readonly completionTokens: number;
618-
619-
/**
620-
* Optional breakdown of prompt token usage by category and label.
621-
* If the percentages do not sum to 100%, the remaining will be shown as "Uncategorized".
622-
*/
623-
readonly promptTokenDetails?: readonly ChatResultPromptTokenDetail[];
624-
}
625-
626497
export interface ChatResult {
627498
nextQuestion?: {
628499
prompt: string;
@@ -633,12 +504,6 @@ declare module 'vscode' {
633504
* An optional detail string that will be rendered at the end of the response in certain UI contexts.
634505
*/
635506
details?: string;
636-
637-
/**
638-
* Token usage information for this request, if available.
639-
* This is typically provided by the underlying language model.
640-
*/
641-
readonly usage?: ChatResultUsage;
642507
}
643508

644509
export namespace chat {
@@ -803,39 +668,6 @@ declare module 'vscode' {
803668

804669
export interface LanguageModelToolInvocationOptions<T> {
805670
model?: LanguageModelChat;
806-
chatStreamToolCallId?: string;
807-
}
808-
809-
export interface LanguageModelToolInvocationStreamOptions<T> {
810-
/**
811-
* Raw argument payload, such as the streamed JSON fragment from the language model.
812-
*/
813-
readonly rawInput?: unknown;
814-
815-
readonly chatRequestId?: string;
816-
/** @deprecated Use {@link chatSessionResource} instead */
817-
readonly chatSessionId?: string;
818-
readonly chatSessionResource?: Uri;
819-
readonly chatInteractionId?: string;
820-
}
821-
822-
export interface LanguageModelToolStreamResult {
823-
/**
824-
* A customized progress message to show while the tool runs.
825-
*/
826-
invocationMessage?: string | MarkdownString;
827-
}
828-
829-
export interface LanguageModelTool<T> {
830-
/**
831-
* Called zero or more times before {@link LanguageModelTool.prepareInvocation} while the
832-
* language model streams argument data for the invocation. Use this to update progress
833-
* or UI with the partial arguments that have been generated so far.
834-
*
835-
* Implementations must be free of side-effects and should be resilient to receiving
836-
* malformed or incomplete input.
837-
*/
838-
handleToolStream?(options: LanguageModelToolInvocationStreamOptions<T>, token: CancellationToken): ProviderResult<LanguageModelToolStreamResult>;
839671
}
840672

841673
export interface ChatRequest {

0 commit comments

Comments
 (0)