@theia/ai-core 1.54.0

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.
Files changed (209) hide show
  1. package/README.md +30 -0
  2. package/data/prompttemplate.tmLanguage.json +52 -0
  3. package/lib/browser/ai-activation-service.d.ts +17 -0
  4. package/lib/browser/ai-activation-service.d.ts.map +1 -0
  5. package/lib/browser/ai-activation-service.js +63 -0
  6. package/lib/browser/ai-activation-service.js.map +1 -0
  7. package/lib/browser/ai-command-handler-factory.d.ts +4 -0
  8. package/lib/browser/ai-command-handler-factory.d.ts.map +1 -0
  9. package/lib/browser/ai-command-handler-factory.js +20 -0
  10. package/lib/browser/ai-command-handler-factory.js.map +1 -0
  11. package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +27 -0
  12. package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +1 -0
  13. package/lib/browser/ai-configuration/agent-configuration-widget.js +231 -0
  14. package/lib/browser/ai-configuration/agent-configuration-widget.js.map +1 -0
  15. package/lib/browser/ai-configuration/ai-configuration-service.d.ts +13 -0
  16. package/lib/browser/ai-configuration/ai-configuration-service.d.ts.map +1 -0
  17. package/lib/browser/ai-configuration/ai-configuration-service.js +44 -0
  18. package/lib/browser/ai-configuration/ai-configuration-service.js.map +1 -0
  19. package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts +12 -0
  20. package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts.map +1 -0
  21. package/lib/browser/ai-configuration/ai-configuration-view-contribution.js +41 -0
  22. package/lib/browser/ai-configuration/ai-configuration-view-contribution.js.map +1 -0
  23. package/lib/browser/ai-configuration/ai-configuration-widget.d.ts +20 -0
  24. package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +1 -0
  25. package/lib/browser/ai-configuration/ai-configuration-widget.js +88 -0
  26. package/lib/browser/ai-configuration/ai-configuration-widget.js.map +1 -0
  27. package/lib/browser/ai-configuration/language-model-renderer.d.ts +13 -0
  28. package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +1 -0
  29. package/lib/browser/ai-configuration/language-model-renderer.js +104 -0
  30. package/lib/browser/ai-configuration/language-model-renderer.js.map +1 -0
  31. package/lib/browser/ai-configuration/template-settings-renderer.d.ts +11 -0
  32. package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +1 -0
  33. package/lib/browser/ai-configuration/template-settings-renderer.js +33 -0
  34. package/lib/browser/ai-configuration/template-settings-renderer.js.map +1 -0
  35. package/lib/browser/ai-configuration/variable-configuration-widget.d.ts +20 -0
  36. package/lib/browser/ai-configuration/variable-configuration-widget.d.ts.map +1 -0
  37. package/lib/browser/ai-configuration/variable-configuration-widget.js +99 -0
  38. package/lib/browser/ai-configuration/variable-configuration-widget.js.map +1 -0
  39. package/lib/browser/ai-core-frontend-application-contribution.d.ts +8 -0
  40. package/lib/browser/ai-core-frontend-application-contribution.d.ts.map +1 -0
  41. package/lib/browser/ai-core-frontend-application-contribution.js +46 -0
  42. package/lib/browser/ai-core-frontend-application-contribution.js.map +1 -0
  43. package/lib/browser/ai-core-frontend-module.d.ts +4 -0
  44. package/lib/browser/ai-core-frontend-module.d.ts.map +1 -0
  45. package/lib/browser/ai-core-frontend-module.js +122 -0
  46. package/lib/browser/ai-core-frontend-module.js.map +1 -0
  47. package/lib/browser/ai-core-preferences.d.ts +14 -0
  48. package/lib/browser/ai-core-preferences.d.ts.map +1 -0
  49. package/lib/browser/ai-core-preferences.js +69 -0
  50. package/lib/browser/ai-core-preferences.js.map +1 -0
  51. package/lib/browser/ai-settings-service.d.ts +14 -0
  52. package/lib/browser/ai-settings-service.d.ts.map +1 -0
  53. package/lib/browser/ai-settings-service.js +56 -0
  54. package/lib/browser/ai-settings-service.js.map +1 -0
  55. package/lib/browser/ai-view-contribution.d.ts +14 -0
  56. package/lib/browser/ai-view-contribution.d.ts.map +1 -0
  57. package/lib/browser/ai-view-contribution.js +71 -0
  58. package/lib/browser/ai-view-contribution.js.map +1 -0
  59. package/lib/browser/frontend-language-model-registry.d.ts +39 -0
  60. package/lib/browser/frontend-language-model-registry.d.ts.map +1 -0
  61. package/lib/browser/frontend-language-model-registry.js +321 -0
  62. package/lib/browser/frontend-language-model-registry.js.map +1 -0
  63. package/lib/browser/frontend-prompt-customization-service.d.ts +31 -0
  64. package/lib/browser/frontend-prompt-customization-service.d.ts.map +1 -0
  65. package/lib/browser/frontend-prompt-customization-service.js +194 -0
  66. package/lib/browser/frontend-prompt-customization-service.js.map +1 -0
  67. package/lib/browser/frontend-variable-service.d.ts +6 -0
  68. package/lib/browser/frontend-variable-service.d.ts.map +1 -0
  69. package/lib/browser/frontend-variable-service.js +31 -0
  70. package/lib/browser/frontend-variable-service.js.map +1 -0
  71. package/lib/browser/index.d.ts +11 -0
  72. package/lib/browser/index.d.ts.map +1 -0
  73. package/lib/browser/index.js +29 -0
  74. package/lib/browser/index.js.map +1 -0
  75. package/lib/browser/prompttemplate-contribution.d.ts +28 -0
  76. package/lib/browser/prompttemplate-contribution.d.ts.map +1 -0
  77. package/lib/browser/prompttemplate-contribution.js +207 -0
  78. package/lib/browser/prompttemplate-contribution.js.map +1 -0
  79. package/lib/browser/theia-variable-contribution.d.ts +13 -0
  80. package/lib/browser/theia-variable-contribution.d.ts.map +1 -0
  81. package/lib/browser/theia-variable-contribution.js +64 -0
  82. package/lib/browser/theia-variable-contribution.js.map +1 -0
  83. package/lib/common/agent-service.d.ts +48 -0
  84. package/lib/common/agent-service.d.ts.map +1 -0
  85. package/lib/common/agent-service.js +88 -0
  86. package/lib/common/agent-service.js.map +1 -0
  87. package/lib/common/agent.d.ts +45 -0
  88. package/lib/common/agent.d.ts.map +1 -0
  89. package/lib/common/agent.js +20 -0
  90. package/lib/common/agent.js.map +1 -0
  91. package/lib/common/agents-variable-contribution.d.ts +19 -0
  92. package/lib/common/agents-variable-contribution.d.ts.map +1 -0
  93. package/lib/common/agents-variable-contribution.js +56 -0
  94. package/lib/common/agents-variable-contribution.js.map +1 -0
  95. package/lib/common/communication-recording-service.d.ts +23 -0
  96. package/lib/common/communication-recording-service.d.ts.map +1 -0
  97. package/lib/common/communication-recording-service.js +20 -0
  98. package/lib/common/communication-recording-service.js.map +1 -0
  99. package/lib/common/index.d.ts +16 -0
  100. package/lib/common/index.d.ts.map +1 -0
  101. package/lib/common/index.js +34 -0
  102. package/lib/common/index.js.map +1 -0
  103. package/lib/common/language-model-delegate.d.ts +24 -0
  104. package/lib/common/language-model-delegate.d.ts.map +1 -0
  105. package/lib/common/language-model-delegate.js +26 -0
  106. package/lib/common/language-model-delegate.js.map +1 -0
  107. package/lib/common/language-model-util.d.ts +5 -0
  108. package/lib/common/language-model-util.d.ts.map +1 -0
  109. package/lib/common/language-model-util.js +75 -0
  110. package/lib/common/language-model-util.js.map +1 -0
  111. package/lib/common/language-model.d.ts +137 -0
  112. package/lib/common/language-model.d.ts.map +1 -0
  113. package/lib/common/language-model.js +142 -0
  114. package/lib/common/language-model.js.map +1 -0
  115. package/lib/common/language-model.spec.d.ts +2 -0
  116. package/lib/common/language-model.spec.d.ts.map +1 -0
  117. package/lib/common/language-model.spec.js +62 -0
  118. package/lib/common/language-model.spec.js.map +1 -0
  119. package/lib/common/prompt-service-util.d.ts +5 -0
  120. package/lib/common/prompt-service-util.d.ts.map +1 -0
  121. package/lib/common/prompt-service-util.js +23 -0
  122. package/lib/common/prompt-service-util.js.map +1 -0
  123. package/lib/common/prompt-service.d.ts +101 -0
  124. package/lib/common/prompt-service.d.ts.map +1 -0
  125. package/lib/common/prompt-service.js +139 -0
  126. package/lib/common/prompt-service.js.map +1 -0
  127. package/lib/common/prompt-service.spec.d.ts +2 -0
  128. package/lib/common/prompt-service.spec.d.ts.map +1 -0
  129. package/lib/common/prompt-service.spec.js +86 -0
  130. package/lib/common/prompt-service.spec.js.map +1 -0
  131. package/lib/common/protocol.d.ts +7 -0
  132. package/lib/common/protocol.d.ts.map +1 -0
  133. package/lib/common/protocol.js +20 -0
  134. package/lib/common/protocol.js.map +1 -0
  135. package/lib/common/settings-service.d.ts +18 -0
  136. package/lib/common/settings-service.d.ts.map +1 -0
  137. package/lib/common/settings-service.js +5 -0
  138. package/lib/common/settings-service.js.map +1 -0
  139. package/lib/common/today-variable-contribution.d.ts +17 -0
  140. package/lib/common/today-variable-contribution.d.ts.map +1 -0
  141. package/lib/common/today-variable-contribution.js +48 -0
  142. package/lib/common/today-variable-contribution.js.map +1 -0
  143. package/lib/common/tomorrow-variable-contribution.d.ts +17 -0
  144. package/lib/common/tomorrow-variable-contribution.d.ts.map +1 -0
  145. package/lib/common/tomorrow-variable-contribution.js +48 -0
  146. package/lib/common/tomorrow-variable-contribution.js.map +1 -0
  147. package/lib/common/tool-invocation-registry.d.ts +23 -0
  148. package/lib/common/tool-invocation-registry.d.ts.map +1 -0
  149. package/lib/common/tool-invocation-registry.js +72 -0
  150. package/lib/common/tool-invocation-registry.js.map +1 -0
  151. package/lib/common/variable-service.d.ts +70 -0
  152. package/lib/common/variable-service.d.ts.map +1 -0
  153. package/lib/common/variable-service.js +122 -0
  154. package/lib/common/variable-service.js.map +1 -0
  155. package/lib/node/ai-core-backend-module.d.ts +4 -0
  156. package/lib/node/ai-core-backend-module.d.ts.map +1 -0
  157. package/lib/node/ai-core-backend-module.js +47 -0
  158. package/lib/node/ai-core-backend-module.js.map +1 -0
  159. package/lib/node/backend-language-model-registry.d.ts +12 -0
  160. package/lib/node/backend-language-model-registry.d.ts.map +1 -0
  161. package/lib/node/backend-language-model-registry.js +61 -0
  162. package/lib/node/backend-language-model-registry.js.map +1 -0
  163. package/lib/node/language-model-frontend-delegate.d.ts +18 -0
  164. package/lib/node/language-model-frontend-delegate.d.ts.map +1 -0
  165. package/lib/node/language-model-frontend-delegate.js +100 -0
  166. package/lib/node/language-model-frontend-delegate.js.map +1 -0
  167. package/package.json +59 -0
  168. package/src/browser/ai-activation-service.ts +56 -0
  169. package/src/browser/ai-command-handler-factory.ts +20 -0
  170. package/src/browser/ai-configuration/agent-configuration-widget.tsx +299 -0
  171. package/src/browser/ai-configuration/ai-configuration-service.ts +43 -0
  172. package/src/browser/ai-configuration/ai-configuration-view-contribution.ts +54 -0
  173. package/src/browser/ai-configuration/ai-configuration-widget.tsx +80 -0
  174. package/src/browser/ai-configuration/language-model-renderer.tsx +113 -0
  175. package/src/browser/ai-configuration/template-settings-renderer.tsx +39 -0
  176. package/src/browser/ai-configuration/variable-configuration-widget.tsx +110 -0
  177. package/src/browser/ai-core-frontend-application-contribution.ts +40 -0
  178. package/src/browser/ai-core-frontend-module.ts +161 -0
  179. package/src/browser/ai-core-preferences.ts +76 -0
  180. package/src/browser/ai-settings-service.ts +50 -0
  181. package/src/browser/ai-view-contribution.ts +77 -0
  182. package/src/browser/frontend-language-model-registry.ts +405 -0
  183. package/src/browser/frontend-prompt-customization-service.ts +197 -0
  184. package/src/browser/frontend-variable-service.ts +26 -0
  185. package/src/browser/index.ts +26 -0
  186. package/src/browser/prompttemplate-contribution.ts +250 -0
  187. package/src/browser/style/index.css +90 -0
  188. package/src/browser/theia-variable-contribution.ts +58 -0
  189. package/src/common/agent-service.ts +108 -0
  190. package/src/common/agent.ts +70 -0
  191. package/src/common/agents-variable-contribution.ts +64 -0
  192. package/src/common/communication-recording-service.ts +44 -0
  193. package/src/common/index.ts +30 -0
  194. package/src/common/language-model-delegate.ts +45 -0
  195. package/src/common/language-model-util.ts +67 -0
  196. package/src/common/language-model.spec.ts +86 -0
  197. package/src/common/language-model.ts +237 -0
  198. package/src/common/prompt-service-util.ts +21 -0
  199. package/src/common/prompt-service.spec.ts +98 -0
  200. package/src/common/prompt-service.ts +213 -0
  201. package/src/common/protocol.ts +23 -0
  202. package/src/common/settings-service.ts +33 -0
  203. package/src/common/today-variable-contribution.ts +67 -0
  204. package/src/common/tomorrow-variable-contribution.ts +66 -0
  205. package/src/common/tool-invocation-registry.ts +79 -0
  206. package/src/common/variable-service.ts +177 -0
  207. package/src/node/ai-core-backend-module.ts +83 -0
  208. package/src/node/backend-language-model-registry.ts +59 -0
  209. package/src/node/language-model-frontend-delegate.ts +116 -0
@@ -0,0 +1,20 @@
1
+ import { BaseWidget, DockPanel, WidgetManager } from '@theia/core/lib/browser';
2
+ import { TheiaDockPanel } from '@theia/core/lib/browser/shell/theia-dock-panel';
3
+ import '../../../src/browser/style/index.css';
4
+ import { AIAgentConfigurationWidget } from './agent-configuration-widget';
5
+ import { AIVariableConfigurationWidget } from './variable-configuration-widget';
6
+ import { AIConfigurationSelectionService } from './ai-configuration-service';
7
+ export declare class AIConfigurationContainerWidget extends BaseWidget {
8
+ static readonly ID = "ai-configuration";
9
+ static readonly LABEL = "\u2728 AI Configuration [Experimental]";
10
+ protected dockpanel: DockPanel;
11
+ protected readonly dockPanelFactory: TheiaDockPanel.Factory;
12
+ protected readonly widgetManager: WidgetManager;
13
+ protected readonly aiConfigurationSelectionService: AIConfigurationSelectionService;
14
+ protected agentsWidget: AIAgentConfigurationWidget;
15
+ protected variablesWidget: AIVariableConfigurationWidget;
16
+ protected init(): void;
17
+ protected initUI(): Promise<void>;
18
+ protected initListeners(): void;
19
+ }
20
+ //# sourceMappingURL=ai-configuration-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-configuration-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/ai-configuration-widget.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAsB,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAEhF,OAAO,sCAAsC,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,qBACa,8BAA+B,SAAQ,UAAU;IAE1D,MAAM,CAAC,QAAQ,CAAC,EAAE,sBAAsB;IACxC,MAAM,CAAC,QAAQ,CAAC,KAAK,4CAAuC;IAC5D,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;IAG/B,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,cAAc,CAAC,OAAO,CAAC;IAE5D,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAEhD,SAAS,CAAC,QAAQ,CAAC,+BAA+B,EAAE,+BAA+B,CAAC;IAEpF,SAAS,CAAC,YAAY,EAAE,0BAA0B,CAAC;IACnD,SAAS,CAAC,eAAe,EAAE,6BAA6B,CAAC;IAGzD,SAAS,CAAC,IAAI,IAAI,IAAI;cAUN,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBvC,SAAS,CAAC,aAAa,IAAI,IAAI;CASlC"}
@@ -0,0 +1,88 @@
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
+ var AIConfigurationContainerWidget_1;
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.AIConfigurationContainerWidget = void 0;
20
+ const tslib_1 = require("tslib");
21
+ const browser_1 = require("@theia/core/lib/browser");
22
+ const theia_dock_panel_1 = require("@theia/core/lib/browser/shell/theia-dock-panel");
23
+ const inversify_1 = require("@theia/core/shared/inversify");
24
+ require("../../../src/browser/style/index.css");
25
+ const agent_configuration_widget_1 = require("./agent-configuration-widget");
26
+ const variable_configuration_widget_1 = require("./variable-configuration-widget");
27
+ const ai_configuration_service_1 = require("./ai-configuration-service");
28
+ let AIConfigurationContainerWidget = AIConfigurationContainerWidget_1 = class AIConfigurationContainerWidget extends browser_1.BaseWidget {
29
+ init() {
30
+ this.id = AIConfigurationContainerWidget_1.ID;
31
+ this.title.label = AIConfigurationContainerWidget_1.LABEL;
32
+ this.title.closable = true;
33
+ this.addClass('theia-settings-container');
34
+ this.title.iconClass = (0, browser_1.codicon)('hubot');
35
+ this.initUI();
36
+ this.initListeners();
37
+ }
38
+ async initUI() {
39
+ const layout = (this.layout = new browser_1.BoxLayout({ direction: 'top-to-bottom', spacing: 0 }));
40
+ this.dockpanel = this.dockPanelFactory({
41
+ mode: 'multiple-document',
42
+ spacing: 0
43
+ });
44
+ browser_1.BoxLayout.setStretch(this.dockpanel, 1);
45
+ layout.addWidget(this.dockpanel);
46
+ this.dockpanel.addClass('ai-configuration-widget');
47
+ this.agentsWidget = await this.widgetManager.getOrCreateWidget(agent_configuration_widget_1.AIAgentConfigurationWidget.ID);
48
+ this.variablesWidget = await this.widgetManager.getOrCreateWidget(variable_configuration_widget_1.AIVariableConfigurationWidget.ID);
49
+ this.dockpanel.addWidget(this.agentsWidget);
50
+ this.dockpanel.addWidget(this.variablesWidget);
51
+ this.update();
52
+ }
53
+ initListeners() {
54
+ this.aiConfigurationSelectionService.onDidSelectConfiguration(widgetId => {
55
+ if (widgetId === agent_configuration_widget_1.AIAgentConfigurationWidget.ID) {
56
+ this.dockpanel.activateWidget(this.agentsWidget);
57
+ }
58
+ else if (widgetId === variable_configuration_widget_1.AIVariableConfigurationWidget.ID) {
59
+ this.dockpanel.activateWidget(this.variablesWidget);
60
+ }
61
+ });
62
+ }
63
+ };
64
+ exports.AIConfigurationContainerWidget = AIConfigurationContainerWidget;
65
+ AIConfigurationContainerWidget.ID = 'ai-configuration';
66
+ AIConfigurationContainerWidget.LABEL = '✨ AI Configuration [Experimental]';
67
+ tslib_1.__decorate([
68
+ (0, inversify_1.inject)(theia_dock_panel_1.TheiaDockPanel.Factory),
69
+ tslib_1.__metadata("design:type", Function)
70
+ ], AIConfigurationContainerWidget.prototype, "dockPanelFactory", void 0);
71
+ tslib_1.__decorate([
72
+ (0, inversify_1.inject)(browser_1.WidgetManager),
73
+ tslib_1.__metadata("design:type", browser_1.WidgetManager)
74
+ ], AIConfigurationContainerWidget.prototype, "widgetManager", void 0);
75
+ tslib_1.__decorate([
76
+ (0, inversify_1.inject)(ai_configuration_service_1.AIConfigurationSelectionService),
77
+ tslib_1.__metadata("design:type", ai_configuration_service_1.AIConfigurationSelectionService)
78
+ ], AIConfigurationContainerWidget.prototype, "aiConfigurationSelectionService", void 0);
79
+ tslib_1.__decorate([
80
+ (0, inversify_1.postConstruct)(),
81
+ tslib_1.__metadata("design:type", Function),
82
+ tslib_1.__metadata("design:paramtypes", []),
83
+ tslib_1.__metadata("design:returntype", void 0)
84
+ ], AIConfigurationContainerWidget.prototype, "init", null);
85
+ exports.AIConfigurationContainerWidget = AIConfigurationContainerWidget = AIConfigurationContainerWidget_1 = tslib_1.__decorate([
86
+ (0, inversify_1.injectable)()
87
+ ], AIConfigurationContainerWidget);
88
+ //# sourceMappingURL=ai-configuration-widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-configuration-widget.js","sourceRoot":"","sources":["../../../src/browser/ai-configuration/ai-configuration-widget.tsx"],"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,qDAAmG;AACnG,qFAAgF;AAChF,4DAAiF;AACjF,gDAA8C;AAC9C,6EAA0E;AAC1E,mFAAgF;AAChF,yEAA6E;AAGtE,IAAM,8BAA8B,sCAApC,MAAM,8BAA+B,SAAQ,oBAAU;I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AAI,CAAC,eAAe,CAAC,CAAC;QAE/C,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAES,aAAa;QACnB,IAAI,CAAC,+BAA+B,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EAAE;YACrE,IAAI,QAAQ,KAAK,uDAA0B,CAAC,EAAE,EAAE,CAAC;gBAC7C,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACrD,CAAC;iBAAM,IAAI,QAAQ,KAAK,6DAA6B,CAAC,EAAE,EAAE,CAAC;gBACvD,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACxD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;;AArDQ,wEAA8B;AAEvB,iCAAE,GAAG,kBAAkB,AAArB,CAAsB;AACxB,oCAAK,GAAG,mCAAmC,AAAtC,CAAuC;AAIzC;IADlB,IAAA,kBAAM,EAAC,iCAAc,CAAC,OAAO,CAAC;;wEAC6B;AAEzC;IADlB,IAAA,kBAAM,EAAC,uBAAa,CAAC;sCACY,uBAAa;qEAAC;AAE7B;IADlB,IAAA,kBAAM,EAAC,0DAA+B,CAAC;sCACY,0DAA+B;uFAAC;AAM1E;IADT,IAAA,yBAAa,GAAE;;;;0DASf;yCAzBQ,8BAA8B;IAD1C,IAAA,sBAAU,GAAE;GACA,8BAA8B,CAsD1C"}
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import * as React from '@theia/core/shared/react';
3
+ import { Agent } from '../../common';
4
+ import { LanguageModel, LanguageModelRegistry } from '../../common/language-model';
5
+ import { AISettingsService } from '../../common/settings-service';
6
+ export interface LanguageModelSettingsProps {
7
+ agent: Agent;
8
+ languageModels?: LanguageModel[];
9
+ aiSettingsService: AISettingsService;
10
+ languageModelRegistry: LanguageModelRegistry;
11
+ }
12
+ export declare const LanguageModelRenderer: React.FC<LanguageModelSettingsProps>;
13
+ //# sourceMappingURL=language-model-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-model-renderer.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/language-model-renderer.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,KAAK,EAA4B,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGlE,MAAM,WAAW,0BAA0B;IACvC,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;IACjC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,qBAAqB,EAAE,qBAAqB,CAAC;CAChD;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAoFtE,CAAC"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LanguageModelRenderer = 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
+ const React = require("@theia/core/shared/react");
20
+ const LanguageModelRenderer = ({ agent, languageModels, aiSettingsService, languageModelRegistry }) => {
21
+ const findLanguageModelRequirement = async (purpose) => {
22
+ var _a;
23
+ const requirementSetting = await aiSettingsService.getAgentSettings(agent.id);
24
+ return (_a = requirementSetting === null || requirementSetting === void 0 ? void 0 : requirementSetting.languageModelRequirements) === null || _a === void 0 ? void 0 : _a.find(e => e.purpose === purpose);
25
+ };
26
+ const [lmRequirementMap, setLmRequirementMap] = React.useState({});
27
+ React.useEffect(() => {
28
+ const computeLmRequirementMap = async () => {
29
+ const map = await agent.languageModelRequirements.reduce(async (accPromise, curr) => {
30
+ var _a;
31
+ const acc = await accPromise;
32
+ // take the agents requirements and override them with the user settings if present
33
+ const lmRequirement = (_a = await findLanguageModelRequirement(curr.purpose)) !== null && _a !== void 0 ? _a : curr;
34
+ // if no llm is selected through the identifier, see what would be the default
35
+ if (!lmRequirement.identifier) {
36
+ const llm = await languageModelRegistry.selectLanguageModel({ agent: agent.id, ...lmRequirement });
37
+ lmRequirement.identifier = llm === null || llm === void 0 ? void 0 : llm.id;
38
+ }
39
+ acc[curr.purpose] = lmRequirement;
40
+ return acc;
41
+ }, Promise.resolve({}));
42
+ setLmRequirementMap(map);
43
+ };
44
+ computeLmRequirementMap();
45
+ }, []);
46
+ const renderLanguageModelMetadata = (requirement, index) => {
47
+ const languageModel = languageModels === null || languageModels === void 0 ? void 0 : languageModels.find(model => model.id === requirement.identifier);
48
+ if (!languageModel) {
49
+ return React.createElement("div", null);
50
+ }
51
+ return React.createElement(React.Fragment, null,
52
+ React.createElement("div", null, requirement.purpose),
53
+ React.createElement("div", { key: index },
54
+ languageModel.id && React.createElement("p", null,
55
+ React.createElement("strong", null, "Identifier: "),
56
+ " ",
57
+ languageModel.id),
58
+ languageModel.name && React.createElement("p", null,
59
+ React.createElement("strong", null, "Name: "),
60
+ " ",
61
+ languageModel.name),
62
+ languageModel.vendor && React.createElement("p", null,
63
+ React.createElement("strong", null, "Vendor: "),
64
+ " ",
65
+ languageModel.vendor),
66
+ languageModel.version && React.createElement("p", null,
67
+ React.createElement("strong", null, "Version: "),
68
+ " ",
69
+ languageModel.version),
70
+ languageModel.family && React.createElement("p", null,
71
+ React.createElement("strong", null, "Family: "),
72
+ " ",
73
+ languageModel.family),
74
+ languageModel.maxInputTokens && React.createElement("p", null,
75
+ React.createElement("strong", null, "Min Input Tokens: "),
76
+ " ",
77
+ languageModel.maxInputTokens),
78
+ languageModel.maxOutputTokens && React.createElement("p", null,
79
+ React.createElement("strong", null, "Max Output Tokens: "),
80
+ " ",
81
+ languageModel.maxOutputTokens)));
82
+ };
83
+ const onSelectedModelChange = (purpose, event) => {
84
+ const newLmRequirementMap = { ...lmRequirementMap, [purpose]: { purpose, identifier: event.target.value } };
85
+ aiSettingsService.updateAgentSettings(agent.id, { languageModelRequirements: Object.values(newLmRequirementMap) });
86
+ setLmRequirementMap(newLmRequirementMap);
87
+ };
88
+ return React.createElement("div", { className: 'language-model-container' }, Object.values(lmRequirementMap).map((requirements, index) => (React.createElement(React.Fragment, { key: index },
89
+ React.createElement("div", null,
90
+ React.createElement("strong", null, "Purpose:")),
91
+ React.createElement("div", null,
92
+ renderLanguageModelMetadata(requirements, index),
93
+ React.createElement(React.Fragment, null,
94
+ React.createElement("label", { className: "theia-header no-select", htmlFor: `model-select-${agent.id}` }, "Language Model:"),
95
+ React.createElement("select", { className: "theia-select", id: `model-select-${agent.id}`, value: requirements.identifier, onChange: event => onSelectedModelChange(requirements.purpose, event) },
96
+ React.createElement("option", { value: "" }), languageModels === null || languageModels === void 0 ? void 0 :
97
+ languageModels.map(model => {
98
+ var _a;
99
+ return (React.createElement("option", { key: model.id, value: model.id }, (_a = model.name) !== null && _a !== void 0 ? _a : model.id));
100
+ }))),
101
+ React.createElement("hr", null))))));
102
+ };
103
+ exports.LanguageModelRenderer = LanguageModelRenderer;
104
+ //# sourceMappingURL=language-model-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-model-renderer.js","sourceRoot":"","sources":["../../../src/browser/ai-configuration/language-model-renderer.tsx"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA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AAC,KAAK,CAAC,EAAE;;wBAAC,OAAA,CAC1B,gCAAQ,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,IAAG,MAAA,KAAK,CAAC,IAAI,mCAAI,KAAK,CAAC,EAAE,CAAU,CAC5E,CAAA;qBAAA,CAAC,CACG,CACV;YACH,+BAAM,CACJ,CACO,CACpB,CAAC,CAEA,CAAC;AACX,CAAC,CAAC;AApFW,QAAA,qBAAqB,yBAoFhC"}
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import * as React from '@theia/core/shared/react';
3
+ import { PromptCustomizationService } from '../../common/prompt-service';
4
+ import { PromptTemplate } from '../../common';
5
+ export interface TemplateSettingProps {
6
+ agentId: string;
7
+ template: PromptTemplate;
8
+ promptCustomizationService: PromptCustomizationService;
9
+ }
10
+ export declare const TemplateRenderer: React.FC<TemplateSettingProps>;
11
+ //# sourceMappingURL=template-settings-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-settings-renderer.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/template-settings-renderer.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,0BAA0B,EAAE,0BAA0B,CAAC;CAC1D;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAa3D,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplateRenderer = 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
+ const React = require("@theia/core/shared/react");
20
+ const TemplateRenderer = ({ agentId, template, promptCustomizationService }) => {
21
+ const openTemplate = React.useCallback(async () => {
22
+ promptCustomizationService.editTemplate(template.id);
23
+ }, [template, promptCustomizationService]);
24
+ const resetTemplate = React.useCallback(async () => {
25
+ promptCustomizationService.resetTemplate(template.id);
26
+ }, [promptCustomizationService, template]);
27
+ return React.createElement(React.Fragment, null,
28
+ template.id,
29
+ React.createElement("button", { className: 'theia-button main', onClick: openTemplate }, "Edit"),
30
+ React.createElement("button", { className: 'theia-button secondary', onClick: resetTemplate }, "Reset"));
31
+ };
32
+ exports.TemplateRenderer = TemplateRenderer;
33
+ //# sourceMappingURL=template-settings-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-settings-renderer.js","sourceRoot":"","sources":["../../../src/browser/ai-configuration/template-settings-renderer.tsx"],"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,kDAAkD;AAU3C,MAAM,gBAAgB,GAAmC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,0BAA0B,EAAE,EAAE,EAAE;IAClH,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE;QAC9C,0BAA0B,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,QAAQ,EAAE,0BAA0B,CAAC,CAAC,CAAC;IAC3C,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE;QAC/C,0BAA0B,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC,EAAE,CAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE3C,OAAO;QACF,QAAQ,CAAC,EAAE;QACZ,gCAAQ,SAAS,EAAC,mBAAmB,EAAC,OAAO,EAAE,YAAY,WAAe;QAC1E,gCAAQ,SAAS,EAAC,wBAAwB,EAAC,OAAO,EAAE,aAAa,YAAgB,CAClF,CAAC;AACR,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B"}
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { ReactWidget } from '@theia/core/lib/browser';
3
+ import * as React from '@theia/core/shared/react';
4
+ import { Agent, AIVariable, AIVariableService } from '../../common';
5
+ import { AIConfigurationSelectionService } from './ai-configuration-service';
6
+ import { AgentService } from '../../common/agent-service';
7
+ export declare class AIVariableConfigurationWidget extends ReactWidget {
8
+ static readonly ID = "ai-variable-configuration-container-widget";
9
+ static readonly LABEL = "Variables";
10
+ protected readonly variableService: AIVariableService;
11
+ protected readonly agentService: AgentService;
12
+ protected readonly aiConfigurationSelectionService: AIConfigurationSelectionService;
13
+ protected init(): void;
14
+ protected render(): React.ReactNode;
15
+ protected renderReferencedVariables(variable: AIVariable): React.ReactNode | undefined;
16
+ protected renderArgs(variable: AIVariable): React.ReactNode | undefined;
17
+ protected showAgentConfiguration(agent: Agent): void;
18
+ protected getAgentsForVariable(variable: AIVariable): Agent[];
19
+ }
20
+ //# sourceMappingURL=variable-configuration-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variable-configuration-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/variable-configuration-widget.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAW,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,qBACa,6BAA8B,SAAQ,WAAW;IAE1D,MAAM,CAAC,QAAQ,CAAC,EAAE,gDAAgD;IAClE,MAAM,CAAC,QAAQ,CAAC,KAAK,eAAe;IAGpC,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC;IAGtD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAG9C,SAAS,CAAC,QAAQ,CAAC,+BAA+B,EAAE,+BAA+B,CAAC;IAGpF,SAAS,CAAC,IAAI,IAAI,IAAI;IAQtB,SAAS,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS;IAgBnC,SAAS,CAAC,yBAAyB,CAAC,QAAQ,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,GAAG,SAAS;IAkBtF,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,GAAG,SAAS;IAkBvE,SAAS,CAAC,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAKpD,SAAS,CAAC,oBAAoB,CAAC,QAAQ,EAAE,UAAU,GAAG,KAAK,EAAE;CAGhE"}
@@ -0,0 +1,99 @@
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
+ var AIVariableConfigurationWidget_1;
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.AIVariableConfigurationWidget = void 0;
20
+ const tslib_1 = require("tslib");
21
+ const browser_1 = require("@theia/core/lib/browser");
22
+ const inversify_1 = require("@theia/core/shared/inversify");
23
+ const React = require("@theia/core/shared/react");
24
+ const common_1 = require("../../common");
25
+ const agent_configuration_widget_1 = require("./agent-configuration-widget");
26
+ const ai_configuration_service_1 = require("./ai-configuration-service");
27
+ const agent_service_1 = require("../../common/agent-service");
28
+ let AIVariableConfigurationWidget = AIVariableConfigurationWidget_1 = class AIVariableConfigurationWidget extends browser_1.ReactWidget {
29
+ init() {
30
+ this.id = AIVariableConfigurationWidget_1.ID;
31
+ this.title.label = AIVariableConfigurationWidget_1.LABEL;
32
+ this.title.closable = false;
33
+ this.update();
34
+ this.toDispose.push(this.variableService.onDidChangeVariables(() => this.update()));
35
+ }
36
+ render() {
37
+ return React.createElement("div", { className: 'configuration-variables-list' },
38
+ React.createElement("ul", null, this.variableService.getVariables().map(variable => React.createElement("li", { key: variable.id, className: 'variable-item' },
39
+ React.createElement("div", { className: 'settings-section-title settings-section-category-title', style: { paddingLeft: 0, paddingBottom: 10 } }, variable.name),
40
+ React.createElement("small", null, variable.id),
41
+ React.createElement("small", null, variable.description),
42
+ this.renderReferencedVariables(variable),
43
+ this.renderArgs(variable)))));
44
+ }
45
+ renderReferencedVariables(variable) {
46
+ const agents = this.getAgentsForVariable(variable);
47
+ if (agents.length === 0) {
48
+ return;
49
+ }
50
+ return React.createElement("div", null,
51
+ React.createElement("h3", null, "Agents"),
52
+ React.createElement("ul", { className: 'variable-references' }, agents.map(agent => React.createElement("li", { key: agent.id, className: 'theia-TreeNode theia-CompositeTreeNode theia-ExpandableTreeNode theia-mod-selected' },
53
+ React.createElement("div", { onClick: () => { this.showAgentConfiguration(agent); }, className: 'variable-reference' },
54
+ React.createElement("span", null, agent.name),
55
+ React.createElement("i", { className: (0, browser_1.codicon)('chevron-right') }))))));
56
+ }
57
+ renderArgs(variable) {
58
+ if (variable.args === undefined || variable.args.length === 0) {
59
+ return;
60
+ }
61
+ return React.createElement("div", { className: 'variable-args-container' },
62
+ React.createElement("h3", null, "Variable Arguments"),
63
+ React.createElement("div", { className: 'variable-args' }, variable.args.map(arg => React.createElement(React.Fragment, { key: arg.name },
64
+ React.createElement("span", null, arg.name),
65
+ React.createElement("small", null, arg.description)))));
66
+ }
67
+ showAgentConfiguration(agent) {
68
+ this.aiConfigurationSelectionService.setActiveAgent(agent);
69
+ this.aiConfigurationSelectionService.selectConfigurationTab(agent_configuration_widget_1.AIAgentConfigurationWidget.ID);
70
+ }
71
+ getAgentsForVariable(variable) {
72
+ return this.agentService.getAgents().filter(a => { var _a; return (_a = a.variables) === null || _a === void 0 ? void 0 : _a.includes(variable.id); });
73
+ }
74
+ };
75
+ exports.AIVariableConfigurationWidget = AIVariableConfigurationWidget;
76
+ AIVariableConfigurationWidget.ID = 'ai-variable-configuration-container-widget';
77
+ AIVariableConfigurationWidget.LABEL = 'Variables';
78
+ tslib_1.__decorate([
79
+ (0, inversify_1.inject)(common_1.AIVariableService),
80
+ tslib_1.__metadata("design:type", Object)
81
+ ], AIVariableConfigurationWidget.prototype, "variableService", void 0);
82
+ tslib_1.__decorate([
83
+ (0, inversify_1.inject)(agent_service_1.AgentService),
84
+ tslib_1.__metadata("design:type", Object)
85
+ ], AIVariableConfigurationWidget.prototype, "agentService", void 0);
86
+ tslib_1.__decorate([
87
+ (0, inversify_1.inject)(ai_configuration_service_1.AIConfigurationSelectionService),
88
+ tslib_1.__metadata("design:type", ai_configuration_service_1.AIConfigurationSelectionService)
89
+ ], AIVariableConfigurationWidget.prototype, "aiConfigurationSelectionService", void 0);
90
+ tslib_1.__decorate([
91
+ (0, inversify_1.postConstruct)(),
92
+ tslib_1.__metadata("design:type", Function),
93
+ tslib_1.__metadata("design:paramtypes", []),
94
+ tslib_1.__metadata("design:returntype", void 0)
95
+ ], AIVariableConfigurationWidget.prototype, "init", null);
96
+ exports.AIVariableConfigurationWidget = AIVariableConfigurationWidget = AIVariableConfigurationWidget_1 = tslib_1.__decorate([
97
+ (0, inversify_1.injectable)()
98
+ ], AIVariableConfigurationWidget);
99
+ //# sourceMappingURL=variable-configuration-widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variable-configuration-widget.js","sourceRoot":"","sources":["../../../src/browser/ai-configuration/variable-configuration-widget.tsx"],"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,qDAA+D;AAC/D,4DAAiF;AACjF,kDAAkD;AAClD,yCAAoE;AACpE,6EAA0E;AAC1E,yEAA6E;AAC7E,8DAA0D;AAGnD,IAAM,6BAA6B,qCAAnC,MAAM,6BAA8B,SAAQ,qBAAW;IAehD,IAAI;QACV,IAAI,CAAC,EAAE,GAAG,+BAA6B,CAAC,EAAE,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,+BAA6B,CAAC,KAAK,CAAC;QACvD,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,SAAS,CAAC,IAAI,CAA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;sFAAC;AAG1E;IADT,IAAA,yBAAa,GAAE;;;;yDAOf;wCArBQ,6BAA6B;IADzC,IAAA,sBAAU,GAAE;GACA,6BAA6B,CAmFzC"}
@@ -0,0 +1,8 @@
1
+ import { FrontendApplicationContribution } from '@theia/core/lib/browser';
2
+ export declare class AICoreFrontendApplicationContribution implements FrontendApplicationContribution {
3
+ private readonly agentService;
4
+ private readonly promptService;
5
+ onStart(): void;
6
+ onStop(): void;
7
+ }
8
+ //# sourceMappingURL=ai-core-frontend-application-contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-core-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/ai-core-frontend-application-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAK1E,qBACa,qCAAsC,YAAW,+BAA+B;IAEzF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAG5C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAE9C,OAAO,IAAI,IAAI;IAQf,MAAM,IAAI,IAAI;CAEjB"}
@@ -0,0 +1,46 @@
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.AICoreFrontendApplicationContribution = 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 agent_service_1 = require("../common/agent-service");
23
+ let AICoreFrontendApplicationContribution = class AICoreFrontendApplicationContribution {
24
+ onStart() {
25
+ this.agentService.getAllAgents().forEach(a => {
26
+ a.promptTemplates.forEach(t => {
27
+ this.promptService.storePrompt(t.id, t.template);
28
+ });
29
+ });
30
+ }
31
+ onStop() {
32
+ }
33
+ };
34
+ exports.AICoreFrontendApplicationContribution = AICoreFrontendApplicationContribution;
35
+ tslib_1.__decorate([
36
+ (0, inversify_1.inject)(agent_service_1.AgentService),
37
+ tslib_1.__metadata("design:type", Object)
38
+ ], AICoreFrontendApplicationContribution.prototype, "agentService", void 0);
39
+ tslib_1.__decorate([
40
+ (0, inversify_1.inject)(common_1.PromptService),
41
+ tslib_1.__metadata("design:type", Object)
42
+ ], AICoreFrontendApplicationContribution.prototype, "promptService", void 0);
43
+ exports.AICoreFrontendApplicationContribution = AICoreFrontendApplicationContribution = tslib_1.__decorate([
44
+ (0, inversify_1.injectable)()
45
+ ], AICoreFrontendApplicationContribution);
46
+ //# sourceMappingURL=ai-core-frontend-application-contribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-core-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/ai-core-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;;;;AAGhF,4DAAkE;AAClE,sCAA0C;AAC1C,2DAAuD;AAGhD,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAO9C,OAAO;QACH,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACzC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBAC1B,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM;IACN,CAAC;CACJ,CAAA;AAjBY,sFAAqC;AAE7B;IADhB,IAAA,kBAAM,EAAC,4BAAY,CAAC;;2EACuB;AAG3B;IADhB,IAAA,kBAAM,EAAC,sBAAa,CAAC;;4EACwB;gDALrC,qCAAqC;IADjD,IAAA,sBAAU,GAAE;GACA,qCAAqC,CAiBjD"}
@@ -0,0 +1,4 @@
1
+ import { ContainerModule } from '@theia/core/shared/inversify';
2
+ declare const _default: ContainerModule;
3
+ export default _default;
4
+ //# sourceMappingURL=ai-core-frontend-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-core-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/ai-core-frontend-module.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AA+C/D,wBA6FG"}