@theia/ai-ide 1.62.0-next.3 → 1.62.1
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-configuration/agent-configuration-widget.d.ts +3 -3
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/agent-configuration-widget.js +24 -18
- package/lib/browser/ai-configuration/agent-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.js +1 -1
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.js.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts +2 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.js +6 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts +138 -0
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js +492 -0
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts +4 -5
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +1 -1
- package/lib/browser/ai-configuration/template-settings-renderer.js +15 -31
- package/lib/browser/ai-configuration/template-settings-renderer.js.map +1 -1
- package/lib/browser/architect-agent.d.ts +1 -1
- package/lib/browser/architect-agent.d.ts.map +1 -1
- package/lib/browser/architect-agent.js +2 -2
- package/lib/browser/architect-agent.js.map +1 -1
- package/lib/browser/coder-agent.d.ts +2 -2
- package/lib/browser/coder-agent.d.ts.map +1 -1
- package/lib/browser/coder-agent.js +7 -3
- package/lib/browser/coder-agent.js.map +1 -1
- package/lib/browser/file-changeset-functions.d.ts +14 -1
- package/lib/browser/file-changeset-functions.d.ts.map +1 -1
- package/lib/browser/file-changeset-functions.js +153 -14
- package/lib/browser/file-changeset-functions.js.map +1 -1
- package/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +11 -1
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/template-preference-contribution.d.ts +2 -2
- package/lib/browser/template-preference-contribution.d.ts.map +1 -1
- package/lib/browser/template-preference-contribution.js +2 -2
- package/lib/browser/template-preference-contribution.js.map +1 -1
- package/lib/browser/workspace-functions.d.ts +1 -1
- package/lib/browser/workspace-functions.js +13 -13
- package/lib/common/architect-prompt-template.d.ts +2 -3
- package/lib/common/architect-prompt-template.d.ts.map +1 -1
- package/lib/common/architect-prompt-template.js +49 -11
- package/lib/common/architect-prompt-template.js.map +1 -1
- package/lib/common/coder-replace-prompt-template.d.ts +6 -3
- package/lib/common/coder-replace-prompt-template.d.ts.map +1 -1
- package/lib/common/coder-replace-prompt-template.js +148 -22
- package/lib/common/coder-replace-prompt-template.js.map +1 -1
- package/lib/common/command-chat-agents.d.ts +1 -1
- package/lib/common/command-chat-agents.d.ts.map +1 -1
- package/lib/common/command-chat-agents.js +4 -4
- package/lib/common/command-chat-agents.js.map +1 -1
- package/lib/common/command-prompt-template.d.ts +2 -2
- package/lib/common/command-prompt-template.d.ts.map +1 -1
- package/lib/common/command-prompt-template.js +18 -15
- package/lib/common/command-prompt-template.js.map +1 -1
- package/lib/common/orchestrator-chat-agent.d.ts +2 -3
- package/lib/common/orchestrator-chat-agent.d.ts.map +1 -1
- package/lib/common/orchestrator-chat-agent.js +11 -26
- package/lib/common/orchestrator-chat-agent.js.map +1 -1
- package/lib/common/orchestrator-prompt-template.d.ts +2 -2
- package/lib/common/orchestrator-prompt-template.d.ts.map +1 -1
- package/lib/common/orchestrator-prompt-template.js +4 -1
- package/lib/common/orchestrator-prompt-template.js.map +1 -1
- package/lib/common/universal-chat-agent.d.ts +5 -1
- package/lib/common/universal-chat-agent.d.ts.map +1 -1
- package/lib/common/universal-chat-agent.js +2 -2
- package/lib/common/universal-chat-agent.js.map +1 -1
- package/lib/common/universal-prompt-template.d.ts +3 -3
- package/lib/common/universal-prompt-template.d.ts.map +1 -1
- package/lib/common/universal-prompt-template.js +1 -2
- package/lib/common/universal-prompt-template.js.map +1 -1
- package/package.json +17 -17
- package/src/browser/ai-configuration/agent-configuration-widget.tsx +31 -24
- package/src/browser/ai-configuration/ai-configuration-view-contribution.ts +1 -1
- package/src/browser/ai-configuration/ai-configuration-widget.tsx +6 -0
- package/src/browser/ai-configuration/prompt-fragments-configuration-widget.tsx +710 -0
- package/src/browser/ai-configuration/template-settings-renderer.tsx +18 -38
- package/src/browser/architect-agent.ts +3 -3
- package/src/browser/coder-agent.ts +10 -5
- package/src/browser/file-changeset-functions.ts +152 -14
- package/src/browser/frontend-module.ts +14 -2
- package/src/browser/style/index.css +320 -0
- package/src/browser/template-preference-contribution.ts +4 -4
- package/src/browser/workspace-functions.ts +3 -3
- package/src/common/architect-prompt-template.ts +54 -14
- package/src/common/coder-replace-prompt-template.ts +150 -24
- package/src/common/command-chat-agents.ts +4 -4
- package/src/common/command-prompt-template.ts +21 -18
- package/src/common/orchestrator-chat-agent.ts +12 -28
- package/src/common/orchestrator-prompt-template.ts +7 -4
- package/src/common/universal-chat-agent.ts +2 -2
- package/src/common/universal-prompt-template.ts +4 -5
|
@@ -13,17 +13,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.commandTemplate = void 0;
|
|
14
14
|
exports.commandTemplate = {
|
|
15
15
|
id: 'command-system',
|
|
16
|
-
|
|
16
|
+
defaultVariant: {
|
|
17
|
+
id: 'command-system-default',
|
|
18
|
+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
17
19
|
Made improvements or adaptations to this prompt template? We\u2019d love for you to share it with the community! Contribute back here:
|
|
18
20
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
19
21
|
# System Prompt
|
|
20
22
|
|
|
21
23
|
You are a service that helps users find commands to execute in an IDE.
|
|
22
|
-
You reply with stringified JSON Objects that tell the user which command to execute and its arguments, if any.
|
|
24
|
+
You reply with stringified JSON Objects that tell the user which command to execute and its arguments, if any.
|
|
23
25
|
|
|
24
26
|
# Examples
|
|
25
27
|
|
|
26
|
-
The examples start with a short explanation of the return object.
|
|
28
|
+
The examples start with a short explanation of the return object.
|
|
27
29
|
The response can be found within the markdown \`\`\`json and \`\`\` markers.
|
|
28
30
|
Please include these markers in the reply.
|
|
29
31
|
|
|
@@ -42,7 +44,7 @@ This reply is to tell the user to execute the \`theia-ai-prompt-template:show-pr
|
|
|
42
44
|
|
|
43
45
|
## Example 2
|
|
44
46
|
|
|
45
|
-
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,
|
|
47
|
+
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,
|
|
46
48
|
when the user want to pass arguments to the command.
|
|
47
49
|
|
|
48
50
|
\`\`\`json
|
|
@@ -55,9 +57,9 @@ when the user want to pass arguments to the command.
|
|
|
55
57
|
|
|
56
58
|
## Example 3
|
|
57
59
|
|
|
58
|
-
This reply is for custom commands that are not registered in the Theia command registry.
|
|
60
|
+
This reply is for custom commands that are not registered in the Theia command registry.
|
|
59
61
|
These commands always have the command id \`ai-chat.command-chat-response.generic\`.
|
|
60
|
-
The arguments are an array and may differ, depending on the user's instructions.
|
|
62
|
+
The arguments are an array and may differ, depending on the user's instructions.
|
|
61
63
|
|
|
62
64
|
\`\`\`json
|
|
63
65
|
{
|
|
@@ -69,7 +71,7 @@ The arguments are an array and may differ, depending on the user's instructions.
|
|
|
69
71
|
|
|
70
72
|
## Example 4
|
|
71
73
|
|
|
72
|
-
This reply of type no-command is for cases where you can't find a proper command.
|
|
74
|
+
This reply of type no-command is for cases where you can't find a proper command.
|
|
73
75
|
You may use the message to explain the situation to the user.
|
|
74
76
|
|
|
75
77
|
\`\`\`json
|
|
@@ -84,17 +86,17 @@ You may use the message to explain the situation to the user.
|
|
|
84
86
|
## Theia Commands
|
|
85
87
|
|
|
86
88
|
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"\`.
|
|
87
|
-
You need to exchange the "commandId".
|
|
89
|
+
You need to exchange the "commandId".
|
|
88
90
|
The available command ids in Theia are in the list below. The list of commands is formatted like this:
|
|
89
91
|
|
|
90
92
|
command-id1: Label1
|
|
91
93
|
command-id2: Label2
|
|
92
|
-
command-id3:
|
|
94
|
+
command-id3:
|
|
93
95
|
command-id4: Label4
|
|
94
96
|
|
|
95
97
|
The Labels may be empty, but there is always a command-id.
|
|
96
98
|
|
|
97
|
-
Suggest a command that probably fits the user's message based on the label and the command ids you know.
|
|
99
|
+
Suggest a command that probably fits the user's message based on the label and the command ids you know.
|
|
98
100
|
If you have multiple commands that fit, return the one that fits best. We only want a single command in the reply.
|
|
99
101
|
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.
|
|
100
102
|
|
|
@@ -122,7 +124,7 @@ In all other cases, return a reply of \`"type": "no-command"\`.
|
|
|
122
124
|
|
|
123
125
|
## Invalid Response Example 1
|
|
124
126
|
|
|
125
|
-
This example is invalid because it returns text and two commands.
|
|
127
|
+
This example is invalid because it returns text and two commands.
|
|
126
128
|
Only one command should be replied, and it must be parseable JSON.
|
|
127
129
|
|
|
128
130
|
### The Example
|
|
@@ -172,7 +174,7 @@ I found this command that might help you: core.close.right.tabs
|
|
|
172
174
|
|
|
173
175
|
## Invalid Response Example 4
|
|
174
176
|
|
|
175
|
-
The following example is invalid because it has an explanation string before the JSON.
|
|
177
|
+
The following example is invalid because it has an explanation string before the JSON.
|
|
176
178
|
We only want the JSON!
|
|
177
179
|
|
|
178
180
|
### The Example
|
|
@@ -188,7 +190,7 @@ You can toggle high contrast mode with this command:
|
|
|
188
190
|
|
|
189
191
|
## Invalid Response Example 5
|
|
190
192
|
|
|
191
|
-
The following example is invalid because it explains that no command was found.
|
|
193
|
+
The following example is invalid because it explains that no command was found.
|
|
192
194
|
We want a response of \`"type": "no-command"\` and have the message there.
|
|
193
195
|
|
|
194
196
|
### The Example
|
|
@@ -205,8 +207,8 @@ foo:toggle-visibility-explorer-view-container--files: Label 1
|
|
|
205
207
|
foo:toggle-visibility-explorer-view-container--plugin-view: Label 2
|
|
206
208
|
End List
|
|
207
209
|
|
|
208
|
-
The problem is that workbench.action.toggleHighContrast is not in this list.
|
|
209
|
-
theia-command types may only use commandIds from this list.
|
|
210
|
+
The problem is that workbench.action.toggleHighContrast is not in this list.
|
|
211
|
+
theia-command types may only use commandIds from this list.
|
|
210
212
|
This should have been of \`"type": "no-command"\`.
|
|
211
213
|
|
|
212
214
|
### The Example
|
|
@@ -219,5 +221,6 @@ This should have been of \`"type": "no-command"\`.
|
|
|
219
221
|
\`\`\`
|
|
220
222
|
|
|
221
223
|
`
|
|
224
|
+
}
|
|
222
225
|
};
|
|
223
226
|
//# sourceMappingURL=command-prompt-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-prompt-template.js","sourceRoot":"","sources":["../../src/common/command-prompt-template.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,+CAA+C;AAC/C,mEAAmE;AACnE,sCAAsC;AACtC,EAAE;AACF,+BAA+B;AAC/B,gFAAgF;;;AAInE,QAAA,eAAe,
|
|
1
|
+
{"version":3,"file":"command-prompt-template.js","sourceRoot":"","sources":["../../src/common/command-prompt-template.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,+CAA+C;AAC/C,mEAAmE;AACnE,sCAAsC;AACtC,EAAE;AACF,+BAA+B;AAC/B,gFAAgF;;;AAInE,QAAA,eAAe,GAAqB;IAC7C,EAAE,EAAE,gBAAgB;IACpB,cAAc,EAAE;QACZ,EAAE,EAAE,wBAAwB;QAC5B,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6MjB;KAAC;CACD,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LanguageModel, LanguageModelMessage, LanguageModelRequirement, LanguageModelResponse } from '@theia/ai-core';
|
|
2
2
|
import { ChatAgentService } from '@theia/ai-chat/lib/common/chat-agent-service';
|
|
3
|
+
import { ChatToolRequest } from '@theia/ai-chat/lib/common/chat-tool-request-service';
|
|
3
4
|
import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents';
|
|
4
5
|
import { MutableChatRequestModel } from '@theia/ai-chat/lib/common/chat-model';
|
|
5
|
-
import { ChatToolRequest } from '@theia/ai-chat/lib/common/chat-tool-request-service';
|
|
6
6
|
export declare const OrchestratorChatAgentId = "Orchestrator";
|
|
7
7
|
export declare class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
|
|
8
8
|
id: string;
|
|
@@ -10,7 +10,7 @@ export declare class OrchestratorChatAgent extends AbstractStreamParsingChatAgen
|
|
|
10
10
|
languageModelRequirements: LanguageModelRequirement[];
|
|
11
11
|
protected defaultLanguageModelPurpose: string;
|
|
12
12
|
variables: string[];
|
|
13
|
-
|
|
13
|
+
prompts: import("@theia/ai-core").PromptVariantSet[];
|
|
14
14
|
description: string;
|
|
15
15
|
iconClass: string;
|
|
16
16
|
protected systemPromptId: string;
|
|
@@ -18,7 +18,6 @@ export declare class OrchestratorChatAgent extends AbstractStreamParsingChatAgen
|
|
|
18
18
|
protected chatAgentService: ChatAgentService;
|
|
19
19
|
invoke(request: MutableChatRequestModel): Promise<void>;
|
|
20
20
|
protected sendLlmRequest(request: MutableChatRequestModel, messages: LanguageModelMessage[], toolRequests: ChatToolRequest[], languageModel: LanguageModel): Promise<LanguageModelResponse>;
|
|
21
|
-
protected onResponseComplete(request: MutableChatRequestModel): Promise<void>;
|
|
22
21
|
protected addContentsToResponse(response: LanguageModelResponse, request: MutableChatRequestModel): Promise<void>;
|
|
23
22
|
}
|
|
24
23
|
//# sourceMappingURL=orchestrator-chat-agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/orchestrator-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAoC,aAAa,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAExJ,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"orchestrator-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/orchestrator-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAoC,aAAa,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAExJ,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAwC,MAAM,sCAAsC,CAAC;AAIrH,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAGtD,qBACa,qBAAsB,SAAQ,8BAA8B;IACrE,EAAE,EAAE,MAAM,CAA2B;IACrC,IAAI,SAA2B;IAC/B,yBAAyB,EAAE,wBAAwB,EAAE,CAGlD;IACH,SAAS,CAAC,2BAA2B,EAAE,MAAM,CAAqB;IAEzD,SAAS,WAAkB;IAC3B,OAAO,8CAA0B;IACjC,WAAW,SAE+F;IAC1G,SAAS,EAAE,MAAM,CAAoC;IAE9D,UAAmB,cAAc,EAAE,MAAM,CAA2B;IAEpE,OAAO,CAAC,mBAAmB,CAAe;IAG1C,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAE9B,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;cAS7C,cAAc,CACnC,OAAO,EAAE,uBAAuB,EAChC,QAAQ,EAAE,oBAAoB,EAAE,EAChC,YAAY,EAAE,eAAe,EAAE,EAC/B,aAAa,EAAE,aAAa,GAC7B,OAAO,CAAC,qBAAqB,CAAC;cAqBR,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;CAwDnI"}
|
|
@@ -25,7 +25,7 @@ const chat_model_1 = require("@theia/ai-chat/lib/common/chat-model");
|
|
|
25
25
|
const core_1 = require("@theia/core");
|
|
26
26
|
const orchestrator_prompt_template_1 = require("./orchestrator-prompt-template");
|
|
27
27
|
exports.OrchestratorChatAgentId = 'Orchestrator';
|
|
28
|
-
const OrchestratorRequestIdKey = '
|
|
28
|
+
const OrchestratorRequestIdKey = 'orchestratorRequestIdKey';
|
|
29
29
|
let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
|
|
30
30
|
constructor() {
|
|
31
31
|
super(...arguments);
|
|
@@ -37,7 +37,7 @@ let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.Ab
|
|
|
37
37
|
}];
|
|
38
38
|
this.defaultLanguageModelPurpose = 'agent-selection';
|
|
39
39
|
this.variables = ['chatAgents'];
|
|
40
|
-
this.
|
|
40
|
+
this.prompts = [orchestrator_prompt_template_1.orchestratorTemplate];
|
|
41
41
|
this.description = core_1.nls.localize('theia/ai/chat/orchestrator/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 \
|
|
42
42
|
(by using AI).The user\'s request will be directly delegated to the selected agent without further confirmation.');
|
|
43
43
|
this.iconClass = 'codicon codicon-symbol-boolean';
|
|
@@ -46,24 +46,18 @@ let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.Ab
|
|
|
46
46
|
}
|
|
47
47
|
async invoke(request) {
|
|
48
48
|
request.response.addProgressMessage({ content: 'Determining the most appropriate agent', status: 'inProgress' });
|
|
49
|
-
// We
|
|
49
|
+
// We use a dedicated id for the orchestrator request
|
|
50
50
|
const orchestratorRequestId = (0, core_1.generateUuid)();
|
|
51
51
|
request.addData(OrchestratorRequestIdKey, orchestratorRequestId);
|
|
52
52
|
return super.invoke(request);
|
|
53
53
|
}
|
|
54
|
-
// override sendLlmRequest to modify the data sent to the recording service
|
|
55
|
-
// should no longer be needed after https://github.com/eclipse-theia/theia/issues/15221
|
|
56
54
|
async sendLlmRequest(request, messages, toolRequests, languageModel) {
|
|
57
55
|
var _a;
|
|
58
56
|
const agentSettings = this.getLlmSettings();
|
|
59
57
|
const settings = { ...agentSettings, ...request.session.settings };
|
|
60
58
|
const tools = toolRequests.length > 0 ? toolRequests : undefined;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
sessionId: request.session.id,
|
|
64
|
-
requestId: (_a = request.getDataByKey(OrchestratorRequestIdKey)) !== null && _a !== void 0 ? _a : request.id,
|
|
65
|
-
request: messages
|
|
66
|
-
});
|
|
59
|
+
const subRequestId = (_a = request.getDataByKey(OrchestratorRequestIdKey)) !== null && _a !== void 0 ? _a : request.id;
|
|
60
|
+
request.removeData(OrchestratorRequestIdKey);
|
|
67
61
|
return this.languageModelService.sendRequest(languageModel, {
|
|
68
62
|
messages,
|
|
69
63
|
tools,
|
|
@@ -71,24 +65,13 @@ let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.Ab
|
|
|
71
65
|
agentId: this.id,
|
|
72
66
|
sessionId: request.session.id,
|
|
73
67
|
requestId: request.id,
|
|
68
|
+
subRequestId: subRequestId,
|
|
74
69
|
cancellationToken: request.response.cancellationToken
|
|
75
70
|
});
|
|
76
71
|
}
|
|
77
|
-
// override onResponseComplete to not send data to the communication service on completion
|
|
78
|
-
// should no longer be needed after https://github.com/eclipse-theia/theia/issues/15221
|
|
79
|
-
async onResponseComplete(request) {
|
|
80
|
-
return request.response.complete();
|
|
81
|
-
}
|
|
82
72
|
async addContentsToResponse(response, request) {
|
|
83
|
-
var _a
|
|
73
|
+
var _a;
|
|
84
74
|
const responseText = await (0, ai_core_1.getTextOfResponse)(response);
|
|
85
|
-
// record orchestrator response
|
|
86
|
-
this.recordingService.recordResponse({
|
|
87
|
-
agentId: this.id,
|
|
88
|
-
sessionId: request.session.id,
|
|
89
|
-
requestId: (_a = request.getDataByKey(OrchestratorRequestIdKey)) !== null && _a !== void 0 ? _a : request.id,
|
|
90
|
-
response: [{ type: 'text', actor: 'ai', text: responseText }]
|
|
91
|
-
});
|
|
92
75
|
let agentIds = [];
|
|
93
76
|
try {
|
|
94
77
|
const jsonResponse = await (0, ai_core_1.getJsonOfText)(responseText);
|
|
@@ -108,7 +91,7 @@ let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.Ab
|
|
|
108
91
|
// check if selected (or fallback) agent exists
|
|
109
92
|
if (!this.chatAgentService.getAgent(agentIds[0])) {
|
|
110
93
|
this.logger.error(`Chat agent ${agentIds[0]} not found. Falling back to first registered agent.`);
|
|
111
|
-
const firstRegisteredAgent = (
|
|
94
|
+
const firstRegisteredAgent = (_a = this.chatAgentService.getAgents().filter(a => a.id !== this.id)[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
112
95
|
if (firstRegisteredAgent) {
|
|
113
96
|
agentIds = [firstRegisteredAgent];
|
|
114
97
|
}
|
|
@@ -129,7 +112,9 @@ let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.Ab
|
|
|
129
112
|
if (!agent) {
|
|
130
113
|
throw new Error(`Chat agent ${delegatedToAgent} not found.`);
|
|
131
114
|
}
|
|
132
|
-
|
|
115
|
+
// Get the original request if available
|
|
116
|
+
const originalRequest = '__originalRequest' in request ? request.__originalRequest : request;
|
|
117
|
+
await agent.invoke(originalRequest);
|
|
133
118
|
}
|
|
134
119
|
};
|
|
135
120
|
exports.OrchestratorChatAgent = OrchestratorChatAgent;
|
|
@@ -1 +1 @@
|
|
|
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,4CAAwJ;AACxJ,4DAAkE;AAClE,qFAAgF;
|
|
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,4CAAwJ;AACxJ,4DAAkE;AAClE,qFAAgF;AAEhF,uEAAuF;AACvF,qEAAqH;AACrH,sCAAgD;AAChD,iFAAsE;AAEzD,QAAA,uBAAuB,GAAG,cAAc,CAAC;AACtD,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAGrD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,4CAA8B;IAAlE;;QACH,OAAE,GAAW,+BAAuB,CAAC;QACrC,SAAI,GAAG,+BAAuB,CAAC;QAC/B,8BAAyB,GAA+B,CAAC;gBACrD,OAAO,EAAE,iBAAiB;gBAC1B,UAAU,EAAE,eAAe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AC;QACjE,CAAC;QAED,wCAAwC;QACxC,MAAM,eAAe,GAAG,mBAAmB,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,iBAA4C,CAAC,CAAC,CAAC,OAAO,CAAC;QACxH,MAAM,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;CACJ,CAAA;AAlHY,sDAAqB;AAqBpB;IADT,IAAA,kBAAM,EAAC,qCAAgB,CAAC;;+DACoB;gCArBpC,qBAAqB;IADjC,IAAA,sBAAU,GAAE;GACA,qBAAqB,CAkHjC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const orchestratorTemplate:
|
|
1
|
+
import { PromptVariantSet } from '@theia/ai-core/lib/common';
|
|
2
|
+
export declare const orchestratorTemplate: PromptVariantSet;
|
|
3
3
|
//# sourceMappingURL=orchestrator-prompt-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-prompt-template.d.ts","sourceRoot":"","sources":["../../src/common/orchestrator-prompt-template.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"orchestrator-prompt-template.d.ts","sourceRoot":"","sources":["../../src/common/orchestrator-prompt-template.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,eAAO,MAAM,oBAAoB,EAAE,gBAuClC,CAAC"}
|
|
@@ -13,7 +13,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.orchestratorTemplate = void 0;
|
|
14
14
|
exports.orchestratorTemplate = {
|
|
15
15
|
id: 'orchestrator-system',
|
|
16
|
-
|
|
16
|
+
defaultVariant: {
|
|
17
|
+
id: 'orchestrator-system-default',
|
|
18
|
+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
17
19
|
Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
18
20
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
19
21
|
# Instructions
|
|
@@ -48,5 +50,6 @@ You must only use the \`id\` attribute of the agent, never the name.
|
|
|
48
50
|
|
|
49
51
|
{{chatAgents}}
|
|
50
52
|
`
|
|
53
|
+
}
|
|
51
54
|
};
|
|
52
55
|
//# sourceMappingURL=orchestrator-prompt-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-prompt-template.js","sourceRoot":"","sources":["../../src/common/orchestrator-prompt-template.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,+CAA+C;AAC/C,mEAAmE;AACnE,sCAAsC;AACtC,EAAE;AACF,+BAA+B;AAC/B,gFAAgF;;;AAInE,QAAA,oBAAoB,
|
|
1
|
+
{"version":3,"file":"orchestrator-prompt-template.js","sourceRoot":"","sources":["../../src/common/orchestrator-prompt-template.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,+CAA+C;AAC/C,mEAAmE;AACnE,sCAAsC;AACtC,EAAE;AACF,+BAA+B;AAC/B,gFAAgF;;;AAInE,QAAA,oBAAoB,GAAqB;IAClD,EAAE,EAAE,qBAAqB;IACzB,cAAc,EAAE;QACZ,EAAE,EAAE,6BAA6B;QACjC,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCjB;KAAC;CACD,CAAC"}
|
|
@@ -7,7 +7,11 @@ export declare class UniversalChatAgent extends AbstractStreamParsingChatAgent {
|
|
|
7
7
|
languageModelRequirements: LanguageModelRequirement[];
|
|
8
8
|
protected defaultLanguageModelPurpose: string;
|
|
9
9
|
description: string;
|
|
10
|
-
|
|
10
|
+
prompts: {
|
|
11
|
+
id: string;
|
|
12
|
+
defaultVariant: import("@theia/ai-core/lib/common").BasePromptFragment;
|
|
13
|
+
variants: import("@theia/ai-core/lib/common").BasePromptFragment[];
|
|
14
|
+
}[];
|
|
11
15
|
protected systemPromptId: string;
|
|
12
16
|
}
|
|
13
17
|
//# sourceMappingURL=universal-chat-agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universal-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/universal-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAIvF,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAChD,qBACa,kBAAmB,SAAQ,8BAA8B;IACnE,EAAE,EAAE,MAAM,CAAwB;IAClC,IAAI,SAAwB;IAC5B,yBAAyB,EAAE,wBAAwB,EAAE,CAGlD;IACH,SAAS,CAAC,2BAA2B,EAAE,MAAM,CAAU;IAC9C,WAAW,SAGsC;IAEjD,
|
|
1
|
+
{"version":3,"file":"universal-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/universal-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAIvF,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAChD,qBACa,kBAAmB,SAAQ,8BAA8B;IACnE,EAAE,EAAE,MAAM,CAAwB;IAClC,IAAI,SAAwB;IAC5B,yBAAyB,EAAE,wBAAwB,EAAE,CAGlD;IACH,SAAS,CAAC,2BAA2B,EAAE,MAAM,CAAU;IAC9C,WAAW,SAGsC;IAEjD,OAAO;;;;QAAyG;IACzH,UAAmB,cAAc,EAAE,MAAM,CAAsB;CACjE"}
|
|
@@ -36,8 +36,8 @@ let UniversalChatAgent = class UniversalChatAgent extends chat_agents_1.Abstract
|
|
|
36
36
|
+ 'answers to general programming and software development questions. It is also the fall-back for any generic '
|
|
37
37
|
+ 'questions the user might ask. The universal agent currently does not have any context by default, i.e. it cannot '
|
|
38
38
|
+ 'access the current user context or the workspace.');
|
|
39
|
-
this.
|
|
40
|
-
this.systemPromptId =
|
|
39
|
+
this.prompts = [{ id: 'universal-prompt', defaultVariant: universal_prompt_template_1.universalTemplate, variants: [universal_prompt_template_1.universalTemplateVariant] }];
|
|
40
|
+
this.systemPromptId = 'universal-prompt';
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
exports.UniversalChatAgent = UniversalChatAgent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universal-chat-agent.js","sourceRoot":"","sources":["../../src/common/universal-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;;;;AAGhF,4DAA0D;AAC1D,uEAAuF;AACvF,sCAAkC;AAClC,2EAA0F;AAE7E,QAAA,oBAAoB,GAAG,WAAW,CAAC;AAEzC,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,4CAA8B;IAA/D;;QACJ,OAAE,GAAW,4BAAoB,CAAC;QAClC,SAAI,GAAG,4BAAoB,CAAC;QAC5B,8BAAyB,GAA+B,CAAC;gBACtD,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,eAAe;aAC7B,CAAC,CAAC;QACO,gCAA2B,GAAW,MAAM,CAAC;QAC9C,gBAAW,GAAG,UAAG,CAAC,QAAQ,CAAC,qCAAqC,EAAE,uFAAuF;cAC7J,8GAA8G;cAC9G,mHAAmH;cACnH,mDAAmD,CAAC,CAAC;QAEjD,
|
|
1
|
+
{"version":3,"file":"universal-chat-agent.js","sourceRoot":"","sources":["../../src/common/universal-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;;;;AAGhF,4DAA0D;AAC1D,uEAAuF;AACvF,sCAAkC;AAClC,2EAA0F;AAE7E,QAAA,oBAAoB,GAAG,WAAW,CAAC;AAEzC,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,4CAA8B;IAA/D;;QACJ,OAAE,GAAW,4BAAoB,CAAC;QAClC,SAAI,GAAG,4BAAoB,CAAC;QAC5B,8BAAyB,GAA+B,CAAC;gBACtD,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,eAAe;aAC7B,CAAC,CAAC;QACO,gCAA2B,GAAW,MAAM,CAAC;QAC9C,gBAAW,GAAG,UAAG,CAAC,QAAQ,CAAC,qCAAqC,EAAE,uFAAuF;cAC7J,8GAA8G;cAC9G,mHAAmH;cACnH,mDAAmD,CAAC,CAAC;QAEjD,YAAO,GAAG,CAAC,EAAE,EAAE,EAAE,kBAAkB,EAAE,cAAc,EAAE,6CAAiB,EAAE,QAAQ,EAAE,CAAC,oDAAwB,CAAC,EAAE,CAAC,CAAC;QACtG,mBAAc,GAAW,kBAAkB,CAAC;IAClE,CAAC;CAAA,CAAA;AAfY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAe9B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const universalTemplate:
|
|
3
|
-
export declare const universalTemplateVariant:
|
|
1
|
+
import { BasePromptFragment } from '@theia/ai-core/lib/common';
|
|
2
|
+
export declare const universalTemplate: BasePromptFragment;
|
|
3
|
+
export declare const universalTemplateVariant: BasePromptFragment;
|
|
4
4
|
//# sourceMappingURL=universal-prompt-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universal-prompt-template.d.ts","sourceRoot":"","sources":["../../src/common/universal-prompt-template.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"universal-prompt-template.d.ts","sourceRoot":"","sources":["../../src/common/universal-prompt-template.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,eAAO,MAAM,iBAAiB,EAAE,kBAY/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,kBAGtC,CAAC"}
|
|
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.universalTemplateVariant = exports.universalTemplate = void 0;
|
|
14
14
|
const ai_chat_1 = require("@theia/ai-chat");
|
|
15
15
|
exports.universalTemplate = {
|
|
16
|
-
id: 'universal-system',
|
|
16
|
+
id: 'universal-system-default',
|
|
17
17
|
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
18
18
|
Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
19
19
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
@@ -28,6 +28,5 @@ Some files and other pieces of data may have been added by the user to the conte
|
|
|
28
28
|
exports.universalTemplateVariant = {
|
|
29
29
|
id: 'universal-system-empty',
|
|
30
30
|
template: '',
|
|
31
|
-
variantOf: exports.universalTemplate.id,
|
|
32
31
|
};
|
|
33
32
|
//# sourceMappingURL=universal-prompt-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universal-prompt-template.js","sourceRoot":"","sources":["../../src/common/universal-prompt-template.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,+CAA+C;AAC/C,mEAAmE;AACnE,sCAAsC;AACtC,EAAE;AACF,+BAA+B;AAC/B,gFAAgF;;;AAGhF,4CAAkE;AAErD,QAAA,iBAAiB,
|
|
1
|
+
{"version":3,"file":"universal-prompt-template.js","sourceRoot":"","sources":["../../src/common/universal-prompt-template.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,+CAA+C;AAC/C,mEAAmE;AACnE,sCAAsC;AACtC,EAAE;AACF,+BAA+B;AAC/B,gFAAgF;;;AAGhF,4CAAkE;AAErD,QAAA,iBAAiB,GAAuB;IAClD,EAAE,EAAE,0BAA0B;IAC9B,QAAQ,EAAE;;;;;;;;IAQT,0CAAgC;CACnC;CACA,CAAC;AAEW,QAAA,wBAAwB,GAAuB;IACzD,EAAE,EAAE,wBAAwB;IAC5B,QAAQ,EAAE,EAAE;CACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-ide",
|
|
3
|
-
"version": "1.62.
|
|
3
|
+
"version": "1.62.1",
|
|
4
4
|
"description": "AI IDE Agents Extension",
|
|
5
5
|
"license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
"theia-extension"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@theia/ai-chat": "1.62.
|
|
19
|
-
"@theia/ai-chat-ui": "1.62.
|
|
20
|
-
"@theia/ai-core": "1.62.
|
|
21
|
-
"@theia/ai-mcp": "1.62.
|
|
22
|
-
"@theia/core": "1.62.
|
|
23
|
-
"@theia/filesystem": "1.62.
|
|
24
|
-
"@theia/markers": "1.62.
|
|
25
|
-
"@theia/monaco": "1.62.
|
|
26
|
-
"@theia/navigator": "1.62.
|
|
27
|
-
"@theia/search-in-workspace": "1.62.
|
|
28
|
-
"@theia/task": "1.62.
|
|
29
|
-
"@theia/terminal": "1.62.
|
|
30
|
-
"@theia/workspace": "1.62.
|
|
18
|
+
"@theia/ai-chat": "1.62.1",
|
|
19
|
+
"@theia/ai-chat-ui": "1.62.1",
|
|
20
|
+
"@theia/ai-core": "1.62.1",
|
|
21
|
+
"@theia/ai-mcp": "1.62.1",
|
|
22
|
+
"@theia/core": "1.62.1",
|
|
23
|
+
"@theia/filesystem": "1.62.1",
|
|
24
|
+
"@theia/markers": "1.62.1",
|
|
25
|
+
"@theia/monaco": "1.62.1",
|
|
26
|
+
"@theia/navigator": "1.62.1",
|
|
27
|
+
"@theia/search-in-workspace": "1.62.1",
|
|
28
|
+
"@theia/task": "1.62.1",
|
|
29
|
+
"@theia/terminal": "1.62.1",
|
|
30
|
+
"@theia/workspace": "1.62.1",
|
|
31
31
|
"date-fns": "^4.1.0",
|
|
32
32
|
"ignore": "^6.0.0",
|
|
33
33
|
"js-yaml": "^4.1.0",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@theia/cli": "1.62.
|
|
41
|
-
"@theia/test": "1.62.
|
|
40
|
+
"@theia/cli": "1.62.1",
|
|
41
|
+
"@theia/test": "1.62.1"
|
|
42
42
|
},
|
|
43
43
|
"theiaExtensions": [
|
|
44
44
|
{
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"nyc": {
|
|
61
61
|
"extends": "../../configs/nyc.json"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "0cdb67623c7b5ce0a2d41a1440ed0a78bce890de"
|
|
64
64
|
}
|
|
@@ -19,11 +19,12 @@ import {
|
|
|
19
19
|
AgentService,
|
|
20
20
|
AISettingsService,
|
|
21
21
|
AIVariableService,
|
|
22
|
+
BasePromptFragment,
|
|
22
23
|
LanguageModel,
|
|
23
24
|
LanguageModelRegistry,
|
|
24
25
|
matchVariablesRegEx,
|
|
25
26
|
PROMPT_FUNCTION_REGEX,
|
|
26
|
-
|
|
27
|
+
PromptFragmentCustomizationService,
|
|
27
28
|
PromptService,
|
|
28
29
|
} from '@theia/ai-core/lib/common';
|
|
29
30
|
import { codicon, QuickInputService, ReactWidget } from '@theia/core/lib/browser';
|
|
@@ -32,9 +33,9 @@ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'
|
|
|
32
33
|
import * as React from '@theia/core/shared/react';
|
|
33
34
|
import { AIConfigurationSelectionService } from './ai-configuration-service';
|
|
34
35
|
import { LanguageModelRenderer } from './language-model-renderer';
|
|
35
|
-
import { TemplateRenderer } from './template-settings-renderer';
|
|
36
36
|
import { AIVariableConfigurationWidget } from './variable-configuration-widget';
|
|
37
37
|
import { nls } from '@theia/core';
|
|
38
|
+
import { PromptVariantRenderer } from './template-settings-renderer';
|
|
38
39
|
|
|
39
40
|
interface ParsedPrompt {
|
|
40
41
|
functions: string[];
|
|
@@ -54,8 +55,8 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
54
55
|
@inject(LanguageModelRegistry)
|
|
55
56
|
protected readonly languageModelRegistry: LanguageModelRegistry;
|
|
56
57
|
|
|
57
|
-
@inject(
|
|
58
|
-
protected readonly
|
|
58
|
+
@inject(PromptFragmentCustomizationService)
|
|
59
|
+
protected readonly promptFragmentCustomizationService: PromptFragmentCustomizationService;
|
|
59
60
|
|
|
60
61
|
@inject(AISettingsService)
|
|
61
62
|
protected readonly aiSettingsService: AISettingsService;
|
|
@@ -88,7 +89,7 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
88
89
|
this.languageModels = models;
|
|
89
90
|
this.update();
|
|
90
91
|
}));
|
|
91
|
-
this.toDispose.push(this.
|
|
92
|
+
this.toDispose.push(this.promptService.onPromptsChange(() => this.update()));
|
|
92
93
|
|
|
93
94
|
this.aiSettingsService.onDidChange(() => this.update());
|
|
94
95
|
this.aiConfigurationSelectionService.onDidAgentChange(() => this.update());
|
|
@@ -134,7 +135,7 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
134
135
|
|
|
135
136
|
const enabled = this.agentService.isEnabled(agent.id);
|
|
136
137
|
|
|
137
|
-
const parsedPromptParts = this.
|
|
138
|
+
const parsedPromptParts = this.parsePromptFragmentsForVariableAndFunction(agent);
|
|
138
139
|
const globalVariables = Array.from(new Set([...parsedPromptParts.globalVariables, ...agent.variables]));
|
|
139
140
|
const functions = Array.from(new Set([...parsedPromptParts.functions, ...agent.functions]));
|
|
140
141
|
|
|
@@ -157,17 +158,16 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
157
158
|
</div>
|
|
158
159
|
<div className="ai-templates">
|
|
159
160
|
{(() => {
|
|
160
|
-
const
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
<div key={agent.id + '.' +
|
|
164
|
-
<
|
|
165
|
-
key={agent.id + '.' +
|
|
161
|
+
const prompts = agent.prompts;
|
|
162
|
+
return prompts.length > 0 ? (
|
|
163
|
+
prompts.map(prompt => (
|
|
164
|
+
<div key={agent.id + '.' + prompt.id}>
|
|
165
|
+
<PromptVariantRenderer
|
|
166
|
+
key={agent.id + '.' + prompt.id}
|
|
166
167
|
agentId={agent.id}
|
|
167
|
-
|
|
168
|
+
promptVariantSet={prompt}
|
|
168
169
|
promptService={this.promptService}
|
|
169
170
|
aiSettingsService={this.aiSettingsService}
|
|
170
|
-
promptCustomizationService={this.promptCustomizationService}
|
|
171
171
|
/>
|
|
172
172
|
</div>
|
|
173
173
|
))
|
|
@@ -208,11 +208,18 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
208
208
|
</div>;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
private
|
|
212
|
-
const
|
|
211
|
+
private parsePromptFragmentsForVariableAndFunction(agent: Agent): ParsedPrompt {
|
|
212
|
+
const prompts = agent.prompts;
|
|
213
|
+
const promptFragments: BasePromptFragment[] = [];
|
|
214
|
+
prompts.forEach(prompt => {
|
|
215
|
+
promptFragments.push(prompt.defaultVariant);
|
|
216
|
+
if (prompt.variants) {
|
|
217
|
+
promptFragments.push(...prompt.variants);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
213
220
|
const result: ParsedPrompt = { functions: [], globalVariables: [], agentSpecificVariables: [] };
|
|
214
|
-
|
|
215
|
-
const storedPrompt = this.promptService.
|
|
221
|
+
promptFragments.forEach(template => {
|
|
222
|
+
const storedPrompt = this.promptService.getPromptFragment(template.id);
|
|
216
223
|
const prompt = storedPrompt?.template ?? template.template;
|
|
217
224
|
const variableMatches = matchVariablesRegEx(prompt);
|
|
218
225
|
|
|
@@ -242,11 +249,11 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
242
249
|
}
|
|
243
250
|
|
|
244
251
|
protected async addCustomAgent(): Promise<void> {
|
|
245
|
-
const locations = await this.
|
|
252
|
+
const locations = await this.promptFragmentCustomizationService.getCustomAgentsLocations();
|
|
246
253
|
|
|
247
254
|
// If only one location is available, use the direct approach
|
|
248
255
|
if (locations.length === 1) {
|
|
249
|
-
this.
|
|
256
|
+
this.promptFragmentCustomizationService.openCustomAgentYaml(locations[0].uri);
|
|
250
257
|
return;
|
|
251
258
|
}
|
|
252
259
|
|
|
@@ -265,7 +272,7 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
265
272
|
const selectedItem = quickPick.selectedItems[0] as unknown as { location: { uri: URI, exists: boolean } };
|
|
266
273
|
if (selectedItem && selectedItem.location) {
|
|
267
274
|
quickPick.dispose();
|
|
268
|
-
this.
|
|
275
|
+
this.promptFragmentCustomizationService.openCustomAgentYaml(selectedItem.location.uri);
|
|
269
276
|
}
|
|
270
277
|
});
|
|
271
278
|
|
|
@@ -336,7 +343,7 @@ const AgentSpecificVariables = ({ promptVariables, agent }: AgentSpecificVariabl
|
|
|
336
343
|
}
|
|
337
344
|
return <>
|
|
338
345
|
{variables.map(variableId =>
|
|
339
|
-
<
|
|
346
|
+
<AgentSpecificVariable
|
|
340
347
|
key={variableId}
|
|
341
348
|
variableId={variableId}
|
|
342
349
|
agent={agent}
|
|
@@ -345,12 +352,12 @@ const AgentSpecificVariables = ({ promptVariables, agent }: AgentSpecificVariabl
|
|
|
345
352
|
)}
|
|
346
353
|
</>;
|
|
347
354
|
};
|
|
348
|
-
interface
|
|
355
|
+
interface AgentSpecificVariableProps {
|
|
349
356
|
variableId: string;
|
|
350
357
|
agent: Agent;
|
|
351
358
|
promptVariables: string[];
|
|
352
359
|
}
|
|
353
|
-
const
|
|
360
|
+
const AgentSpecificVariable = ({ variableId, agent, promptVariables }: AgentSpecificVariableProps) => {
|
|
354
361
|
const agentDefinedVariable = agent.agentSpecificVariables.find(v => v.name === variableId);
|
|
355
362
|
const undeclared = agentDefinedVariable === undefined;
|
|
356
363
|
const notUsed = !promptVariables.includes(variableId) && agentDefinedVariable?.usedInPrompt === true;
|
|
@@ -35,7 +35,7 @@ export class AIAgentConfigurationViewContribution extends AIViewContribution<AIC
|
|
|
35
35
|
widgetId: AIConfigurationContainerWidget.ID,
|
|
36
36
|
widgetName: AIConfigurationContainerWidget.LABEL,
|
|
37
37
|
defaultWidgetOptions: {
|
|
38
|
-
area: '
|
|
38
|
+
area: 'bottom',
|
|
39
39
|
rank: 100
|
|
40
40
|
},
|
|
41
41
|
toggleCommandId: AI_CONFIGURATION_TOGGLE_COMMAND_ID
|