@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,243 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { DisposableCollection, URI, Event, Emitter } from '@theia/core';
|
|
18
|
+
import { OpenerService } from '@theia/core/lib/browser';
|
|
19
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
20
|
+
import { PromptCustomizationService, CustomAgentDescription } from '../common';
|
|
21
|
+
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
|
|
22
|
+
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
23
|
+
import { FileChangesEvent } from '@theia/filesystem/lib/common/files';
|
|
24
|
+
import { AICorePreferences, PREFERENCE_NAME_PROMPT_TEMPLATES } from './ai-core-preferences';
|
|
25
|
+
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
26
|
+
import { load, dump } from 'js-yaml';
|
|
27
|
+
import { PROMPT_TEMPLATE_EXTENSION } from './prompttemplate-contribution';
|
|
28
|
+
|
|
29
|
+
const templateEntry = {
|
|
30
|
+
id: 'my_agent',
|
|
31
|
+
name: 'My Agent',
|
|
32
|
+
description: 'This is an example agent. Please adapt the properties to fit your needs.',
|
|
33
|
+
prompt: 'You are an example agent. Be nice and helpful to the user.',
|
|
34
|
+
defaultLLM: 'openai/gpt-4o'
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
@injectable()
|
|
38
|
+
export class FrontendPromptCustomizationServiceImpl implements PromptCustomizationService {
|
|
39
|
+
|
|
40
|
+
@inject(EnvVariablesServer)
|
|
41
|
+
protected readonly envVariablesServer: EnvVariablesServer;
|
|
42
|
+
|
|
43
|
+
@inject(AICorePreferences)
|
|
44
|
+
protected readonly preferences: AICorePreferences;
|
|
45
|
+
|
|
46
|
+
@inject(FileService)
|
|
47
|
+
protected readonly fileService: FileService;
|
|
48
|
+
|
|
49
|
+
@inject(OpenerService)
|
|
50
|
+
protected readonly openerService: OpenerService;
|
|
51
|
+
|
|
52
|
+
protected readonly trackedTemplateURIs = new Set<string>();
|
|
53
|
+
protected templates = new Map<string, string>();
|
|
54
|
+
|
|
55
|
+
protected toDispose = new DisposableCollection();
|
|
56
|
+
|
|
57
|
+
private readonly onDidChangePromptEmitter = new Emitter<string>();
|
|
58
|
+
readonly onDidChangePrompt: Event<string> = this.onDidChangePromptEmitter.event;
|
|
59
|
+
|
|
60
|
+
private readonly onDidChangeCustomAgentsEmitter = new Emitter<void>();
|
|
61
|
+
readonly onDidChangeCustomAgents = this.onDidChangeCustomAgentsEmitter.event;
|
|
62
|
+
|
|
63
|
+
@postConstruct()
|
|
64
|
+
protected init(): void {
|
|
65
|
+
this.preferences.onPreferenceChanged(event => {
|
|
66
|
+
if (event.preferenceName === PREFERENCE_NAME_PROMPT_TEMPLATES) {
|
|
67
|
+
this.update();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
this.update();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
protected async update(): Promise<void> {
|
|
74
|
+
this.toDispose.dispose();
|
|
75
|
+
// we need to assign a local variable, so that updates running in parallel don't interfere with each other
|
|
76
|
+
const _templates = new Map<string, string>();
|
|
77
|
+
this.templates = _templates;
|
|
78
|
+
this.trackedTemplateURIs.clear();
|
|
79
|
+
|
|
80
|
+
const templateURI = await this.getTemplatesDirectoryURI();
|
|
81
|
+
|
|
82
|
+
this.toDispose.push(this.fileService.watch(templateURI, { recursive: true, excludes: [] }));
|
|
83
|
+
this.toDispose.push(this.fileService.onDidFilesChange(async (event: FileChangesEvent) => {
|
|
84
|
+
if (event.changes.some(change => change.resource.toString().endsWith('customAgents.yml'))) {
|
|
85
|
+
this.onDidChangeCustomAgentsEmitter.fire();
|
|
86
|
+
}
|
|
87
|
+
// check deleted templates
|
|
88
|
+
for (const deletedFile of event.getDeleted()) {
|
|
89
|
+
if (this.trackedTemplateURIs.has(deletedFile.resource.toString())) {
|
|
90
|
+
this.trackedTemplateURIs.delete(deletedFile.resource.toString());
|
|
91
|
+
const templateId = this.removePromptTemplateSuffix(deletedFile.resource.path.name);
|
|
92
|
+
_templates.delete(templateId);
|
|
93
|
+
this.onDidChangePromptEmitter.fire(templateId);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// check updated templates
|
|
97
|
+
for (const updatedFile of event.getUpdated()) {
|
|
98
|
+
if (this.trackedTemplateURIs.has(updatedFile.resource.toString())) {
|
|
99
|
+
const fileContent = await this.fileService.read(updatedFile.resource);
|
|
100
|
+
const templateId = this.removePromptTemplateSuffix(updatedFile.resource.path.name);
|
|
101
|
+
_templates.set(templateId, fileContent.value);
|
|
102
|
+
this.onDidChangePromptEmitter.fire(templateId);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// check new templates
|
|
106
|
+
for (const addedFile of event.getAdded()) {
|
|
107
|
+
if (addedFile.resource.parent.toString() === templateURI.toString() && addedFile.resource.path.ext === PROMPT_TEMPLATE_EXTENSION) {
|
|
108
|
+
this.trackedTemplateURIs.add(addedFile.resource.toString());
|
|
109
|
+
const fileContent = await this.fileService.read(addedFile.resource);
|
|
110
|
+
const templateId = this.removePromptTemplateSuffix(addedFile.resource.path.name);
|
|
111
|
+
_templates.set(templateId, fileContent.value);
|
|
112
|
+
this.onDidChangePromptEmitter.fire(templateId);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
}));
|
|
117
|
+
|
|
118
|
+
this.onDidChangeCustomAgentsEmitter.fire();
|
|
119
|
+
|
|
120
|
+
if (!(await this.fileService.exists(templateURI))) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const stat = await this.fileService.resolve(templateURI);
|
|
124
|
+
if (stat.children === undefined) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
for (const file of stat.children) {
|
|
129
|
+
if (!file.isFile) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const fileURI = file.resource;
|
|
133
|
+
if (fileURI.path.ext === PROMPT_TEMPLATE_EXTENSION) {
|
|
134
|
+
this.trackedTemplateURIs.add(fileURI.toString());
|
|
135
|
+
const fileContent = await this.fileService.read(fileURI);
|
|
136
|
+
const templateId = this.removePromptTemplateSuffix(file.name);
|
|
137
|
+
_templates.set(templateId, fileContent.value);
|
|
138
|
+
this.onDidChangePromptEmitter.fire(templateId);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
protected async getTemplatesDirectoryURI(): Promise<URI> {
|
|
144
|
+
const templatesFolder = this.preferences[PREFERENCE_NAME_PROMPT_TEMPLATES];
|
|
145
|
+
if (templatesFolder && templatesFolder.trim().length > 0) {
|
|
146
|
+
return URI.fromFilePath(templatesFolder);
|
|
147
|
+
}
|
|
148
|
+
const theiaConfigDir = await this.envVariablesServer.getConfigDirUri();
|
|
149
|
+
return new URI(theiaConfigDir).resolve('prompt-templates');
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
protected async getTemplateURI(templateId: string): Promise<URI> {
|
|
153
|
+
return (await this.getTemplatesDirectoryURI()).resolve(`${templateId}${PROMPT_TEMPLATE_EXTENSION}`);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
protected removePromptTemplateSuffix(filename: string): string {
|
|
157
|
+
const suffix = PROMPT_TEMPLATE_EXTENSION;
|
|
158
|
+
if (filename.endsWith(suffix)) {
|
|
159
|
+
return filename.slice(0, -suffix.length);
|
|
160
|
+
}
|
|
161
|
+
return filename;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
isPromptTemplateCustomized(id: string): boolean {
|
|
165
|
+
return this.templates.has(id);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
getCustomizedPromptTemplate(id: string): string | undefined {
|
|
169
|
+
return this.templates.get(id);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
getCustomPromptTemplateIDs(): string[] {
|
|
173
|
+
return Array.from(this.templates.keys());
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async editTemplate(id: string, defaultContent?: string): Promise<void> {
|
|
177
|
+
const editorUri = await this.getTemplateURI(id);
|
|
178
|
+
if (! await this.fileService.exists(editorUri)) {
|
|
179
|
+
await this.fileService.createFile(editorUri, BinaryBuffer.fromString(defaultContent ?? ''));
|
|
180
|
+
}
|
|
181
|
+
const openHandler = await this.openerService.getOpener(editorUri);
|
|
182
|
+
openHandler.open(editorUri);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async resetTemplate(id: string): Promise<void> {
|
|
186
|
+
const editorUri = await this.getTemplateURI(id);
|
|
187
|
+
if (await this.fileService.exists(editorUri)) {
|
|
188
|
+
await this.fileService.delete(editorUri);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
getTemplateIDFromURI(uri: URI): string | undefined {
|
|
193
|
+
const id = this.removePromptTemplateSuffix(uri.path.name);
|
|
194
|
+
if (this.templates.has(id)) {
|
|
195
|
+
return id;
|
|
196
|
+
}
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
async getCustomAgents(): Promise<CustomAgentDescription[]> {
|
|
201
|
+
const customAgentYamlUri = (await this.getTemplatesDirectoryURI()).resolve('customAgents.yml');
|
|
202
|
+
const yamlExists = await this.fileService.exists(customAgentYamlUri);
|
|
203
|
+
if (!yamlExists) {
|
|
204
|
+
return [];
|
|
205
|
+
}
|
|
206
|
+
const fileContent = await this.fileService.read(customAgentYamlUri, { encoding: 'utf-8' });
|
|
207
|
+
try {
|
|
208
|
+
const doc = load(fileContent.value);
|
|
209
|
+
if (!Array.isArray(doc) || !doc.every(entry => CustomAgentDescription.is(entry))) {
|
|
210
|
+
console.debug('Invalid customAgents.yml file content');
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
const readAgents = doc as CustomAgentDescription[];
|
|
214
|
+
// make sure all agents are unique (id and name)
|
|
215
|
+
const uniqueAgentIds = new Set<string>();
|
|
216
|
+
const uniqueAgents: CustomAgentDescription[] = [];
|
|
217
|
+
readAgents.forEach(agent => {
|
|
218
|
+
if (uniqueAgentIds.has(agent.id)) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
uniqueAgentIds.add(agent.id);
|
|
222
|
+
uniqueAgents.push(agent);
|
|
223
|
+
});
|
|
224
|
+
return uniqueAgents;
|
|
225
|
+
} catch (e) {
|
|
226
|
+
console.debug(e.message, e);
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async openCustomAgentYaml(): Promise<void> {
|
|
232
|
+
const customAgentYamlUri = (await this.getTemplatesDirectoryURI()).resolve('customAgents.yml');
|
|
233
|
+
const content = dump([templateEntry]);
|
|
234
|
+
if (! await this.fileService.exists(customAgentYamlUri)) {
|
|
235
|
+
await this.fileService.createFile(customAgentYamlUri, BinaryBuffer.fromString(content));
|
|
236
|
+
} else {
|
|
237
|
+
const fileContent = (await this.fileService.readFile(customAgentYamlUri)).value;
|
|
238
|
+
await this.fileService.writeFile(customAgentYamlUri, BinaryBuffer.concat([fileContent, BinaryBuffer.fromString(content)]));
|
|
239
|
+
}
|
|
240
|
+
const openHandler = await this.openerService.getOpener(customAgentYamlUri);
|
|
241
|
+
openHandler.open(customAgentYamlUri);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { DefaultAIVariableService } from '../common';
|
|
19
|
+
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
export class FrontendVariableService extends DefaultAIVariableService implements FrontendApplicationContribution {
|
|
23
|
+
onStart(): void {
|
|
24
|
+
this.initContributions();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export * from './ai-activation-service';
|
|
18
|
+
export * from './ai-core-frontend-application-contribution';
|
|
19
|
+
export * from './ai-core-frontend-module';
|
|
20
|
+
export * from './ai-core-preferences';
|
|
21
|
+
export * from './ai-settings-service';
|
|
22
|
+
export * from './ai-view-contribution';
|
|
23
|
+
export * from './frontend-language-model-registry';
|
|
24
|
+
export * from './frontend-variable-service';
|
|
25
|
+
export * from './prompttemplate-contribution';
|
|
26
|
+
export * from './theia-variable-contribution';
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
18
|
+
import { GrammarDefinition, GrammarDefinitionProvider, LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate';
|
|
19
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
20
|
+
import { Command, CommandContribution, CommandRegistry, ContributionProvider, MessageService } from '@theia/core';
|
|
21
|
+
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
22
|
+
|
|
23
|
+
import { codicon, Widget } from '@theia/core/lib/browser';
|
|
24
|
+
import { EditorWidget, ReplaceOperation } from '@theia/editor/lib/browser';
|
|
25
|
+
import { PromptCustomizationService, PromptService, ToolProvider } from '../common';
|
|
26
|
+
import { ProviderResult } from '@theia/monaco-editor-core/esm/vs/editor/common/languages';
|
|
27
|
+
|
|
28
|
+
const PROMPT_TEMPLATE_LANGUAGE_ID = 'theia-ai-prompt-template';
|
|
29
|
+
const PROMPT_TEMPLATE_TEXTMATE_SCOPE = 'source.prompttemplate';
|
|
30
|
+
|
|
31
|
+
export const PROMPT_TEMPLATE_EXTENSION = '.prompttemplate';
|
|
32
|
+
|
|
33
|
+
export const DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS: Command = {
|
|
34
|
+
id: 'theia-ai-prompt-template:discard',
|
|
35
|
+
iconClass: codicon('discard'),
|
|
36
|
+
category: 'Theia AI Prompt Templates'
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// TODO this command is mainly for testing purposes
|
|
40
|
+
export const SHOW_ALL_PROMPTS_COMMAND: Command = {
|
|
41
|
+
id: 'theia-ai-prompt-template:show-prompts-command',
|
|
42
|
+
label: 'Show all prompts',
|
|
43
|
+
iconClass: codicon('beaker'),
|
|
44
|
+
category: 'Theia AI Prompt Templates',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
@injectable()
|
|
48
|
+
export class PromptTemplateContribution implements LanguageGrammarDefinitionContribution, CommandContribution, TabBarToolbarContribution {
|
|
49
|
+
|
|
50
|
+
@inject(PromptService)
|
|
51
|
+
private readonly promptService: PromptService;
|
|
52
|
+
|
|
53
|
+
@inject(MessageService)
|
|
54
|
+
private readonly messageService: MessageService;
|
|
55
|
+
|
|
56
|
+
@inject(PromptCustomizationService)
|
|
57
|
+
protected readonly customizationService: PromptCustomizationService;
|
|
58
|
+
|
|
59
|
+
@inject(ContributionProvider)
|
|
60
|
+
@named(ToolProvider)
|
|
61
|
+
private toolProviders: ContributionProvider<ToolProvider>;
|
|
62
|
+
|
|
63
|
+
readonly config: monaco.languages.LanguageConfiguration =
|
|
64
|
+
{
|
|
65
|
+
'brackets': [
|
|
66
|
+
['${', '}'],
|
|
67
|
+
['~{', '}']
|
|
68
|
+
],
|
|
69
|
+
'autoClosingPairs': [
|
|
70
|
+
{ 'open': '${', 'close': '}' },
|
|
71
|
+
{ 'open': '~{', 'close': '}' },
|
|
72
|
+
],
|
|
73
|
+
'surroundingPairs': [
|
|
74
|
+
{ 'open': '${', 'close': '}' },
|
|
75
|
+
{ 'open': '~{', 'close': '}' }
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
registerTextmateLanguage(registry: TextmateRegistry): void {
|
|
80
|
+
monaco.languages.register({
|
|
81
|
+
id: PROMPT_TEMPLATE_LANGUAGE_ID,
|
|
82
|
+
'aliases': [
|
|
83
|
+
'Theia AI Prompt Templates'
|
|
84
|
+
],
|
|
85
|
+
'extensions': [
|
|
86
|
+
PROMPT_TEMPLATE_EXTENSION,
|
|
87
|
+
],
|
|
88
|
+
'filenames': []
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
monaco.languages.setLanguageConfiguration(PROMPT_TEMPLATE_LANGUAGE_ID, this.config);
|
|
92
|
+
|
|
93
|
+
monaco.languages.registerCompletionItemProvider(PROMPT_TEMPLATE_LANGUAGE_ID, {
|
|
94
|
+
// Monaco only supports single character trigger characters
|
|
95
|
+
triggerCharacters: ['{'],
|
|
96
|
+
provideCompletionItems: (model, position, _context, _token): ProviderResult<monaco.languages.CompletionList> => this.provideFunctionCompletions(model, position),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const textmateGrammar = require('../../data/prompttemplate.tmLanguage.json');
|
|
100
|
+
const grammarDefinitionProvider: GrammarDefinitionProvider = {
|
|
101
|
+
getGrammarDefinition: function (): Promise<GrammarDefinition> {
|
|
102
|
+
return Promise.resolve({
|
|
103
|
+
format: 'json',
|
|
104
|
+
content: textmateGrammar
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
registry.registerTextmateGrammarScope(PROMPT_TEMPLATE_TEXTMATE_SCOPE, grammarDefinitionProvider);
|
|
109
|
+
|
|
110
|
+
registry.mapLanguageIdToTextmateGrammar(PROMPT_TEMPLATE_LANGUAGE_ID, PROMPT_TEMPLATE_TEXTMATE_SCOPE);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
provideFunctionCompletions(model: monaco.editor.ITextModel, position: monaco.Position): ProviderResult<monaco.languages.CompletionList> {
|
|
114
|
+
return this.getSuggestions(
|
|
115
|
+
model,
|
|
116
|
+
position,
|
|
117
|
+
'~{',
|
|
118
|
+
this.toolProviders.getContributions().map(provider => provider.getTool()),
|
|
119
|
+
monaco.languages.CompletionItemKind.Function,
|
|
120
|
+
tool => tool.id,
|
|
121
|
+
tool => tool.name,
|
|
122
|
+
tool => tool.description ?? ''
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
getCompletionRange(model: monaco.editor.ITextModel, position: monaco.Position, triggerCharacters: string): monaco.Range | undefined {
|
|
127
|
+
// Check if the characters before the current position are the trigger characters
|
|
128
|
+
const lineContent = model.getLineContent(position.lineNumber);
|
|
129
|
+
const triggerLength = triggerCharacters.length;
|
|
130
|
+
const charactersBefore = lineContent.substring(
|
|
131
|
+
position.column - triggerLength - 1,
|
|
132
|
+
position.column - 1
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
if (charactersBefore !== triggerCharacters) {
|
|
136
|
+
// Do not return agent suggestions if the user didn't just type the trigger characters
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Calculate the range from the position of the trigger characters
|
|
141
|
+
const wordInfo = model.getWordUntilPosition(position);
|
|
142
|
+
return new monaco.Range(
|
|
143
|
+
position.lineNumber,
|
|
144
|
+
wordInfo.startColumn,
|
|
145
|
+
position.lineNumber,
|
|
146
|
+
position.column
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private getSuggestions<T>(
|
|
151
|
+
model: monaco.editor.ITextModel,
|
|
152
|
+
position: monaco.Position,
|
|
153
|
+
triggerChars: string,
|
|
154
|
+
items: T[],
|
|
155
|
+
kind: monaco.languages.CompletionItemKind,
|
|
156
|
+
getId: (item: T) => string,
|
|
157
|
+
getName: (item: T) => string,
|
|
158
|
+
getDescription: (item: T) => string
|
|
159
|
+
): ProviderResult<monaco.languages.CompletionList> {
|
|
160
|
+
const completionRange = this.getCompletionRange(model, position, triggerChars);
|
|
161
|
+
if (completionRange === undefined) {
|
|
162
|
+
return { suggestions: [] };
|
|
163
|
+
}
|
|
164
|
+
const suggestions = items.map(item => ({
|
|
165
|
+
insertText: getId(item),
|
|
166
|
+
kind: kind,
|
|
167
|
+
label: getName(item),
|
|
168
|
+
range: completionRange,
|
|
169
|
+
detail: getDescription(item),
|
|
170
|
+
}));
|
|
171
|
+
return { suggestions };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
registerCommands(commands: CommandRegistry): void {
|
|
175
|
+
commands.registerCommand(DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS, {
|
|
176
|
+
isVisible: (widget: Widget) => this.isPromptTemplateWidget(widget),
|
|
177
|
+
isEnabled: (widget: EditorWidget) => this.canDiscard(widget),
|
|
178
|
+
execute: (widget: EditorWidget) => this.discard(widget)
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
commands.registerCommand(SHOW_ALL_PROMPTS_COMMAND, {
|
|
182
|
+
execute: () => this.showAllPrompts()
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
protected isPromptTemplateWidget(widget: Widget): boolean {
|
|
187
|
+
if (widget instanceof EditorWidget) {
|
|
188
|
+
return PROMPT_TEMPLATE_LANGUAGE_ID === widget.editor.document.languageId;
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
protected canDiscard(widget: EditorWidget): boolean {
|
|
194
|
+
const resourceUri = widget.editor.uri;
|
|
195
|
+
const id = this.customizationService.getTemplateIDFromURI(resourceUri);
|
|
196
|
+
if (id === undefined) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
const rawPrompt = this.promptService.getRawPrompt(id);
|
|
200
|
+
const defaultPrompt = this.promptService.getDefaultRawPrompt(id);
|
|
201
|
+
return rawPrompt?.template !== defaultPrompt?.template;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
protected async discard(widget: EditorWidget): Promise<void> {
|
|
205
|
+
const resourceUri = widget.editor.uri;
|
|
206
|
+
const id = this.customizationService.getTemplateIDFromURI(resourceUri);
|
|
207
|
+
if (id === undefined) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const defaultPrompt = this.promptService.getDefaultRawPrompt(id);
|
|
211
|
+
if (defaultPrompt === undefined) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const source: string = widget.editor.document.getText();
|
|
216
|
+
const lastLine = widget.editor.document.getLineContent(widget.editor.document.lineCount);
|
|
217
|
+
|
|
218
|
+
const replaceOperation: ReplaceOperation = {
|
|
219
|
+
range: {
|
|
220
|
+
start: {
|
|
221
|
+
line: 0,
|
|
222
|
+
character: 0
|
|
223
|
+
},
|
|
224
|
+
end: {
|
|
225
|
+
line: widget.editor.document.lineCount,
|
|
226
|
+
character: lastLine.length
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
text: defaultPrompt.template
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
await widget.editor.replaceText({
|
|
233
|
+
source,
|
|
234
|
+
replaceOperations: [replaceOperation]
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
private showAllPrompts(): void {
|
|
239
|
+
const allPrompts = this.promptService.getAllPrompts();
|
|
240
|
+
Object.keys(allPrompts).forEach(id => {
|
|
241
|
+
this.messageService.info(`Prompt Template ID: ${id}\n${allPrompts[id].template}`, 'Got it');
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
registerToolbarItems(registry: TabBarToolbarRegistry): void {
|
|
246
|
+
registry.registerItem({
|
|
247
|
+
id: DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS.id,
|
|
248
|
+
command: DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS.id,
|
|
249
|
+
tooltip: 'Discard Customizations'
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
.ai-configuration-widget {
|
|
2
|
+
padding: var(--theia-ui-padding);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.theia-ai-settings-container {
|
|
6
|
+
padding: var(--theia-ui-padding);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.language-model-container {
|
|
10
|
+
padding-top: calc(2 * var(--theia-ui-padding));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.language-model-container .theia-select {
|
|
14
|
+
margin-left: var(--theia-ui-padding);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.theia-settings-container .settings-section-subcategory-title.ai-settings-section-subcategory-title {
|
|
18
|
+
padding-left: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ai-templates {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: 5px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.template-renderer {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
padding: 10px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.template-header {
|
|
34
|
+
margin-bottom: 8px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.template-controls {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 10px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.template-select-label {
|
|
44
|
+
margin-right: 5px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.template-variant-selector {
|
|
48
|
+
min-width: 120px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.template-variant-selector.error {
|
|
52
|
+
border-color: var(--theia-errorForeground);
|
|
53
|
+
background-color: var(--theia-errorBackground, rgba(255, 0, 0, 0.1));
|
|
54
|
+
color: var(--theia-errorForeground);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#ai-variable-configuration-container-widget,
|
|
58
|
+
#ai-agent-configuration-container-widget {
|
|
59
|
+
margin-top: 5px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Variable Settings */
|
|
63
|
+
#ai-variable-configuration-container-widget ul {
|
|
64
|
+
list-style: none;
|
|
65
|
+
padding: 0;
|
|
66
|
+
margin: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#ai-variable-configuration-container-widget .variable-item {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
margin-bottom: 1rem;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#ai-variable-configuration-container-widget .variable-args {
|
|
76
|
+
display: grid;
|
|
77
|
+
grid-template-columns: 1fr 2fr;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Agent Settings */
|
|
81
|
+
#ai-agent-configuration-container-widget ul {
|
|
82
|
+
list-style: none;
|
|
83
|
+
padding: 0;
|
|
84
|
+
margin: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ai-agent-configuration-main {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: row;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.configuration-agents-list {
|
|
93
|
+
width: 128px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.configuration-agent-panel {
|
|
97
|
+
flex: 1;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#ai-variable-configuration-container-widget .variable-references,
|
|
101
|
+
#ai-agent-configuration-container-widget .variable-references,
|
|
102
|
+
#ai-agent-configuration-container-widget .function-references {
|
|
103
|
+
margin-left: 0.5rem;
|
|
104
|
+
padding: 0.5rem;
|
|
105
|
+
border-left: solid 1px var(--theia-tree-indentGuidesStroke);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
#ai-variable-configuration-container-widget .variable-reference,
|
|
109
|
+
#ai-agent-configuration-container-widget .variable-reference,
|
|
110
|
+
#ai-agent-configuration-container-widget .function-reference {
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: row;
|
|
113
|
+
align-items: center;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.agent-tag {
|
|
117
|
+
padding: calc(var(--theia-ui-padding) * 2 / 3);
|
|
118
|
+
padding-top: 0px;
|
|
119
|
+
padding-bottom: 0px;
|
|
120
|
+
border-radius: calc(var(--theia-ui-padding) * 2 / 3);
|
|
121
|
+
background: hsla(0, 0%, 68%, 0.31);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.configuration-agents-add {
|
|
125
|
+
margin-top: 3em;
|
|
126
|
+
margin-left: 0;
|
|
127
|
+
}
|