@theia/ai-core 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/data/prompttemplate.tmLanguage.json +107 -0
- package/lib/browser/ai-activation-service.d.ts +17 -0
- package/lib/browser/ai-activation-service.d.ts.map +1 -0
- package/lib/browser/ai-activation-service.js +63 -0
- package/lib/browser/ai-activation-service.js.map +1 -0
- package/lib/browser/ai-command-handler-factory.d.ts +4 -0
- package/lib/browser/ai-command-handler-factory.d.ts.map +1 -0
- package/lib/browser/ai-command-handler-factory.js +20 -0
- package/lib/browser/ai-command-handler-factory.js.map +1 -0
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +28 -0
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/agent-configuration-widget.js +242 -0
- package/lib/browser/ai-configuration/agent-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts +13 -0
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-service.js +44 -0
- package/lib/browser/ai-configuration/ai-configuration-service.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts +12 -0
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.js +41 -0
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.js.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts +20 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.js +88 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/language-model-renderer.d.ts +13 -0
- package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +1 -0
- package/lib/browser/ai-configuration/language-model-renderer.js +104 -0
- package/lib/browser/ai-configuration/language-model-renderer.js.map +1 -0
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts +13 -0
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +1 -0
- package/lib/browser/ai-configuration/template-settings-renderer.js +71 -0
- package/lib/browser/ai-configuration/template-settings-renderer.js.map +1 -0
- package/lib/browser/ai-configuration/variable-configuration-widget.d.ts +20 -0
- package/lib/browser/ai-configuration/variable-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/variable-configuration-widget.js +99 -0
- package/lib/browser/ai-configuration/variable-configuration-widget.js.map +1 -0
- package/lib/browser/ai-core-frontend-application-contribution.d.ts +10 -0
- package/lib/browser/ai-core-frontend-application-contribution.d.ts.map +1 -0
- package/lib/browser/ai-core-frontend-application-contribution.js +46 -0
- package/lib/browser/ai-core-frontend-application-contribution.js.map +1 -0
- package/lib/browser/ai-core-frontend-module.d.ts +4 -0
- package/lib/browser/ai-core-frontend-module.d.ts.map +1 -0
- package/lib/browser/ai-core-frontend-module.js +122 -0
- package/lib/browser/ai-core-frontend-module.js.map +1 -0
- package/lib/browser/ai-core-preferences.d.ts +29 -0
- package/lib/browser/ai-core-preferences.d.ts.map +1 -0
- package/lib/browser/ai-core-preferences.js +98 -0
- package/lib/browser/ai-core-preferences.js.map +1 -0
- package/lib/browser/ai-settings-service.d.ts +14 -0
- package/lib/browser/ai-settings-service.d.ts.map +1 -0
- package/lib/browser/ai-settings-service.js +56 -0
- package/lib/browser/ai-settings-service.js.map +1 -0
- package/lib/browser/ai-view-contribution.d.ts +14 -0
- package/lib/browser/ai-view-contribution.d.ts.map +1 -0
- package/lib/browser/ai-view-contribution.js +71 -0
- package/lib/browser/ai-view-contribution.js.map +1 -0
- package/lib/browser/frontend-language-model-registry.d.ts +39 -0
- package/lib/browser/frontend-language-model-registry.d.ts.map +1 -0
- package/lib/browser/frontend-language-model-registry.js +321 -0
- package/lib/browser/frontend-language-model-registry.js.map +1 -0
- package/lib/browser/frontend-prompt-customization-service.d.ts +33 -0
- package/lib/browser/frontend-prompt-customization-service.d.ts.map +1 -0
- package/lib/browser/frontend-prompt-customization-service.js +237 -0
- package/lib/browser/frontend-prompt-customization-service.js.map +1 -0
- package/lib/browser/frontend-variable-service.d.ts +6 -0
- package/lib/browser/frontend-variable-service.d.ts.map +1 -0
- package/lib/browser/frontend-variable-service.js +31 -0
- package/lib/browser/frontend-variable-service.js.map +1 -0
- package/lib/browser/index.d.ts +11 -0
- package/lib/browser/index.d.ts.map +1 -0
- package/lib/browser/index.js +29 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/prompttemplate-contribution.d.ts +29 -0
- package/lib/browser/prompttemplate-contribution.d.ts.map +1 -0
- package/lib/browser/prompttemplate-contribution.js +208 -0
- package/lib/browser/prompttemplate-contribution.js.map +1 -0
- package/lib/browser/theia-variable-contribution.d.ts +13 -0
- package/lib/browser/theia-variable-contribution.d.ts.map +1 -0
- package/lib/browser/theia-variable-contribution.js +64 -0
- package/lib/browser/theia-variable-contribution.js.map +1 -0
- package/lib/common/agent-service.d.ts +66 -0
- package/lib/common/agent-service.d.ts.map +1 -0
- package/lib/common/agent-service.js +92 -0
- package/lib/common/agent-service.js.map +1 -0
- package/lib/common/agent.d.ts +45 -0
- package/lib/common/agent.d.ts.map +1 -0
- package/lib/common/agent.js +20 -0
- package/lib/common/agent.js.map +1 -0
- package/lib/common/agents-variable-contribution.d.ts +19 -0
- package/lib/common/agents-variable-contribution.d.ts.map +1 -0
- package/lib/common/agents-variable-contribution.js +56 -0
- package/lib/common/agents-variable-contribution.js.map +1 -0
- package/lib/common/communication-recording-service.d.ts +29 -0
- package/lib/common/communication-recording-service.d.ts.map +1 -0
- package/lib/common/communication-recording-service.js +20 -0
- package/lib/common/communication-recording-service.js.map +1 -0
- package/lib/common/index.d.ts +16 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +34 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/language-model-delegate.d.ts +24 -0
- package/lib/common/language-model-delegate.d.ts.map +1 -0
- package/lib/common/language-model-delegate.js +26 -0
- package/lib/common/language-model-delegate.js.map +1 -0
- package/lib/common/language-model-util.d.ts +16 -0
- package/lib/common/language-model-util.d.ts.map +1 -0
- package/lib/common/language-model-util.js +92 -0
- package/lib/common/language-model-util.js.map +1 -0
- package/lib/common/language-model.d.ts +144 -0
- package/lib/common/language-model.d.ts.map +1 -0
- package/lib/common/language-model.js +142 -0
- package/lib/common/language-model.js.map +1 -0
- package/lib/common/language-model.spec.d.ts +2 -0
- package/lib/common/language-model.spec.d.ts.map +1 -0
- package/lib/common/language-model.spec.js +62 -0
- package/lib/common/language-model.spec.js.map +1 -0
- package/lib/common/prompt-service-util.d.ts +8 -0
- package/lib/common/prompt-service-util.d.ts.map +1 -0
- package/lib/common/prompt-service-util.js +34 -0
- package/lib/common/prompt-service-util.js.map +1 -0
- package/lib/common/prompt-service.d.ts +161 -0
- package/lib/common/prompt-service.d.ts.map +1 -0
- package/lib/common/prompt-service.js +204 -0
- package/lib/common/prompt-service.js.map +1 -0
- package/lib/common/prompt-service.spec.d.ts +2 -0
- package/lib/common/prompt-service.spec.d.ts.map +1 -0
- package/lib/common/prompt-service.spec.js +254 -0
- package/lib/common/prompt-service.spec.js.map +1 -0
- package/lib/common/protocol.d.ts +7 -0
- package/lib/common/protocol.d.ts.map +1 -0
- package/lib/common/protocol.js +20 -0
- package/lib/common/protocol.js.map +1 -0
- package/lib/common/settings-service.d.ts +23 -0
- package/lib/common/settings-service.d.ts.map +1 -0
- package/lib/common/settings-service.js +5 -0
- package/lib/common/settings-service.js.map +1 -0
- package/lib/common/today-variable-contribution.d.ts +17 -0
- package/lib/common/today-variable-contribution.d.ts.map +1 -0
- package/lib/common/today-variable-contribution.js +48 -0
- package/lib/common/today-variable-contribution.js.map +1 -0
- package/lib/common/tomorrow-variable-contribution.d.ts +17 -0
- package/lib/common/tomorrow-variable-contribution.d.ts.map +1 -0
- package/lib/common/tomorrow-variable-contribution.js +48 -0
- package/lib/common/tomorrow-variable-contribution.js.map +1 -0
- package/lib/common/tool-invocation-registry.d.ts +23 -0
- package/lib/common/tool-invocation-registry.d.ts.map +1 -0
- package/lib/common/tool-invocation-registry.js +72 -0
- package/lib/common/tool-invocation-registry.js.map +1 -0
- package/lib/common/variable-service.d.ts +70 -0
- package/lib/common/variable-service.d.ts.map +1 -0
- package/lib/common/variable-service.js +122 -0
- package/lib/common/variable-service.js.map +1 -0
- package/lib/node/ai-core-backend-module.d.ts +4 -0
- package/lib/node/ai-core-backend-module.d.ts.map +1 -0
- package/lib/node/ai-core-backend-module.js +47 -0
- package/lib/node/ai-core-backend-module.js.map +1 -0
- package/lib/node/backend-language-model-registry.d.ts +12 -0
- package/lib/node/backend-language-model-registry.d.ts.map +1 -0
- package/lib/node/backend-language-model-registry.js +61 -0
- package/lib/node/backend-language-model-registry.js.map +1 -0
- package/lib/node/language-model-frontend-delegate.d.ts +18 -0
- package/lib/node/language-model-frontend-delegate.d.ts.map +1 -0
- package/lib/node/language-model-frontend-delegate.js +100 -0
- package/lib/node/language-model-frontend-delegate.js.map +1 -0
- package/package.json +61 -0
- package/src/browser/ai-activation-service.ts +56 -0
- package/src/browser/ai-command-handler-factory.ts +20 -0
- package/src/browser/ai-configuration/agent-configuration-widget.tsx +324 -0
- package/src/browser/ai-configuration/ai-configuration-service.ts +43 -0
- package/src/browser/ai-configuration/ai-configuration-view-contribution.ts +54 -0
- package/src/browser/ai-configuration/ai-configuration-widget.tsx +80 -0
- package/src/browser/ai-configuration/language-model-renderer.tsx +113 -0
- package/src/browser/ai-configuration/template-settings-renderer.tsx +128 -0
- package/src/browser/ai-configuration/variable-configuration-widget.tsx +110 -0
- package/src/browser/ai-core-frontend-application-contribution.ts +39 -0
- package/src/browser/ai-core-frontend-module.ts +161 -0
- package/src/browser/ai-core-preferences.ts +115 -0
- package/src/browser/ai-settings-service.ts +50 -0
- package/src/browser/ai-view-contribution.ts +77 -0
- package/src/browser/frontend-language-model-registry.ts +405 -0
- package/src/browser/frontend-prompt-customization-service.ts +243 -0
- package/src/browser/frontend-variable-service.ts +26 -0
- package/src/browser/index.ts +26 -0
- package/src/browser/prompttemplate-contribution.ts +252 -0
- package/src/browser/style/index.css +127 -0
- package/src/browser/theia-variable-contribution.ts +58 -0
- package/src/common/agent-service.ts +137 -0
- package/src/common/agent.ts +70 -0
- package/src/common/agents-variable-contribution.ts +64 -0
- package/src/common/communication-recording-service.ts +53 -0
- package/src/common/index.ts +30 -0
- package/src/common/language-model-delegate.ts +45 -0
- package/src/common/language-model-util.ts +84 -0
- package/src/common/language-model.spec.ts +86 -0
- package/src/common/language-model.ts +242 -0
- package/src/common/prompt-service-util.ts +31 -0
- package/src/common/prompt-service.spec.ts +301 -0
- package/src/common/prompt-service.ts +334 -0
- package/src/common/protocol.ts +23 -0
- package/src/common/settings-service.ts +38 -0
- package/src/common/today-variable-contribution.ts +67 -0
- package/src/common/tomorrow-variable-contribution.ts +66 -0
- package/src/common/tool-invocation-registry.ts +79 -0
- package/src/common/variable-service.ts +177 -0
- package/src/node/ai-core-backend-module.ts +83 -0
- package/src/node/backend-language-model-registry.ts +59 -0
- package/src/node/language-model-frontend-delegate.ts +116 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FrontendApplication } from '@theia/core/lib/browser';
|
|
2
|
+
import { AIViewContribution } from '../ai-view-contribution';
|
|
3
|
+
import { AIConfigurationContainerWidget } from './ai-configuration-widget';
|
|
4
|
+
import { Command, CommandRegistry } from '@theia/core';
|
|
5
|
+
export declare const AI_CONFIGURATION_TOGGLE_COMMAND_ID = "aiConfiguration:toggle";
|
|
6
|
+
export declare const OPEN_AI_CONFIG_VIEW: Command;
|
|
7
|
+
export declare class AIAgentConfigurationViewContribution extends AIViewContribution<AIConfigurationContainerWidget> {
|
|
8
|
+
constructor();
|
|
9
|
+
initializeLayout(_app: FrontendApplication): Promise<void>;
|
|
10
|
+
registerCommands(commands: CommandRegistry): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ai-configuration-view-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-configuration-view-contribution.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/ai-configuration-view-contribution.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,kCAAkC,2BAA2B,CAAC;AAC3E,eAAO,MAAM,mBAAmB,SAG9B,CAAC;AAEH,qBACa,oCAAqC,SAAQ,kBAAkB,CAAC,8BAA8B,CAAC;;IAclG,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;CAM7D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AIAgentConfigurationViewContribution = exports.OPEN_AI_CONFIG_VIEW = exports.AI_CONFIGURATION_TOGGLE_COMMAND_ID = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
6
|
+
const ai_view_contribution_1 = require("../ai-view-contribution");
|
|
7
|
+
const ai_configuration_widget_1 = require("./ai-configuration-widget");
|
|
8
|
+
const core_1 = require("@theia/core");
|
|
9
|
+
exports.AI_CONFIGURATION_TOGGLE_COMMAND_ID = 'aiConfiguration:toggle';
|
|
10
|
+
exports.OPEN_AI_CONFIG_VIEW = core_1.Command.toLocalizedCommand({
|
|
11
|
+
id: 'aiConfiguration:open',
|
|
12
|
+
label: 'Open AI Configuration view',
|
|
13
|
+
});
|
|
14
|
+
let AIAgentConfigurationViewContribution = class AIAgentConfigurationViewContribution extends ai_view_contribution_1.AIViewContribution {
|
|
15
|
+
constructor() {
|
|
16
|
+
super({
|
|
17
|
+
widgetId: ai_configuration_widget_1.AIConfigurationContainerWidget.ID,
|
|
18
|
+
widgetName: ai_configuration_widget_1.AIConfigurationContainerWidget.LABEL,
|
|
19
|
+
defaultWidgetOptions: {
|
|
20
|
+
area: 'main',
|
|
21
|
+
rank: 100
|
|
22
|
+
},
|
|
23
|
+
toggleCommandId: exports.AI_CONFIGURATION_TOGGLE_COMMAND_ID
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async initializeLayout(_app) {
|
|
27
|
+
await this.openView();
|
|
28
|
+
}
|
|
29
|
+
registerCommands(commands) {
|
|
30
|
+
super.registerCommands(commands);
|
|
31
|
+
commands.registerCommand(exports.OPEN_AI_CONFIG_VIEW, {
|
|
32
|
+
execute: () => this.openView({ activate: true }),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.AIAgentConfigurationViewContribution = AIAgentConfigurationViewContribution;
|
|
37
|
+
exports.AIAgentConfigurationViewContribution = AIAgentConfigurationViewContribution = tslib_1.__decorate([
|
|
38
|
+
(0, inversify_1.injectable)(),
|
|
39
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
40
|
+
], AIAgentConfigurationViewContribution);
|
|
41
|
+
//# sourceMappingURL=ai-configuration-view-contribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-configuration-view-contribution.js","sourceRoot":"","sources":["../../../src/browser/ai-configuration/ai-configuration-view-contribution.ts"],"names":[],"mappings":";;;;AAgBA,4DAA0D;AAC1D,kEAA6D;AAC7D,uEAA2E;AAC3E,sCAAuD;AAE1C,QAAA,kCAAkC,GAAG,wBAAwB,CAAC;AAC9D,QAAA,mBAAmB,GAAG,cAAO,CAAC,kBAAkB,CAAC;IAC1D,EAAE,EAAE,sBAAsB;IAC1B,KAAK,EAAE,4BAA4B;CACtC,CAAC,CAAC;AAGI,IAAM,oCAAoC,GAA1C,MAAM,oCAAqC,SAAQ,yCAAkD;IAExG;QACI,KAAK,CAAC;YACF,QAAQ,EAAE,wDAA8B,CAAC,EAAE;YAC3C,UAAU,EAAE,wDAA8B,CAAC,KAAK;YAChD,oBAAoB,EAAE;gBAClB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,GAAG;aACZ;YACD,eAAe,EAAE,0CAAkC;SACtD,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,IAAyB;QAC5C,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAEQ,gBAAgB,CAAC,QAAyB;QAC/C,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACjC,QAAQ,CAAC,eAAe,CAAC,2BAAmB,EAAE;YAC1C,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SACnD,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAxBY,oFAAoC;+CAApC,oCAAoC;IADhD,IAAA,sBAAU,GAAE;;GACA,oCAAoC,CAwBhD"}
|
|
@@ -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,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,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.sort((a, b) => { var _a, _b; return ((_a = a.name) !== null && _a !== void 0 ? _a : a.id).localeCompare((_b = b.name) !== null && _b !== void 0 ? _b : b.id); }).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":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C,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;oBAErE,gCAAQ,KAAK,EAAC,EAAE,GAAU,EACzB,cAAc,aAAd,cAAc;oBAAd,cAAc,CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,eAAC,OAAA,CAAC,MAAA,CAAC,CAAC,IAAI,mCAAI,CAAC,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,MAAA,CAAC,CAAC,IAAI,mCAAI,CAAC,CAAC,EAAE,CAAC,CAAA,EAAA,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE;;wBAAC,OAAA,CACzF,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,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as React from '@theia/core/shared/react';
|
|
3
|
+
import { PromptCustomizationService, PromptService } from '../../common/prompt-service';
|
|
4
|
+
import { AISettingsService, PromptTemplate } from '../../common';
|
|
5
|
+
export interface TemplateRendererProps {
|
|
6
|
+
agentId: string;
|
|
7
|
+
template: PromptTemplate;
|
|
8
|
+
promptCustomizationService: PromptCustomizationService;
|
|
9
|
+
promptService: PromptService;
|
|
10
|
+
aiSettingsService: AISettingsService;
|
|
11
|
+
}
|
|
12
|
+
export declare const TemplateRenderer: React.FC<TemplateRendererProps>;
|
|
13
|
+
//# 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,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAIjE,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,0BAA0B,EAAE,0BAA0B,CAAC;IACvD,aAAa,EAAE,aAAa,CAAC;IAC7B,iBAAiB,EAAE,iBAAiB,CAAC;CACxC;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAkG5D,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 DEFAULT_VARIANT = 'default';
|
|
21
|
+
const TemplateRenderer = ({ agentId, template, promptCustomizationService, promptService, aiSettingsService, }) => {
|
|
22
|
+
const variantIds = [DEFAULT_VARIANT, ...promptService.getVariantIds(template.id)];
|
|
23
|
+
const [selectedVariant, setSelectedVariant] = React.useState(DEFAULT_VARIANT);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
(async () => {
|
|
26
|
+
var _a;
|
|
27
|
+
const agentSettings = await aiSettingsService.getAgentSettings(agentId);
|
|
28
|
+
const currentVariant = ((_a = agentSettings === null || agentSettings === void 0 ? void 0 : agentSettings.selectedVariants) === null || _a === void 0 ? void 0 : _a[template.id]) || DEFAULT_VARIANT;
|
|
29
|
+
setSelectedVariant(currentVariant);
|
|
30
|
+
})();
|
|
31
|
+
}, [template.id, aiSettingsService, agentId]);
|
|
32
|
+
const isInvalidVariant = !variantIds.includes(selectedVariant);
|
|
33
|
+
const handleVariantChange = async (event) => {
|
|
34
|
+
const newVariant = event.target.value;
|
|
35
|
+
setSelectedVariant(newVariant);
|
|
36
|
+
const agentSettings = await aiSettingsService.getAgentSettings(agentId);
|
|
37
|
+
const selectedVariants = (agentSettings === null || agentSettings === void 0 ? void 0 : agentSettings.selectedVariants) || {};
|
|
38
|
+
const updatedVariants = { ...selectedVariants };
|
|
39
|
+
if (newVariant === DEFAULT_VARIANT) {
|
|
40
|
+
delete updatedVariants[template.id];
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
updatedVariants[template.id] = newVariant;
|
|
44
|
+
}
|
|
45
|
+
await aiSettingsService.updateAgentSettings(agentId, {
|
|
46
|
+
selectedVariants: updatedVariants,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const openTemplate = () => {
|
|
50
|
+
const templateId = selectedVariant === DEFAULT_VARIANT ? template.id : selectedVariant;
|
|
51
|
+
const selectedTemplate = promptService.getRawPrompt(templateId);
|
|
52
|
+
promptCustomizationService.editTemplate(templateId, (selectedTemplate === null || selectedTemplate === void 0 ? void 0 : selectedTemplate.template) || '');
|
|
53
|
+
};
|
|
54
|
+
const resetTemplate = () => {
|
|
55
|
+
const templateId = selectedVariant === DEFAULT_VARIANT ? template.id : selectedVariant;
|
|
56
|
+
promptCustomizationService.resetTemplate(templateId);
|
|
57
|
+
};
|
|
58
|
+
return (React.createElement("div", { className: "template-renderer" },
|
|
59
|
+
React.createElement("div", { className: "settings-section-title template-header" },
|
|
60
|
+
React.createElement("strong", null, template.id)),
|
|
61
|
+
React.createElement("div", { className: "template-controls" },
|
|
62
|
+
(variantIds.length > 1 || isInvalidVariant) && (React.createElement(React.Fragment, null,
|
|
63
|
+
React.createElement("label", { htmlFor: `variant-selector-${template.id}`, className: "template-select-label" }, "Select Variant:"),
|
|
64
|
+
React.createElement("select", { id: `variant-selector-${template.id}`, className: `theia-select template-variant-selector ${isInvalidVariant ? 'error' : ''}`, value: isInvalidVariant ? 'invalid' : selectedVariant, onChange: handleVariantChange },
|
|
65
|
+
isInvalidVariant && (React.createElement("option", { value: "invalid", disabled: true }, "The selected variant is no longer available")),
|
|
66
|
+
variantIds.map(variantId => (React.createElement("option", { key: variantId, value: variantId }, variantId)))))),
|
|
67
|
+
React.createElement("button", { className: "theia-button main", onClick: openTemplate, disabled: isInvalidVariant }, "Edit"),
|
|
68
|
+
React.createElement("button", { className: "theia-button secondary", onClick: resetTemplate, disabled: isInvalidVariant }, "Reset"))));
|
|
69
|
+
};
|
|
70
|
+
exports.TemplateRenderer = TemplateRenderer;
|
|
71
|
+
//# 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;AAIlD,MAAM,eAAe,GA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ACI,EAAE,EAAE,oBAAoB,QAAQ,CAAC,EAAE,EAAE,EACrC,SAAS,EAAE,0CAA0C,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EACtF,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,EACrD,QAAQ,EAAE,mBAAmB;oBAE5B,gBAAgB,IAAI,CACjB,gCAAQ,KAAK,EAAC,SAAS,EAAC,QAAQ,wDAEvB,CACZ;oBACA,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CACzB,gCAAQ,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,IACnC,SAAS,CACL,CACZ,CAAC,CACG,CACV,CACN;YACD,gCACI,SAAS,EAAC,mBAAmB,EAC7B,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,gBAAgB,WAGrB;YACT,gCACI,SAAS,EAAC,wBAAwB,EAClC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,gBAAgB,YAGrB,CACP,CACJ,CACT,CAAC;AACN,CAAC,CAAC;AAlGW,QAAA,gBAAgB,oBAkG3B"}
|
|
@@ -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,CAAC,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxF,CAAC;IAES,MAAM;QACZ,OAAO,6BAAK,SAAS,EAAC,8BAA8B;YAChD,gCACK,IAAI,CAAC,eAAe,CAAC,YAA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{ Agent } from '../common';
|
|
3
|
+
import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
|
|
4
|
+
export declare class AICoreFrontendApplicationContribution implements FrontendApplicationContribution {
|
|
5
|
+
private readonly agentService;
|
|
6
|
+
protected readonly agentsProvider: ContributionProvider<Agent>;
|
|
7
|
+
onStart(): void;
|
|
8
|
+
onStop(): void;
|
|
9
|
+
}
|
|
10
|
+
//# 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;AAE1E,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAEpF,qBACa,qCAAsC,YAAW,+BAA+B;IAEzF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAG5C,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAE/D,OAAO,IAAI,IAAI;IAMf,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
|
+
const contribution_provider_1 = require("@theia/core/lib/common/contribution-provider");
|
|
24
|
+
let AICoreFrontendApplicationContribution = class AICoreFrontendApplicationContribution {
|
|
25
|
+
onStart() {
|
|
26
|
+
this.agentsProvider.getContributions().forEach(agent => {
|
|
27
|
+
this.agentService.registerAgent(agent);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
onStop() {
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.AICoreFrontendApplicationContribution = AICoreFrontendApplicationContribution;
|
|
34
|
+
tslib_1.__decorate([
|
|
35
|
+
(0, inversify_1.inject)(agent_service_1.AgentService),
|
|
36
|
+
tslib_1.__metadata("design:type", Object)
|
|
37
|
+
], AICoreFrontendApplicationContribution.prototype, "agentService", void 0);
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, inversify_1.inject)(contribution_provider_1.ContributionProvider),
|
|
40
|
+
(0, inversify_1.named)(common_1.Agent),
|
|
41
|
+
tslib_1.__metadata("design:type", Object)
|
|
42
|
+
], AICoreFrontendApplicationContribution.prototype, "agentsProvider", 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,4DAAyE;AACzE,sCAAkC;AAClC,2DAAuD;AACvD,wFAAoF;AAG7E,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAO9C,OAAO;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACnD,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM;IACN,CAAC;CACJ,CAAA;AAfY,sFAAqC;AAE7B;IADhB,IAAA,kBAAM,EAAC,4BAAY,CAAC;;2EACuB;AAGzB;IADlB,IAAA,kBAAM,EAAC,4CAAoB,CAAC;IAAE,IAAA,iBAAK,EAAC,cAAK,CAAC;;6EACoB;gDALtD,qCAAqC;IADjD,IAAA,sBAAU,GAAE;GACA,qCAAqC,CAejD"}
|