@theia/ai-ide 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/README.md +48 -0
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +27 -0
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/agent-configuration-widget.js +242 -0
- package/lib/browser/ai-configuration/agent-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts +13 -0
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-service.js +44 -0
- package/lib/browser/ai-configuration/ai-configuration-service.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts +12 -0
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.js +56 -0
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts +20 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.js +89 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/language-model-renderer.d.ts +11 -0
- package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +1 -0
- package/lib/browser/ai-configuration/language-model-renderer.js +125 -0
- package/lib/browser/ai-configuration/language-model-renderer.js.map +1 -0
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts +12 -0
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +1 -0
- package/lib/browser/ai-configuration/template-settings-renderer.js +57 -0
- package/lib/browser/ai-configuration/template-settings-renderer.js.map +1 -0
- package/lib/browser/ai-configuration/variable-configuration-widget.d.ts +19 -0
- package/lib/browser/ai-configuration/variable-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/variable-configuration-widget.js +98 -0
- package/lib/browser/ai-configuration/variable-configuration-widget.js.map +1 -0
- package/lib/browser/architect-agent.d.ts +13 -0
- package/lib/browser/architect-agent.d.ts.map +1 -0
- package/lib/browser/architect-agent.js +47 -0
- package/lib/browser/architect-agent.js.map +1 -0
- package/lib/browser/coder-agent.d.ts +13 -0
- package/lib/browser/coder-agent.d.ts.map +1 -0
- package/lib/browser/coder-agent.js +48 -0
- package/lib/browser/coder-agent.js.map +1 -0
- package/lib/browser/content-replacer.d.ts +46 -0
- package/lib/browser/content-replacer.d.ts.map +1 -0
- package/lib/browser/content-replacer.js +115 -0
- package/lib/browser/content-replacer.js.map +1 -0
- package/lib/browser/content-replacer.spec.d.ts +2 -0
- package/lib/browser/content-replacer.spec.d.ts.map +1 -0
- package/lib/browser/content-replacer.spec.js +86 -0
- package/lib/browser/content-replacer.spec.js.map +1 -0
- package/lib/browser/context-functions.d.ts +10 -0
- package/lib/browser/context-functions.d.ts.map +1 -0
- package/lib/browser/context-functions.js +82 -0
- package/lib/browser/context-functions.js.map +1 -0
- package/lib/browser/file-changeset-functions.d.ts +21 -0
- package/lib/browser/file-changeset-functions.d.ts.map +1 -0
- package/lib/browser/file-changeset-functions.js +189 -0
- package/lib/browser/file-changeset-functions.js.map +1 -0
- package/lib/browser/frontend-module.d.ts +4 -0
- package/lib/browser/frontend-module.d.ts.map +1 -0
- package/lib/browser/frontend-module.js +87 -0
- package/lib/browser/frontend-module.js.map +1 -0
- package/lib/browser/workspace-functions.d.ts +48 -0
- package/lib/browser/workspace-functions.d.ts.map +1 -0
- package/lib/browser/workspace-functions.js +306 -0
- package/lib/browser/workspace-functions.js.map +1 -0
- package/lib/browser/workspace-preferences.d.ts +5 -0
- package/lib/browser/workspace-preferences.d.ts.map +1 -0
- package/lib/browser/workspace-preferences.js +42 -0
- package/lib/browser/workspace-preferences.js.map +1 -0
- package/lib/common/architect-prompt-template.d.ts +3 -0
- package/lib/common/architect-prompt-template.d.ts.map +1 -0
- package/lib/common/architect-prompt-template.js +29 -0
- package/lib/common/architect-prompt-template.js.map +1 -0
- package/lib/common/coder-replace-prompt-template.d.ts +5 -0
- package/lib/common/coder-replace-prompt-template.d.ts.map +1 -0
- package/lib/common/coder-replace-prompt-template.js +46 -0
- package/lib/common/coder-replace-prompt-template.js.map +1 -0
- package/lib/common/command-chat-agents.d.ts +37 -0
- package/lib/common/command-chat-agents.d.ts.map +1 -0
- package/lib/common/command-chat-agents.js +329 -0
- package/lib/common/command-chat-agents.js.map +1 -0
- package/lib/common/orchestrator-chat-agent.d.ts +24 -0
- package/lib/common/orchestrator-chat-agent.d.ts.map +1 -0
- package/lib/common/orchestrator-chat-agent.js +164 -0
- package/lib/common/orchestrator-chat-agent.js.map +1 -0
- package/lib/common/universal-chat-agent.d.ts +15 -0
- package/lib/common/universal-chat-agent.d.ts.map +1 -0
- package/lib/common/universal-chat-agent.js +107 -0
- package/lib/common/universal-chat-agent.js.map +1 -0
- package/lib/common/workspace-functions.d.ts +4 -0
- package/lib/common/workspace-functions.d.ts.map +1 -0
- package/lib/common/workspace-functions.js +22 -0
- package/lib/common/workspace-functions.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +26 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +57 -0
- package/src/browser/ai-configuration/agent-configuration-widget.tsx +330 -0
- package/src/browser/ai-configuration/ai-configuration-service.ts +43 -0
- package/src/browser/ai-configuration/ai-configuration-view-contribution.ts +53 -0
- package/src/browser/ai-configuration/ai-configuration-widget.tsx +81 -0
- package/src/browser/ai-configuration/language-model-renderer.tsx +122 -0
- package/src/browser/ai-configuration/template-settings-renderer.tsx +128 -0
- package/src/browser/ai-configuration/variable-configuration-widget.tsx +108 -0
- package/src/browser/architect-agent.ts +41 -0
- package/src/browser/coder-agent.ts +42 -0
- package/src/browser/content-replacer.spec.ts +92 -0
- package/src/browser/content-replacer.ts +126 -0
- package/src/browser/context-functions.ts +78 -0
- package/src/browser/file-changeset-functions.ts +185 -0
- package/src/browser/frontend-module.ts +102 -0
- package/src/browser/style/index.css +127 -0
- package/src/browser/workspace-functions.ts +326 -0
- package/src/browser/workspace-preferences.ts +43 -0
- package/src/common/architect-prompt-template.ts +42 -0
- package/src/common/coder-replace-prompt-template.ts +49 -0
- package/src/common/command-chat-agents.ts +343 -0
- package/src/common/orchestrator-chat-agent.ts +169 -0
- package/src/common/universal-chat-agent.ts +102 -0
- package/src/common/workspace-functions.ts +18 -0
- package/src/package.spec.ts +28 -0
|
@@ -0,0 +1,107 @@
|
|
|
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.UniversalChatAgent = exports.UniversalChatAgentId = exports.universalTemplateVariant = exports.universalTemplate = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const chat_agents_1 = require("@theia/ai-chat/lib/common/chat-agents");
|
|
22
|
+
const core_1 = require("@theia/core");
|
|
23
|
+
exports.universalTemplate = {
|
|
24
|
+
id: 'universal-system',
|
|
25
|
+
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
26
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
27
|
+
# Instructions
|
|
28
|
+
|
|
29
|
+
You are an AI assistant integrated into the Theia IDE, specifically designed to help software developers by
|
|
30
|
+
providing concise and accurate answers to programming-related questions. Your role is to enhance the
|
|
31
|
+
developer's productivity by offering quick solutions, explanations, and best practices.
|
|
32
|
+
Keep responses short and to the point, focusing on delivering valuable insights, best practices and
|
|
33
|
+
simple solutions.
|
|
34
|
+
|
|
35
|
+
### Guidelines
|
|
36
|
+
|
|
37
|
+
1. **Understand Context:**
|
|
38
|
+
- Assess the context of the code or issue when available.
|
|
39
|
+
- Tailor responses to be relevant to the programming language, framework, or tools like Eclipse Theia.
|
|
40
|
+
- Ask clarifying questions if necessary to provide accurate assistance.
|
|
41
|
+
|
|
42
|
+
2. **Provide Clear Solutions:**
|
|
43
|
+
- Offer direct answers or code snippets that solve the problem or clarify the concept.
|
|
44
|
+
- Avoid lengthy explanations unless necessary for understanding.
|
|
45
|
+
|
|
46
|
+
3. **Promote Best Practices:**
|
|
47
|
+
- Suggest best practices and common patterns relevant to the question.
|
|
48
|
+
- Provide links to official documentation for further reading when applicable.
|
|
49
|
+
|
|
50
|
+
4. **Support Multiple Languages and Tools:**
|
|
51
|
+
- Be familiar with popular programming languages, frameworks, IDEs like Eclipse Theia, and command-line tools.
|
|
52
|
+
- Adapt advice based on the language, environment, or tools specified by the developer.
|
|
53
|
+
|
|
54
|
+
5. **Facilitate Learning:**
|
|
55
|
+
- Encourage learning by explaining why a solution works or why a particular approach is recommended.
|
|
56
|
+
- Keep explanations concise and educational.
|
|
57
|
+
|
|
58
|
+
6. **Maintain Professional Tone:**
|
|
59
|
+
- Communicate in a friendly, professional manner.
|
|
60
|
+
- Use technical jargon appropriately, ensuring clarity for the target audience.
|
|
61
|
+
|
|
62
|
+
7. **Stay on Topic:**
|
|
63
|
+
- Limit responses strictly to topics related to software development, frameworks, Eclipse Theia, terminal usage, and relevant technologies.
|
|
64
|
+
- Politely decline to answer questions unrelated to these areas by saying, "I'm here to assist with programming-related questions.
|
|
65
|
+
For other topics, please refer to a specialized source."
|
|
66
|
+
|
|
67
|
+
### Example Interactions
|
|
68
|
+
|
|
69
|
+
- **Question:** "What's the difference between \`let\` and \`var\` in JavaScript?"
|
|
70
|
+
**Answer:** "\`let\` is block-scoped, while \`var\` is function-scoped. Prefer \`let\` to avoid scope-related bugs."
|
|
71
|
+
|
|
72
|
+
- **Question:** "How do I handle exceptions in Java?"
|
|
73
|
+
**Answer:** "Use try-catch blocks: \`\`\`java try { /* code */ } catch (ExceptionType e) { /* handle exception */ }\`\`\`."
|
|
74
|
+
|
|
75
|
+
- **Question:** "What is the capital of France?"
|
|
76
|
+
**Answer:** "I'm here to assist with programming-related queries. For other topics, please refer to a specialized source."
|
|
77
|
+
`
|
|
78
|
+
};
|
|
79
|
+
exports.universalTemplateVariant = {
|
|
80
|
+
id: 'universal-system-empty',
|
|
81
|
+
template: '',
|
|
82
|
+
variantOf: exports.universalTemplate.id,
|
|
83
|
+
};
|
|
84
|
+
exports.UniversalChatAgentId = 'Universal';
|
|
85
|
+
let UniversalChatAgent = class UniversalChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
|
|
86
|
+
constructor() {
|
|
87
|
+
super(...arguments);
|
|
88
|
+
this.id = exports.UniversalChatAgentId;
|
|
89
|
+
this.name = exports.UniversalChatAgentId;
|
|
90
|
+
this.languageModelRequirements = [{
|
|
91
|
+
purpose: 'chat',
|
|
92
|
+
identifier: 'openai/gpt-4o',
|
|
93
|
+
}];
|
|
94
|
+
this.defaultLanguageModelPurpose = 'chat';
|
|
95
|
+
this.description = core_1.nls.localize('theia/ai/chat/universal/description', 'This agent is designed to help software developers by providing concise and accurate '
|
|
96
|
+
+ 'answers to general programming and software development questions. It is also the fall-back for any generic '
|
|
97
|
+
+ 'questions the user might ask. The universal agent currently does not have any context by default, i.e. it cannot '
|
|
98
|
+
+ 'access the current user context or the workspace.');
|
|
99
|
+
this.promptTemplates = [exports.universalTemplate, exports.universalTemplateVariant];
|
|
100
|
+
this.systemPromptId = exports.universalTemplate.id;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
exports.UniversalChatAgent = UniversalChatAgent;
|
|
104
|
+
exports.UniversalChatAgent = UniversalChatAgent = tslib_1.__decorate([
|
|
105
|
+
(0, inversify_1.injectable)()
|
|
106
|
+
], UniversalChatAgent);
|
|
107
|
+
//# sourceMappingURL=universal-chat-agent.js.map
|
|
@@ -0,0 +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;AAErB,QAAA,iBAAiB,GAAmB;IAC9C,EAAE,EAAE,kBAAkB;IACtB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDZ;CACA,CAAC;AAEW,QAAA,wBAAwB,GAAmB;IACrD,EAAE,EAAE,wBAAwB;IAC5B,QAAQ,EAAE,EAAE;IACZ,SAAS,EAAE,yBAAiB,CAAC,EAAE;CACjC,CAAC;AAEW,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,oBAAe,GAAG,CAAC,yBAAiB,EAAE,gCAAwB,CAAC,CAAC;QACtD,mBAAc,GAAW,yBAAiB,CAAC,EAAE,CAAC;IACpE,CAAC;CAAA,CAAA;AAfY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAe9B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const FILE_CONTENT_FUNCTION_ID = "getFileContent";
|
|
2
|
+
export declare const GET_WORKSPACE_FILE_LIST_FUNCTION_ID = "getWorkspaceFileList";
|
|
3
|
+
export declare const GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID = "getWorkspaceDirectoryStructure";
|
|
4
|
+
//# sourceMappingURL=workspace-functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-functions.d.ts","sourceRoot":"","sources":["../../src/common/workspace-functions.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,mCAAmC,yBAAyB,CAAC;AAC1E,eAAO,MAAM,6CAA6C,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID = exports.GET_WORKSPACE_FILE_LIST_FUNCTION_ID = exports.FILE_CONTENT_FUNCTION_ID = void 0;
|
|
4
|
+
// *****************************************************************************
|
|
5
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
6
|
+
//
|
|
7
|
+
// This program and the accompanying materials are made available under the
|
|
8
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
+
//
|
|
11
|
+
// This Source Code may also be made available under the following Secondary
|
|
12
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
+
// with the GNU Classpath Exception which is available at
|
|
15
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
16
|
+
//
|
|
17
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
18
|
+
// *****************************************************************************
|
|
19
|
+
exports.FILE_CONTENT_FUNCTION_ID = 'getFileContent';
|
|
20
|
+
exports.GET_WORKSPACE_FILE_LIST_FUNCTION_ID = 'getWorkspaceFileList';
|
|
21
|
+
exports.GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID = 'getWorkspaceDirectoryStructure';
|
|
22
|
+
//# sourceMappingURL=workspace-functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-functions.js","sourceRoot":"","sources":["../../src/common/workspace-functions.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;AACnE,QAAA,wBAAwB,GAAG,gBAAgB,CAAC;AAC5C,QAAA,mCAAmC,GAAG,sBAAsB,CAAC;AAC7D,QAAA,6CAA6C,GAAG,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=package.spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 EclipseSource GmbH and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
/* note: this bogus test file is required so that
|
|
17
|
+
we are able to run mocha unit tests on this
|
|
18
|
+
package, without having any actual unit tests in it.
|
|
19
|
+
This way a coverage report will be generated,
|
|
20
|
+
showing 0% coverage, instead of no report.
|
|
21
|
+
This file can be removed once we have real unit
|
|
22
|
+
tests in place. */
|
|
23
|
+
describe('ai-ide-agents package', () => {
|
|
24
|
+
it('support code coverage statistics', () => true);
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=package.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,oDAAoD;AACpD,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;;;;;;qBAMqB;AAErB,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IAEnC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@theia/ai-ide",
|
|
3
|
+
"version": "1.59.0-next.62+9e43c93ad",
|
|
4
|
+
"description": "AI IDE Agents Extension",
|
|
5
|
+
"license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/eclipse-theia/theia.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/eclipse-theia/theia/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/eclipse-theia/theia",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"theia-extension"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@theia/ai-chat": "1.59.0-next.62+9e43c93ad",
|
|
19
|
+
"@theia/ai-core": "1.59.0-next.62+9e43c93ad",
|
|
20
|
+
"@theia/core": "1.59.0-next.62+9e43c93ad",
|
|
21
|
+
"@theia/filesystem": "1.59.0-next.62+9e43c93ad",
|
|
22
|
+
"@theia/monaco": "1.59.0-next.62+9e43c93ad",
|
|
23
|
+
"@theia/navigator": "1.59.0-next.62+9e43c93ad",
|
|
24
|
+
"@theia/terminal": "1.59.0-next.62+9e43c93ad",
|
|
25
|
+
"@theia/workspace": "1.59.0-next.62+9e43c93ad",
|
|
26
|
+
"ignore": "^6.0.0",
|
|
27
|
+
"minimatch": "^9.0.0"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@theia/cli": "1.59.0-next.62+9e43c93ad",
|
|
34
|
+
"@theia/test": "1.59.0-next.62+9e43c93ad"
|
|
35
|
+
},
|
|
36
|
+
"theiaExtensions": [
|
|
37
|
+
{
|
|
38
|
+
"frontend": "lib/browser/frontend-module"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"files": [
|
|
42
|
+
"lib",
|
|
43
|
+
"src"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "theiaext build",
|
|
47
|
+
"clean": "theiaext clean",
|
|
48
|
+
"compile": "theiaext compile",
|
|
49
|
+
"lint": "theiaext lint",
|
|
50
|
+
"test": "theiaext test",
|
|
51
|
+
"watch": "theiaext watch"
|
|
52
|
+
},
|
|
53
|
+
"nyc": {
|
|
54
|
+
"extends": "../../configs/nyc.json"
|
|
55
|
+
},
|
|
56
|
+
"gitHead": "9e43c93ad61ea977db3974207bac5d7c1fd3ccd6"
|
|
57
|
+
}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
Agent,
|
|
19
|
+
AgentService,
|
|
20
|
+
AISettingsService,
|
|
21
|
+
AIVariableService,
|
|
22
|
+
LanguageModel,
|
|
23
|
+
LanguageModelRegistry,
|
|
24
|
+
matchVariablesRegEx,
|
|
25
|
+
PROMPT_FUNCTION_REGEX,
|
|
26
|
+
PromptCustomizationService,
|
|
27
|
+
PromptService,
|
|
28
|
+
} from '@theia/ai-core/lib/common';
|
|
29
|
+
import { codicon, ReactWidget } from '@theia/core/lib/browser';
|
|
30
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
31
|
+
import * as React from '@theia/core/shared/react';
|
|
32
|
+
import { AIConfigurationSelectionService } from './ai-configuration-service';
|
|
33
|
+
import { LanguageModelRenderer } from './language-model-renderer';
|
|
34
|
+
import { TemplateRenderer } from './template-settings-renderer';
|
|
35
|
+
import { AIVariableConfigurationWidget } from './variable-configuration-widget';
|
|
36
|
+
import { nls } from '@theia/core';
|
|
37
|
+
|
|
38
|
+
interface ParsedPrompt {
|
|
39
|
+
functions: string[];
|
|
40
|
+
globalVariables: string[];
|
|
41
|
+
agentSpecificVariables: string[];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
@injectable()
|
|
45
|
+
export class AIAgentConfigurationWidget extends ReactWidget {
|
|
46
|
+
|
|
47
|
+
static readonly ID = 'ai-agent-configuration-container-widget';
|
|
48
|
+
static readonly LABEL = nls.localize('theia/ai/core/agentConfiguration/label', 'Agents');
|
|
49
|
+
|
|
50
|
+
@inject(AgentService)
|
|
51
|
+
protected readonly agentService: AgentService;
|
|
52
|
+
|
|
53
|
+
@inject(LanguageModelRegistry)
|
|
54
|
+
protected readonly languageModelRegistry: LanguageModelRegistry;
|
|
55
|
+
|
|
56
|
+
@inject(PromptCustomizationService)
|
|
57
|
+
protected readonly promptCustomizationService: PromptCustomizationService;
|
|
58
|
+
|
|
59
|
+
@inject(AISettingsService)
|
|
60
|
+
protected readonly aiSettingsService: AISettingsService;
|
|
61
|
+
|
|
62
|
+
@inject(AIConfigurationSelectionService)
|
|
63
|
+
protected readonly aiConfigurationSelectionService: AIConfigurationSelectionService;
|
|
64
|
+
|
|
65
|
+
@inject(AIVariableService)
|
|
66
|
+
protected readonly variableService: AIVariableService;
|
|
67
|
+
|
|
68
|
+
@inject(PromptService)
|
|
69
|
+
protected promptService: PromptService;
|
|
70
|
+
|
|
71
|
+
protected languageModels: LanguageModel[] | undefined;
|
|
72
|
+
|
|
73
|
+
@postConstruct()
|
|
74
|
+
protected init(): void {
|
|
75
|
+
this.id = AIAgentConfigurationWidget.ID;
|
|
76
|
+
this.title.label = AIAgentConfigurationWidget.LABEL;
|
|
77
|
+
this.title.closable = false;
|
|
78
|
+
|
|
79
|
+
this.languageModelRegistry.getLanguageModels().then(models => {
|
|
80
|
+
this.languageModels = models ?? [];
|
|
81
|
+
this.update();
|
|
82
|
+
});
|
|
83
|
+
this.toDispose.push(this.languageModelRegistry.onChange(({ models }) => {
|
|
84
|
+
this.languageModels = models;
|
|
85
|
+
this.update();
|
|
86
|
+
}));
|
|
87
|
+
this.toDispose.push(this.promptCustomizationService.onDidChangePrompt(() => this.update()));
|
|
88
|
+
|
|
89
|
+
this.aiSettingsService.onDidChange(() => this.update());
|
|
90
|
+
this.aiConfigurationSelectionService.onDidAgentChange(() => this.update());
|
|
91
|
+
this.agentService.onDidChangeAgents(() => this.update());
|
|
92
|
+
this.update();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
protected render(): React.ReactNode {
|
|
96
|
+
return <div className='ai-agent-configuration-main'>
|
|
97
|
+
<div className='configuration-agents-list preferences-tree-widget theia-TreeContainer' style={{ width: '25%' }}>
|
|
98
|
+
<ul>
|
|
99
|
+
{this.agentService.getAllAgents().map(agent =>
|
|
100
|
+
<li key={agent.id} className='theia-TreeNode theia-CompositeTreeNode theia-ExpandableTreeNode' onClick={() => this.setActiveAgent(agent)}>
|
|
101
|
+
{this.renderAgentName(agent)}
|
|
102
|
+
</li>
|
|
103
|
+
)}
|
|
104
|
+
</ul>
|
|
105
|
+
<div className='configuration-agents-add'>
|
|
106
|
+
<button
|
|
107
|
+
style={{ marginLeft: 0 }}
|
|
108
|
+
className='theia-button main'
|
|
109
|
+
onClick={() => this.addCustomAgent()}>
|
|
110
|
+
{nls.localize('theia/ai/core/agentConfiguration/addCustomAgent', 'Add Custom Agent')}
|
|
111
|
+
</button>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
<div className='configuration-agent-panel preferences-editor-widget'>
|
|
115
|
+
{this.renderAgentDetails()}
|
|
116
|
+
</div>
|
|
117
|
+
</div>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private renderAgentName(agent: Agent): React.ReactNode {
|
|
121
|
+
const tagsSuffix = agent.tags?.length ? <span>{agent.tags.map(tag => <span key={tag} className='agent-tag'>{tag}</span>)}</span> : '';
|
|
122
|
+
return <span>{agent.name} {tagsSuffix}</span>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private renderAgentDetails(): React.ReactNode {
|
|
126
|
+
const agent = this.aiConfigurationSelectionService.getActiveAgent();
|
|
127
|
+
if (!agent) {
|
|
128
|
+
return <div>{nls.localize('theia/ai/core/agentConfiguration/selectAgentMessage', 'Please select an Agent first!')}</div>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const enabled = this.agentService.isEnabled(agent.id);
|
|
132
|
+
|
|
133
|
+
const parsedPromptParts = this.parsePromptTemplatesForVariableAndFunction(agent);
|
|
134
|
+
const globalVariables = Array.from(new Set([...parsedPromptParts.globalVariables, ...agent.variables]));
|
|
135
|
+
const functions = Array.from(new Set([...parsedPromptParts.functions, ...agent.functions]));
|
|
136
|
+
|
|
137
|
+
return <div key={agent.id} style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
|
|
138
|
+
<div className='settings-section-title settings-section-category-title' style={{ paddingLeft: 0, paddingBottom: 10 }}>{this.renderAgentName(agent)}</div>
|
|
139
|
+
<div style={{ paddingBottom: 10 }}>{agent.description}</div>
|
|
140
|
+
<div style={{ paddingBottom: 10 }}>
|
|
141
|
+
<label>
|
|
142
|
+
<input type="checkbox" checked={enabled} onChange={this.toggleAgentEnabled} />
|
|
143
|
+
{nls.localize('theia/ai/core/agentConfiguration/enableAgent', 'Enable Agent')}
|
|
144
|
+
</label>
|
|
145
|
+
</div>
|
|
146
|
+
<div className="settings-section-subcategory-title ai-settings-section-subcategory-title">
|
|
147
|
+
{nls.localize('theia/ai/core/agentConfiguration/promptTemplates', 'Prompt Templates')}
|
|
148
|
+
</div>
|
|
149
|
+
<div className="ai-templates">
|
|
150
|
+
{(() => {
|
|
151
|
+
const defaultTemplates = agent.promptTemplates?.filter(template => !template.variantOf) || [];
|
|
152
|
+
return defaultTemplates.length > 0 ? (
|
|
153
|
+
defaultTemplates.map(template => (
|
|
154
|
+
<div key={agent.id + '.' + template.id}>
|
|
155
|
+
<TemplateRenderer
|
|
156
|
+
key={agent.id + '.' + template.id}
|
|
157
|
+
agentId={agent.id}
|
|
158
|
+
template={template}
|
|
159
|
+
promptService={this.promptService}
|
|
160
|
+
aiSettingsService={this.aiSettingsService}
|
|
161
|
+
promptCustomizationService={this.promptCustomizationService}
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
164
|
+
))
|
|
165
|
+
) : (
|
|
166
|
+
<div>{nls.localize('theia/ai/core/agentConfiguration/noDefaultTemplate', 'No default template available')}</div>
|
|
167
|
+
);
|
|
168
|
+
})()}
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div className='ai-lm-requirements'>
|
|
172
|
+
<LanguageModelRenderer
|
|
173
|
+
agent={agent}
|
|
174
|
+
languageModels={this.languageModels}
|
|
175
|
+
aiSettingsService={this.aiSettingsService}
|
|
176
|
+
languageModelRegistry={this.languageModelRegistry} />
|
|
177
|
+
</div>
|
|
178
|
+
<div>
|
|
179
|
+
<span>Used Global Variables:</span>
|
|
180
|
+
<ul className='variable-references'>
|
|
181
|
+
<AgentGlobalVariables variables={globalVariables} showVariableConfigurationTab={this.showVariableConfigurationTab.bind(this)} />
|
|
182
|
+
</ul>
|
|
183
|
+
</div>
|
|
184
|
+
<div>
|
|
185
|
+
<span>Used agent-specific Variables:</span>
|
|
186
|
+
<ul className='variable-references'>
|
|
187
|
+
<AgentSpecificVariables
|
|
188
|
+
promptVariables={parsedPromptParts.agentSpecificVariables}
|
|
189
|
+
agent={agent}
|
|
190
|
+
/>
|
|
191
|
+
</ul>
|
|
192
|
+
</div>
|
|
193
|
+
<div>
|
|
194
|
+
<span>Used Functions:</span>
|
|
195
|
+
<ul className='function-references'>
|
|
196
|
+
<AgentFunctions functions={functions} />
|
|
197
|
+
</ul>
|
|
198
|
+
</div>
|
|
199
|
+
</div>;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
private parsePromptTemplatesForVariableAndFunction(agent: Agent): ParsedPrompt {
|
|
203
|
+
const promptTemplates = agent.promptTemplates;
|
|
204
|
+
const result: ParsedPrompt = { functions: [], globalVariables: [], agentSpecificVariables: [] };
|
|
205
|
+
promptTemplates.forEach(template => {
|
|
206
|
+
const storedPrompt = this.promptService.getUnresolvedPrompt(template.id);
|
|
207
|
+
const prompt = storedPrompt?.template ?? template.template;
|
|
208
|
+
const variableMatches = matchVariablesRegEx(prompt);
|
|
209
|
+
|
|
210
|
+
variableMatches.forEach(match => {
|
|
211
|
+
const variableId = match[1];
|
|
212
|
+
// if the variable is part of the variable service and not part of the agent specific variables then it is a global variable
|
|
213
|
+
if (this.variableService.hasVariable(variableId) &&
|
|
214
|
+
agent.agentSpecificVariables.find(v => v.name === variableId) === undefined) {
|
|
215
|
+
result.globalVariables.push(variableId);
|
|
216
|
+
} else {
|
|
217
|
+
result.agentSpecificVariables.push(variableId);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const functionMatches = [...prompt.matchAll(PROMPT_FUNCTION_REGEX)];
|
|
222
|
+
functionMatches.forEach(match => {
|
|
223
|
+
const functionId = match[1];
|
|
224
|
+
result.functions.push(functionId);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
});
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
protected showVariableConfigurationTab(): void {
|
|
232
|
+
this.aiConfigurationSelectionService.selectConfigurationTab(AIVariableConfigurationWidget.ID);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
protected addCustomAgent(): void {
|
|
236
|
+
this.promptCustomizationService.openCustomAgentYaml();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
protected setActiveAgent(agent: Agent): void {
|
|
240
|
+
this.aiConfigurationSelectionService.setActiveAgent(agent);
|
|
241
|
+
this.update();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
private toggleAgentEnabled = () => {
|
|
245
|
+
const agent = this.aiConfigurationSelectionService.getActiveAgent();
|
|
246
|
+
if (!agent) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
const enabled = this.agentService.isEnabled(agent.id);
|
|
250
|
+
if (enabled) {
|
|
251
|
+
this.agentService.disableAgent(agent.id);
|
|
252
|
+
} else {
|
|
253
|
+
this.agentService.enableAgent(agent.id);
|
|
254
|
+
}
|
|
255
|
+
this.update();
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
}
|
|
259
|
+
interface AgentGlobalVariablesProps {
|
|
260
|
+
variables: string[];
|
|
261
|
+
showVariableConfigurationTab: () => void;
|
|
262
|
+
}
|
|
263
|
+
const AgentGlobalVariables = ({ variables: globalVariables, showVariableConfigurationTab }: AgentGlobalVariablesProps) => {
|
|
264
|
+
if (globalVariables.length === 0) {
|
|
265
|
+
return <>{nls.localizeByDefault('None')}</>;
|
|
266
|
+
}
|
|
267
|
+
return <>
|
|
268
|
+
{globalVariables.map(variableId => <li key={variableId} className='theia-TreeNode theia-CompositeTreeNode theia-ExpandableTreeNode theia-mod-selected'>
|
|
269
|
+
<div key={variableId} onClick={() => { showVariableConfigurationTab(); }} className='variable-reference'>
|
|
270
|
+
<span>{variableId}</span>
|
|
271
|
+
<i className={codicon('chevron-right')}></i>
|
|
272
|
+
</div></li>)}
|
|
273
|
+
|
|
274
|
+
</>;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
interface AgentFunctionsProps {
|
|
278
|
+
functions: string[];
|
|
279
|
+
}
|
|
280
|
+
const AgentFunctions = ({ functions }: AgentFunctionsProps) => {
|
|
281
|
+
if (functions.length === 0) {
|
|
282
|
+
return <>{nls.localizeByDefault('None')}</>;
|
|
283
|
+
}
|
|
284
|
+
return <>
|
|
285
|
+
{functions.map(functionId => <li key={functionId} className='variable-reference'>
|
|
286
|
+
<span>{functionId}</span>
|
|
287
|
+
</li>)}
|
|
288
|
+
</>;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
interface AgentSpecificVariablesProps {
|
|
292
|
+
promptVariables: string[];
|
|
293
|
+
agent: Agent;
|
|
294
|
+
}
|
|
295
|
+
const AgentSpecificVariables = ({ promptVariables, agent }: AgentSpecificVariablesProps) => {
|
|
296
|
+
const agentDefinedVariablesName = agent.agentSpecificVariables.map(v => v.name);
|
|
297
|
+
const variables = Array.from(new Set([...promptVariables, ...agentDefinedVariablesName]));
|
|
298
|
+
if (variables.length === 0) {
|
|
299
|
+
return <>{nls.localizeByDefault('None')}</>;
|
|
300
|
+
}
|
|
301
|
+
return <>
|
|
302
|
+
{variables.map(variableId =>
|
|
303
|
+
<AgentSpecifcVariable
|
|
304
|
+
key={variableId}
|
|
305
|
+
variableId={variableId}
|
|
306
|
+
agent={agent}
|
|
307
|
+
promptVariables={promptVariables} />
|
|
308
|
+
|
|
309
|
+
)}
|
|
310
|
+
</>;
|
|
311
|
+
};
|
|
312
|
+
interface AgentSpecifcVariableProps {
|
|
313
|
+
variableId: string;
|
|
314
|
+
agent: Agent;
|
|
315
|
+
promptVariables: string[];
|
|
316
|
+
}
|
|
317
|
+
const AgentSpecifcVariable = ({ variableId, agent, promptVariables }: AgentSpecifcVariableProps) => {
|
|
318
|
+
const agentDefinedVariable = agent.agentSpecificVariables.find(v => v.name === variableId);
|
|
319
|
+
const undeclared = agentDefinedVariable === undefined;
|
|
320
|
+
const notUsed = !promptVariables.includes(variableId) && agentDefinedVariable?.usedInPrompt === true;
|
|
321
|
+
return <li key={variableId}>
|
|
322
|
+
<div><span>{nls.localize('theia/ai/core/agentConfiguration/name', 'Name:')}</span> <span>{variableId}</span></div>
|
|
323
|
+
{undeclared ? <div><span>{nls.localize('theia/ai/core/agentConfiguration/undeclared', 'Undeclared')}</span></div> :
|
|
324
|
+
(<>
|
|
325
|
+
<div><span>{nls.localize('theia/ai/core/agentConfiguration/description', 'Description:')}</span> <span>{agentDefinedVariable.description}</span></div>
|
|
326
|
+
{notUsed && <div>{nls.localize('theia/ai/core/agentConfiguration/notUsedInPrompt', 'Not used in prompt')}</div>}
|
|
327
|
+
</>)}
|
|
328
|
+
<hr />
|
|
329
|
+
</li>;
|
|
330
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { Agent } from '@theia/ai-core/lib/common';
|
|
18
|
+
import { Emitter } from '@theia/core';
|
|
19
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
export class AIConfigurationSelectionService {
|
|
23
|
+
protected activeAgent?: Agent;
|
|
24
|
+
|
|
25
|
+
protected readonly onDidSelectConfigurationEmitter = new Emitter<string>();
|
|
26
|
+
onDidSelectConfiguration = this.onDidSelectConfigurationEmitter.event;
|
|
27
|
+
|
|
28
|
+
protected readonly onDidAgentChangeEmitter = new Emitter<Agent | undefined>();
|
|
29
|
+
onDidAgentChange = this.onDidSelectConfigurationEmitter.event;
|
|
30
|
+
|
|
31
|
+
public getActiveAgent(): Agent | undefined {
|
|
32
|
+
return this.activeAgent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public setActiveAgent(agent?: Agent): void {
|
|
36
|
+
this.activeAgent = agent;
|
|
37
|
+
this.onDidAgentChangeEmitter.fire(agent);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public selectConfigurationTab(widgetId: string): void {
|
|
41
|
+
this.onDidSelectConfigurationEmitter.fire(widgetId);
|
|
42
|
+
}
|
|
43
|
+
}
|