@theia/ai-chat 1.58.3 → 1.59.0-next.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/ai-chat-frontend-module.d.ts.map +1 -1
- package/lib/browser/ai-chat-frontend-module.js +10 -13
- package/lib/browser/ai-chat-frontend-module.js.map +1 -1
- package/lib/browser/ai-chat-preferences.d.ts +1 -0
- package/lib/browser/ai-chat-preferences.d.ts.map +1 -1
- package/lib/browser/ai-chat-preferences.js +12 -3
- package/lib/browser/ai-chat-preferences.js.map +1 -1
- package/lib/browser/change-set-file-element.d.ts +24 -6
- package/lib/browser/change-set-file-element.d.ts.map +1 -1
- package/lib/browser/change-set-file-element.js +105 -15
- package/lib/browser/change-set-file-element.js.map +1 -1
- package/lib/browser/change-set-file-resource.d.ts +40 -8
- package/lib/browser/change-set-file-resource.d.ts.map +1 -1
- package/lib/browser/change-set-file-resource.js +123 -37
- package/lib/browser/change-set-file-resource.js.map +1 -1
- package/lib/browser/change-set-file-service.d.ts +9 -3
- package/lib/browser/change-set-file-service.d.ts.map +1 -1
- package/lib/browser/change-set-file-service.js +35 -13
- package/lib/browser/change-set-file-service.js.map +1 -1
- package/lib/browser/context-file-variable-label-provider.d.ts +14 -0
- package/lib/browser/context-file-variable-label-provider.d.ts.map +1 -0
- package/lib/browser/context-file-variable-label-provider.js +63 -0
- package/lib/browser/context-file-variable-label-provider.js.map +1 -0
- package/lib/browser/context-variable-label-provider.d.ts +9 -0
- package/lib/browser/context-variable-label-provider.d.ts.map +1 -0
- package/lib/browser/context-variable-label-provider.js +55 -0
- package/lib/browser/context-variable-label-provider.js.map +1 -0
- package/lib/browser/file-chat-variable-contribution.d.ts +18 -0
- package/lib/browser/file-chat-variable-contribution.d.ts.map +1 -0
- package/lib/browser/file-chat-variable-contribution.js +135 -0
- package/lib/browser/file-chat-variable-contribution.js.map +1 -0
- package/lib/browser/frontend-chat-service.d.ts +10 -3
- package/lib/browser/frontend-chat-service.d.ts.map +1 -1
- package/lib/browser/frontend-chat-service.js +39 -19
- package/lib/browser/frontend-chat-service.js.map +1 -1
- package/lib/common/chat-agents.d.ts +47 -24
- package/lib/common/chat-agents.d.ts.map +1 -1
- package/lib/common/chat-agents.js +50 -19
- package/lib/common/chat-agents.js.map +1 -1
- package/lib/common/chat-history-entry.js +1 -1
- package/lib/common/chat-history-entry.js.map +1 -1
- package/lib/common/chat-model.d.ts +58 -35
- package/lib/common/chat-model.d.ts.map +1 -1
- package/lib/common/chat-model.js +96 -53
- package/lib/common/chat-model.js.map +1 -1
- package/lib/common/chat-service.d.ts +32 -12
- package/lib/common/chat-service.d.ts.map +1 -1
- package/lib/common/chat-service.js +77 -19
- package/lib/common/chat-service.js.map +1 -1
- package/lib/common/chat-tool-request-service.d.ts +5 -5
- package/lib/common/chat-tool-request-service.d.ts.map +1 -1
- package/lib/common/chat-tool-request-service.js.map +1 -1
- package/lib/common/custom-chat-agent.d.ts +7 -10
- package/lib/common/custom-chat-agent.d.ts.map +1 -1
- package/lib/common/custom-chat-agent.js +7 -11
- package/lib/common/custom-chat-agent.js.map +1 -1
- package/lib/common/index.d.ts +0 -3
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +0 -3
- package/lib/common/index.js.map +1 -1
- package/lib/common/parse-contents.d.ts +2 -2
- package/lib/common/parse-contents.d.ts.map +1 -1
- package/lib/common/parse-contents.js.map +1 -1
- package/lib/common/parse-contents.spec.d.ts.map +1 -1
- package/lib/common/parse-contents.spec.js.map +1 -1
- package/lib/common/response-content-matcher.d.ts +3 -3
- package/lib/common/response-content-matcher.d.ts.map +1 -1
- package/lib/common/response-content-matcher.js.map +1 -1
- package/package.json +12 -10
- package/src/browser/ai-chat-frontend-module.ts +14 -18
- package/src/browser/ai-chat-preferences.ts +13 -2
- package/src/browser/change-set-file-element.ts +99 -20
- package/src/browser/change-set-file-resource.ts +125 -39
- package/src/browser/change-set-file-service.ts +38 -16
- package/src/browser/context-file-variable-label-provider.ts +62 -0
- package/src/browser/context-variable-label-provider.ts +56 -0
- package/src/browser/file-chat-variable-contribution.ts +143 -0
- package/src/browser/frontend-chat-service.ts +40 -26
- package/src/common/chat-agents.ts +72 -27
- package/src/common/chat-history-entry.ts +1 -1
- package/src/common/chat-model.ts +138 -74
- package/src/common/chat-service.ts +96 -23
- package/src/common/chat-tool-request-service.ts +5 -5
- package/src/common/custom-chat-agent.ts +8 -20
- package/src/common/index.ts +0 -3
- package/src/common/parse-contents.spec.ts +2 -2
- package/src/common/parse-contents.ts +2 -2
- package/src/common/response-content-matcher.ts +3 -3
- package/lib/common/command-chat-agents.d.ts +0 -33
- package/lib/common/command-chat-agents.d.ts.map +0 -1
- package/lib/common/command-chat-agents.js +0 -329
- package/lib/common/command-chat-agents.js.map +0 -1
- package/lib/common/orchestrator-chat-agent.d.ts +0 -22
- package/lib/common/orchestrator-chat-agent.d.ts.map +0 -1
- package/lib/common/orchestrator-chat-agent.js +0 -167
- package/lib/common/orchestrator-chat-agent.js.map +0 -1
- package/lib/common/universal-chat-agent.d.ts +0 -16
- package/lib/common/universal-chat-agent.d.ts.map +0 -1
- package/lib/common/universal-chat-agent.js +0 -109
- package/lib/common/universal-chat-agent.js.map +0 -1
- package/src/common/command-chat-agents.ts +0 -354
- package/src/common/orchestrator-chat-agent.ts +0 -179
- package/src/common/universal-chat-agent.ts +0 -117
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.CommandChatAgent = exports.commandTemplate = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const chat_agents_1 = require("./chat-agents");
|
|
22
|
-
const chat_model_1 = require("./chat-model");
|
|
23
|
-
const core_1 = require("@theia/core");
|
|
24
|
-
exports.commandTemplate = {
|
|
25
|
-
id: 'command-system',
|
|
26
|
-
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
27
|
-
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
28
|
-
# System Prompt
|
|
29
|
-
|
|
30
|
-
You are a service that helps users find commands to execute in an IDE.
|
|
31
|
-
You reply with stringified JSON Objects that tell the user which command to execute and its arguments, if any.
|
|
32
|
-
|
|
33
|
-
# Examples
|
|
34
|
-
|
|
35
|
-
The examples start with a short explanation of the return object.
|
|
36
|
-
The response can be found within the markdown \`\`\`json and \`\`\` markers.
|
|
37
|
-
Please include these markers in the reply.
|
|
38
|
-
|
|
39
|
-
Never under any circumstances may you reply with just the command-id!
|
|
40
|
-
|
|
41
|
-
## Example 1
|
|
42
|
-
|
|
43
|
-
This reply is to tell the user to execute the \`theia-ai-prompt-template:show-prompts-command\` command that is available in the Theia command registry.
|
|
44
|
-
|
|
45
|
-
\`\`\`json
|
|
46
|
-
{
|
|
47
|
-
"type": "theia-command",
|
|
48
|
-
"commandId": "theia-ai-prompt-template:show-prompts-command"
|
|
49
|
-
}
|
|
50
|
-
\`\`\`
|
|
51
|
-
|
|
52
|
-
## Example 2
|
|
53
|
-
|
|
54
|
-
This reply is to tell the user to execute the \`theia-ai-prompt-template:show-prompts-command\` command that is available in the theia command registry,
|
|
55
|
-
when the user want to pass arguments to the command.
|
|
56
|
-
|
|
57
|
-
\`\`\`json
|
|
58
|
-
{
|
|
59
|
-
"type": "theia-command",
|
|
60
|
-
"commandId": "theia-ai-prompt-template:show-prompts-command",
|
|
61
|
-
"arguments": ["foo"]
|
|
62
|
-
}
|
|
63
|
-
\`\`\`
|
|
64
|
-
|
|
65
|
-
## Example 3
|
|
66
|
-
|
|
67
|
-
This reply is for custom commands that are not registered in the Theia command registry.
|
|
68
|
-
These commands always have the command id \`ai-chat.command-chat-response.generic\`.
|
|
69
|
-
The arguments are an array and may differ, depending on the user's instructions.
|
|
70
|
-
|
|
71
|
-
\`\`\`json
|
|
72
|
-
{
|
|
73
|
-
"type": "custom-handler",
|
|
74
|
-
"commandId": "ai-chat.command-chat-response.generic",
|
|
75
|
-
"arguments": ["foo", "bar"]
|
|
76
|
-
}
|
|
77
|
-
\`\`\`
|
|
78
|
-
|
|
79
|
-
## Example 4
|
|
80
|
-
|
|
81
|
-
This reply of type no-command is for cases where you can't find a proper command.
|
|
82
|
-
You may use the message to explain the situation to the user.
|
|
83
|
-
|
|
84
|
-
\`\`\`json
|
|
85
|
-
{
|
|
86
|
-
"type": "no-command",
|
|
87
|
-
"message": "a message explaining what is wrong"
|
|
88
|
-
}
|
|
89
|
-
\`\`\`
|
|
90
|
-
|
|
91
|
-
# Rules
|
|
92
|
-
|
|
93
|
-
## Theia Commands
|
|
94
|
-
|
|
95
|
-
If a user asks for a Theia command, or the context implies it is about a command in Theia, return a response with \`"type": "theia-command"\`.
|
|
96
|
-
You need to exchange the "commandId".
|
|
97
|
-
The available command ids in Theia are in the list below. The list of commands is formatted like this:
|
|
98
|
-
|
|
99
|
-
command-id1: Label1
|
|
100
|
-
command-id2: Label2
|
|
101
|
-
command-id3:
|
|
102
|
-
command-id4: Label4
|
|
103
|
-
|
|
104
|
-
The Labels may be empty, but there is always a command-id.
|
|
105
|
-
|
|
106
|
-
Suggest a command that probably fits the user's message based on the label and the command ids you know.
|
|
107
|
-
If you have multiple commands that fit, return the one that fits best. We only want a single command in the reply.
|
|
108
|
-
If the user says that the last command was not right, try to return the next best fit based on the conversation history with the user.
|
|
109
|
-
|
|
110
|
-
If there are no more command ids that seem to fit, return a response of \`"type": "no-command"\` explaining the situation.
|
|
111
|
-
|
|
112
|
-
Here are the known Theia commands:
|
|
113
|
-
|
|
114
|
-
Begin List:
|
|
115
|
-
{{command-ids}}
|
|
116
|
-
End List
|
|
117
|
-
|
|
118
|
-
You may only use commands from this list when responding with \`"type": "theia-command"\`.
|
|
119
|
-
Do not come up with command ids that are not in this list.
|
|
120
|
-
If you need to do this, use the \`"type": "no-command"\`. instead
|
|
121
|
-
|
|
122
|
-
## Custom Handlers
|
|
123
|
-
|
|
124
|
-
If the user asks for a command that is not a Theia command, return a response with \`"type": "custom-handler"\`.
|
|
125
|
-
|
|
126
|
-
## Other Cases
|
|
127
|
-
|
|
128
|
-
In all other cases, return a reply of \`"type": "no-command"\`.
|
|
129
|
-
|
|
130
|
-
# Examples of Invalid Responses
|
|
131
|
-
|
|
132
|
-
## Invalid Response Example 1
|
|
133
|
-
|
|
134
|
-
This example is invalid because it returns text and two commands.
|
|
135
|
-
Only one command should be replied, and it must be parseable JSON.
|
|
136
|
-
|
|
137
|
-
### The Example
|
|
138
|
-
|
|
139
|
-
Yes, there are a few more theme-related commands. Here is another one:
|
|
140
|
-
|
|
141
|
-
\`\`\`json
|
|
142
|
-
{
|
|
143
|
-
"type": "theia-command",
|
|
144
|
-
"commandId": "workbench.action.selectIconTheme"
|
|
145
|
-
}
|
|
146
|
-
\`\`\`
|
|
147
|
-
|
|
148
|
-
And another one:
|
|
149
|
-
|
|
150
|
-
\`\`\`json
|
|
151
|
-
{
|
|
152
|
-
"type": "theia-command",
|
|
153
|
-
"commandId": "core.close.right.tabs"
|
|
154
|
-
}
|
|
155
|
-
\`\`\`
|
|
156
|
-
|
|
157
|
-
## Invalid Response Example 2
|
|
158
|
-
|
|
159
|
-
The following example is invalid because it only returns the command id and is not parseable JSON:
|
|
160
|
-
|
|
161
|
-
### The Example
|
|
162
|
-
|
|
163
|
-
workbench.action.selectIconTheme
|
|
164
|
-
|
|
165
|
-
## Invalid Response Example 3
|
|
166
|
-
|
|
167
|
-
The following example is invalid because it returns a message with the command id. We need JSON objects based on the above rules.
|
|
168
|
-
Do not respond like this in any case! We need a command of \`"type": "theia-command"\`.
|
|
169
|
-
|
|
170
|
-
The expected response would be:
|
|
171
|
-
\`\`\`json
|
|
172
|
-
{
|
|
173
|
-
"type": "theia-command",
|
|
174
|
-
"commandId": "core.close.right.tabs"
|
|
175
|
-
}
|
|
176
|
-
\`\`\`
|
|
177
|
-
|
|
178
|
-
### The Example
|
|
179
|
-
|
|
180
|
-
I found this command that might help you: core.close.right.tabs
|
|
181
|
-
|
|
182
|
-
## Invalid Response Example 4
|
|
183
|
-
|
|
184
|
-
The following example is invalid because it has an explanation string before the JSON.
|
|
185
|
-
We only want the JSON!
|
|
186
|
-
|
|
187
|
-
### The Example
|
|
188
|
-
|
|
189
|
-
You can toggle high contrast mode with this command:
|
|
190
|
-
|
|
191
|
-
\`\`\`json
|
|
192
|
-
{
|
|
193
|
-
"type": "theia-command",
|
|
194
|
-
"commandId": "editor.action.toggleHighContrast"
|
|
195
|
-
}
|
|
196
|
-
\`\`\`
|
|
197
|
-
|
|
198
|
-
## Invalid Response Example 5
|
|
199
|
-
|
|
200
|
-
The following example is invalid because it explains that no command was found.
|
|
201
|
-
We want a response of \`"type": "no-command"\` and have the message there.
|
|
202
|
-
|
|
203
|
-
### The Example
|
|
204
|
-
|
|
205
|
-
There is no specific command available to "open the windows" in the provided Theia command list.
|
|
206
|
-
|
|
207
|
-
## Invalid Response Example 6
|
|
208
|
-
|
|
209
|
-
In this example we were using the following theia id command list:
|
|
210
|
-
|
|
211
|
-
Begin List:
|
|
212
|
-
container--theia-open-editors-widget: Hello
|
|
213
|
-
foo:toggle-visibility-explorer-view-container--files: Label 1
|
|
214
|
-
foo:toggle-visibility-explorer-view-container--plugin-view: Label 2
|
|
215
|
-
End List
|
|
216
|
-
|
|
217
|
-
The problem is that workbench.action.toggleHighContrast is not in this list.
|
|
218
|
-
theia-command types may only use commandIds from this list.
|
|
219
|
-
This should have been of \`"type": "no-command"\`.
|
|
220
|
-
|
|
221
|
-
### The Example
|
|
222
|
-
|
|
223
|
-
\`\`\`json
|
|
224
|
-
{
|
|
225
|
-
"type": "theia-command",
|
|
226
|
-
"commandId": "workbench.action.toggleHighContrast"
|
|
227
|
-
}
|
|
228
|
-
\`\`\`
|
|
229
|
-
|
|
230
|
-
`
|
|
231
|
-
};
|
|
232
|
-
let CommandChatAgent = class CommandChatAgent extends chat_agents_1.AbstractTextToModelParsingChatAgent {
|
|
233
|
-
constructor() {
|
|
234
|
-
super('Command', [{
|
|
235
|
-
purpose: 'command',
|
|
236
|
-
identifier: 'openai/gpt-4o',
|
|
237
|
-
}], 'command');
|
|
238
|
-
this.name = 'Command';
|
|
239
|
-
this.description = 'This agent is aware of all commands that the user can execute within the Theia IDE, the tool that the user is currently working with. \
|
|
240
|
-
Based on the user request, it can find the right command and then let the user execute it.';
|
|
241
|
-
this.variables = [];
|
|
242
|
-
this.promptTemplates = [exports.commandTemplate];
|
|
243
|
-
this.functions = [];
|
|
244
|
-
this.agentSpecificVariables = [{
|
|
245
|
-
name: 'command-ids',
|
|
246
|
-
description: 'The list of available commands in Theia.',
|
|
247
|
-
usedInPrompt: true
|
|
248
|
-
}];
|
|
249
|
-
}
|
|
250
|
-
async getSystemMessageDescription() {
|
|
251
|
-
const knownCommands = [];
|
|
252
|
-
for (const command of this.commandRegistry.getAllCommands()) {
|
|
253
|
-
knownCommands.push(`${command.id}: ${command.label}`);
|
|
254
|
-
}
|
|
255
|
-
const systemPrompt = await this.promptService.getPrompt(exports.commandTemplate.id, {
|
|
256
|
-
'command-ids': knownCommands.join('\n')
|
|
257
|
-
});
|
|
258
|
-
if (systemPrompt === undefined) {
|
|
259
|
-
throw new Error('Couldn\'t get system prompt ');
|
|
260
|
-
}
|
|
261
|
-
return chat_agents_1.SystemMessageDescription.fromResolvedPromptTemplate(systemPrompt);
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* @param text the text received from the language model
|
|
265
|
-
* @returns the parsed command if the text contained a valid command.
|
|
266
|
-
* If there was no json in the text, return a no-command response.
|
|
267
|
-
*/
|
|
268
|
-
async parseTextResponse(text) {
|
|
269
|
-
const jsonMatch = text.match(/(\{[\s\S]*\})/);
|
|
270
|
-
const jsonString = jsonMatch ? jsonMatch[1] : `{
|
|
271
|
-
"type": "no-command",
|
|
272
|
-
"message": "Please try again."
|
|
273
|
-
}`;
|
|
274
|
-
const parsedCommand = JSON.parse(jsonString);
|
|
275
|
-
return parsedCommand;
|
|
276
|
-
}
|
|
277
|
-
createResponseContent(parsedCommand, request) {
|
|
278
|
-
var _a;
|
|
279
|
-
if (parsedCommand.type === 'theia-command') {
|
|
280
|
-
const theiaCommand = this.commandRegistry.getCommand(parsedCommand.commandId);
|
|
281
|
-
if (theiaCommand === undefined) {
|
|
282
|
-
console.error(`No Theia Command with id ${parsedCommand.commandId}`);
|
|
283
|
-
request.cancel();
|
|
284
|
-
}
|
|
285
|
-
const args = parsedCommand.arguments !== undefined &&
|
|
286
|
-
parsedCommand.arguments.length > 0
|
|
287
|
-
? parsedCommand.arguments
|
|
288
|
-
: undefined;
|
|
289
|
-
return new chat_model_1.HorizontalLayoutChatResponseContentImpl([
|
|
290
|
-
new chat_model_1.MarkdownChatResponseContentImpl('I found this command that might help you:'),
|
|
291
|
-
new chat_model_1.CommandChatResponseContentImpl(theiaCommand, undefined, args),
|
|
292
|
-
]);
|
|
293
|
-
}
|
|
294
|
-
else if (parsedCommand.type === 'custom-handler') {
|
|
295
|
-
const id = `ai-command-${(0, core_1.generateUuid)()}`;
|
|
296
|
-
const commandArgs = parsedCommand.arguments !== undefined && parsedCommand.arguments.length > 0 ? parsedCommand.arguments : [];
|
|
297
|
-
const args = [id, ...commandArgs];
|
|
298
|
-
const customCallback = {
|
|
299
|
-
label: 'AI command',
|
|
300
|
-
callback: () => this.commandCallback(...args),
|
|
301
|
-
};
|
|
302
|
-
return new chat_model_1.HorizontalLayoutChatResponseContentImpl([
|
|
303
|
-
new chat_model_1.MarkdownChatResponseContentImpl('Try executing this:'),
|
|
304
|
-
new chat_model_1.CommandChatResponseContentImpl(undefined, customCallback, args),
|
|
305
|
-
]);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
return new chat_model_1.MarkdownChatResponseContentImpl((_a = parsedCommand.message) !== null && _a !== void 0 ? _a : 'Sorry, I can\'t find such a command');
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
async commandCallback(...commandArgs) {
|
|
312
|
-
this.messageService.info(`Executing callback with args ${commandArgs.join(', ')}. The first arg is the command id registered for the dynamically registered command.
|
|
313
|
-
The other args are the actual args for the handler.`, 'Got it');
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
exports.CommandChatAgent = CommandChatAgent;
|
|
317
|
-
tslib_1.__decorate([
|
|
318
|
-
(0, inversify_1.inject)(core_1.CommandRegistry),
|
|
319
|
-
tslib_1.__metadata("design:type", core_1.CommandRegistry)
|
|
320
|
-
], CommandChatAgent.prototype, "commandRegistry", void 0);
|
|
321
|
-
tslib_1.__decorate([
|
|
322
|
-
(0, inversify_1.inject)(core_1.MessageService),
|
|
323
|
-
tslib_1.__metadata("design:type", core_1.MessageService)
|
|
324
|
-
], CommandChatAgent.prototype, "messageService", void 0);
|
|
325
|
-
exports.CommandChatAgent = CommandChatAgent = tslib_1.__decorate([
|
|
326
|
-
(0, inversify_1.injectable)(),
|
|
327
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
328
|
-
], CommandChatAgent);
|
|
329
|
-
//# sourceMappingURL=command-chat-agents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file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,cAAc,CAAC,IAAI,CAAC,gCAAgC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;4DAC3B,EAAE,QAAQ,CAAC,CAAC;IACpE,CAAC;CACJ,CAAA;AArGY,4CAAgB;AAEf;IADT,IAAA,kBAAM,EAAC,sBAAe,CAAC;sCACG,sBAAe;yDAAC;AAEjC;IADT,IAAA,kBAAM,EAAC,qBAAc,CAAC;sCACG,qBAAc;wDAAC;2BAJhC,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;;GACA,gBAAgB,CAqG5B"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { AgentSpecificVariables, LanguageModelResponse } from '@theia/ai-core';
|
|
2
|
-
import { PromptTemplate } from '@theia/ai-core/lib/common';
|
|
3
|
-
import { ChatAgentService } from './chat-agent-service';
|
|
4
|
-
import { AbstractStreamParsingChatAgent, ChatAgent, SystemMessageDescription } from './chat-agents';
|
|
5
|
-
import { ChatRequestModelImpl } from './chat-model';
|
|
6
|
-
export declare const orchestratorTemplate: PromptTemplate;
|
|
7
|
-
export declare const OrchestratorChatAgentId = "Orchestrator";
|
|
8
|
-
export declare class OrchestratorChatAgent extends AbstractStreamParsingChatAgent implements ChatAgent {
|
|
9
|
-
name: string;
|
|
10
|
-
description: string;
|
|
11
|
-
readonly variables: string[];
|
|
12
|
-
promptTemplates: PromptTemplate[];
|
|
13
|
-
fallBackChatAgentId: string;
|
|
14
|
-
readonly functions: string[];
|
|
15
|
-
readonly agentSpecificVariables: AgentSpecificVariables[];
|
|
16
|
-
constructor();
|
|
17
|
-
protected chatAgentService: ChatAgentService;
|
|
18
|
-
invoke(request: ChatRequestModelImpl): Promise<void>;
|
|
19
|
-
protected getSystemMessageDescription(): Promise<SystemMessageDescription | undefined>;
|
|
20
|
-
protected addContentsToResponse(response: LanguageModelResponse, request: ChatRequestModelImpl): Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=orchestrator-chat-agent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/orchestrator-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAoC,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACjH,OAAO,EACH,cAAc,EACjB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAwC,MAAM,cAAc,CAAC;AAI1F,eAAO,MAAM,oBAAoB,EAAE,cAmCjC,CAAC;AAEH,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAGtD,qBACa,qBAAsB,SAAQ,8BAA+B,YAAW,SAAS;IAC1F,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAM;IAClC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,EAAE,CAAM;;IAkB/D,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAE9B,MAAM,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;cAiBnD,2BAA2B,IAAI,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;cAKnE,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CA6DhI"}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.OrchestratorChatAgent = exports.OrchestratorChatAgentId = exports.orchestratorTemplate = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const ai_core_1 = require("@theia/ai-core");
|
|
21
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
-
const chat_agent_service_1 = require("./chat-agent-service");
|
|
23
|
-
const chat_agents_1 = require("./chat-agents");
|
|
24
|
-
const chat_model_1 = require("./chat-model");
|
|
25
|
-
const core_1 = require("@theia/core");
|
|
26
|
-
const chat_history_entry_1 = require("./chat-history-entry");
|
|
27
|
-
exports.orchestratorTemplate = {
|
|
28
|
-
id: 'orchestrator-system',
|
|
29
|
-
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
30
|
-
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
31
|
-
# Instructions
|
|
32
|
-
|
|
33
|
-
Your task is to identify which Chat Agent(s) should best reply a given user's message.
|
|
34
|
-
You consider all messages of the conversation to ensure consistency and avoid agent switches without a clear context change.
|
|
35
|
-
You should select the best Chat Agent based on the name and description of the agents, matching them to the user message.
|
|
36
|
-
|
|
37
|
-
## Constraints
|
|
38
|
-
|
|
39
|
-
Your response must be a JSON array containing the id(s) of the selected Chat Agent(s).
|
|
40
|
-
|
|
41
|
-
* Do not use ids that are not provided in the list below.
|
|
42
|
-
* Do not include any additional information, explanations, or questions for the user.
|
|
43
|
-
* If there is no suitable choice, pick \`Universal\`.
|
|
44
|
-
* If there are multiple good choices, return all of them.
|
|
45
|
-
|
|
46
|
-
Unless there is a more specific agent available, select \`Universal\`, especially for general programming-related questions.
|
|
47
|
-
You must only use the \`id\` attribute of the agent, never the name.
|
|
48
|
-
|
|
49
|
-
### Example Results
|
|
50
|
-
|
|
51
|
-
\`\`\`json
|
|
52
|
-
["Universal"]
|
|
53
|
-
\`\`\`
|
|
54
|
-
|
|
55
|
-
\`\`\`json
|
|
56
|
-
["AnotherChatAgent", "Universal"]
|
|
57
|
-
\`\`\`
|
|
58
|
-
|
|
59
|
-
## List of Currently Available Chat Agents
|
|
60
|
-
|
|
61
|
-
{{chatAgents}}
|
|
62
|
-
`
|
|
63
|
-
};
|
|
64
|
-
exports.OrchestratorChatAgentId = 'Orchestrator';
|
|
65
|
-
const OrchestratorRequestIdKey = 'orchestatorRequestIdKey';
|
|
66
|
-
let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
|
|
67
|
-
constructor() {
|
|
68
|
-
super(exports.OrchestratorChatAgentId, [{
|
|
69
|
-
purpose: 'agent-selection',
|
|
70
|
-
identifier: 'openai/gpt-4o',
|
|
71
|
-
}], 'agent-selection', 'codicon codicon-symbol-boolean', undefined, undefined, false);
|
|
72
|
-
this.functions = [];
|
|
73
|
-
this.agentSpecificVariables = [];
|
|
74
|
-
this.name = exports.OrchestratorChatAgentId;
|
|
75
|
-
this.description = 'This agent analyzes the user request against the description of all available chat agents and selects the best fitting agent to answer the request \
|
|
76
|
-
(by using AI).The user\'s request will be directly delegated to the selected agent without further confirmation.';
|
|
77
|
-
this.variables = ['chatAgents'];
|
|
78
|
-
this.promptTemplates = [exports.orchestratorTemplate];
|
|
79
|
-
this.fallBackChatAgentId = 'Universal';
|
|
80
|
-
this.functions = [];
|
|
81
|
-
this.agentSpecificVariables = [];
|
|
82
|
-
}
|
|
83
|
-
async invoke(request) {
|
|
84
|
-
var _a;
|
|
85
|
-
request.response.addProgressMessage({ content: 'Determining the most appropriate agent', status: 'inProgress' });
|
|
86
|
-
// We generate a dedicated ID for recording the orchestrator request/response, as we will forward the original request to another agent
|
|
87
|
-
const orchestratorRequestId = (0, core_1.generateUuid)();
|
|
88
|
-
request.addData(OrchestratorRequestIdKey, orchestratorRequestId);
|
|
89
|
-
const messages = await this.getMessages(request.session);
|
|
90
|
-
const systemMessage = (_a = (await this.getSystemMessageDescription())) === null || _a === void 0 ? void 0 : _a.text;
|
|
91
|
-
this.recordingService.recordRequest(chat_history_entry_1.ChatHistoryEntry.fromRequest(this.id, request, {
|
|
92
|
-
requestId: orchestratorRequestId,
|
|
93
|
-
messages,
|
|
94
|
-
systemMessage
|
|
95
|
-
}));
|
|
96
|
-
return super.invoke(request);
|
|
97
|
-
}
|
|
98
|
-
async getSystemMessageDescription() {
|
|
99
|
-
const resolvedPrompt = await this.promptService.getPrompt(exports.orchestratorTemplate.id);
|
|
100
|
-
return resolvedPrompt ? chat_agents_1.SystemMessageDescription.fromResolvedPromptTemplate(resolvedPrompt) : undefined;
|
|
101
|
-
}
|
|
102
|
-
async addContentsToResponse(response, request) {
|
|
103
|
-
var _a;
|
|
104
|
-
let agentIds = [];
|
|
105
|
-
const responseText = await (0, ai_core_1.getTextOfResponse)(response);
|
|
106
|
-
// We use the previously generated, dedicated ID to log the orchestrator response before we forward the original request
|
|
107
|
-
const orchestratorRequestId = request.getDataByKey(OrchestratorRequestIdKey);
|
|
108
|
-
if (typeof orchestratorRequestId === 'string') {
|
|
109
|
-
this.recordingService.recordResponse({
|
|
110
|
-
agentId: this.id,
|
|
111
|
-
sessionId: request.session.id,
|
|
112
|
-
requestId: orchestratorRequestId,
|
|
113
|
-
response: responseText,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
try {
|
|
117
|
-
const jsonResponse = await (0, ai_core_1.getJsonOfText)(responseText);
|
|
118
|
-
if (Array.isArray(jsonResponse)) {
|
|
119
|
-
agentIds = jsonResponse.filter((id) => id !== this.id);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
// The llm sometimes does not return a parseable result
|
|
124
|
-
this.logger.error('Failed to parse JSON response', error);
|
|
125
|
-
}
|
|
126
|
-
if (agentIds.length < 1) {
|
|
127
|
-
this.logger.error('No agent was selected, delegating to fallback chat agent');
|
|
128
|
-
request.response.progressMessages.forEach(progressMessage => request.response.updateProgressMessage({ ...progressMessage, status: 'failed' }));
|
|
129
|
-
agentIds = [this.fallBackChatAgentId];
|
|
130
|
-
}
|
|
131
|
-
// check if selected (or fallback) agent exists
|
|
132
|
-
if (!this.chatAgentService.getAgent(agentIds[0])) {
|
|
133
|
-
this.logger.error(`Chat agent ${agentIds[0]} not found. Falling back to first registered agent.`);
|
|
134
|
-
const firstRegisteredAgent = (_a = this.chatAgentService.getAgents().filter(a => a.id !== this.id)[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
135
|
-
if (firstRegisteredAgent) {
|
|
136
|
-
agentIds = [firstRegisteredAgent];
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
throw new Error('No chat agent available to handle request. Please check your configuration whether any are enabled.');
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// TODO support delegating to more than one agent
|
|
143
|
-
const delegatedToAgent = agentIds[0];
|
|
144
|
-
request.response.response.addContent(new chat_model_1.InformationalChatResponseContentImpl(`*Orchestrator*: Delegating to \`@${delegatedToAgent}\`
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
`));
|
|
149
|
-
request.response.overrideAgentId(delegatedToAgent);
|
|
150
|
-
request.response.progressMessages.forEach(progressMessage => request.response.updateProgressMessage({ ...progressMessage, status: 'completed' }));
|
|
151
|
-
const agent = this.chatAgentService.getAgent(delegatedToAgent);
|
|
152
|
-
if (!agent) {
|
|
153
|
-
throw new Error(`Chat agent ${delegatedToAgent} not found.`);
|
|
154
|
-
}
|
|
155
|
-
await agent.invoke(request);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
exports.OrchestratorChatAgent = OrchestratorChatAgent;
|
|
159
|
-
tslib_1.__decorate([
|
|
160
|
-
(0, inversify_1.inject)(chat_agent_service_1.ChatAgentService),
|
|
161
|
-
tslib_1.__metadata("design:type", Object)
|
|
162
|
-
], OrchestratorChatAgent.prototype, "chatAgentService", void 0);
|
|
163
|
-
exports.OrchestratorChatAgent = OrchestratorChatAgent = tslib_1.__decorate([
|
|
164
|
-
(0, inversify_1.injectable)(),
|
|
165
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
166
|
-
], OrchestratorChatAgent);
|
|
167
|
-
//# sourceMappingURL=orchestrator-chat-agent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-chat-agent.js","sourceRoot":"","sources":["../../src/common/orchestrator-chat-agent.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4CAAiH;AAIjH,4DAAkE;AAClE,6DAAwD;AACxD,+CAAoG;AACpG,6CAA0F;AAC1F,sCAA2C;AAC3C,6DAAwD;AAE3C,QAAA,oBAAoB,GAAmB;IAChD,EAAE,EAAE,qBAAqB;IACzB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCb;CAAC,CAAC;AAEU,QAAA,uBAAuB,GAAG,cAAc,CAAC;AACtD,MAAM,wBAA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C,gBAAgB;;;;aAInD,CACJ,CAAC,CAAC;QACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;QACnD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CACxD,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,GAAG,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CACtF,CAAC;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,cAAc,gBAAgB,aAAa,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;CACJ,CAAA;AA9GY,sDAAqB;AAyBpB;IADT,IAAA,kBAAM,EAAC,qCAAgB,CAAC;;+DACoB;gCAzBpC,qBAAqB;IADjC,IAAA,sBAAU,GAAE;;GACA,qBAAqB,CA8GjC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AgentSpecificVariables } from '@theia/ai-core';
|
|
2
|
-
import { PromptTemplate } from '@theia/ai-core/lib/common';
|
|
3
|
-
import { AbstractStreamParsingChatAgent, ChatAgent, SystemMessageDescription } from './chat-agents';
|
|
4
|
-
export declare const universalTemplate: PromptTemplate;
|
|
5
|
-
export declare const universalTemplateVariant: PromptTemplate;
|
|
6
|
-
export declare class UniversalChatAgent extends AbstractStreamParsingChatAgent implements ChatAgent {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
variables: string[];
|
|
10
|
-
promptTemplates: PromptTemplate[];
|
|
11
|
-
readonly functions: string[];
|
|
12
|
-
readonly agentSpecificVariables: AgentSpecificVariables[];
|
|
13
|
-
constructor();
|
|
14
|
-
protected getSystemMessageDescription(): Promise<SystemMessageDescription | undefined>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=universal-chat-agent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"universal-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/universal-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACJ,cAAc,EAChB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,8BAA8B,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAEpG,eAAO,MAAM,iBAAiB,EAAE,cAuD/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,cAItC,CAAC;AAEF,qBACa,kBAAmB,SAAQ,8BAA+B,YAAW,SAAS;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,EAAE,CAAC;;cAkBjC,2BAA2B,IAAI,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;CAKvG"}
|