@theia/ai-chat 1.46.0-next.241
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 +31 -0
- package/lib/browser/ai-chat-frontend-module.d.ts +4 -0
- package/lib/browser/ai-chat-frontend-module.d.ts.map +1 -0
- package/lib/browser/ai-chat-frontend-module.js +79 -0
- package/lib/browser/ai-chat-frontend-module.js.map +1 -0
- package/lib/browser/ai-chat-preferences.d.ts +4 -0
- package/lib/browser/ai-chat-preferences.d.ts.map +1 -0
- package/lib/browser/ai-chat-preferences.js +32 -0
- package/lib/browser/ai-chat-preferences.js.map +1 -0
- package/lib/browser/custom-agent-factory.d.ts +4 -0
- package/lib/browser/custom-agent-factory.d.ts.map +1 -0
- package/lib/browser/custom-agent-factory.js +20 -0
- package/lib/browser/custom-agent-factory.js.map +1 -0
- package/lib/browser/custom-agent-frontend-application-contribution.d.ts +13 -0
- package/lib/browser/custom-agent-frontend-application-contribution.d.ts.map +1 -0
- package/lib/browser/custom-agent-frontend-application-contribution.js +82 -0
- package/lib/browser/custom-agent-frontend-application-contribution.js.map +1 -0
- package/lib/browser/frontend-chat-service.d.ts +8 -0
- package/lib/browser/frontend-chat-service.d.ts.map +1 -0
- package/lib/browser/frontend-chat-service.js +67 -0
- package/lib/browser/frontend-chat-service.js.map +1 -0
- package/lib/common/chat-agent-service.d.ts +45 -0
- package/lib/common/chat-agent-service.d.ts.map +1 -0
- package/lib/common/chat-agent-service.js +78 -0
- package/lib/common/chat-agent-service.js.map +1 -0
- package/lib/common/chat-agents-variable-contribution.d.ts +17 -0
- package/lib/common/chat-agents-variable-contribution.d.ts.map +1 -0
- package/lib/common/chat-agents-variable-contribution.js +51 -0
- package/lib/common/chat-agents-variable-contribution.js.map +1 -0
- package/lib/common/chat-agents.d.ts +108 -0
- package/lib/common/chat-agents.d.ts.map +1 -0
- package/lib/common/chat-agents.js +321 -0
- package/lib/common/chat-agents.js.map +1 -0
- package/lib/common/chat-history-entry.d.ts +7 -0
- package/lib/common/chat-history-entry.d.ts.map +1 -0
- package/lib/common/chat-history-entry.js +42 -0
- package/lib/common/chat-history-entry.js.map +1 -0
- package/lib/common/chat-model-util.d.ts +7 -0
- package/lib/common/chat-model-util.d.ts.map +1 -0
- package/lib/common/chat-model-util.js +50 -0
- package/lib/common/chat-model-util.js.map +1 -0
- package/lib/common/chat-model.d.ts +393 -0
- package/lib/common/chat-model.d.ts.map +1 -0
- package/lib/common/chat-model.js +612 -0
- package/lib/common/chat-model.js.map +1 -0
- package/lib/common/chat-request-parser.d.ts +20 -0
- package/lib/common/chat-request-parser.d.ts.map +1 -0
- package/lib/common/chat-request-parser.js +158 -0
- package/lib/common/chat-request-parser.js.map +1 -0
- package/lib/common/chat-request-parser.spec.d.ts +2 -0
- package/lib/common/chat-request-parser.spec.d.ts.map +1 -0
- package/lib/common/chat-request-parser.spec.js +108 -0
- package/lib/common/chat-request-parser.spec.js.map +1 -0
- package/lib/common/chat-service.d.ts +72 -0
- package/lib/common/chat-service.d.ts.map +1 -0
- package/lib/common/chat-service.js +170 -0
- package/lib/common/chat-service.js.map +1 -0
- package/lib/common/command-chat-agents.d.ts +33 -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/custom-chat-agent.d.ts +14 -0
- package/lib/common/custom-chat-agent.d.ts.map +1 -0
- package/lib/common/custom-chat-agent.js +43 -0
- package/lib/common/custom-chat-agent.js.map +1 -0
- package/lib/common/index.d.ts +12 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +30 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/o1-chat-agent.d.ts +13 -0
- package/lib/common/o1-chat-agent.d.ts.map +1 -0
- package/lib/common/o1-chat-agent.js +45 -0
- package/lib/common/o1-chat-agent.js.map +1 -0
- package/lib/common/orchestrator-chat-agent.d.ts +22 -0
- package/lib/common/orchestrator-chat-agent.d.ts.map +1 -0
- package/lib/common/orchestrator-chat-agent.js +167 -0
- package/lib/common/orchestrator-chat-agent.js.map +1 -0
- package/lib/common/parse-contents.d.ts +11 -0
- package/lib/common/parse-contents.d.ts.map +1 -0
- package/lib/common/parse-contents.js +67 -0
- package/lib/common/parse-contents.js.map +1 -0
- package/lib/common/parse-contents.spec.d.ts +9 -0
- package/lib/common/parse-contents.spec.d.ts.map +1 -0
- package/lib/common/parse-contents.spec.js +134 -0
- package/lib/common/parse-contents.spec.js.map +1 -0
- package/lib/common/parsed-chat-request.d.ts +66 -0
- package/lib/common/parsed-chat-request.d.ts.map +1 -0
- package/lib/common/parsed-chat-request.js +83 -0
- package/lib/common/parsed-chat-request.js.map +1 -0
- package/lib/common/response-content-matcher.d.ts +63 -0
- package/lib/common/response-content-matcher.d.ts.map +1 -0
- package/lib/common/response-content-matcher.js +86 -0
- package/lib/common/response-content-matcher.js.map +1 -0
- package/lib/common/universal-chat-agent.d.ts +16 -0
- package/lib/common/universal-chat-agent.d.ts.map +1 -0
- package/lib/common/universal-chat-agent.js +109 -0
- package/lib/common/universal-chat-agent.js.map +1 -0
- package/package.json +54 -0
- package/src/browser/ai-chat-frontend-module.ts +98 -0
- package/src/browser/ai-chat-preferences.ts +32 -0
- package/src/browser/custom-agent-factory.ts +20 -0
- package/src/browser/custom-agent-frontend-application-contribution.ts +73 -0
- package/src/browser/frontend-chat-service.ts +66 -0
- package/src/common/chat-agent-service.ts +100 -0
- package/src/common/chat-agents-variable-contribution.ts +81 -0
- package/src/common/chat-agents.ts +392 -0
- package/src/common/chat-history-entry.ts +47 -0
- package/src/common/chat-model-util.ts +44 -0
- package/src/common/chat-model.ts +889 -0
- package/src/common/chat-request-parser.spec.ts +120 -0
- package/src/common/chat-request-parser.ts +220 -0
- package/src/common/chat-service.ts +236 -0
- package/src/common/command-chat-agents.ts +354 -0
- package/src/common/custom-chat-agent.ts +44 -0
- package/src/common/index.ts +26 -0
- package/src/common/o1-chat-agent.ts +51 -0
- package/src/common/orchestrator-chat-agent.ts +179 -0
- package/src/common/parse-contents.spec.ts +144 -0
- package/src/common/parse-contents.ts +93 -0
- package/src/common/parsed-chat-request.ts +112 -0
- package/src/common/response-content-matcher.ts +103 -0
- package/src/common/universal-chat-agent.ts +117 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<div align='center'>
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
+
|
|
7
|
+
<h2>ECLIPSE THEIA - AI Chat EXTENSION</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
|
|
15
|
+
The `@theia/ai-chat` extension provides the concept of a language model chat to Theia.
|
|
16
|
+
It serves as the basis for `@theia/ai-chat-ui` to provide the Chat UI.
|
|
17
|
+
|
|
18
|
+
## Additional Information
|
|
19
|
+
|
|
20
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
21
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
26
|
+
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
27
|
+
|
|
28
|
+
## Trademark
|
|
29
|
+
|
|
30
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
31
|
+
<https://www.eclipse.org/theia>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-chat-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/ai-chat-frontend-module.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAsB/D,wBAwDG"}
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
const common_1 = require("@theia/ai-core/lib/common");
|
|
19
|
+
const core_1 = require("@theia/core");
|
|
20
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
const common_2 = require("../common");
|
|
23
|
+
const chat_agents_variable_contribution_1 = require("../common/chat-agents-variable-contribution");
|
|
24
|
+
const command_chat_agents_1 = require("../common/command-chat-agents");
|
|
25
|
+
const custom_chat_agent_1 = require("../common/custom-chat-agent");
|
|
26
|
+
const orchestrator_chat_agent_1 = require("../common/orchestrator-chat-agent");
|
|
27
|
+
const response_content_matcher_1 = require("../common/response-content-matcher");
|
|
28
|
+
const universal_chat_agent_1 = require("../common/universal-chat-agent");
|
|
29
|
+
const ai_chat_preferences_1 = require("./ai-chat-preferences");
|
|
30
|
+
const custom_agent_frontend_application_contribution_1 = require("./custom-agent-frontend-application-contribution");
|
|
31
|
+
const frontend_chat_service_1 = require("./frontend-chat-service");
|
|
32
|
+
const custom_agent_factory_1 = require("./custom-agent-factory");
|
|
33
|
+
const o1_chat_agent_1 = require("../common/o1-chat-agent");
|
|
34
|
+
exports.default = new inversify_1.ContainerModule(bind => {
|
|
35
|
+
(0, core_1.bindContributionProvider)(bind, common_1.Agent);
|
|
36
|
+
(0, core_1.bindContributionProvider)(bind, common_2.ChatAgent);
|
|
37
|
+
bind(common_2.ChatAgentServiceImpl).toSelf().inSingletonScope();
|
|
38
|
+
bind(common_2.ChatAgentService).toService(common_2.ChatAgentServiceImpl);
|
|
39
|
+
bind(common_2.DefaultChatAgentId).toConstantValue({ id: orchestrator_chat_agent_1.OrchestratorChatAgentId });
|
|
40
|
+
(0, core_1.bindContributionProvider)(bind, response_content_matcher_1.ResponseContentMatcherProvider);
|
|
41
|
+
bind(response_content_matcher_1.DefaultResponseContentMatcherProvider).toSelf().inSingletonScope();
|
|
42
|
+
bind(response_content_matcher_1.ResponseContentMatcherProvider).toService(response_content_matcher_1.DefaultResponseContentMatcherProvider);
|
|
43
|
+
bind(response_content_matcher_1.DefaultResponseContentFactory).toSelf().inSingletonScope();
|
|
44
|
+
bind(common_1.AIVariableContribution).to(chat_agents_variable_contribution_1.ChatAgentsVariableContribution).inSingletonScope();
|
|
45
|
+
bind(common_2.ChatRequestParserImpl).toSelf().inSingletonScope();
|
|
46
|
+
bind(common_2.ChatRequestParser).toService(common_2.ChatRequestParserImpl);
|
|
47
|
+
bind(frontend_chat_service_1.FrontendChatServiceImpl).toSelf().inSingletonScope();
|
|
48
|
+
bind(common_2.ChatService).toService(frontend_chat_service_1.FrontendChatServiceImpl);
|
|
49
|
+
bind(orchestrator_chat_agent_1.OrchestratorChatAgent).toSelf().inSingletonScope();
|
|
50
|
+
bind(common_1.Agent).toService(orchestrator_chat_agent_1.OrchestratorChatAgent);
|
|
51
|
+
bind(common_2.ChatAgent).toService(orchestrator_chat_agent_1.OrchestratorChatAgent);
|
|
52
|
+
bind(o1_chat_agent_1.O1ChatAgent).toSelf().inSingletonScope();
|
|
53
|
+
bind(common_1.Agent).toService(o1_chat_agent_1.O1ChatAgent);
|
|
54
|
+
bind(common_2.ChatAgent).toService(o1_chat_agent_1.O1ChatAgent);
|
|
55
|
+
bind(universal_chat_agent_1.UniversalChatAgent).toSelf().inSingletonScope();
|
|
56
|
+
bind(common_1.Agent).toService(universal_chat_agent_1.UniversalChatAgent);
|
|
57
|
+
bind(common_2.ChatAgent).toService(universal_chat_agent_1.UniversalChatAgent);
|
|
58
|
+
bind(command_chat_agents_1.CommandChatAgent).toSelf().inSingletonScope();
|
|
59
|
+
bind(common_1.Agent).toService(command_chat_agents_1.CommandChatAgent);
|
|
60
|
+
bind(common_2.ChatAgent).toService(command_chat_agents_1.CommandChatAgent);
|
|
61
|
+
bind(browser_1.PreferenceContribution).toConstantValue({ schema: ai_chat_preferences_1.aiChatPreferences });
|
|
62
|
+
bind(custom_chat_agent_1.CustomChatAgent).toSelf();
|
|
63
|
+
bind(custom_agent_factory_1.CustomAgentFactory).toFactory(ctx => (id, name, description, prompt, defaultLLM) => {
|
|
64
|
+
const agent = ctx.container.get(custom_chat_agent_1.CustomChatAgent);
|
|
65
|
+
agent.id = id;
|
|
66
|
+
agent.name = name;
|
|
67
|
+
agent.description = description;
|
|
68
|
+
agent.prompt = prompt;
|
|
69
|
+
agent.languageModelRequirements = [{
|
|
70
|
+
purpose: 'chat',
|
|
71
|
+
identifier: defaultLLM,
|
|
72
|
+
}];
|
|
73
|
+
ctx.container.get(common_2.ChatAgentService).registerChatAgent(agent);
|
|
74
|
+
ctx.container.get(common_1.AgentService).registerAgent(agent);
|
|
75
|
+
return agent;
|
|
76
|
+
});
|
|
77
|
+
bind(browser_1.FrontendApplicationContribution).to(custom_agent_frontend_application_contribution_1.AICustomAgentsFrontendApplicationContribution).inSingletonScope();
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=ai-chat-frontend-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-ch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C,CAAC;IAE5C,IAAI,CAAC,gCAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,uCAAiB,EAAE,CAAC,CAAC;IAE5E,IAAI,CAAC,mCAAe,CAAC,CAAC,MAAM,EAAE,CAAC;IAC/B,IAAI,CAAC,yCAAkB,CAAC,CAAC,SAAS,CAC9B,GAAG,CAAC,EAAE,CAAC,CAAC,EAAU,EAAE,IAAY,EAAE,WAAmB,EAAE,MAAc,EAAE,UAAkB,EAAE,EAAE;QACzF,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAkB,mCAAe,CAAC,CAAC;QAClE,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;QACd,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;QAChC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACtB,KAAK,CAAC,yBAAyB,GAAG,CAAC;gBAC/B,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,UAAU;aACzB,CAAC,CAAC;QACH,GAAG,CAAC,SAAS,CAAC,GAAG,CAAmB,yBAAgB,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC/E,GAAG,CAAC,SAAS,CAAC,GAAG,CAAe,qBAAY,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACnE,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;IACP,IAAI,CAAC,yCAA+B,CAAC,CAAC,EAAE,CAAC,8FAA6C,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAC/G,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution';
|
|
2
|
+
export declare const DEFAULT_CHAT_AGENT_PREF = "ai-features.chat.defaultChatAgent";
|
|
3
|
+
export declare const aiChatPreferences: PreferenceSchema;
|
|
4
|
+
//# sourceMappingURL=ai-chat-preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-chat-preferences.d.ts","sourceRoot":"","sources":["../../src/browser/ai-chat-preferences.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAE/F,eAAO,MAAM,uBAAuB,sCAAsC,CAAC;AAE3E,eAAO,MAAM,iBAAiB,EAAE,gBAU/B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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.aiChatPreferences = exports.DEFAULT_CHAT_AGENT_PREF = void 0;
|
|
19
|
+
const ai_core_preferences_1 = require("@theia/ai-core/lib/browser/ai-core-preferences");
|
|
20
|
+
exports.DEFAULT_CHAT_AGENT_PREF = 'ai-features.chat.defaultChatAgent';
|
|
21
|
+
exports.aiChatPreferences = {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
[exports.DEFAULT_CHAT_AGENT_PREF]: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'Optional: <agent-name> of the Chat Agent that shall be invoked, if no agent is explicitly mentioned with @<agent-name> in the user query.\
|
|
27
|
+
If no Default Agent is configured, Theia´s defaults will be applied.',
|
|
28
|
+
title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=ai-chat-preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-chat-preferences.js","sourceRoot":"","sources":["../../src/browser/ai-chat-preferences.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,wFAA2F;AAG9E,QAAA,uBAAuB,GAAG,mCAAmC,CAAC;AAE9D,QAAA,iBAAiB,GAAqB;IAC/C,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,CAAC,+BAAuB,CAAC,EAAE;YACvB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE;iFACwD;YACrE,KAAK,EAAE,+CAAyB;SACnC;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CustomChatAgent } from '../common';
|
|
2
|
+
export declare const CustomAgentFactory: unique symbol;
|
|
3
|
+
export type CustomAgentFactory = (id: string, name: string, description: string, prompt: string, defaultLLM: string) => CustomChatAgent;
|
|
4
|
+
//# sourceMappingURL=custom-agent-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-agent-factory.d.ts","sourceRoot":"","sources":["../../src/browser/custom-agent-factory.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,eAAe,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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.CustomAgentFactory = void 0;
|
|
19
|
+
exports.CustomAgentFactory = Symbol('CustomAgentFactory');
|
|
20
|
+
//# sourceMappingURL=custom-agent-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-agent-factory.js","sourceRoot":"","sources":["../../src/browser/custom-agent-factory.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;;;AAInE,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PromptCustomizationService } from '@theia/ai-core';
|
|
2
|
+
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
3
|
+
import { CustomAgentFactory } from './custom-agent-factory';
|
|
4
|
+
export declare class AICustomAgentsFrontendApplicationContribution implements FrontendApplicationContribution {
|
|
5
|
+
protected readonly customAgentFactory: CustomAgentFactory;
|
|
6
|
+
protected readonly customizationService: PromptCustomizationService;
|
|
7
|
+
private readonly agentService;
|
|
8
|
+
private readonly chatAgentService;
|
|
9
|
+
private knownCustomAgents;
|
|
10
|
+
onStart(): void;
|
|
11
|
+
onStop(): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=custom-agent-frontend-application-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-agent-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/custom-agent-frontend-application-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAwC,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,qBACa,6CAA8C,YAAW,+BAA+B;IAEjG,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAG1D,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,0BAA0B,CAAC;IAGpE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAG5C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IAEpD,OAAO,CAAC,iBAAiB,CAAkD;IAC3E,OAAO,IAAI,IAAI;IAiCf,MAAM,IAAI,IAAI;CAEjB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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.AICustomAgentsFrontendApplicationContribution = 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 common_1 = require("../common");
|
|
23
|
+
const custom_agent_factory_1 = require("./custom-agent-factory");
|
|
24
|
+
let AICustomAgentsFrontendApplicationContribution = class AICustomAgentsFrontendApplicationContribution {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.knownCustomAgents = new Map();
|
|
27
|
+
}
|
|
28
|
+
onStart() {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
(_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getCustomAgents().then(customAgents => {
|
|
31
|
+
customAgents.forEach(agent => {
|
|
32
|
+
this.customAgentFactory(agent.id, agent.name, agent.description, agent.prompt, agent.defaultLLM);
|
|
33
|
+
this.knownCustomAgents.set(agent.id, agent);
|
|
34
|
+
});
|
|
35
|
+
}).catch(e => {
|
|
36
|
+
console.error('Failed to load custom agents', e);
|
|
37
|
+
});
|
|
38
|
+
(_b = this.customizationService) === null || _b === void 0 ? void 0 : _b.onDidChangeCustomAgents(() => {
|
|
39
|
+
var _a;
|
|
40
|
+
(_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getCustomAgents().then(customAgents => {
|
|
41
|
+
const customAgentsToAdd = customAgents.filter(agent => !this.knownCustomAgents.has(agent.id) || !ai_core_1.CustomAgentDescription.equals(this.knownCustomAgents.get(agent.id), agent));
|
|
42
|
+
const customAgentIdsToRemove = [...this.knownCustomAgents.values()].filter(agent => !customAgents.find(a => ai_core_1.CustomAgentDescription.equals(a, agent))).map(a => a.id);
|
|
43
|
+
// delete first so we don't have to deal with the case where we add and remove the same agentId
|
|
44
|
+
customAgentIdsToRemove.forEach(id => {
|
|
45
|
+
this.chatAgentService.unregisterChatAgent(id);
|
|
46
|
+
this.agentService.unregisterAgent(id);
|
|
47
|
+
this.knownCustomAgents.delete(id);
|
|
48
|
+
});
|
|
49
|
+
customAgentsToAdd
|
|
50
|
+
.forEach(agent => {
|
|
51
|
+
this.customAgentFactory(agent.id, agent.name, agent.description, agent.prompt, agent.defaultLLM);
|
|
52
|
+
this.knownCustomAgents.set(agent.id, agent);
|
|
53
|
+
});
|
|
54
|
+
}).catch(e => {
|
|
55
|
+
console.error('Failed to load custom agents', e);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
onStop() {
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.AICustomAgentsFrontendApplicationContribution = AICustomAgentsFrontendApplicationContribution;
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, inversify_1.inject)(custom_agent_factory_1.CustomAgentFactory),
|
|
65
|
+
tslib_1.__metadata("design:type", Function)
|
|
66
|
+
], AICustomAgentsFrontendApplicationContribution.prototype, "customAgentFactory", void 0);
|
|
67
|
+
tslib_1.__decorate([
|
|
68
|
+
(0, inversify_1.inject)(ai_core_1.PromptCustomizationService),
|
|
69
|
+
tslib_1.__metadata("design:type", Object)
|
|
70
|
+
], AICustomAgentsFrontendApplicationContribution.prototype, "customizationService", void 0);
|
|
71
|
+
tslib_1.__decorate([
|
|
72
|
+
(0, inversify_1.inject)(ai_core_1.AgentService),
|
|
73
|
+
tslib_1.__metadata("design:type", Object)
|
|
74
|
+
], AICustomAgentsFrontendApplicationContribution.prototype, "agentService", void 0);
|
|
75
|
+
tslib_1.__decorate([
|
|
76
|
+
(0, inversify_1.inject)(common_1.ChatAgentService),
|
|
77
|
+
tslib_1.__metadata("design:type", Object)
|
|
78
|
+
], AICustomAgentsFrontendApplicationContribution.prototype, "chatAgentService", void 0);
|
|
79
|
+
exports.AICustomAgentsFrontendApplicationContribution = AICustomAgentsFrontendApplicationContribution = tslib_1.__decorate([
|
|
80
|
+
(0, inversify_1.injectable)()
|
|
81
|
+
], AICustomAgentsFrontendApplicationContribution);
|
|
82
|
+
//# sourceMappingURL=custom-agent-frontend-application-contribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-agent-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/custom-agent-frontend-application-contribution.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,4CAAkG;AAElG,4DAAkE;AAClE,sCAA6C;AAC7C,iEAA4D;AAGrD,IAAM,6CAA6C,GAAnD,MAAM,6CAA6C;IAAnD;QAaK,sBAAiB,GAAwC,IAAI,GAAG,EAAE,CAAC;IAoC/E,CAAC;IAnCG,OAAO;;QACH,MAAA,IAAI,CAAC,oBAAoB,0CAAE,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE;YAC7D,YAAY,CAAC,OAAO,CAAC,KA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BAChC,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;oBAC9C,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;oBACtC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBACtC,CAAC,CAAC,CAAC;gBACH,iBAAiB;qBACZ,OAAO,CAAC,KAAK,CAAC,EAAE;oBACb,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;oBACjG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;gBAChD,CAAC,CAAC,CAAC;YACX,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE;gBACT,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,CAAC,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM;IACN,CAAC;CACJ,CAAA;AAjDY,sGAA6C;AAEnC;IADlB,IAAA,kBAAM,EAAC,yCAAkB,CAAC;;yFAC+B;AAGvC;IADlB,IAAA,kBAAM,EAAC,oCAA0B,CAAC;;2FACiC;AAGnD;IADhB,IAAA,kBAAM,EAAC,sBAAY,CAAC;;mFACuB;AAG3B;IADhB,IAAA,kBAAM,EAAC,yBAAgB,CAAC;;uFAC2B;wDAX3C,6CAA6C;IADzD,IAAA,sBAAU,GAAE;GACA,6CAA6C,CAiDzD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChatAgent, ChatServiceImpl, ParsedChatRequest } from '../common';
|
|
2
|
+
import { PreferenceService } from '@theia/core/lib/browser';
|
|
3
|
+
export declare class FrontendChatServiceImpl extends ChatServiceImpl {
|
|
4
|
+
protected preferenceService: PreferenceService;
|
|
5
|
+
protected getAgent(parsedRequest: ParsedChatRequest): ChatAgent | undefined;
|
|
6
|
+
protected getConfiguredDefaultChatAgent(): ChatAgent | undefined;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=frontend-chat-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontend-chat-service.d.ts","sourceRoot":"","sources":["../../src/browser/frontend-chat-service.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,qBACa,uBAAwB,SAAQ,eAAe;IAGxD,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;cAE5B,QAAQ,CAAC,aAAa,EAAE,iBAAiB,GAAG,SAAS,GAAG,SAAS;IA8BpF,SAAS,CAAC,6BAA6B,IAAI,SAAS,GAAG,SAAS;CAQnE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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.FrontendChatServiceImpl = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const common_1 = require("../common");
|
|
22
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
23
|
+
const ai_chat_preferences_1 = require("./ai-chat-preferences");
|
|
24
|
+
let FrontendChatServiceImpl = class FrontendChatServiceImpl extends common_1.ChatServiceImpl {
|
|
25
|
+
getAgent(parsedRequest) {
|
|
26
|
+
var _a;
|
|
27
|
+
const agentPart = this.getMentionedAgent(parsedRequest);
|
|
28
|
+
if (agentPart) {
|
|
29
|
+
return this.chatAgentService.getAgent(agentPart.agentId);
|
|
30
|
+
}
|
|
31
|
+
const configuredDefaultChatAgent = this.getConfiguredDefaultChatAgent();
|
|
32
|
+
if (configuredDefaultChatAgent) {
|
|
33
|
+
return configuredDefaultChatAgent;
|
|
34
|
+
}
|
|
35
|
+
if (this.defaultChatAgentId) {
|
|
36
|
+
const defaultAgent = this.chatAgentService.getAgent(this.defaultChatAgentId.id);
|
|
37
|
+
// the default agent could be disabled
|
|
38
|
+
if (defaultAgent) {
|
|
39
|
+
return defaultAgent;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// check whether "Universal" is available
|
|
43
|
+
const universalAgent = this.chatAgentService.getAgent('Universal');
|
|
44
|
+
if (universalAgent) {
|
|
45
|
+
return universalAgent;
|
|
46
|
+
}
|
|
47
|
+
this.logger.warn('No default chat agent is configured or available and the "Universal" Chat Agent is unavailable too. Falling back to first registered agent.');
|
|
48
|
+
return (_a = this.chatAgentService.getAgents()[0]) !== null && _a !== void 0 ? _a : undefined;
|
|
49
|
+
}
|
|
50
|
+
getConfiguredDefaultChatAgent() {
|
|
51
|
+
const configuredDefaultChatAgentId = this.preferenceService.get(ai_chat_preferences_1.DEFAULT_CHAT_AGENT_PREF, undefined);
|
|
52
|
+
const configuredDefaultChatAgent = configuredDefaultChatAgentId ? this.chatAgentService.getAgent(configuredDefaultChatAgentId) : undefined;
|
|
53
|
+
if (configuredDefaultChatAgentId && !configuredDefaultChatAgent) {
|
|
54
|
+
this.logger.warn(`The configured default chat agent with id '${configuredDefaultChatAgentId}' does not exist.`);
|
|
55
|
+
}
|
|
56
|
+
return configuredDefaultChatAgent;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.FrontendChatServiceImpl = FrontendChatServiceImpl;
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
(0, inversify_1.inject)(browser_1.PreferenceService),
|
|
62
|
+
tslib_1.__metadata("design:type", Object)
|
|
63
|
+
], FrontendChatServiceImpl.prototype, "preferenceService", void 0);
|
|
64
|
+
exports.FrontendChatServiceImpl = FrontendChatServiceImpl = tslib_1.__decorate([
|
|
65
|
+
(0, inversify_1.injectable)()
|
|
66
|
+
], FrontendChatServiceImpl);
|
|
67
|
+
//# sourceMappingURL=frontend-chat-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontend-chat-service.js","sourceRoot":"","sources":["../../src/browser/frontend-chat-service.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,4DAAkE;AAClE,sCAA0E;AAC1E,qDAA4D;AAC5D,+DAAgE;AAGzD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,wBAAe;IAKrC,QAAQ,CAAC,aAAgC;;QACxD,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;QACxD,IAAI,SAAS,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,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CAAC;;kEACqB;kCAHtC,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CA2CnC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ContributionProvider, ILogger } from '@theia/core';
|
|
2
|
+
import { ChatAgent } from './chat-agents';
|
|
3
|
+
import { AgentService } from '@theia/ai-core';
|
|
4
|
+
export declare const ChatAgentService: unique symbol;
|
|
5
|
+
/**
|
|
6
|
+
* The ChatAgentService provides access to the available chat agents.
|
|
7
|
+
*/
|
|
8
|
+
export interface ChatAgentService {
|
|
9
|
+
/**
|
|
10
|
+
* Returns all available agents.
|
|
11
|
+
*/
|
|
12
|
+
getAgents(): ChatAgent[];
|
|
13
|
+
/**
|
|
14
|
+
* Returns the specified agent, if available
|
|
15
|
+
*/
|
|
16
|
+
getAgent(id: string): ChatAgent | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Returns all agents, including disabled ones.
|
|
19
|
+
*/
|
|
20
|
+
getAllAgents(): ChatAgent[];
|
|
21
|
+
/**
|
|
22
|
+
* Allows to register a chat agent programmatically.
|
|
23
|
+
* @param agent the agent to register
|
|
24
|
+
*/
|
|
25
|
+
registerChatAgent(agent: ChatAgent): void;
|
|
26
|
+
/**
|
|
27
|
+
* Allows to unregister a chat agent programmatically.
|
|
28
|
+
* @param agentId the agent id to unregister
|
|
29
|
+
*/
|
|
30
|
+
unregisterChatAgent(agentId: string): void;
|
|
31
|
+
}
|
|
32
|
+
export declare class ChatAgentServiceImpl implements ChatAgentService {
|
|
33
|
+
protected readonly agentContributions: ContributionProvider<ChatAgent>;
|
|
34
|
+
protected logger: ILogger;
|
|
35
|
+
protected agentService: AgentService;
|
|
36
|
+
protected _agents: ChatAgent[];
|
|
37
|
+
protected get agents(): ChatAgent[];
|
|
38
|
+
registerChatAgent(agent: ChatAgent): void;
|
|
39
|
+
unregisterChatAgent(agentId: string): void;
|
|
40
|
+
getAgent(id: string): ChatAgent | undefined;
|
|
41
|
+
getAgents(): ChatAgent[];
|
|
42
|
+
getAllAgents(): ChatAgent[];
|
|
43
|
+
private _agentIsEnabled;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=chat-agent-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-agent-service.d.ts","sourceRoot":"","sources":["../../src/common/chat-agent-service.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAC3D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,SAAS,IAAI,SAAS,EAAE,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAC5C;;OAEG;IACH,YAAY,IAAI,SAAS,EAAE,CAAC;IAE5B;;;OAGG;IACH,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAE1C;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9C;AACD,qBACa,oBAAqB,YAAW,gBAAgB;IAGzD,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAGvE,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAG1B,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IAErC,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,CAAM;IAEpC,SAAS,KAAK,MAAM,IAAI,SAAS,EAAE,CAIlC;IAED,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAGzC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI1C,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAM3C,SAAS,IAAI,SAAS,EAAE;IAGxB,YAAY,IAAI,SAAS,EAAE;IAI3B,OAAO,CAAC,eAAe;CAG1B"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
/*---------------------------------------------------------------------------------------------
|
|
18
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
19
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20
|
+
*--------------------------------------------------------------------------------------------*/
|
|
21
|
+
// Partially copied from https://github.com/microsoft/vscode/blob/a2cab7255c0df424027be05d58e1b7b941f4ea60/src/vs/workbench/contrib/chat/common/chatAgents.ts
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.ChatAgentServiceImpl = exports.ChatAgentService = void 0;
|
|
24
|
+
const tslib_1 = require("tslib");
|
|
25
|
+
const core_1 = require("@theia/core");
|
|
26
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
27
|
+
const chat_agents_1 = require("./chat-agents");
|
|
28
|
+
const ai_core_1 = require("@theia/ai-core");
|
|
29
|
+
exports.ChatAgentService = Symbol('ChatAgentService');
|
|
30
|
+
let ChatAgentServiceImpl = class ChatAgentServiceImpl {
|
|
31
|
+
constructor() {
|
|
32
|
+
this._agents = [];
|
|
33
|
+
}
|
|
34
|
+
get agents() {
|
|
35
|
+
// We can't collect the contributions at @postConstruct because this will lead to a circular dependency
|
|
36
|
+
// with chat agents reusing the chat agent service (e.g. orchestrator)
|
|
37
|
+
return [...this.agentContributions.getContributions(), ...this._agents];
|
|
38
|
+
}
|
|
39
|
+
registerChatAgent(agent) {
|
|
40
|
+
this._agents.push(agent);
|
|
41
|
+
}
|
|
42
|
+
unregisterChatAgent(agentId) {
|
|
43
|
+
this._agents = this._agents.filter(a => a.id !== agentId);
|
|
44
|
+
}
|
|
45
|
+
getAgent(id) {
|
|
46
|
+
if (!this._agentIsEnabled(id)) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
return this.getAgents().find(agent => agent.id === id);
|
|
50
|
+
}
|
|
51
|
+
getAgents() {
|
|
52
|
+
return this.agents.filter(a => this._agentIsEnabled(a.id));
|
|
53
|
+
}
|
|
54
|
+
getAllAgents() {
|
|
55
|
+
return this.agents;
|
|
56
|
+
}
|
|
57
|
+
_agentIsEnabled(id) {
|
|
58
|
+
return this.agentService.isEnabled(id);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.ChatAgentServiceImpl = ChatAgentServiceImpl;
|
|
62
|
+
tslib_1.__decorate([
|
|
63
|
+
(0, inversify_1.inject)(core_1.ContributionProvider),
|
|
64
|
+
(0, inversify_1.named)(chat_agents_1.ChatAgent),
|
|
65
|
+
tslib_1.__metadata("design:type", Object)
|
|
66
|
+
], ChatAgentServiceImpl.prototype, "agentContributions", void 0);
|
|
67
|
+
tslib_1.__decorate([
|
|
68
|
+
(0, inversify_1.inject)(core_1.ILogger),
|
|
69
|
+
tslib_1.__metadata("design:type", Object)
|
|
70
|
+
], ChatAgentServiceImpl.prototype, "logger", void 0);
|
|
71
|
+
tslib_1.__decorate([
|
|
72
|
+
(0, inversify_1.inject)(ai_core_1.AgentService),
|
|
73
|
+
tslib_1.__metadata("design:type", Object)
|
|
74
|
+
], ChatAgentServiceImpl.prototype, "agentService", void 0);
|
|
75
|
+
exports.ChatAgentServiceImpl = ChatAgentServiceImpl = tslib_1.__decorate([
|
|
76
|
+
(0, inversify_1.injectable)()
|
|
77
|
+
], ChatAgentServiceImpl);
|
|
78
|
+
//# sourceMappingURL=chat-agent-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-agent-service.js","sourceRoot":"","sources":["../../src/common/chat-agent-service.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;AAChF;;;gGAGgG;AAChG,6JAA6J;;;;AAE7J,sCAA4D;AAC5D,4DAAyE;AACzE,+CAA0C;AAC1C,4CAA8C;AAEjC,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AA+BpD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAA1B;QAWO,YAAO,GAAgB,EAAE,CAAC;IA+BxC,CAAC;IA7BG,IAAc,MAAM;QAChB,uGAAuG;QACvG,sEAAsE;QACtE,OAAO,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5E,CAAC;IAED,iBAAiB,CAAC,KAAgB;QAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IACD,mBAAmB,CAAC,OAAe;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED,QAAQ,CAAC,EAAU;QACf,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,SAAS;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/D,CAAC;IACD,YAAY;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEO,eAAe,CAAC,EAAU;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;CACJ,CAAA;AA1CY,oDAAoB;AAGV;IADlB,IAAA,kBAAM,EAAC,2BAAoB,CAAC;IAAE,IAAA,iBAAK,EAAC,uBAAS,CAAC;;gEACwB;AAG7D;IADT,IAAA,kBAAM,EAAC,cAAO,CAAC;;oDACU;AAGhB;IADT,IAAA,kBAAM,EAAC,sBAAY,CAAC;;0DACgB;+BAT5B,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CA0ChC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MaybePromise } from '@theia/core';
|
|
2
|
+
import { AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest, AIVariableResolver, AIVariableService, ResolvedAIVariable } from '@theia/ai-core';
|
|
3
|
+
import { ChatAgentService } from './chat-agent-service';
|
|
4
|
+
export declare const CHAT_AGENTS_VARIABLE: AIVariable;
|
|
5
|
+
export interface ChatAgentDescriptor {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class ChatAgentsVariableContribution implements AIVariableContribution, AIVariableResolver {
|
|
11
|
+
protected readonly agents: ChatAgentService;
|
|
12
|
+
registerVariables(service: AIVariableService): void;
|
|
13
|
+
canResolve(request: AIVariableResolutionRequest, _context: AIVariableContext): MaybePromise<number>;
|
|
14
|
+
resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise<ResolvedAIVariable | undefined>;
|
|
15
|
+
resolveAgentsVariable(_request: AIVariableResolutionRequest): ResolvedAIVariable;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=chat-agents-variable-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-agents-variable-contribution.d.ts","sourceRoot":"","sources":["../../src/common/chat-agents-variable-contribution.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACH,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,2BAA2B,EAC3B,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,eAAO,MAAM,oBAAoB,EAAE,UAIlC,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,qBACa,8BAA+B,YAAW,sBAAsB,EAAE,kBAAkB;IAG7F,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAE5C,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAInD,UAAU,CAAC,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC;IAO7F,OAAO,CAAC,OAAO,EAAE,2BAA2B,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAMxH,qBAAqB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,kBAAkB;CASnF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatAgentsVariableContribution = exports.CHAT_AGENTS_VARIABLE = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
6
|
+
const chat_agent_service_1 = require("./chat-agent-service");
|
|
7
|
+
exports.CHAT_AGENTS_VARIABLE = {
|
|
8
|
+
id: 'chatAgents',
|
|
9
|
+
name: 'chatAgents',
|
|
10
|
+
description: 'Returns the list of chat agents available in the system'
|
|
11
|
+
};
|
|
12
|
+
let ChatAgentsVariableContribution = class ChatAgentsVariableContribution {
|
|
13
|
+
registerVariables(service) {
|
|
14
|
+
service.registerResolver(exports.CHAT_AGENTS_VARIABLE, this);
|
|
15
|
+
}
|
|
16
|
+
canResolve(request, _context) {
|
|
17
|
+
if (request.variable.name === exports.CHAT_AGENTS_VARIABLE.name) {
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
return -1;
|
|
21
|
+
}
|
|
22
|
+
async resolve(request, context) {
|
|
23
|
+
if (request.variable.name === exports.CHAT_AGENTS_VARIABLE.name) {
|
|
24
|
+
return this.resolveAgentsVariable(request);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
resolveAgentsVariable(_request) {
|
|
28
|
+
const agents = this.agents.getAgents().map(agent => ({
|
|
29
|
+
id: agent.id,
|
|
30
|
+
name: agent.name,
|
|
31
|
+
description: agent.description
|
|
32
|
+
}));
|
|
33
|
+
const value = agents.map(agent => prettyPrintInMd(agent)).join('\n');
|
|
34
|
+
return { variable: exports.CHAT_AGENTS_VARIABLE, value };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.ChatAgentsVariableContribution = ChatAgentsVariableContribution;
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, inversify_1.inject)(chat_agent_service_1.ChatAgentService),
|
|
40
|
+
tslib_1.__metadata("design:type", Object)
|
|
41
|
+
], ChatAgentsVariableContribution.prototype, "agents", void 0);
|
|
42
|
+
exports.ChatAgentsVariableContribution = ChatAgentsVariableContribution = tslib_1.__decorate([
|
|
43
|
+
(0, inversify_1.injectable)()
|
|
44
|
+
], ChatAgentsVariableContribution);
|
|
45
|
+
function prettyPrintInMd(agent) {
|
|
46
|
+
return `- ${agent.id}
|
|
47
|
+
- *ID*: ${agent.id}
|
|
48
|
+
- *Name*: ${agent.name}
|
|
49
|
+
- *Description*: ${agent.description.replace(/\n/g, ' ')}`;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=chat-agents-variable-contribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-agents-variable-contribution.js","sourceRoot":"","sources":["../../src/common/chat-agents-variable-contribution.ts"],"names":[],"mappings":";;;;AAgBA,4DAAkE;AAUlE,6DAAwD;AAE3C,QAAA,oBAAoB,GAAe;IAC5C,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,yDAAyD;CACzE,CAAC;AASK,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAKvC,iBAAiB,CAAC,OAA0B;QACxC,OAAO,CAAC,gBAAgB,CAAC,4BAAoB,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,UAAU,CAAC,OAAoC,EAAE,QAA2B;QACxE,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,4BAAoB,CAAC,IAAI,EAAE,CAAC;YACtD,OAAO,CAAC,CAAC;QACb,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;IACd,CAAC;IAED,KAAK,C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