mirror of
https://github.com/Microsoft/vscode
synced 2024-07-05 01:08:57 +00:00
Rename the chat agent API to "participant" (#205477)
* Start renaming chat API from "agent" to "participant" * Rename the rest of the API * Rename in integration test * Update integration test api proposals * Bump distro
This commit is contained in:
parent
b2b60ac5b3
commit
05bf957b31
|
@ -7,9 +7,9 @@
|
|||
"enabledApiProposals": [
|
||||
"activeComment",
|
||||
"authSession",
|
||||
"chatAgents2",
|
||||
"chatParticipant",
|
||||
"languageModels",
|
||||
"defaultChatAgent",
|
||||
"defaultChatParticipant",
|
||||
"contribViewsRemote",
|
||||
"contribStatusBarItems",
|
||||
"createFileSystemWatcher",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import { CancellationToken, ChatAgentContext, ChatAgentRequest, ChatAgentResult2, ChatVariableLevel, Disposable, Event, EventEmitter, InteractiveSession, ProviderResult, chat, interactive } from 'vscode';
|
||||
import { CancellationToken, ChatContext, ChatRequest, ChatResult, ChatVariableLevel, Disposable, Event, EventEmitter, InteractiveSession, ProviderResult, chat, interactive } from 'vscode';
|
||||
import { DeferredPromise, assertNoRpc, closeAllEditors, disposeAll } from '../utils';
|
||||
|
||||
suite('chat', () => {
|
||||
|
@ -21,15 +21,15 @@ suite('chat', () => {
|
|||
disposeAll(disposables);
|
||||
});
|
||||
|
||||
function getDeferredForRequest(): DeferredPromise<ChatAgentRequest> {
|
||||
const deferred = new DeferredPromise<ChatAgentRequest>();
|
||||
disposables.push(setupAgent()(request => deferred.complete(request.request)));
|
||||
function getDeferredForRequest(): DeferredPromise<ChatRequest> {
|
||||
const deferred = new DeferredPromise<ChatRequest>();
|
||||
disposables.push(setupParticipant()(request => deferred.complete(request.request)));
|
||||
|
||||
return deferred;
|
||||
}
|
||||
|
||||
function setupAgent(): Event<{ request: ChatAgentRequest; context: ChatAgentContext }> {
|
||||
const emitter = new EventEmitter<{ request: ChatAgentRequest; context: ChatAgentContext }>();
|
||||
function setupParticipant(): Event<{ request: ChatRequest; context: ChatContext }> {
|
||||
const emitter = new EventEmitter<{ request: ChatRequest; context: ChatContext }>();
|
||||
disposables.push();
|
||||
disposables.push(interactive.registerInteractiveSessionProvider('provider', {
|
||||
prepareSession: (_token: CancellationToken): ProviderResult<InteractiveSession> => {
|
||||
|
@ -40,23 +40,23 @@ suite('chat', () => {
|
|||
},
|
||||
}));
|
||||
|
||||
const agent = chat.createChatAgent('agent', (request, context, _progress, _token) => {
|
||||
const participant = chat.createChatParticipant('participant', (request, context, _progress, _token) => {
|
||||
emitter.fire({ request, context });
|
||||
return null;
|
||||
});
|
||||
agent.isDefault = true;
|
||||
agent.commandProvider = {
|
||||
participant.isDefault = true;
|
||||
participant.commandProvider = {
|
||||
provideCommands: (_token) => {
|
||||
return [{ name: 'hello', description: 'Hello' }];
|
||||
}
|
||||
};
|
||||
disposables.push(agent);
|
||||
disposables.push(participant);
|
||||
return emitter.event;
|
||||
}
|
||||
|
||||
test('agent and slash command', async () => {
|
||||
const onRequest = setupAgent();
|
||||
interactive.sendInteractiveRequestToProvider('provider', { message: '@agent /hello friend' });
|
||||
test('participant and slash command', async () => {
|
||||
const onRequest = setupParticipant();
|
||||
interactive.sendInteractiveRequestToProvider('provider', { message: '@participant /hello friend' });
|
||||
|
||||
let i = 0;
|
||||
onRequest(request => {
|
||||
|
@ -64,16 +64,16 @@ suite('chat', () => {
|
|||
assert.deepStrictEqual(request.request.command, 'hello');
|
||||
assert.strictEqual(request.request.prompt, 'friend');
|
||||
i++;
|
||||
interactive.sendInteractiveRequestToProvider('provider', { message: '@agent /hello friend' });
|
||||
interactive.sendInteractiveRequestToProvider('provider', { message: '@participant /hello friend' });
|
||||
} else {
|
||||
assert.strictEqual(request.context.history.length, 1);
|
||||
assert.strictEqual(request.context.history[0].agent.agent, 'agent');
|
||||
assert.strictEqual(request.context.history[0].participant.participant, 'participant');
|
||||
assert.strictEqual(request.context.history[0].command, 'hello');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test('agent and variable', async () => {
|
||||
test('participant and variable', async () => {
|
||||
disposables.push(chat.registerVariable('myVar', 'My variable', {
|
||||
resolve(_name, _context, _token) {
|
||||
return [{ level: ChatVariableLevel.Full, value: 'myValue' }];
|
||||
|
@ -81,7 +81,7 @@ suite('chat', () => {
|
|||
}));
|
||||
|
||||
const deferred = getDeferredForRequest();
|
||||
interactive.sendInteractiveRequestToProvider('provider', { message: '@agent hi #myVar' });
|
||||
interactive.sendInteractiveRequestToProvider('provider', { message: '@participant hi #myVar' });
|
||||
const request = await deferred.p;
|
||||
assert.strictEqual(request.prompt, 'hi #myVar');
|
||||
assert.strictEqual(request.variables[0].values[0].value, 'myValue');
|
||||
|
@ -97,25 +97,25 @@ suite('chat', () => {
|
|||
},
|
||||
}));
|
||||
|
||||
const deferred = new DeferredPromise<ChatAgentResult2>();
|
||||
const agent = chat.createChatAgent('agent', (_request, _context, _progress, _token) => {
|
||||
const deferred = new DeferredPromise<ChatResult>();
|
||||
const participant = chat.createChatParticipant('participant', (_request, _context, _progress, _token) => {
|
||||
return { metadata: { key: 'value' } };
|
||||
});
|
||||
agent.isDefault = true;
|
||||
agent.commandProvider = {
|
||||
participant.isDefault = true;
|
||||
participant.commandProvider = {
|
||||
provideCommands: (_token) => {
|
||||
return [{ name: 'hello', description: 'Hello' }];
|
||||
}
|
||||
};
|
||||
agent.followupProvider = {
|
||||
participant.followupProvider = {
|
||||
provideFollowups(result, _token) {
|
||||
deferred.complete(result);
|
||||
return [];
|
||||
},
|
||||
};
|
||||
disposables.push(agent);
|
||||
disposables.push(participant);
|
||||
|
||||
interactive.sendInteractiveRequestToProvider('provider', { message: '@agent /hello friend' });
|
||||
interactive.sendInteractiveRequestToProvider('provider', { message: '@participant /hello friend' });
|
||||
const result = await deferred.p;
|
||||
assert.deepStrictEqual(result.metadata, { key: 'value' });
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.87.0",
|
||||
"distro": "664b4b796ea2343e71889a507e125feb14390bdf",
|
||||
"distro": "af73a537ea203329debad3df7ca7b42b4799473f",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
|
|
@ -1410,15 +1410,15 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
return extHostChatProvider.registerLanguageModel(extension, id, provider, metadata);
|
||||
},
|
||||
registerVariable(name: string, description: string, resolver: vscode.ChatVariableResolver) {
|
||||
checkProposedApiEnabled(extension, 'chatAgents2');
|
||||
checkProposedApiEnabled(extension, 'chatParticipant');
|
||||
return extHostChatVariables.registerVariableResolver(extension, name, description, resolver);
|
||||
},
|
||||
registerMappedEditsProvider(selector: vscode.DocumentSelector, provider: vscode.MappedEditsProvider) {
|
||||
checkProposedApiEnabled(extension, 'mappedEditsProvider');
|
||||
return extHostLanguageFeatures.registerMappedEditsProvider(extension, selector, provider);
|
||||
},
|
||||
createChatAgent(name: string, handler: vscode.ChatAgentExtendedRequestHandler) {
|
||||
checkProposedApiEnabled(extension, 'chatAgents2');
|
||||
createChatParticipant(name: string, handler: vscode.ChatExtendedRequestHandler) {
|
||||
checkProposedApiEnabled(extension, 'chatParticipant');
|
||||
return extHostChatAgents2.createChatAgent(extension, name, handler);
|
||||
},
|
||||
};
|
||||
|
@ -1472,9 +1472,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
// types
|
||||
Breakpoint: extHostTypes.Breakpoint,
|
||||
TerminalOutputAnchor: extHostTypes.TerminalOutputAnchor,
|
||||
ChatAgentResultFeedbackKind: extHostTypes.ChatAgentResultFeedbackKind,
|
||||
ChatResultFeedbackKind: extHostTypes.ChatResultFeedbackKind,
|
||||
ChatVariableLevel: extHostTypes.ChatVariableLevel,
|
||||
ChatAgentCompletionItem: extHostTypes.ChatAgentCompletionItem,
|
||||
ChatCompletionItem: extHostTypes.ChatCompletionItem,
|
||||
CallHierarchyIncomingCall: extHostTypes.CallHierarchyIncomingCall,
|
||||
CallHierarchyItem: extHostTypes.CallHierarchyItem,
|
||||
CallHierarchyOutgoingCall: extHostTypes.CallHierarchyOutgoingCall,
|
||||
|
@ -1664,7 +1664,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
LogLevel: LogLevel,
|
||||
EditSessionIdentityMatch: EditSessionIdentityMatch,
|
||||
InteractiveSessionVoteDirection: extHostTypes.InteractiveSessionVoteDirection,
|
||||
ChatAgentCopyKind: extHostTypes.ChatAgentCopyKind,
|
||||
ChatCopyKind: extHostTypes.ChatCopyKind,
|
||||
InteractiveEditorResponseFeedbackKind: extHostTypes.InteractiveEditorResponseFeedbackKind,
|
||||
StackFrameFocus: extHostTypes.StackFrameFocus,
|
||||
ThreadFocus: extHostTypes.ThreadFocus,
|
||||
|
@ -1678,8 +1678,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
ChatResponseProgressPart: extHostTypes.ChatResponseProgressPart,
|
||||
ChatResponseReferencePart: extHostTypes.ChatResponseReferencePart,
|
||||
ChatResponseCommandButtonPart: extHostTypes.ChatResponseCommandButtonPart,
|
||||
ChatAgentRequestTurn: extHostTypes.ChatAgentRequestTurn,
|
||||
ChatAgentResponseTurn: extHostTypes.ChatAgentResponseTurn,
|
||||
ChatRequestTurn: extHostTypes.ChatRequestTurn,
|
||||
ChatResponseTurn: extHostTypes.ChatResponseTurn,
|
||||
LanguageModelSystemMessage: extHostTypes.LanguageModelSystemMessage,
|
||||
LanguageModelUserMessage: extHostTypes.LanguageModelUserMessage,
|
||||
LanguageModelAssistantMessage: extHostTypes.LanguageModelAssistantMessage,
|
||||
|
|
|
@ -31,7 +31,7 @@ class ChatAgentResponseStream {
|
|||
private _stopWatch = StopWatch.create(false);
|
||||
private _isClosed: boolean = false;
|
||||
private _firstProgress: number | undefined;
|
||||
private _apiObject: vscode.ChatAgentExtendedResponseStream | undefined;
|
||||
private _apiObject: vscode.ChatExtendedResponseStream | undefined;
|
||||
|
||||
constructor(
|
||||
private readonly _extension: IExtensionDescription,
|
||||
|
@ -165,7 +165,7 @@ export class ExtHostChatAgents2 implements ExtHostChatAgentsShape2 {
|
|||
this._proxy = mainContext.getProxy(MainContext.MainThreadChatAgents2);
|
||||
}
|
||||
|
||||
createChatAgent(extension: IExtensionDescription, name: string, handler: vscode.ChatAgentExtendedRequestHandler): vscode.ChatAgent2 {
|
||||
createChatAgent(extension: IExtensionDescription, name: string, handler: vscode.ChatExtendedRequestHandler): vscode.ChatParticipant {
|
||||
const handle = ExtHostChatAgents2._idPool++;
|
||||
const agent = new ExtHostChatAgent(extension, name, this._proxy, handle, handler);
|
||||
this._agents.set(handle, agent);
|
||||
|
@ -219,22 +219,22 @@ export class ExtHostChatAgents2 implements ExtHostChatAgentsShape2 {
|
|||
}
|
||||
}
|
||||
|
||||
private async prepareHistoryTurns(request: IChatAgentRequest, context: { history: IChatAgentHistoryEntryDto[] }): Promise<(vscode.ChatAgentRequestTurn | vscode.ChatAgentResponseTurn)[]> {
|
||||
private async prepareHistoryTurns(request: IChatAgentRequest, context: { history: IChatAgentHistoryEntryDto[] }): Promise<(vscode.ChatRequestTurn | vscode.ChatResponseTurn)[]> {
|
||||
|
||||
const res: (vscode.ChatAgentRequestTurn | vscode.ChatAgentResponseTurn)[] = [];
|
||||
const res: (vscode.ChatRequestTurn | vscode.ChatResponseTurn)[] = [];
|
||||
|
||||
for (const h of context.history) {
|
||||
const ehResult = typeConvert.ChatAgentResult.to(h.result);
|
||||
const result: vscode.ChatAgentResult2 = request.agentId === h.request.agentId ?
|
||||
const result: vscode.ChatResult = request.agentId === h.request.agentId ?
|
||||
ehResult :
|
||||
{ ...ehResult, metadata: undefined };
|
||||
|
||||
// REQUEST turn
|
||||
res.push(new extHostTypes.ChatAgentRequestTurn(h.request.message, h.request.command, h.request.variables.variables.map(typeConvert.ChatAgentResolvedVariable.to), { extensionId: '', agent: h.request.agentId }));
|
||||
res.push(new extHostTypes.ChatRequestTurn(h.request.message, h.request.command, h.request.variables.variables.map(typeConvert.ChatAgentResolvedVariable.to), { extensionId: '', participant: h.request.agentId }));
|
||||
|
||||
// RESPONSE turn
|
||||
const parts = coalesce(h.response.map(r => typeConvert.ChatResponsePart.from(r, this.commands.converter)));
|
||||
res.push(new extHostTypes.ChatAgentResponseTurn(parts, result, { extensionId: '', agent: h.request.agentId }, h.request.command));
|
||||
res.push(new extHostTypes.ChatResponseTurn(parts, result, { extensionId: '', participant: h.request.agentId }, h.request.command));
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -271,13 +271,13 @@ export class ExtHostChatAgents2 implements ExtHostChatAgentsShape2 {
|
|||
}
|
||||
|
||||
const ehResult = typeConvert.ChatAgentResult.to(result);
|
||||
let kind: extHostTypes.ChatAgentResultFeedbackKind;
|
||||
let kind: extHostTypes.ChatResultFeedbackKind;
|
||||
switch (vote) {
|
||||
case InteractiveSessionVoteDirection.Down:
|
||||
kind = extHostTypes.ChatAgentResultFeedbackKind.Unhelpful;
|
||||
kind = extHostTypes.ChatResultFeedbackKind.Unhelpful;
|
||||
break;
|
||||
case InteractiveSessionVoteDirection.Up:
|
||||
kind = extHostTypes.ChatAgentResultFeedbackKind.Helpful;
|
||||
kind = extHostTypes.ChatResultFeedbackKind.Helpful;
|
||||
break;
|
||||
}
|
||||
agent.acceptFeedback(reportIssue ?
|
||||
|
@ -333,8 +333,8 @@ export class ExtHostChatAgents2 implements ExtHostChatAgentsShape2 {
|
|||
|
||||
class ExtHostChatAgent {
|
||||
|
||||
private _commandProvider: vscode.ChatAgentCommandProvider | undefined;
|
||||
private _followupProvider: vscode.ChatAgentFollowupProvider | undefined;
|
||||
private _commandProvider: vscode.ChatCommandProvider | undefined;
|
||||
private _followupProvider: vscode.ChatFollowupProvider | undefined;
|
||||
private _description: string | undefined;
|
||||
private _fullName: string | undefined;
|
||||
private _iconPath: vscode.Uri | { light: vscode.Uri; dark: vscode.Uri } | vscode.ThemeIcon | undefined;
|
||||
|
@ -343,11 +343,11 @@ class ExtHostChatAgent {
|
|||
private _helpTextPostfix: string | vscode.MarkdownString | undefined;
|
||||
private _sampleRequest?: string;
|
||||
private _isSecondary: boolean | undefined;
|
||||
private _onDidReceiveFeedback = new Emitter<vscode.ChatAgentResult2Feedback>();
|
||||
private _onDidPerformAction = new Emitter<vscode.ChatAgentUserActionEvent>();
|
||||
private _onDidReceiveFeedback = new Emitter<vscode.ChatResultFeedback>();
|
||||
private _onDidPerformAction = new Emitter<vscode.ChatUserActionEvent>();
|
||||
private _supportIssueReporting: boolean | undefined;
|
||||
private _agentVariableProvider?: { provider: vscode.ChatAgentCompletionItemProvider; triggerCharacters: string[] };
|
||||
private _welcomeMessageProvider?: vscode.ChatAgentWelcomeMessageProvider | undefined;
|
||||
private _agentVariableProvider?: { provider: vscode.ChatParticipantCompletionItemProvider; triggerCharacters: string[] };
|
||||
private _welcomeMessageProvider?: vscode.ChatWelcomeMessageProvider | undefined;
|
||||
private _isSticky: boolean | undefined;
|
||||
|
||||
constructor(
|
||||
|
@ -355,18 +355,18 @@ class ExtHostChatAgent {
|
|||
public readonly id: string,
|
||||
private readonly _proxy: MainThreadChatAgentsShape2,
|
||||
private readonly _handle: number,
|
||||
private _requestHandler: vscode.ChatAgentExtendedRequestHandler,
|
||||
private _requestHandler: vscode.ChatExtendedRequestHandler,
|
||||
) { }
|
||||
|
||||
acceptFeedback(feedback: vscode.ChatAgentResult2Feedback) {
|
||||
acceptFeedback(feedback: vscode.ChatResultFeedback) {
|
||||
this._onDidReceiveFeedback.fire(feedback);
|
||||
}
|
||||
|
||||
acceptAction(event: vscode.ChatAgentUserActionEvent) {
|
||||
acceptAction(event: vscode.ChatUserActionEvent) {
|
||||
this._onDidPerformAction.fire(event);
|
||||
}
|
||||
|
||||
async invokeCompletionProvider(query: string, token: CancellationToken): Promise<vscode.ChatAgentCompletionItem[]> {
|
||||
async invokeCompletionProvider(query: string, token: CancellationToken): Promise<vscode.ChatCompletionItem[]> {
|
||||
if (!this._agentVariableProvider) {
|
||||
return [];
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ class ExtHostChatAgent {
|
|||
return result
|
||||
.map(c => {
|
||||
if ('isSticky2' in c) {
|
||||
checkProposedApiEnabled(this.extension, 'chatAgents2Additions');
|
||||
checkProposedApiEnabled(this.extension, 'chatParticipantAdditions');
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -398,7 +398,7 @@ class ExtHostChatAgent {
|
|||
});
|
||||
}
|
||||
|
||||
async provideFollowups(result: vscode.ChatAgentResult2, token: CancellationToken): Promise<vscode.ChatAgentFollowup[]> {
|
||||
async provideFollowups(result: vscode.ChatResult, token: CancellationToken): Promise<vscode.ChatFollowup[]> {
|
||||
if (!this._followupProvider) {
|
||||
return [];
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ class ExtHostChatAgent {
|
|||
});
|
||||
}
|
||||
|
||||
async provideSampleQuestions(token: CancellationToken): Promise<vscode.ChatAgentFollowup[]> {
|
||||
async provideSampleQuestions(token: CancellationToken): Promise<vscode.ChatFollowup[]> {
|
||||
if (!this._welcomeMessageProvider || !this._welcomeMessageProvider.provideSampleQuestions) {
|
||||
return [];
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ class ExtHostChatAgent {
|
|||
return content;
|
||||
}
|
||||
|
||||
get apiAgent(): vscode.ChatAgent2 {
|
||||
get apiAgent(): vscode.ChatParticipant {
|
||||
let disposed = false;
|
||||
let updateScheduled = false;
|
||||
const updateMetadataSoon = () => {
|
||||
|
@ -527,20 +527,20 @@ class ExtHostChatAgent {
|
|||
updateMetadataSoon();
|
||||
},
|
||||
get isDefault() {
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatAgent');
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatParticipant');
|
||||
return that._isDefault;
|
||||
},
|
||||
set isDefault(v) {
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatAgent');
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatParticipant');
|
||||
that._isDefault = v;
|
||||
updateMetadataSoon();
|
||||
},
|
||||
get helpTextPrefix() {
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatAgent');
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatParticipant');
|
||||
return that._helpTextPrefix;
|
||||
},
|
||||
set helpTextPrefix(v) {
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatAgent');
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatParticipant');
|
||||
if (!that._isDefault) {
|
||||
throw new Error('helpTextPrefix is only available on the default chat agent');
|
||||
}
|
||||
|
@ -549,11 +549,11 @@ class ExtHostChatAgent {
|
|||
updateMetadataSoon();
|
||||
},
|
||||
get helpTextPostfix() {
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatAgent');
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatParticipant');
|
||||
return that._helpTextPostfix;
|
||||
},
|
||||
set helpTextPostfix(v) {
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatAgent');
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatParticipant');
|
||||
if (!that._isDefault) {
|
||||
throw new Error('helpTextPostfix is only available on the default chat agent');
|
||||
}
|
||||
|
@ -562,11 +562,11 @@ class ExtHostChatAgent {
|
|||
updateMetadataSoon();
|
||||
},
|
||||
get isSecondary() {
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatAgent');
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatParticipant');
|
||||
return that._isSecondary;
|
||||
},
|
||||
set isSecondary(v) {
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatAgent');
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatParticipant');
|
||||
that._isSecondary = v;
|
||||
updateMetadataSoon();
|
||||
},
|
||||
|
@ -578,19 +578,19 @@ class ExtHostChatAgent {
|
|||
updateMetadataSoon();
|
||||
},
|
||||
get supportIssueReporting() {
|
||||
checkProposedApiEnabled(that.extension, 'chatAgents2Additions');
|
||||
checkProposedApiEnabled(that.extension, 'chatParticipantAdditions');
|
||||
return that._supportIssueReporting;
|
||||
},
|
||||
set supportIssueReporting(v) {
|
||||
checkProposedApiEnabled(that.extension, 'chatAgents2Additions');
|
||||
checkProposedApiEnabled(that.extension, 'chatParticipantAdditions');
|
||||
that._supportIssueReporting = v;
|
||||
updateMetadataSoon();
|
||||
},
|
||||
get onDidReceiveFeedback() {
|
||||
return that._onDidReceiveFeedback.event;
|
||||
},
|
||||
set agentVariableProvider(v) {
|
||||
checkProposedApiEnabled(that.extension, 'chatAgents2Additions');
|
||||
set participantVariableProvider(v) {
|
||||
checkProposedApiEnabled(that.extension, 'chatParticipantAdditions');
|
||||
that._agentVariableProvider = v;
|
||||
if (v) {
|
||||
if (!v.triggerCharacters.length) {
|
||||
|
@ -602,20 +602,20 @@ class ExtHostChatAgent {
|
|||
that._proxy.$unregisterAgentCompletionsProvider(that._handle);
|
||||
}
|
||||
},
|
||||
get agentVariableProvider() {
|
||||
checkProposedApiEnabled(that.extension, 'chatAgents2Additions');
|
||||
get participantVariableProvider() {
|
||||
checkProposedApiEnabled(that.extension, 'chatParticipantAdditions');
|
||||
return that._agentVariableProvider;
|
||||
},
|
||||
set welcomeMessageProvider(v) {
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatAgent');
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatParticipant');
|
||||
that._welcomeMessageProvider = v;
|
||||
updateMetadataSoon();
|
||||
},
|
||||
get welcomeMessageProvider() {
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatAgent');
|
||||
checkProposedApiEnabled(that.extension, 'defaultChatParticipant');
|
||||
return that._welcomeMessageProvider;
|
||||
},
|
||||
onDidPerformAction: !isProposedApiEnabled(this.extension, 'chatAgents2Additions')
|
||||
onDidPerformAction: !isProposedApiEnabled(this.extension, 'chatParticipantAdditions')
|
||||
? undefined!
|
||||
: this._onDidPerformAction.event
|
||||
,
|
||||
|
@ -633,10 +633,10 @@ class ExtHostChatAgent {
|
|||
that._onDidReceiveFeedback.dispose();
|
||||
that._proxy.$unregisterAgent(that._handle);
|
||||
},
|
||||
} satisfies vscode.ChatAgent2;
|
||||
} satisfies vscode.ChatParticipant;
|
||||
}
|
||||
|
||||
invoke(request: vscode.ChatAgentRequest, context: vscode.ChatAgentContext, response: vscode.ChatAgentExtendedResponseStream, token: CancellationToken): vscode.ProviderResult<vscode.ChatAgentResult2> {
|
||||
invoke(request: vscode.ChatRequest, context: vscode.ChatContext, response: vscode.ChatExtendedResponseStream, token: CancellationToken): vscode.ProviderResult<vscode.ChatResult> {
|
||||
return this._requestHandler(request, context, response, token);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ export class ExtHostChatVariables implements ExtHostChatVariablesShape {
|
|||
}
|
||||
try {
|
||||
if (item.resolver.resolve2) {
|
||||
checkProposedApiEnabled(item.extension, 'chatAgents2Additions');
|
||||
checkProposedApiEnabled(item.extension, 'chatParticipantAdditions');
|
||||
const stream = new ChatVariableResolverResponseStream(requestId, this._proxy);
|
||||
const value = await item.resolver.resolve2(item.data.name, { prompt: messageText }, stream.apiObject, token);
|
||||
if (value) {
|
||||
|
|
|
@ -2195,10 +2195,10 @@ export namespace DataTransfer {
|
|||
}
|
||||
|
||||
export namespace ChatFollowup {
|
||||
export function from(followup: vscode.ChatAgentFollowup, request: IChatAgentRequest | undefined): IChatFollowup {
|
||||
export function from(followup: vscode.ChatFollowup, request: IChatAgentRequest | undefined): IChatFollowup {
|
||||
return {
|
||||
kind: 'reply',
|
||||
agentId: followup.agentId ?? request?.agentId ?? '',
|
||||
agentId: followup.participant ?? request?.agentId ?? '',
|
||||
subCommand: followup.command ?? request?.command,
|
||||
message: followup.prompt,
|
||||
title: followup.title,
|
||||
|
@ -2206,11 +2206,11 @@ export namespace ChatFollowup {
|
|||
};
|
||||
}
|
||||
|
||||
export function to(followup: IChatFollowup): vscode.ChatAgentFollowup {
|
||||
export function to(followup: IChatFollowup): vscode.ChatFollowup {
|
||||
return {
|
||||
prompt: followup.message,
|
||||
title: followup.title,
|
||||
agentId: followup.agentId,
|
||||
participant: followup.agentId,
|
||||
command: followup.subCommand,
|
||||
tooltip: followup.tooltip,
|
||||
};
|
||||
|
@ -2490,13 +2490,13 @@ export namespace ChatResponsePart {
|
|||
}
|
||||
|
||||
export namespace ChatResponseProgress {
|
||||
export function from(extension: IExtensionDescription, progress: vscode.ChatAgentExtendedProgress): extHostProtocol.IChatProgressDto | undefined {
|
||||
export function from(extension: IExtensionDescription, progress: vscode.ChatExtendedProgress): extHostProtocol.IChatProgressDto | undefined {
|
||||
if ('markdownContent' in progress) {
|
||||
checkProposedApiEnabled(extension, 'chatAgents2Additions');
|
||||
checkProposedApiEnabled(extension, 'chatParticipantAdditions');
|
||||
return { content: MarkdownString.from(progress.markdownContent), kind: 'markdownContent' };
|
||||
} else if ('content' in progress) {
|
||||
if ('vulnerabilities' in progress && progress.vulnerabilities) {
|
||||
checkProposedApiEnabled(extension, 'chatAgents2Additions');
|
||||
checkProposedApiEnabled(extension, 'chatParticipantAdditions');
|
||||
return { content: progress.content, vulnerabilities: progress.vulnerabilities, kind: 'vulnerability' };
|
||||
}
|
||||
|
||||
|
@ -2504,7 +2504,7 @@ export namespace ChatResponseProgress {
|
|||
return { content: progress.content, kind: 'content' };
|
||||
}
|
||||
|
||||
checkProposedApiEnabled(extension, 'chatAgents2Additions');
|
||||
checkProposedApiEnabled(extension, 'chatParticipantAdditions');
|
||||
return { content: MarkdownString.from(progress.content), kind: 'markdownContent' };
|
||||
} else if ('documents' in progress) {
|
||||
return {
|
||||
|
@ -2534,9 +2534,9 @@ export namespace ChatResponseProgress {
|
|||
name: progress.title,
|
||||
kind: 'inlineReference'
|
||||
};
|
||||
} else if ('agentName' in progress) {
|
||||
checkProposedApiEnabled(extension, 'chatAgents2Additions');
|
||||
return { agentName: progress.agentName, command: progress.command, kind: 'agentDetection' };
|
||||
} else if ('participant' in progress) {
|
||||
checkProposedApiEnabled(extension, 'chatParticipantAdditions');
|
||||
return { agentName: progress.participant, command: progress.command, kind: 'agentDetection' };
|
||||
} else if ('message' in progress) {
|
||||
return { content: MarkdownString.from(progress.message), kind: 'progressMessage' };
|
||||
} else {
|
||||
|
@ -2544,7 +2544,7 @@ export namespace ChatResponseProgress {
|
|||
}
|
||||
}
|
||||
|
||||
export function to(progress: extHostProtocol.IChatProgressDto): vscode.ChatAgentProgress | undefined {
|
||||
export function to(progress: extHostProtocol.IChatProgressDto): vscode.ChatProgress | undefined {
|
||||
switch (progress.kind) {
|
||||
case 'markdownContent':
|
||||
case 'inlineReference':
|
||||
|
@ -2574,7 +2574,7 @@ export namespace ChatResponseProgress {
|
|||
}
|
||||
}
|
||||
|
||||
export function toProgressContent(progress: extHostProtocol.IChatContentProgressDto, commandsConverter: Command.ICommandsConverter): vscode.ChatAgentContentProgress | undefined {
|
||||
export function toProgressContent(progress: extHostProtocol.IChatContentProgressDto, commandsConverter: Command.ICommandsConverter): vscode.ChatContentProgress | undefined {
|
||||
switch (progress.kind) {
|
||||
case 'markdownContent':
|
||||
// For simplicity, don't sent back the 'extended' types, so downgrade markdown to just some text
|
||||
|
@ -2600,7 +2600,7 @@ export namespace ChatResponseProgress {
|
|||
}
|
||||
|
||||
export namespace ChatAgentRequest {
|
||||
export function to(request: IChatAgentRequest): vscode.ChatAgentRequest {
|
||||
export function to(request: IChatAgentRequest): vscode.ChatRequest {
|
||||
return {
|
||||
prompt: request.message,
|
||||
command: request.command,
|
||||
|
@ -2610,7 +2610,7 @@ export namespace ChatAgentRequest {
|
|||
}
|
||||
|
||||
export namespace ChatAgentResolvedVariable {
|
||||
export function to(request: { name: string; range: IOffsetRange; values: IChatRequestVariableValue[] }): vscode.ChatAgentResolvedVariable {
|
||||
export function to(request: { name: string; range: IOffsetRange; values: IChatRequestVariableValue[] }): vscode.ChatResolvedVariable {
|
||||
return {
|
||||
name: request.name,
|
||||
range: [request.range.start, request.range.endExclusive],
|
||||
|
@ -2620,7 +2620,7 @@ export namespace ChatAgentResolvedVariable {
|
|||
}
|
||||
|
||||
export namespace ChatAgentCompletionItem {
|
||||
export function from(item: vscode.ChatAgentCompletionItem): extHostProtocol.IChatAgentCompletionItem {
|
||||
export function from(item: vscode.ChatCompletionItem): extHostProtocol.IChatAgentCompletionItem {
|
||||
return {
|
||||
label: item.label,
|
||||
values: item.values.map(ChatVariable.from),
|
||||
|
@ -2632,7 +2632,7 @@ export namespace ChatAgentCompletionItem {
|
|||
}
|
||||
|
||||
export namespace ChatAgentResult {
|
||||
export function to(result: IChatAgentResult): vscode.ChatAgentResult2 {
|
||||
export function to(result: IChatAgentResult): vscode.ChatResult {
|
||||
return {
|
||||
errorDetails: result.errorDetails,
|
||||
metadata: result.metadata,
|
||||
|
@ -2641,7 +2641,7 @@ export namespace ChatAgentResult {
|
|||
}
|
||||
|
||||
export namespace ChatAgentUserActionEvent {
|
||||
export function to(result: IChatAgentResult, event: IChatUserActionEvent, commandsConverter: CommandsConverter): vscode.ChatAgentUserActionEvent | undefined {
|
||||
export function to(result: IChatAgentResult, event: IChatUserActionEvent, commandsConverter: CommandsConverter): vscode.ChatUserActionEvent | undefined {
|
||||
if (event.action.kind === 'vote') {
|
||||
// Is the "feedback" type
|
||||
return;
|
||||
|
@ -2649,10 +2649,10 @@ export namespace ChatAgentUserActionEvent {
|
|||
|
||||
const ehResult = ChatAgentResult.to(result);
|
||||
if (event.action.kind === 'command') {
|
||||
const commandAction: vscode.ChatAgentCommandAction = { kind: 'command', commandButton: ChatResponseProgress.toProgressContent(event.action.commandButton, commandsConverter) as vscode.ChatAgentCommandButton };
|
||||
const commandAction: vscode.ChatCommandAction = { kind: 'command', commandButton: ChatResponseProgress.toProgressContent(event.action.commandButton, commandsConverter) as vscode.ChatCommandButton };
|
||||
return { action: commandAction, result: ehResult };
|
||||
} else if (event.action.kind === 'followUp') {
|
||||
const followupAction: vscode.ChatAgentFollowupAction = { kind: 'followUp', followup: ChatFollowup.to(event.action.followup) };
|
||||
const followupAction: vscode.ChatFollowupAction = { kind: 'followUp', followup: ChatFollowup.to(event.action.followup) };
|
||||
return { action: followupAction, result: ehResult };
|
||||
} else {
|
||||
return { action: event.action, result: ehResult };
|
||||
|
|
|
@ -4164,7 +4164,7 @@ export enum InteractiveSessionVoteDirection {
|
|||
Up = 1
|
||||
}
|
||||
|
||||
export enum ChatAgentCopyKind {
|
||||
export enum ChatCopyKind {
|
||||
Action = 1,
|
||||
Toolbar = 2
|
||||
}
|
||||
|
@ -4175,7 +4175,7 @@ export enum ChatVariableLevel {
|
|||
Full = 3
|
||||
}
|
||||
|
||||
export class ChatAgentCompletionItem implements vscode.ChatAgentCompletionItem {
|
||||
export class ChatCompletionItem implements vscode.ChatCompletionItem {
|
||||
label: string | CompletionItemLabel;
|
||||
insertText?: string;
|
||||
values: vscode.ChatVariableValue[];
|
||||
|
@ -4200,7 +4200,7 @@ export enum InteractiveEditorResponseFeedbackKind {
|
|||
Bug = 4
|
||||
}
|
||||
|
||||
export enum ChatAgentResultFeedbackKind {
|
||||
export enum ChatResultFeedbackKind {
|
||||
Unhelpful = 0,
|
||||
Helpful = 1,
|
||||
}
|
||||
|
@ -4260,21 +4260,21 @@ export class ChatResponseReferencePart {
|
|||
}
|
||||
|
||||
|
||||
export class ChatAgentRequestTurn implements vscode.ChatAgentRequestTurn {
|
||||
export class ChatRequestTurn implements vscode.ChatRequestTurn {
|
||||
constructor(
|
||||
readonly prompt: string,
|
||||
readonly command: string | undefined,
|
||||
readonly variables: vscode.ChatAgentResolvedVariable[],
|
||||
readonly agent: { extensionId: string; agent: string },
|
||||
readonly variables: vscode.ChatResolvedVariable[],
|
||||
readonly participant: { extensionId: string; participant: string },
|
||||
) { }
|
||||
}
|
||||
|
||||
export class ChatAgentResponseTurn implements vscode.ChatAgentResponseTurn {
|
||||
export class ChatResponseTurn implements vscode.ChatResponseTurn {
|
||||
|
||||
constructor(
|
||||
readonly response: ReadonlyArray<ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>,
|
||||
readonly result: vscode.ChatAgentResult2,
|
||||
readonly agent: { extensionId: string; agent: string },
|
||||
readonly result: vscode.ChatResult,
|
||||
readonly participant: { extensionId: string; participant: string },
|
||||
readonly command?: string
|
||||
) { }
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import { CHAT_CATEGORY } from 'vs/workbench/contrib/chat/browser/actions/chatAct
|
|||
import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat';
|
||||
import { ICodeBlockActionContext } from 'vs/workbench/contrib/chat/browser/codeBlockPart';
|
||||
import { CONTEXT_IN_CHAT_INPUT, CONTEXT_IN_CHAT_SESSION, CONTEXT_PROVIDER_EXISTS } from 'vs/workbench/contrib/chat/common/chatContextKeys';
|
||||
import { ChatAgentCopyKind, IChatService, IDocumentContext } from 'vs/workbench/contrib/chat/common/chatService';
|
||||
import { ChatCopyKind, IChatService, IDocumentContext } from 'vs/workbench/contrib/chat/common/chatService';
|
||||
import { IChatResponseViewModel, isResponseVM } from 'vs/workbench/contrib/chat/common/chatViewModel';
|
||||
import { CTX_INLINE_CHAT_VISIBLE } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
|
||||
import { insertCell } from 'vs/workbench/contrib/notebook/browser/controller/cellOperations';
|
||||
|
@ -112,7 +112,7 @@ export function registerChatCodeBlockActions() {
|
|||
action: {
|
||||
kind: 'copy',
|
||||
codeBlockIndex: context.codeBlockIndex,
|
||||
copyKind: ChatAgentCopyKind.Toolbar,
|
||||
copyKind: ChatCopyKind.Toolbar,
|
||||
copiedCharacters: context.code.length,
|
||||
totalCharacters: context.code.length,
|
||||
copiedText: context.code,
|
||||
|
@ -156,7 +156,7 @@ export function registerChatCodeBlockActions() {
|
|||
action: {
|
||||
kind: 'copy',
|
||||
codeBlockIndex: context.codeBlockIndex,
|
||||
copyKind: ChatAgentCopyKind.Action,
|
||||
copyKind: ChatCopyKind.Action,
|
||||
copiedText,
|
||||
copiedCharacters: copiedText.length,
|
||||
totalCharacters,
|
||||
|
|
|
@ -177,7 +177,7 @@ export interface IChatVoteAction {
|
|||
reportIssue?: boolean;
|
||||
}
|
||||
|
||||
export enum ChatAgentCopyKind {
|
||||
export enum ChatCopyKind {
|
||||
// Keyboard shortcut or context menu
|
||||
Action = 1,
|
||||
Toolbar = 2
|
||||
|
@ -186,7 +186,7 @@ export enum ChatAgentCopyKind {
|
|||
export interface IChatCopyAction {
|
||||
kind: 'copy';
|
||||
codeBlockIndex: number;
|
||||
copyKind: ChatAgentCopyKind;
|
||||
copyKind: ChatCopyKind;
|
||||
copiedCharacters: number;
|
||||
totalCharacters: number;
|
||||
copiedText: string;
|
||||
|
|
|
@ -26,7 +26,7 @@ import { ChatModel, ChatModelInitState, ChatRequestModel, ChatWelcomeMessageMode
|
|||
import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart, IParsedChatRequest, getPromptText } from 'vs/workbench/contrib/chat/common/chatParserTypes';
|
||||
import { ChatMessageRole, IChatMessage } from 'vs/workbench/contrib/chat/common/chatProvider';
|
||||
import { ChatRequestParser } from 'vs/workbench/contrib/chat/common/chatRequestParser';
|
||||
import { ChatAgentCopyKind, IChat, IChatCompleteResponse, IChatDetail, IChatDynamicRequest, IChatFollowup, IChatProgress, IChatProvider, IChatProviderInfo, IChatSendRequestData, IChatService, IChatTransferredSessionData, IChatUserActionEvent, InteractiveSessionVoteDirection } from 'vs/workbench/contrib/chat/common/chatService';
|
||||
import { ChatCopyKind, IChat, IChatCompleteResponse, IChatDetail, IChatDynamicRequest, IChatFollowup, IChatProgress, IChatProvider, IChatProviderInfo, IChatSendRequestData, IChatService, IChatTransferredSessionData, IChatUserActionEvent, InteractiveSessionVoteDirection } from 'vs/workbench/contrib/chat/common/chatService';
|
||||
import { IChatSlashCommandService } from 'vs/workbench/contrib/chat/common/chatSlashCommands';
|
||||
import { IChatVariablesService } from 'vs/workbench/contrib/chat/common/chatVariables';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
|
@ -226,7 +226,7 @@ export class ChatService extends Disposable implements IChatService {
|
|||
} else if (action.action.kind === 'copy') {
|
||||
this.telemetryService.publicLog2<ChatCopyEvent, ChatCopyClassification>('interactiveSessionCopy', {
|
||||
providerId: action.providerId,
|
||||
copyKind: action.action.copyKind === ChatAgentCopyKind.Action ? 'action' : 'toolbar'
|
||||
copyKind: action.action.copyKind === ChatCopyKind.Action ? 'action' : 'toolbar'
|
||||
});
|
||||
} else if (action.action.kind === 'insert') {
|
||||
this.telemetryService.publicLog2<ChatInsertEvent, ChatInsertClassification>('interactiveSessionInsert', {
|
||||
|
|
|
@ -11,8 +11,8 @@ export const allApiProposals = Object.freeze({
|
|||
authGetSessions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authGetSessions.d.ts',
|
||||
authSession: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts',
|
||||
canonicalUriProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts',
|
||||
chatAgents2: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatAgents2.d.ts',
|
||||
chatAgents2Additions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatAgents2Additions.d.ts',
|
||||
chatParticipant: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipant.d.ts',
|
||||
chatParticipantAdditions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts',
|
||||
chatProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatProvider.d.ts',
|
||||
chatTab: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatTab.d.ts',
|
||||
codeActionAI: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionAI.d.ts',
|
||||
|
@ -44,7 +44,7 @@ export const allApiProposals = Object.freeze({
|
|||
customEditorMove: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorMove.d.ts',
|
||||
debugFocus: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.debugFocus.d.ts',
|
||||
debugVisualization: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.debugVisualization.d.ts',
|
||||
defaultChatAgent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.defaultChatAgent.d.ts',
|
||||
defaultChatParticipant: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts',
|
||||
diffCommand: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffCommand.d.ts',
|
||||
diffContentOptions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffContentOptions.d.ts',
|
||||
documentFiltersExclusive: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts',
|
||||
|
|
|
@ -6,70 +6,70 @@
|
|||
declare module 'vscode' {
|
||||
|
||||
// TODO@API name: Turn?
|
||||
export class ChatAgentRequestTurn {
|
||||
export class ChatRequestTurn {
|
||||
|
||||
/**
|
||||
* The prompt as entered by the user.
|
||||
*
|
||||
* Information about variables used in this request are is stored in {@link ChatAgentRequest.variables}.
|
||||
* Information about variables used in this request are is stored in {@link ChatRequest.variables}.
|
||||
*
|
||||
* *Note* that the {@link ChatAgent2.name name} of the agent and the {@link ChatAgentCommand.name command}
|
||||
* *Note* that the {@link ChatParticipant.name name} of the participant and the {@link ChatCommand.name command}
|
||||
* are not part of the prompt.
|
||||
*/
|
||||
readonly prompt: string;
|
||||
|
||||
/**
|
||||
* The name of the chat agent and contributing extension to which this request was directed.
|
||||
* The name of the chat participant and contributing extension to which this request was directed.
|
||||
*/
|
||||
readonly agent: { readonly extensionId: string; readonly agent: string };
|
||||
readonly participant: { readonly extensionId: string; readonly participant: string };
|
||||
|
||||
/**
|
||||
* The name of the {@link ChatAgentCommand command} that was selected for this request.
|
||||
* The name of the {@link ChatCommand command} that was selected for this request.
|
||||
*/
|
||||
readonly command: string | undefined;
|
||||
|
||||
/**
|
||||
* The variables that were referenced in this message.
|
||||
*/
|
||||
readonly variables: ChatAgentResolvedVariable[];
|
||||
readonly variables: ChatResolvedVariable[];
|
||||
|
||||
private constructor(prompt: string, command: string | undefined, variables: ChatAgentResolvedVariable[], agent: { extensionId: string; agent: string });
|
||||
private constructor(prompt: string, command: string | undefined, variables: ChatResolvedVariable[], participant: { extensionId: string; participant: string });
|
||||
}
|
||||
|
||||
// TODO@API name: Turn?
|
||||
export class ChatAgentResponseTurn {
|
||||
export class ChatResponseTurn {
|
||||
|
||||
/**
|
||||
* The content that was received from the chat agent. Only the progress parts that represent actual content (not metadata) are represented.
|
||||
* The content that was received from the chat participant. Only the progress parts that represent actual content (not metadata) are represented.
|
||||
*/
|
||||
readonly response: ReadonlyArray<ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>;
|
||||
|
||||
/**
|
||||
* The result that was received from the chat agent.
|
||||
* The result that was received from the chat participant.
|
||||
*/
|
||||
readonly result: ChatAgentResult2;
|
||||
readonly result: ChatResult;
|
||||
|
||||
/**
|
||||
* The name of the chat agent and contributing extension to which this request was directed.
|
||||
* The name of the chat participant and contributing extension to which this request was directed.
|
||||
*/
|
||||
readonly agent: { readonly extensionId: string; readonly agent: string };
|
||||
readonly participant: { readonly extensionId: string; readonly participant: string };
|
||||
|
||||
readonly command?: string;
|
||||
|
||||
private constructor(response: ReadonlyArray<ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>, result: ChatAgentResult2, agentId: { extensionId: string; agent: string });
|
||||
private constructor(response: ReadonlyArray<ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>, result: ChatResult, participant: { extensionId: string; participant: string });
|
||||
}
|
||||
|
||||
export interface ChatAgentContext {
|
||||
export interface ChatContext {
|
||||
/**
|
||||
* All of the chat messages so far in the current chat session.
|
||||
*/
|
||||
readonly history: ReadonlyArray<ChatAgentRequestTurn | ChatAgentResponseTurn>;
|
||||
readonly history: ReadonlyArray<ChatRequestTurn | ChatResponseTurn>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an error result from a chat request.
|
||||
*/
|
||||
export interface ChatAgentErrorDetails {
|
||||
export interface ChatErrorDetails {
|
||||
/**
|
||||
* An error message that is shown to the user.
|
||||
*/
|
||||
|
@ -93,11 +93,11 @@ declare module 'vscode' {
|
|||
/**
|
||||
* The result of a chat request.
|
||||
*/
|
||||
export interface ChatAgentResult2 {
|
||||
export interface ChatResult {
|
||||
/**
|
||||
* If the request resulted in an error, this property defines the error details.
|
||||
*/
|
||||
errorDetails?: ChatAgentErrorDetails;
|
||||
errorDetails?: ChatErrorDetails;
|
||||
|
||||
/**
|
||||
* Arbitrary metadata for this result. Can be anything but must be JSON-stringifyable.
|
||||
|
@ -108,7 +108,7 @@ declare module 'vscode' {
|
|||
/**
|
||||
* Represents the type of user feedback received.
|
||||
*/
|
||||
export enum ChatAgentResultFeedbackKind {
|
||||
export enum ChatResultFeedbackKind {
|
||||
/**
|
||||
* The user marked the result as helpful.
|
||||
*/
|
||||
|
@ -123,25 +123,24 @@ declare module 'vscode' {
|
|||
/**
|
||||
* Represents user feedback for a result.
|
||||
*/
|
||||
export interface ChatAgentResult2Feedback {
|
||||
export interface ChatResultFeedback {
|
||||
/**
|
||||
* This instance of ChatAgentResult2 is the same instance that was returned from the chat agent,
|
||||
* and it can be extended with arbitrary properties if needed.
|
||||
* This instance of ChatResult has the same properties as the result returned from the participant callback, including `metadata`, but is not the same instance.
|
||||
*/
|
||||
readonly result: ChatAgentResult2;
|
||||
readonly result: ChatResult;
|
||||
|
||||
/**
|
||||
* The kind of feedback that was received.
|
||||
*/
|
||||
readonly kind: ChatAgentResultFeedbackKind;
|
||||
readonly kind: ChatResultFeedbackKind;
|
||||
}
|
||||
|
||||
export interface ChatAgentCommand {
|
||||
export interface ChatCommand {
|
||||
/**
|
||||
* A short name by which this command is referred to in the UI, e.g. `fix` or
|
||||
* `explain` for commands that fix an issue or explain code.
|
||||
*
|
||||
* **Note**: The name should be unique among the commands provided by this agent.
|
||||
* **Note**: The name should be unique among the commands provided by this participant.
|
||||
*/
|
||||
readonly name: string;
|
||||
|
||||
|
@ -157,17 +156,16 @@ declare module 'vscode' {
|
|||
|
||||
/**
|
||||
* Whether executing the command puts the chat into a persistent mode, where the command is automatically added to the chat input for the next message.
|
||||
* If this is not set, the chat input will fall back to the agent after submitting this command.
|
||||
*/
|
||||
readonly isSticky?: boolean;
|
||||
}
|
||||
|
||||
export interface ChatAgentCommandProvider {
|
||||
export interface ChatCommandProvider {
|
||||
|
||||
/**
|
||||
* Returns a list of commands that its agent is capable of handling. A command
|
||||
* can be selected by the user and will then be passed to the {@link ChatAgentRequestHandler handler}
|
||||
* via the {@link ChatAgentRequest.command command} property.
|
||||
* Returns a list of commands that its participant is capable of handling. A command
|
||||
* can be selected by the user and will then be passed to the {@link ChatRequestHandler handler}
|
||||
* via the {@link ChatRequest.command command} property.
|
||||
*
|
||||
*
|
||||
* @param token A cancellation token.
|
||||
|
@ -175,26 +173,26 @@ declare module 'vscode' {
|
|||
* an empty array.
|
||||
*/
|
||||
// TODO@API Q: should we provide the current history or last results for extra context?
|
||||
provideCommands(token: CancellationToken): ProviderResult<ChatAgentCommand[]>;
|
||||
provideCommands(token: CancellationToken): ProviderResult<ChatCommand[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A followup question suggested by the model.
|
||||
*/
|
||||
export interface ChatAgentFollowup {
|
||||
export interface ChatFollowup {
|
||||
/**
|
||||
* The message to send to the chat.
|
||||
*/
|
||||
prompt: string;
|
||||
|
||||
/**
|
||||
* By default, the followup goes to the same agent/command. But this property can be set to invoke a different agent.
|
||||
* TODO@API do extensions need to specify the extensionID of the agent here as well?
|
||||
* By default, the followup goes to the same participant/command. But this property can be set to invoke a different participant.
|
||||
* TODO@API do extensions need to specify the extensionID of the participant here as well?
|
||||
*/
|
||||
agentId?: string;
|
||||
participant?: string;
|
||||
|
||||
/**
|
||||
* By default, the followup goes to the same agent/command. But this property can be set to invoke a different command.
|
||||
* By default, the followup goes to the same participant/command. But this property can be set to invoke a different command.
|
||||
*/
|
||||
command?: string;
|
||||
|
||||
|
@ -213,40 +211,40 @@ declare module 'vscode' {
|
|||
/**
|
||||
* Will be invoked once after each request to get suggested followup questions to show the user. The user can click the followup to send it to the chat.
|
||||
*/
|
||||
export interface ChatAgentFollowupProvider {
|
||||
export interface ChatFollowupProvider {
|
||||
/**
|
||||
*
|
||||
* @param result The same instance of the result object that was returned by the chat agent, and it can be extended with arbitrary properties if needed.
|
||||
* @param result The same instance of the result object that was returned by the chat participant, and it can be extended with arbitrary properties if needed.
|
||||
* @param token A cancellation token.
|
||||
*/
|
||||
provideFollowups(result: ChatAgentResult2, token: CancellationToken): ProviderResult<ChatAgentFollowup[]>;
|
||||
provideFollowups(result: ChatResult, token: CancellationToken): ProviderResult<ChatFollowup[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A chat request handler is a callback that will be invoked when a request is made to a chat agent.
|
||||
* A chat request handler is a callback that will be invoked when a request is made to a chat participant.
|
||||
*/
|
||||
export type ChatAgentRequestHandler = (request: ChatAgentRequest, context: ChatAgentContext, response: ChatAgentResponseStream, token: CancellationToken) => ProviderResult<ChatAgentResult2>;
|
||||
export type ChatRequestHandler = (request: ChatRequest, context: ChatContext, response: ChatResponseStream, token: CancellationToken) => ProviderResult<ChatResult>;
|
||||
|
||||
|
||||
export interface ChatAgent2 {
|
||||
export interface ChatParticipant {
|
||||
|
||||
/**
|
||||
* The short name by which this agent is referred to in the UI, e.g `workspace`.
|
||||
* The short name by which this participant is referred to in the UI, e.g `workspace`.
|
||||
*/
|
||||
readonly name: string;
|
||||
|
||||
/**
|
||||
* The full name of this agent.
|
||||
* The full name of this participant.
|
||||
*/
|
||||
fullName: string;
|
||||
|
||||
/**
|
||||
* A human-readable description explaining what this agent does.
|
||||
* A human-readable description explaining what this participant does.
|
||||
*/
|
||||
description: string;
|
||||
|
||||
/**
|
||||
* Icon for the agent shown in UI.
|
||||
* Icon for the participant shown in UI.
|
||||
*/
|
||||
iconPath?: Uri | {
|
||||
/**
|
||||
|
@ -260,27 +258,27 @@ declare module 'vscode' {
|
|||
} | ThemeIcon;
|
||||
|
||||
/**
|
||||
* The handler for requests to this agent.
|
||||
* The handler for requests to this participant.
|
||||
*/
|
||||
requestHandler: ChatAgentRequestHandler;
|
||||
requestHandler: ChatRequestHandler;
|
||||
|
||||
/**
|
||||
* This provider will be called to retrieve the agent's commands.
|
||||
* This provider will be called to retrieve the participant's commands.
|
||||
*/
|
||||
commandProvider?: ChatAgentCommandProvider;
|
||||
commandProvider?: ChatCommandProvider;
|
||||
|
||||
/**
|
||||
* This provider will be called once after each request to retrieve suggested followup questions.
|
||||
*/
|
||||
followupProvider?: ChatAgentFollowupProvider;
|
||||
followupProvider?: ChatFollowupProvider;
|
||||
|
||||
/**
|
||||
* When the user clicks this agent in `/help`, this text will be submitted to this command
|
||||
* When the user clicks this participant in `/help`, this text will be submitted to this command
|
||||
*/
|
||||
sampleRequest?: string;
|
||||
|
||||
/**
|
||||
* Whether invoking the agent puts the chat into a persistent mode, where the agent is automatically added to the chat input for the next message.
|
||||
* Whether invoking the participant puts the chat into a persistent mode, where the participant is automatically added to the chat input for the next message.
|
||||
*/
|
||||
isSticky?: boolean;
|
||||
|
||||
|
@ -288,13 +286,13 @@ declare module 'vscode' {
|
|||
* An event that fires whenever feedback for a result is received, e.g. when a user up- or down-votes
|
||||
* a result.
|
||||
*
|
||||
* The passed {@link ChatAgentResult2Feedback.result result} is guaranteed to be the same instance that was
|
||||
* previously returned from this chat agent.
|
||||
* The passed {@link ChatResultFeedback.result result} is guaranteed to be the same instance that was
|
||||
* previously returned from this chat participant.
|
||||
*/
|
||||
onDidReceiveFeedback: Event<ChatAgentResult2Feedback>;
|
||||
onDidReceiveFeedback: Event<ChatResultFeedback>;
|
||||
|
||||
/**
|
||||
* Dispose this agent and free resources
|
||||
* Dispose this participant and free resources
|
||||
*/
|
||||
dispose(): void;
|
||||
}
|
||||
|
@ -302,7 +300,7 @@ declare module 'vscode' {
|
|||
/**
|
||||
* A resolved variable value is a name-value pair as well as the range in the prompt where a variable was used.
|
||||
*/
|
||||
export interface ChatAgentResolvedVariable {
|
||||
export interface ChatResolvedVariable {
|
||||
|
||||
/**
|
||||
* The name of the variable.
|
||||
|
@ -313,7 +311,7 @@ declare module 'vscode' {
|
|||
readonly name: string;
|
||||
|
||||
/**
|
||||
* The start and end index of the variable in the {@link ChatAgentRequest.prompt prompt}.
|
||||
* The start and end index of the variable in the {@link ChatRequest.prompt prompt}.
|
||||
*
|
||||
* *Note* that the indices take the leading `#`-character into account which means they can
|
||||
* used to modify the prompt as-is.
|
||||
|
@ -324,47 +322,47 @@ declare module 'vscode' {
|
|||
readonly values: ChatVariableValue[];
|
||||
}
|
||||
|
||||
export interface ChatAgentRequest {
|
||||
export interface ChatRequest {
|
||||
|
||||
/**
|
||||
* The prompt as entered by the user.
|
||||
*
|
||||
* Information about variables used in this request are is stored in {@link ChatAgentRequest.variables}.
|
||||
* Information about variables used in this request are is stored in {@link ChatRequest.variables}.
|
||||
*
|
||||
* *Note* that the {@link ChatAgent2.name name} of the agent and the {@link ChatAgentCommand.name command}
|
||||
* *Note* that the {@link ChatParticipant.name name} of the participant and the {@link ChatCommand.name command}
|
||||
* are not part of the prompt.
|
||||
*/
|
||||
readonly prompt: string;
|
||||
|
||||
/**
|
||||
* The name of the {@link ChatAgentCommand command} that was selected for this request.
|
||||
* The name of the {@link ChatCommand command} that was selected for this request.
|
||||
*/
|
||||
readonly command: string | undefined;
|
||||
|
||||
/**
|
||||
* The list of variables and their values that are referenced in the prompt.
|
||||
*
|
||||
* *Note* that the prompt contains varibale references as authored and that it is up to the agent
|
||||
* *Note* that the prompt contains varibale references as authored and that it is up to the participant
|
||||
* to further modify the prompt, for instance by inlining variable values or creating links to
|
||||
* headings which contain the resolved values. vvariables are sorted in reverse by their range
|
||||
* in the prompt. That means the last variable in the prompt is the first in this list. This simplifies
|
||||
* string-manipulation of the prompt.
|
||||
*/
|
||||
// TODO@API Q? are there implicit variables that are not part of the prompt?
|
||||
readonly variables: readonly ChatAgentResolvedVariable[];
|
||||
readonly variables: readonly ChatResolvedVariable[];
|
||||
}
|
||||
|
||||
export interface ChatAgentResponseStream {
|
||||
export interface ChatResponseStream {
|
||||
|
||||
/**
|
||||
* Push a markdown part to this stream. Short-hand for
|
||||
* `push(new ChatResponseMarkdownPart(value))`.
|
||||
*
|
||||
* @see {@link ChatAgentResponseStream.push}
|
||||
* @see {@link ChatResponseStream.push}
|
||||
* @param value A markdown string or a string that should be interpreted as markdown.
|
||||
* @returns This stream.
|
||||
*/
|
||||
markdown(value: string | MarkdownString): ChatAgentResponseStream;
|
||||
markdown(value: string | MarkdownString): ChatResponseStream;
|
||||
|
||||
/**
|
||||
* Push an anchor part to this stream. Short-hand for
|
||||
|
@ -374,7 +372,7 @@ declare module 'vscode' {
|
|||
* @param title An optional title that is rendered with value
|
||||
* @returns This stream.
|
||||
*/
|
||||
anchor(value: Uri | Location, title?: string): ChatAgentResponseStream;
|
||||
anchor(value: Uri | Location, title?: string): ChatResponseStream;
|
||||
|
||||
/**
|
||||
* Push a command button part to this stream. Short-hand for
|
||||
|
@ -383,7 +381,7 @@ declare module 'vscode' {
|
|||
* @param command A Command that will be executed when the button is clicked.
|
||||
* @returns This stream.
|
||||
*/
|
||||
button(command: Command): ChatAgentResponseStream;
|
||||
button(command: Command): ChatResponseStream;
|
||||
|
||||
/**
|
||||
* Push a filetree part to this stream. Short-hand for
|
||||
|
@ -393,7 +391,7 @@ declare module 'vscode' {
|
|||
* @param baseUri The base uri to which this file tree is relative to.
|
||||
* @returns This stream.
|
||||
*/
|
||||
filetree(value: ChatResponseFileTree[], baseUri: Uri): ChatAgentResponseStream;
|
||||
filetree(value: ChatResponseFileTree[], baseUri: Uri): ChatResponseStream;
|
||||
|
||||
/**
|
||||
* Push a progress part to this stream. Short-hand for
|
||||
|
@ -405,7 +403,7 @@ declare module 'vscode' {
|
|||
// TODO@API is this always inline or not
|
||||
// TODO@API is this markdown or string?
|
||||
// TODO@API this influences the rendering, it inserts new lines which is likely a bug
|
||||
progress(value: string): ChatAgentResponseStream;
|
||||
progress(value: string): ChatResponseStream;
|
||||
|
||||
/**
|
||||
* Push a reference to this stream. Short-hand for
|
||||
|
@ -418,14 +416,14 @@ declare module 'vscode' {
|
|||
*/
|
||||
// TODO@API support non-file uris, like http://example.com
|
||||
// TODO@API support mapped edits
|
||||
reference(value: Uri | Location): ChatAgentResponseStream;
|
||||
reference(value: Uri | Location): ChatResponseStream;
|
||||
|
||||
/**
|
||||
* Pushes a part to this stream.
|
||||
*
|
||||
* @param part A response part, rendered or metadata
|
||||
*/
|
||||
push(part: ChatResponsePart): ChatAgentResponseStream;
|
||||
push(part: ChatResponsePart): ChatResponseStream;
|
||||
}
|
||||
|
||||
// TODO@API should the name suffix differentiate between rendered items (XYZPart)
|
||||
|
@ -483,17 +481,17 @@ declare module 'vscode' {
|
|||
export namespace chat {
|
||||
|
||||
/**
|
||||
* Create a new {@link ChatAgent2 chat agent} instance.
|
||||
* Create a new {@link ChatParticipant chat participant} instance.
|
||||
*
|
||||
* @param name Short name by which the agent is referred to in the UI. The name must be unique for the extension
|
||||
* contributing the agent but can collide with names from other extensions.
|
||||
* @param handler A request handler for the agent.
|
||||
* @returns A new chat agent
|
||||
* @param name Short name by which the participant is referred to in the UI. The name must be unique for the extension
|
||||
* contributing the participant but can collide with names from other extensions.
|
||||
* @param handler A request handler for the participant.
|
||||
* @returns A new chat participant
|
||||
*/
|
||||
export function createChatAgent(name: string, handler: ChatAgentRequestHandler): ChatAgent2;
|
||||
export function createChatParticipant(name: string, handler: ChatRequestHandler): ChatParticipant;
|
||||
|
||||
/**
|
||||
* Register a variable which can be used in a chat request to any agent.
|
||||
* Register a variable which can be used in a chat request to any participant.
|
||||
* @param name The name of the variable, to be used in the chat input as `#name`.
|
||||
* @param description A description of the variable for the chat input suggest widget.
|
||||
* @param resolver Will be called to provide the chat variable's value when it is used.
|
||||
|
@ -519,7 +517,7 @@ declare module 'vscode' {
|
|||
level: ChatVariableLevel;
|
||||
|
||||
/**
|
||||
* The variable's value, which can be included in an LLM prompt as-is, or the chat agent may decide to read the value and do something else with it.
|
||||
* The variable's value, which can be included in an LLM prompt as-is, or the chat participant may decide to read the value and do something else with it.
|
||||
*/
|
||||
value: string | Uri;
|
||||
|
|
@ -5,70 +5,70 @@
|
|||
|
||||
declare module 'vscode' {
|
||||
|
||||
export interface ChatAgent2 {
|
||||
onDidPerformAction: Event<ChatAgentUserActionEvent>;
|
||||
export interface ChatParticipant {
|
||||
onDidPerformAction: Event<ChatUserActionEvent>;
|
||||
supportIssueReporting?: boolean;
|
||||
}
|
||||
|
||||
export interface ChatAgentErrorDetails {
|
||||
export interface ChatErrorDetails {
|
||||
/**
|
||||
* If set to true, the message content is completely hidden. Only ChatAgentErrorDetails#message will be shown.
|
||||
* If set to true, the message content is completely hidden. Only ChatErrorDetails#message will be shown.
|
||||
*/
|
||||
responseIsRedacted?: boolean;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export interface ChatAgentMarkdownContent {
|
||||
export interface ChatMarkdownContent {
|
||||
markdownContent: MarkdownString;
|
||||
}
|
||||
|
||||
// TODO@API fit this into the stream
|
||||
export interface ChatAgentDetectedAgent {
|
||||
agentName: string;
|
||||
command?: ChatAgentCommand;
|
||||
export interface ChatDetectedParticipant {
|
||||
participant: string;
|
||||
command?: ChatCommand;
|
||||
}
|
||||
|
||||
// TODO@API fit this into the stream
|
||||
export interface ChatAgentVulnerability {
|
||||
export interface ChatVulnerability {
|
||||
title: string;
|
||||
description: string;
|
||||
// id: string; // Later we will need to be able to link these across multiple content chunks.
|
||||
}
|
||||
|
||||
// TODO@API fit this into the stream
|
||||
export interface ChatAgentContent {
|
||||
vulnerabilities?: ChatAgentVulnerability[];
|
||||
export interface ChatContent {
|
||||
vulnerabilities?: ChatVulnerability[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use ChatAgentResponseStream instead
|
||||
* @deprecated use ChatResponseStream instead
|
||||
*/
|
||||
export type ChatAgentContentProgress =
|
||||
| ChatAgentContent
|
||||
| ChatAgentInlineContentReference
|
||||
| ChatAgentCommandButton;
|
||||
export type ChatContentProgress =
|
||||
| ChatContent
|
||||
| ChatInlineContentReference
|
||||
| ChatCommandButton;
|
||||
|
||||
/**
|
||||
* @deprecated use ChatAgentResponseStream instead
|
||||
* @deprecated use ChatResponseStream instead
|
||||
*/
|
||||
export type ChatAgentMetadataProgress =
|
||||
| ChatAgentUsedContext
|
||||
| ChatAgentContentReference
|
||||
| ChatAgentProgressMessage;
|
||||
export type ChatMetadataProgress =
|
||||
| ChatUsedContext
|
||||
| ChatContentReference
|
||||
| ChatProgressMessage;
|
||||
|
||||
/**
|
||||
* @deprecated use ChatAgentResponseStream instead
|
||||
* @deprecated use ChatResponseStream instead
|
||||
*/
|
||||
export type ChatAgentProgress = ChatAgentContentProgress | ChatAgentMetadataProgress;
|
||||
export type ChatProgress = ChatContentProgress | ChatMetadataProgress;
|
||||
|
||||
/** @deprecated */
|
||||
export interface ChatAgentProgressMessage {
|
||||
export interface ChatProgressMessage {
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
|
||||
export interface ChatAgentContentReference {
|
||||
export interface ChatContentReference {
|
||||
/**
|
||||
* The resource that was referenced.
|
||||
*/
|
||||
|
@ -78,7 +78,7 @@ declare module 'vscode' {
|
|||
/**
|
||||
* A reference to a piece of content that will be rendered inline with the markdown content.
|
||||
*/
|
||||
export interface ChatAgentInlineContentReference {
|
||||
export interface ChatInlineContentReference {
|
||||
/**
|
||||
* The resource being referenced.
|
||||
*/
|
||||
|
@ -93,62 +93,62 @@ declare module 'vscode' {
|
|||
/**
|
||||
* Displays a {@link Command command} as a button in the chat response.
|
||||
*/
|
||||
export interface ChatAgentCommandButton {
|
||||
export interface ChatCommandButton {
|
||||
command: Command;
|
||||
}
|
||||
|
||||
/**
|
||||
* A piece of the chat response's content. Will be merged with other progress pieces as needed, and rendered as markdown.
|
||||
*/
|
||||
export interface ChatAgentContent {
|
||||
export interface ChatContent {
|
||||
/**
|
||||
* The content as a string of markdown source.
|
||||
*/
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface ChatAgentDocumentContext {
|
||||
export interface ChatDocumentContext {
|
||||
uri: Uri;
|
||||
version: number;
|
||||
ranges: Range[];
|
||||
}
|
||||
|
||||
// TODO@API fit this into the stream
|
||||
export interface ChatAgentUsedContext {
|
||||
documents: ChatAgentDocumentContext[];
|
||||
export interface ChatUsedContext {
|
||||
documents: ChatDocumentContext[];
|
||||
}
|
||||
|
||||
export interface ChatAgentResponseStream {
|
||||
export interface ChatResponseStream {
|
||||
/**
|
||||
* @deprecated use above methods instread
|
||||
*/
|
||||
report(value: ChatAgentProgress): void;
|
||||
report(value: ChatProgress): void;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export type ChatAgentExtendedProgress = ChatAgentProgress
|
||||
| ChatAgentMarkdownContent
|
||||
| ChatAgentDetectedAgent;
|
||||
export type ChatExtendedProgress = ChatProgress
|
||||
| ChatMarkdownContent
|
||||
| ChatDetectedParticipant;
|
||||
|
||||
export type ChatAgentExtendedResponseStream = ChatAgentResponseStream & {
|
||||
export type ChatExtendedResponseStream = ChatResponseStream & {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
report(value: ChatAgentExtendedProgress): void;
|
||||
report(value: ChatExtendedProgress): void;
|
||||
};
|
||||
|
||||
export interface ChatAgent2 {
|
||||
export interface ChatParticipant {
|
||||
/**
|
||||
* Provide a set of variables that can only be used with this agent.
|
||||
* Provide a set of variables that can only be used with this participant.
|
||||
*/
|
||||
agentVariableProvider?: { provider: ChatAgentCompletionItemProvider; triggerCharacters: string[] };
|
||||
participantVariableProvider?: { provider: ChatParticipantCompletionItemProvider; triggerCharacters: string[] };
|
||||
}
|
||||
|
||||
export interface ChatAgentCompletionItemProvider {
|
||||
provideCompletionItems(query: string, token: CancellationToken): ProviderResult<ChatAgentCompletionItem[]>;
|
||||
export interface ChatParticipantCompletionItemProvider {
|
||||
provideCompletionItems(query: string, token: CancellationToken): ProviderResult<ChatCompletionItem[]>;
|
||||
}
|
||||
|
||||
export class ChatAgentCompletionItem {
|
||||
export class ChatCompletionItem {
|
||||
label: string | CompletionItemLabel;
|
||||
values: ChatVariableValue[];
|
||||
insertText?: string;
|
||||
|
@ -158,36 +158,36 @@ declare module 'vscode' {
|
|||
constructor(label: string | CompletionItemLabel, values: ChatVariableValue[]);
|
||||
}
|
||||
|
||||
export type ChatAgentExtendedRequestHandler = (request: ChatAgentRequest, context: ChatAgentContext, response: ChatAgentExtendedResponseStream, token: CancellationToken) => ProviderResult<ChatAgentResult2>;
|
||||
export type ChatExtendedRequestHandler = (request: ChatRequest, context: ChatContext, response: ChatExtendedResponseStream, token: CancellationToken) => ProviderResult<ChatResult>;
|
||||
|
||||
export namespace chat {
|
||||
/**
|
||||
* Create a chat agent with the extended progress type
|
||||
* Create a chat participant with the extended progress type
|
||||
*/
|
||||
export function createChatAgent(name: string, handler: ChatAgentExtendedRequestHandler): ChatAgent2;
|
||||
export function createChatParticipant(name: string, handler: ChatExtendedRequestHandler): ChatParticipant;
|
||||
}
|
||||
|
||||
/*
|
||||
* User action events
|
||||
*/
|
||||
|
||||
export enum ChatAgentCopyKind {
|
||||
export enum ChatCopyKind {
|
||||
// Keyboard shortcut or context menu
|
||||
Action = 1,
|
||||
Toolbar = 2
|
||||
}
|
||||
|
||||
export interface ChatAgentCopyAction {
|
||||
export interface ChatCopyAction {
|
||||
// eslint-disable-next-line local/vscode-dts-string-type-literals
|
||||
kind: 'copy';
|
||||
codeBlockIndex: number;
|
||||
copyKind: ChatAgentCopyKind;
|
||||
copyKind: ChatCopyKind;
|
||||
copiedCharacters: number;
|
||||
totalCharacters: number;
|
||||
copiedText: string;
|
||||
}
|
||||
|
||||
export interface ChatAgentInsertAction {
|
||||
export interface ChatInsertAction {
|
||||
// eslint-disable-next-line local/vscode-dts-string-type-literals
|
||||
kind: 'insert';
|
||||
codeBlockIndex: number;
|
||||
|
@ -195,33 +195,33 @@ declare module 'vscode' {
|
|||
newFile?: boolean;
|
||||
}
|
||||
|
||||
export interface ChatAgentTerminalAction {
|
||||
export interface ChatTerminalAction {
|
||||
// eslint-disable-next-line local/vscode-dts-string-type-literals
|
||||
kind: 'runInTerminal';
|
||||
codeBlockIndex: number;
|
||||
languageId?: string;
|
||||
}
|
||||
|
||||
export interface ChatAgentCommandAction {
|
||||
export interface ChatCommandAction {
|
||||
// eslint-disable-next-line local/vscode-dts-string-type-literals
|
||||
kind: 'command';
|
||||
commandButton: ChatAgentCommandButton;
|
||||
commandButton: ChatCommandButton;
|
||||
}
|
||||
|
||||
export interface ChatAgentFollowupAction {
|
||||
export interface ChatFollowupAction {
|
||||
// eslint-disable-next-line local/vscode-dts-string-type-literals
|
||||
kind: 'followUp';
|
||||
followup: ChatAgentFollowup;
|
||||
followup: ChatFollowup;
|
||||
}
|
||||
|
||||
export interface ChatAgentBugReportAction {
|
||||
export interface ChatBugReportAction {
|
||||
// eslint-disable-next-line local/vscode-dts-string-type-literals
|
||||
kind: 'bug';
|
||||
}
|
||||
|
||||
export interface ChatAgentUserActionEvent {
|
||||
readonly result: ChatAgentResult2;
|
||||
readonly action: ChatAgentCopyAction | ChatAgentInsertAction | ChatAgentTerminalAction | ChatAgentCommandAction | ChatAgentFollowupAction | ChatAgentBugReportAction;
|
||||
export interface ChatUserActionEvent {
|
||||
readonly result: ChatResult;
|
||||
readonly action: ChatCopyAction | ChatInsertAction | ChatTerminalAction | ChatCommandAction | ChatFollowupAction | ChatBugReportAction;
|
||||
}
|
||||
|
||||
export interface ChatVariableValue {
|
||||
|
@ -231,7 +231,7 @@ declare module 'vscode' {
|
|||
kind?: string;
|
||||
}
|
||||
|
||||
export interface ChatAgentCommand {
|
||||
export interface ChatCommand {
|
||||
readonly isSticky2?: {
|
||||
/**
|
||||
* Indicates that the command should be automatically repopulated.
|
|
@ -5,35 +5,35 @@
|
|||
|
||||
declare module 'vscode' {
|
||||
|
||||
export type ChatAgentWelcomeMessageContent = string | MarkdownString;
|
||||
export type ChatWelcomeMessageContent = string | MarkdownString;
|
||||
|
||||
export interface ChatAgentWelcomeMessageProvider {
|
||||
provideWelcomeMessage(token: CancellationToken): ProviderResult<ChatAgentWelcomeMessageContent[]>;
|
||||
provideSampleQuestions?(token: CancellationToken): ProviderResult<ChatAgentFollowup[]>;
|
||||
export interface ChatWelcomeMessageProvider {
|
||||
provideWelcomeMessage(token: CancellationToken): ProviderResult<ChatWelcomeMessageContent[]>;
|
||||
provideSampleQuestions?(token: CancellationToken): ProviderResult<ChatFollowup[]>;
|
||||
}
|
||||
|
||||
export interface ChatAgent2 {
|
||||
export interface ChatParticipant {
|
||||
/**
|
||||
* When true, this agent is invoked by default when no other agent is being invoked
|
||||
* When true, this participant is invoked by default when no other participant is being invoked
|
||||
*/
|
||||
isDefault?: boolean;
|
||||
|
||||
/**
|
||||
* When true, this agent is invoked when the user submits their query using ctrl/cmd+enter
|
||||
* When true, this participant is invoked when the user submits their query using ctrl/cmd+enter
|
||||
* TODO@API name
|
||||
*/
|
||||
isSecondary?: boolean;
|
||||
|
||||
/**
|
||||
* A string that will be added before the listing of chat agents in `/help`.
|
||||
* A string that will be added before the listing of chat participants in `/help`.
|
||||
*/
|
||||
helpTextPrefix?: string | MarkdownString;
|
||||
|
||||
/**
|
||||
* A string that will be appended after the listing of chat agents in `/help`.
|
||||
* A string that will be appended after the listing of chat participants in `/help`.
|
||||
*/
|
||||
helpTextPostfix?: string | MarkdownString;
|
||||
|
||||
welcomeMessageProvider?: ChatAgentWelcomeMessageProvider;
|
||||
welcomeMessageProvider?: ChatWelcomeMessageProvider;
|
||||
}
|
||||
}
|
|
@ -125,7 +125,7 @@ declare module 'vscode' {
|
|||
inputPlaceholder?: string;
|
||||
}
|
||||
|
||||
export type InteractiveWelcomeMessageContent = string | MarkdownString | ChatAgentFollowup[];
|
||||
export type InteractiveWelcomeMessageContent = string | MarkdownString | ChatFollowup[];
|
||||
|
||||
export interface InteractiveSessionProvider<S extends InteractiveSession = InteractiveSession> {
|
||||
prepareSession(token: CancellationToken): ProviderResult<S>;
|
||||
|
|
Loading…
Reference in New Issue
Block a user