@theia/ai-ide 1.64.0-next.28 → 1.64.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.
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +5 -2
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/agent-configuration-widget.js +15 -1
- package/lib/browser/ai-configuration/agent-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts +6 -1
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-service.js +10 -1
- package/lib/browser/ai-configuration/ai-configuration-service.js.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts +2 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.js +7 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/language-model-renderer.d.ts +4 -2
- package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +1 -1
- package/lib/browser/ai-configuration/language-model-renderer.js +49 -71
- package/lib/browser/ai-configuration/language-model-renderer.js.map +1 -1
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts +41 -0
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.js +225 -0
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts +7 -3
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js +35 -13
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +1 -1
- package/lib/browser/ai-configuration/template-settings-renderer.js +11 -6
- package/lib/browser/ai-configuration/template-settings-renderer.js.map +1 -1
- package/lib/browser/ai-ide-activation-service.d.ts +18 -0
- package/lib/browser/ai-ide-activation-service.d.ts.map +1 -0
- package/lib/browser/ai-ide-activation-service.js +72 -0
- package/lib/browser/ai-ide-activation-service.js.map +1 -0
- package/lib/browser/ai-ide-preferences.d.ts +4 -0
- package/lib/browser/ai-ide-preferences.d.ts.map +1 -0
- package/lib/browser/ai-ide-preferences.js +43 -0
- package/lib/browser/ai-ide-preferences.js.map +1 -0
- package/lib/browser/app-tester-chat-agent.d.ts +3 -6
- package/lib/browser/app-tester-chat-agent.d.ts.map +1 -1
- package/lib/browser/app-tester-chat-agent.js +6 -71
- package/lib/browser/app-tester-chat-agent.js.map +1 -1
- package/lib/browser/app-tester-prompt-template.d.ts +6 -0
- package/lib/browser/app-tester-prompt-template.d.ts.map +1 -0
- package/lib/browser/app-tester-prompt-template.js +79 -0
- package/lib/browser/app-tester-prompt-template.js.map +1 -0
- package/lib/browser/architect-agent.js +1 -1
- package/lib/browser/architect-agent.js.map +1 -1
- package/lib/browser/coder-agent.js +1 -1
- package/lib/browser/coder-agent.js.map +1 -1
- package/lib/browser/context-functions.d.ts.map +1 -1
- package/lib/browser/context-functions.js +12 -0
- package/lib/browser/context-functions.js.map +1 -1
- package/lib/browser/context-functions.spec.d.ts +2 -0
- package/lib/browser/context-functions.spec.d.ts.map +1 -0
- package/lib/browser/context-functions.spec.js +93 -0
- package/lib/browser/context-functions.spec.js.map +1 -0
- package/lib/browser/file-changeset-function.spec.d.ts +2 -0
- package/lib/browser/file-changeset-function.spec.d.ts.map +1 -0
- package/lib/browser/file-changeset-function.spec.js +45 -0
- package/lib/browser/file-changeset-function.spec.js.map +1 -0
- package/lib/browser/file-changeset-functions.d.ts +13 -3
- package/lib/browser/file-changeset-functions.d.ts.map +1 -1
- package/lib/browser/file-changeset-functions.js +100 -29
- package/lib/browser/file-changeset-functions.js.map +1 -1
- package/lib/browser/file-changeset-functions.spec.d.ts +2 -0
- package/lib/browser/file-changeset-functions.spec.d.ts.map +1 -0
- package/lib/browser/file-changeset-functions.spec.js +161 -0
- package/lib/browser/file-changeset-functions.spec.js.map +1 -0
- package/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +20 -0
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/ide-chat-welcome-message-provider.js +2 -2
- package/lib/browser/ide-chat-welcome-message-provider.js.map +1 -1
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.d.ts +2 -0
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.d.ts.map +1 -0
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.js +52 -0
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.js.map +1 -0
- package/lib/browser/workspace-functions.d.ts +3 -3
- package/lib/browser/workspace-functions.d.ts.map +1 -1
- package/lib/browser/workspace-functions.js +79 -28
- package/lib/browser/workspace-functions.js.map +1 -1
- package/lib/browser/workspace-functions.spec.d.ts +2 -0
- package/lib/browser/workspace-functions.spec.d.ts.map +1 -0
- package/lib/browser/workspace-functions.spec.js +161 -0
- package/lib/browser/workspace-functions.spec.js.map +1 -0
- package/lib/browser/workspace-launch-provider.d.ts +24 -0
- package/lib/browser/workspace-launch-provider.d.ts.map +1 -0
- package/lib/browser/workspace-launch-provider.js +216 -0
- package/lib/browser/workspace-launch-provider.js.map +1 -0
- package/lib/browser/workspace-launch-provider.spec.d.ts +2 -0
- package/lib/browser/workspace-launch-provider.spec.d.ts.map +1 -0
- package/lib/browser/workspace-launch-provider.spec.js +245 -0
- package/lib/browser/workspace-launch-provider.spec.js.map +1 -0
- package/lib/browser/workspace-search-provider.d.ts.map +1 -1
- package/lib/browser/workspace-search-provider.js +9 -0
- package/lib/browser/workspace-search-provider.js.map +1 -1
- package/lib/browser/workspace-search-provider.spec.js +59 -203
- package/lib/browser/workspace-search-provider.spec.js.map +1 -1
- package/lib/browser/workspace-task-provider.d.ts.map +1 -1
- package/lib/browser/workspace-task-provider.js +8 -1
- package/lib/browser/workspace-task-provider.js.map +1 -1
- package/lib/browser/workspace-task-provider.spec.d.ts +2 -0
- package/lib/browser/workspace-task-provider.spec.d.ts.map +1 -0
- package/lib/browser/workspace-task-provider.spec.js +109 -0
- package/lib/browser/workspace-task-provider.spec.js.map +1 -0
- package/lib/common/architect-prompt-template.d.ts.map +1 -1
- package/lib/common/architect-prompt-template.js +11 -0
- package/lib/common/architect-prompt-template.js.map +1 -1
- package/lib/common/command-chat-agents.js +1 -1
- package/lib/common/command-chat-agents.js.map +1 -1
- package/lib/common/orchestrator-chat-agent.js +1 -1
- package/lib/common/orchestrator-chat-agent.js.map +1 -1
- package/lib/common/universal-chat-agent.js +1 -1
- package/lib/common/universal-chat-agent.js.map +1 -1
- package/lib/common/workspace-functions.d.ts +3 -0
- package/lib/common/workspace-functions.d.ts.map +1 -1
- package/lib/common/workspace-functions.js +4 -1
- package/lib/common/workspace-functions.js.map +1 -1
- package/package.json +18 -17
- package/src/browser/ai-configuration/agent-configuration-widget.tsx +18 -2
- package/src/browser/ai-configuration/ai-configuration-service.ts +14 -1
- package/src/browser/ai-configuration/ai-configuration-widget.tsx +7 -1
- package/src/browser/ai-configuration/language-model-renderer.tsx +87 -59
- package/src/browser/ai-configuration/model-aliases-configuration-widget.tsx +279 -0
- package/src/browser/ai-configuration/prompt-fragments-configuration-widget.tsx +43 -13
- package/src/browser/ai-configuration/template-settings-renderer.tsx +11 -7
- package/src/browser/ai-ide-activation-service.ts +65 -0
- package/src/browser/ai-ide-preferences.ts +44 -0
- package/src/browser/app-tester-chat-agent.ts +5 -73
- package/src/browser/app-tester-prompt-template.ts +81 -0
- package/src/browser/architect-agent.ts +1 -1
- package/src/browser/coder-agent.ts +1 -1
- package/src/browser/context-functions.spec.ts +102 -0
- package/src/browser/context-functions.ts +11 -0
- package/src/browser/file-changeset-function.spec.ts +52 -0
- package/src/browser/file-changeset-functions.spec.ts +212 -0
- package/src/browser/file-changeset-functions.ts +102 -25
- package/src/browser/frontend-module.ts +29 -1
- package/src/browser/ide-chat-welcome-message-provider.tsx +4 -4
- package/src/browser/style/index.css +111 -6
- package/src/browser/test/tool-provider-cancellation-test-util.spec.ts +60 -0
- package/src/browser/workspace-functions.spec.ts +199 -0
- package/src/browser/workspace-functions.ts +105 -32
- package/src/browser/workspace-launch-provider.spec.ts +320 -0
- package/src/browser/workspace-launch-provider.ts +231 -0
- package/src/browser/workspace-search-provider.spec.ts +79 -229
- package/src/browser/workspace-search-provider.ts +10 -1
- package/src/browser/workspace-task-provider.spec.ts +125 -0
- package/src/browser/workspace-task-provider.ts +7 -2
- package/src/common/architect-prompt-template.ts +11 -0
- package/src/common/command-chat-agents.ts +1 -1
- package/src/common/orchestrator-chat-agent.ts +1 -1
- package/src/common/universal-chat-agent.ts +1 -1
- package/src/common/workspace-functions.ts +3 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RUN_TASK_FUNCTION_ID = exports.LIST_TASKS_FUNCTION_ID = exports.SEARCH_IN_WORKSPACE_FUNCTION_ID = exports.GET_FILE_DIAGNOSTICS_ID = exports.GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID = exports.GET_WORKSPACE_FILE_LIST_FUNCTION_ID = exports.FILE_CONTENT_FUNCTION_ID = void 0;
|
|
3
|
+
exports.STOP_LAUNCH_CONFIGURATION_FUNCTION_ID = exports.RUN_LAUNCH_CONFIGURATION_FUNCTION_ID = exports.LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID = exports.RUN_TASK_FUNCTION_ID = exports.LIST_TASKS_FUNCTION_ID = exports.SEARCH_IN_WORKSPACE_FUNCTION_ID = exports.GET_FILE_DIAGNOSTICS_ID = exports.GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID = exports.GET_WORKSPACE_FILE_LIST_FUNCTION_ID = exports.FILE_CONTENT_FUNCTION_ID = void 0;
|
|
4
4
|
// *****************************************************************************
|
|
5
5
|
// Copyright (C) 2024 EclipseSource GmbH.
|
|
6
6
|
//
|
|
@@ -23,4 +23,7 @@ exports.GET_FILE_DIAGNOSTICS_ID = 'getFileDiagnostics';
|
|
|
23
23
|
exports.SEARCH_IN_WORKSPACE_FUNCTION_ID = 'searchInWorkspace';
|
|
24
24
|
exports.LIST_TASKS_FUNCTION_ID = 'listTasks';
|
|
25
25
|
exports.RUN_TASK_FUNCTION_ID = 'runTask';
|
|
26
|
+
exports.LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID = 'listLaunchConfigurations';
|
|
27
|
+
exports.RUN_LAUNCH_CONFIGURATION_FUNCTION_ID = 'runLaunchConfiguration';
|
|
28
|
+
exports.STOP_LAUNCH_CONFIGURATION_FUNCTION_ID = 'stopLaunchConfiguration';
|
|
26
29
|
//# sourceMappingURL=workspace-functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-functions.js","sourceRoot":"","sources":["../../src/common/workspace-functions.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AACnE,QAAA,wBAAwB,GAAG,gBAAgB,CAAC;AAC5C,QAAA,mCAAmC,GAAG,sBAAsB,CAAC;AAC7D,QAAA,6CAA6C,GAAG,gCAAgC,CAAC;AACjF,QAAA,uBAAuB,GAAG,oBAAoB,CAAC;AAC/C,QAAA,+BAA+B,GAAG,mBAAmB,CAAC;AACtD,QAAA,sBAAsB,GAAG,WAAW,CAAC;AACrC,QAAA,oBAAoB,GAAG,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"workspace-functions.js","sourceRoot":"","sources":["../../src/common/workspace-functions.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AACnE,QAAA,wBAAwB,GAAG,gBAAgB,CAAC;AAC5C,QAAA,mCAAmC,GAAG,sBAAsB,CAAC;AAC7D,QAAA,6CAA6C,GAAG,gCAAgC,CAAC;AACjF,QAAA,uBAAuB,GAAG,oBAAoB,CAAC;AAC/C,QAAA,+BAA+B,GAAG,mBAAmB,CAAC;AACtD,QAAA,sBAAsB,GAAG,WAAW,CAAC;AACrC,QAAA,oBAAoB,GAAG,SAAS,CAAC;AACjC,QAAA,sCAAsC,GAAG,0BAA0B,CAAC;AACpE,QAAA,oCAAoC,GAAG,wBAAwB,CAAC;AAChE,QAAA,qCAAqC,GAAG,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-ide",
|
|
3
|
-
"version": "1.64.0
|
|
3
|
+
"version": "1.64.0",
|
|
4
4
|
"description": "AI IDE Agents Extension",
|
|
5
5
|
"license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,19 +15,20 @@
|
|
|
15
15
|
"theia-extension"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@theia/ai-chat": "1.64.0
|
|
19
|
-
"@theia/ai-chat-ui": "1.64.0
|
|
20
|
-
"@theia/ai-core": "1.64.0
|
|
21
|
-
"@theia/ai-mcp": "1.64.0
|
|
22
|
-
"@theia/core": "1.64.0
|
|
23
|
-
"@theia/
|
|
24
|
-
"@theia/
|
|
25
|
-
"@theia/
|
|
26
|
-
"@theia/
|
|
27
|
-
"@theia/
|
|
28
|
-
"@theia/
|
|
29
|
-
"@theia/
|
|
30
|
-
"@theia/
|
|
18
|
+
"@theia/ai-chat": "1.64.0",
|
|
19
|
+
"@theia/ai-chat-ui": "1.64.0",
|
|
20
|
+
"@theia/ai-core": "1.64.0",
|
|
21
|
+
"@theia/ai-mcp": "1.64.0",
|
|
22
|
+
"@theia/core": "1.64.0",
|
|
23
|
+
"@theia/debug": "1.64.0",
|
|
24
|
+
"@theia/filesystem": "1.64.0",
|
|
25
|
+
"@theia/markers": "1.64.0",
|
|
26
|
+
"@theia/monaco": "1.64.0",
|
|
27
|
+
"@theia/navigator": "1.64.0",
|
|
28
|
+
"@theia/search-in-workspace": "1.64.0",
|
|
29
|
+
"@theia/task": "1.64.0",
|
|
30
|
+
"@theia/terminal": "1.64.0",
|
|
31
|
+
"@theia/workspace": "1.64.0",
|
|
31
32
|
"date-fns": "^4.1.0",
|
|
32
33
|
"ignore": "^6.0.0",
|
|
33
34
|
"js-yaml": "^4.1.0",
|
|
@@ -38,8 +39,8 @@
|
|
|
38
39
|
"access": "public"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@theia/cli": "1.64.0
|
|
42
|
-
"@theia/test": "1.64.0
|
|
42
|
+
"@theia/cli": "1.64.0",
|
|
43
|
+
"@theia/test": "1.64.0"
|
|
43
44
|
},
|
|
44
45
|
"theiaExtensions": [
|
|
45
46
|
{
|
|
@@ -63,5 +64,5 @@
|
|
|
63
64
|
"nyc": {
|
|
64
65
|
"extends": "../../configs/nyc.json"
|
|
65
66
|
},
|
|
66
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "4c074e0d16c48e96a044b2f8bc4717de2e031c4b"
|
|
67
68
|
}
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
AISettingsService,
|
|
21
21
|
AIVariableService,
|
|
22
22
|
BasePromptFragment,
|
|
23
|
+
FrontendLanguageModelRegistry,
|
|
23
24
|
LanguageModel,
|
|
24
25
|
LanguageModelRegistry,
|
|
25
26
|
matchVariablesRegEx,
|
|
@@ -33,6 +34,7 @@ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'
|
|
|
33
34
|
import * as React from '@theia/core/shared/react';
|
|
34
35
|
import { AIConfigurationSelectionService } from './ai-configuration-service';
|
|
35
36
|
import { LanguageModelRenderer } from './language-model-renderer';
|
|
37
|
+
import { LanguageModelAliasRegistry, LanguageModelAlias } from '@theia/ai-core/lib/common/language-model-alias';
|
|
36
38
|
import { AIVariableConfigurationWidget } from './variable-configuration-widget';
|
|
37
39
|
import { nls } from '@theia/core';
|
|
38
40
|
import { PromptVariantRenderer } from './template-settings-renderer';
|
|
@@ -53,11 +55,14 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
53
55
|
protected readonly agentService: AgentService;
|
|
54
56
|
|
|
55
57
|
@inject(LanguageModelRegistry)
|
|
56
|
-
protected readonly languageModelRegistry:
|
|
58
|
+
protected readonly languageModelRegistry: FrontendLanguageModelRegistry;
|
|
57
59
|
|
|
58
60
|
@inject(PromptFragmentCustomizationService)
|
|
59
61
|
protected readonly promptFragmentCustomizationService: PromptFragmentCustomizationService;
|
|
60
62
|
|
|
63
|
+
@inject(LanguageModelAliasRegistry)
|
|
64
|
+
protected readonly languageModelAliasRegistry: LanguageModelAliasRegistry;
|
|
65
|
+
|
|
61
66
|
@inject(AISettingsService)
|
|
62
67
|
protected readonly aiSettingsService: AISettingsService;
|
|
63
68
|
|
|
@@ -74,6 +79,7 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
74
79
|
protected readonly quickInputService: QuickInputService;
|
|
75
80
|
|
|
76
81
|
protected languageModels: LanguageModel[] | undefined;
|
|
82
|
+
protected languageModelAliases: LanguageModelAlias[] = [];
|
|
77
83
|
|
|
78
84
|
@postConstruct()
|
|
79
85
|
protected init(): void {
|
|
@@ -85,7 +91,15 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
85
91
|
this.languageModels = models ?? [];
|
|
86
92
|
this.update();
|
|
87
93
|
});
|
|
94
|
+
this.languageModelAliasRegistry.ready.then(() => {
|
|
95
|
+
this.languageModelAliases = this.languageModelAliasRegistry.getAliases();
|
|
96
|
+
this.toDispose.push(this.languageModelAliasRegistry.onDidChange(() => {
|
|
97
|
+
this.languageModelAliases = this.languageModelAliasRegistry.getAliases();
|
|
98
|
+
this.update();
|
|
99
|
+
}));
|
|
100
|
+
});
|
|
88
101
|
this.toDispose.push(this.languageModelRegistry.onChange(({ models }) => {
|
|
102
|
+
this.languageModelAliases = this.languageModelAliasRegistry.getAliases();
|
|
89
103
|
this.languageModels = models;
|
|
90
104
|
this.update();
|
|
91
105
|
}));
|
|
@@ -183,7 +197,9 @@ export class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
183
197
|
agent={agent}
|
|
184
198
|
languageModels={this.languageModels}
|
|
185
199
|
aiSettingsService={this.aiSettingsService}
|
|
186
|
-
languageModelRegistry={this.languageModelRegistry}
|
|
200
|
+
languageModelRegistry={this.languageModelRegistry}
|
|
201
|
+
languageModelAliases={this.languageModelAliases}
|
|
202
|
+
/>
|
|
187
203
|
</div>
|
|
188
204
|
<div>
|
|
189
205
|
<span>Used Global Variables:</span>
|
|
@@ -21,12 +21,16 @@ import { injectable } from '@theia/core/shared/inversify';
|
|
|
21
21
|
@injectable()
|
|
22
22
|
export class AIConfigurationSelectionService {
|
|
23
23
|
protected activeAgent?: Agent;
|
|
24
|
+
protected selectedAliasId?: string;
|
|
24
25
|
|
|
25
26
|
protected readonly onDidSelectConfigurationEmitter = new Emitter<string>();
|
|
26
27
|
onDidSelectConfiguration = this.onDidSelectConfigurationEmitter.event;
|
|
27
28
|
|
|
28
29
|
protected readonly onDidAgentChangeEmitter = new Emitter<Agent | undefined>();
|
|
29
|
-
onDidAgentChange = this.
|
|
30
|
+
onDidAgentChange = this.onDidAgentChangeEmitter.event;
|
|
31
|
+
|
|
32
|
+
protected readonly onDidAliasChangeEmitter = new Emitter<string | undefined>();
|
|
33
|
+
onDidAliasChange = this.onDidAliasChangeEmitter.event;
|
|
30
34
|
|
|
31
35
|
public getActiveAgent(): Agent | undefined {
|
|
32
36
|
return this.activeAgent;
|
|
@@ -37,6 +41,15 @@ export class AIConfigurationSelectionService {
|
|
|
37
41
|
this.onDidAgentChangeEmitter.fire(agent);
|
|
38
42
|
}
|
|
39
43
|
|
|
44
|
+
public getSelectedAliasId(): string | undefined {
|
|
45
|
+
return this.selectedAliasId;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public setSelectedAliasId(aliasId?: string): void {
|
|
49
|
+
this.selectedAliasId = aliasId;
|
|
50
|
+
this.onDidAliasChangeEmitter.fire(aliasId);
|
|
51
|
+
}
|
|
52
|
+
|
|
40
53
|
public selectConfigurationTab(widgetId: string): void {
|
|
41
54
|
this.onDidSelectConfigurationEmitter.fire(widgetId);
|
|
42
55
|
}
|
|
@@ -25,12 +25,13 @@ import { nls } from '@theia/core';
|
|
|
25
25
|
import { AIMCPConfigurationWidget } from './mcp-configuration-widget';
|
|
26
26
|
import { AITokenUsageConfigurationWidget } from './token-usage-configuration-widget';
|
|
27
27
|
import { AIPromptFragmentsConfigurationWidget } from './prompt-fragments-configuration-widget';
|
|
28
|
+
import { ModelAliasesConfigurationWidget } from './model-aliases-configuration-widget';
|
|
28
29
|
|
|
29
30
|
@injectable()
|
|
30
31
|
export class AIConfigurationContainerWidget extends BaseWidget {
|
|
31
32
|
|
|
32
33
|
static readonly ID = 'ai-configuration';
|
|
33
|
-
static readonly LABEL = nls.localize('theia/ai/core/aiConfiguration/label', 'AI Configuration [
|
|
34
|
+
static readonly LABEL = nls.localize('theia/ai/core/aiConfiguration/label', 'AI Configuration [Beta]');
|
|
34
35
|
protected dockpanel: DockPanel;
|
|
35
36
|
|
|
36
37
|
@inject(TheiaDockPanel.Factory)
|
|
@@ -46,6 +47,7 @@ export class AIConfigurationContainerWidget extends BaseWidget {
|
|
|
46
47
|
protected tokenUsageWidget: AITokenUsageConfigurationWidget;
|
|
47
48
|
protected promptFragmentsWidget: AIPromptFragmentsConfigurationWidget;
|
|
48
49
|
protected toolsWidget: AIToolsConfigurationWidget;
|
|
50
|
+
protected modelAliasesWidget: ModelAliasesConfigurationWidget;
|
|
49
51
|
|
|
50
52
|
@postConstruct()
|
|
51
53
|
protected init(): void {
|
|
@@ -74,6 +76,7 @@ export class AIConfigurationContainerWidget extends BaseWidget {
|
|
|
74
76
|
this.tokenUsageWidget = await this.widgetManager.getOrCreateWidget(AITokenUsageConfigurationWidget.ID);
|
|
75
77
|
this.promptFragmentsWidget = await this.widgetManager.getOrCreateWidget(AIPromptFragmentsConfigurationWidget.ID);
|
|
76
78
|
this.toolsWidget = await this.widgetManager.getOrCreateWidget(AIToolsConfigurationWidget.ID);
|
|
79
|
+
this.modelAliasesWidget = await this.widgetManager.getOrCreateWidget(ModelAliasesConfigurationWidget.ID);
|
|
77
80
|
|
|
78
81
|
this.dockpanel.addWidget(this.agentsWidget);
|
|
79
82
|
this.dockpanel.addWidget(this.variablesWidget, { mode: 'tab-after', ref: this.agentsWidget });
|
|
@@ -81,6 +84,7 @@ export class AIConfigurationContainerWidget extends BaseWidget {
|
|
|
81
84
|
this.dockpanel.addWidget(this.tokenUsageWidget, { mode: 'tab-after', ref: this.mcpWidget });
|
|
82
85
|
this.dockpanel.addWidget(this.promptFragmentsWidget, { mode: 'tab-after', ref: this.tokenUsageWidget });
|
|
83
86
|
this.dockpanel.addWidget(this.toolsWidget, { mode: 'tab-after', ref: this.promptFragmentsWidget });
|
|
87
|
+
this.dockpanel.addWidget(this.modelAliasesWidget, { mode: 'tab-after', ref: this.toolsWidget });
|
|
84
88
|
|
|
85
89
|
this.update();
|
|
86
90
|
}
|
|
@@ -99,6 +103,8 @@ export class AIConfigurationContainerWidget extends BaseWidget {
|
|
|
99
103
|
this.dockpanel.activateWidget(this.promptFragmentsWidget);
|
|
100
104
|
} else if (widgetId === AIToolsConfigurationWidget.ID) {
|
|
101
105
|
this.dockpanel.activateWidget(this.toolsWidget);
|
|
106
|
+
} else if (widgetId === ModelAliasesConfigurationWidget.ID) {
|
|
107
|
+
this.dockpanel.activateWidget(this.modelAliasesWidget);
|
|
102
108
|
}
|
|
103
109
|
});
|
|
104
110
|
}
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
import * as React from '@theia/core/shared/react';
|
|
17
|
-
import { Agent, AISettingsService,
|
|
17
|
+
import { Agent, AISettingsService, FrontendLanguageModelRegistry, LanguageModel, LanguageModelRequirement } from '@theia/ai-core/lib/common';
|
|
18
|
+
import { LanguageModelAlias } from '@theia/ai-core/lib/common/language-model-alias';
|
|
18
19
|
import { Mutable } from '@theia/core';
|
|
19
20
|
import { nls } from '@theia/core/lib/common/nls';
|
|
20
21
|
|
|
@@ -22,11 +23,12 @@ export interface LanguageModelSettingsProps {
|
|
|
22
23
|
agent: Agent;
|
|
23
24
|
languageModels?: LanguageModel[];
|
|
24
25
|
aiSettingsService: AISettingsService;
|
|
25
|
-
languageModelRegistry:
|
|
26
|
+
languageModelRegistry: FrontendLanguageModelRegistry;
|
|
27
|
+
languageModelAliases: LanguageModelAlias[];
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export const LanguageModelRenderer: React.FC<LanguageModelSettingsProps> = (
|
|
29
|
-
{ agent, languageModels, aiSettingsService, languageModelRegistry }) => {
|
|
31
|
+
{ agent, languageModels, aiSettingsService, languageModelRegistry, languageModelAliases: aliases }) => {
|
|
30
32
|
|
|
31
33
|
const findLanguageModelRequirement = async (purpose: string): Promise<LanguageModelRequirement | undefined> => {
|
|
32
34
|
const requirementSetting = await aiSettingsService.getAgentSettings(agent.id);
|
|
@@ -34,6 +36,7 @@ export const LanguageModelRenderer: React.FC<LanguageModelSettingsProps> = (
|
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
const [lmRequirementMap, setLmRequirementMap] = React.useState<Record<string, LanguageModelRequirement>>({});
|
|
39
|
+
const [resolvedAliasModels, setResolvedAliasModels] = React.useState<Record<string, LanguageModel | undefined>>({});
|
|
37
40
|
|
|
38
41
|
React.useEffect(() => {
|
|
39
42
|
const computeLmRequirementMap = async () => {
|
|
@@ -54,32 +57,20 @@ export const LanguageModelRenderer: React.FC<LanguageModelSettingsProps> = (
|
|
|
54
57
|
computeLmRequirementMap();
|
|
55
58
|
}, []);
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{languageModel.maxInputTokens &&
|
|
72
|
-
<p><strong>
|
|
73
|
-
{nls.localize('theia/ai/core/languageModelRenderer/minInputTokens', 'Min Input Tokens')}:
|
|
74
|
-
</strong> {languageModel.maxInputTokens}</p>}
|
|
75
|
-
{languageModel.maxOutputTokens &&
|
|
76
|
-
<p><strong>
|
|
77
|
-
{nls.localize('theia/ai/core/languageModelRenderer/maxOutputTokens', 'Max Output Tokens')}:
|
|
78
|
-
</strong> {languageModel.maxOutputTokens}</p>}
|
|
79
|
-
</div>
|
|
80
|
-
</>;
|
|
81
|
-
|
|
82
|
-
};
|
|
60
|
+
// Effect to resolve alias to model whenever requirements.identifier or aliases change
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
const resolveAliases = async () => {
|
|
63
|
+
const newResolved: Record<string, LanguageModel | undefined> = {};
|
|
64
|
+
await Promise.all(Object.values(lmRequirementMap).map(async requirements => {
|
|
65
|
+
const id = requirements.identifier;
|
|
66
|
+
if (id && aliases.some(a => a.id === id)) {
|
|
67
|
+
newResolved[id] = await languageModelRegistry.getReadyLanguageModel(id);
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
setResolvedAliasModels(newResolved);
|
|
71
|
+
};
|
|
72
|
+
resolveAliases();
|
|
73
|
+
}, [lmRequirementMap, aliases]);
|
|
83
74
|
|
|
84
75
|
const onSelectedModelChange = (purpose: string, event: React.ChangeEvent<HTMLSelectElement>): void => {
|
|
85
76
|
const newLmRequirementMap = { ...lmRequirementMap, [purpose]: { purpose, identifier: event.target.value } };
|
|
@@ -88,35 +79,72 @@ export const LanguageModelRenderer: React.FC<LanguageModelSettingsProps> = (
|
|
|
88
79
|
};
|
|
89
80
|
|
|
90
81
|
return <div className='language-model-container'>
|
|
91
|
-
{Object.values(lmRequirementMap).map((
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<option
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
82
|
+
{Object.values(lmRequirementMap).map((requirement, index) => {
|
|
83
|
+
const isAlias = requirement.identifier && aliases.some(a => a.id === requirement.identifier);
|
|
84
|
+
const resolvedModel = isAlias ? resolvedAliasModels[requirement.identifier] : undefined;
|
|
85
|
+
return (
|
|
86
|
+
<React.Fragment key={index}>
|
|
87
|
+
<div className="ai-alias-evaluates-to-container">
|
|
88
|
+
<strong>{nls.localize('theia/ai/core/languageModelRenderer/purpose', 'Purpose')}:</strong> {requirement.purpose}
|
|
89
|
+
</div>
|
|
90
|
+
<div>
|
|
91
|
+
<div className="ai-alias-evaluates-to-container">
|
|
92
|
+
<label
|
|
93
|
+
className="theia-header no-select"
|
|
94
|
+
htmlFor={`model-select-${agent.id}`}>
|
|
95
|
+
{nls.localize('theia/ai/core/languageModelRenderer/languageModel', 'Language Model') + ': '}
|
|
96
|
+
</label>
|
|
97
|
+
<select
|
|
98
|
+
className="theia-select"
|
|
99
|
+
id={`model-select-${agent.id}-${requirement.purpose}`}
|
|
100
|
+
value={requirement.identifier}
|
|
101
|
+
onChange={event => onSelectedModelChange(requirement.purpose, event)}
|
|
102
|
+
>
|
|
103
|
+
<option value=""></option>
|
|
104
|
+
{/* Aliases first, then languange models */}
|
|
105
|
+
{aliases?.sort((a, b) => a.id.localeCompare(b.id)).map(alias => (
|
|
106
|
+
<option key={`alias/${alias.id}`} value={alias.id} className='ai-language-model-item-ready'>{`[alias] ${alias.id}`}</option>
|
|
107
|
+
))}
|
|
108
|
+
{languageModels?.sort((a, b) => (a.name ?? a.id).localeCompare(b.name ?? b.id)).map(model => {
|
|
109
|
+
const isNotReady = model.status.status !== 'ready';
|
|
110
|
+
return (
|
|
111
|
+
<option
|
|
112
|
+
key={model.id}
|
|
113
|
+
value={model.id}
|
|
114
|
+
className={isNotReady ? 'ai-language-model-item-not-ready' : 'ai-language-model-item-ready'}
|
|
115
|
+
title={isNotReady && model.status.message ? model.status.message : undefined}
|
|
116
|
+
>
|
|
117
|
+
{model.name ?? model.id} {isNotReady ? '✗' : '✓'}
|
|
118
|
+
</option>
|
|
119
|
+
);
|
|
120
|
+
})}
|
|
121
|
+
</select>
|
|
122
|
+
</div>
|
|
123
|
+
{/* If alias is selected, show what it currently evaluates to */}
|
|
124
|
+
{isAlias && (
|
|
125
|
+
<div className="ai-alias-evaluates-to-container">
|
|
126
|
+
<label className="ai-alias-evaluates-to-label">{nls.localize('theia/ai/core/modelAliasesConfiguration/evaluatesTo', 'Evaluates to')}:</label>
|
|
127
|
+
{resolvedModel ? (
|
|
128
|
+
<span className="ai-alias-evaluates-to-value">
|
|
129
|
+
{resolvedModel.name ?? resolvedModel.id}
|
|
130
|
+
{resolvedModel.status.status === 'ready' ? (
|
|
131
|
+
<span className="ai-model-status-ready" title="Ready">✓</span>
|
|
132
|
+
) : (
|
|
133
|
+
<span className="ai-model-status-not-ready" title={resolvedModel.status.message || 'Not ready'}>✗</span>
|
|
134
|
+
)}
|
|
135
|
+
</span>
|
|
136
|
+
) : (
|
|
137
|
+
<span className="ai-alias-evaluates-to-unresolved">
|
|
138
|
+
{nls.localize('theia/ai/core/modelAliasesConfiguration/noResolvedModel', 'No model ready for this alias.')}
|
|
139
|
+
<span className="ai-model-status-not-ready" title={'No model ready'}>✗</span>
|
|
140
|
+
</span>
|
|
141
|
+
)}
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
<hr />
|
|
145
|
+
</div>
|
|
146
|
+
</React.Fragment>
|
|
147
|
+
);
|
|
148
|
+
})}
|
|
121
149
|
</div>;
|
|
122
150
|
};
|