@theia/ai-core 1.58.3 → 1.59.0-next.62
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-activation-service.d.ts +4 -4
- package/lib/browser/ai-activation-service.d.ts.map +1 -1
- package/lib/browser/ai-activation-service.js +10 -10
- package/lib/browser/ai-activation-service.js.map +1 -1
- package/lib/browser/ai-core-frontend-module.d.ts.map +1 -1
- package/lib/browser/ai-core-frontend-module.js +6 -32
- package/lib/browser/ai-core-frontend-module.js.map +1 -1
- package/lib/browser/ai-core-preferences.d.ts +3 -3
- package/lib/browser/ai-core-preferences.d.ts.map +1 -1
- package/lib/browser/ai-core-preferences.js +14 -13
- package/lib/browser/ai-core-preferences.js.map +1 -1
- package/lib/browser/ai-view-contribution.d.ts.map +1 -1
- package/lib/browser/ai-view-contribution.js +3 -3
- package/lib/browser/ai-view-contribution.js.map +1 -1
- package/lib/browser/file-variable-contribution.d.ts +17 -0
- package/lib/browser/file-variable-contribution.d.ts.map +1 -0
- package/lib/browser/file-variable-contribution.js +96 -0
- package/lib/browser/file-variable-contribution.js.map +1 -0
- package/lib/browser/frontend-variable-service.d.ts +21 -2
- package/lib/browser/frontend-variable-service.d.ts.map +1 -1
- package/lib/browser/frontend-variable-service.js +33 -5
- package/lib/browser/frontend-variable-service.js.map +1 -1
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +1 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/prompttemplate-contribution.d.ts.map +1 -1
- package/lib/browser/prompttemplate-contribution.js +1 -1
- package/lib/browser/prompttemplate-contribution.js.map +1 -1
- package/lib/browser/theia-variable-contribution.d.ts +4 -0
- package/lib/browser/theia-variable-contribution.d.ts.map +1 -1
- package/lib/browser/theia-variable-contribution.js +15 -1
- package/lib/browser/theia-variable-contribution.js.map +1 -1
- package/lib/common/agents-variable-contribution.d.ts.map +1 -1
- package/lib/common/agents-variable-contribution.js +2 -1
- package/lib/common/agents-variable-contribution.js.map +1 -1
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/language-model-util.d.ts.map +1 -1
- package/lib/common/language-model-util.js +1 -18
- package/lib/common/language-model-util.js.map +1 -1
- package/lib/common/prompt-text.d.ts +7 -0
- package/lib/common/prompt-text.d.ts.map +1 -0
- package/lib/common/prompt-text.js +26 -0
- package/lib/common/prompt-text.js.map +1 -0
- package/lib/common/today-variable-contribution.d.ts.map +1 -1
- package/lib/common/today-variable-contribution.js +23 -3
- package/lib/common/today-variable-contribution.js.map +1 -1
- package/lib/common/variable-service.d.ts +64 -1
- package/lib/common/variable-service.d.ts.map +1 -1
- package/lib/common/variable-service.js +87 -2
- package/lib/common/variable-service.js.map +1 -1
- package/package.json +10 -10
- package/src/browser/ai-activation-service.ts +11 -11
- package/src/browser/ai-core-frontend-module.ts +11 -37
- package/src/browser/ai-core-preferences.ts +16 -13
- package/src/browser/ai-view-contribution.ts +4 -4
- package/src/browser/file-variable-contribution.ts +102 -0
- package/src/browser/frontend-variable-service.ts +48 -3
- package/src/browser/index.ts +1 -0
- package/src/browser/prompttemplate-contribution.ts +2 -2
- package/src/browser/theia-variable-contribution.ts +14 -1
- package/src/common/agents-variable-contribution.ts +2 -2
- package/src/common/index.ts +1 -1
- package/src/common/language-model-util.ts +1 -18
- package/src/common/prompt-text.ts +22 -0
- package/src/common/today-variable-contribution.ts +8 -4
- package/src/common/variable-service.ts +130 -2
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +0 -28
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/agent-configuration-widget.js +0 -242
- package/lib/browser/ai-configuration/agent-configuration-widget.js.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts +0 -13
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-service.js +0 -44
- package/lib/browser/ai-configuration/ai-configuration-service.js.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts +0 -12
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.js +0 -41
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.js.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts +0 -20
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.js +0 -88
- package/lib/browser/ai-configuration/ai-configuration-widget.js.map +0 -1
- package/lib/browser/ai-configuration/language-model-renderer.d.ts +0 -13
- package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +0 -1
- package/lib/browser/ai-configuration/language-model-renderer.js +0 -104
- package/lib/browser/ai-configuration/language-model-renderer.js.map +0 -1
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts +0 -13
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +0 -1
- package/lib/browser/ai-configuration/template-settings-renderer.js +0 -71
- package/lib/browser/ai-configuration/template-settings-renderer.js.map +0 -1
- package/lib/browser/ai-configuration/variable-configuration-widget.d.ts +0 -20
- package/lib/browser/ai-configuration/variable-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/variable-configuration-widget.js +0 -99
- package/lib/browser/ai-configuration/variable-configuration-widget.js.map +0 -1
- package/lib/common/tomorrow-variable-contribution.d.ts +0 -17
- package/lib/common/tomorrow-variable-contribution.d.ts.map +0 -1
- package/lib/common/tomorrow-variable-contribution.js +0 -48
- package/lib/common/tomorrow-variable-contribution.js.map +0 -1
- package/src/browser/ai-configuration/agent-configuration-widget.tsx +0 -324
- package/src/browser/ai-configuration/ai-configuration-service.ts +0 -43
- package/src/browser/ai-configuration/ai-configuration-view-contribution.ts +0 -54
- package/src/browser/ai-configuration/ai-configuration-widget.tsx +0 -80
- package/src/browser/ai-configuration/language-model-renderer.tsx +0 -113
- package/src/browser/ai-configuration/template-settings-renderer.tsx +0 -128
- package/src/browser/ai-configuration/variable-configuration-widget.tsx +0 -110
- package/src/browser/style/index.css +0 -127
- package/src/common/tomorrow-variable-contribution.ts +0 -66
|
@@ -1,128 +0,0 @@
|
|
|
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
|
-
import * as React from '@theia/core/shared/react';
|
|
17
|
-
import { PromptCustomizationService, PromptService } from '../../common/prompt-service';
|
|
18
|
-
import { AISettingsService, PromptTemplate } from '../../common';
|
|
19
|
-
|
|
20
|
-
const DEFAULT_VARIANT = 'default';
|
|
21
|
-
|
|
22
|
-
export interface TemplateRendererProps {
|
|
23
|
-
agentId: string;
|
|
24
|
-
template: PromptTemplate;
|
|
25
|
-
promptCustomizationService: PromptCustomizationService;
|
|
26
|
-
promptService: PromptService;
|
|
27
|
-
aiSettingsService: AISettingsService;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const TemplateRenderer: React.FC<TemplateRendererProps> = ({
|
|
31
|
-
agentId,
|
|
32
|
-
template,
|
|
33
|
-
promptCustomizationService,
|
|
34
|
-
promptService,
|
|
35
|
-
aiSettingsService,
|
|
36
|
-
}) => {
|
|
37
|
-
const variantIds = [DEFAULT_VARIANT, ...promptService.getVariantIds(template.id)];
|
|
38
|
-
const [selectedVariant, setSelectedVariant] = React.useState<string>(DEFAULT_VARIANT);
|
|
39
|
-
|
|
40
|
-
React.useEffect(() => {
|
|
41
|
-
(async () => {
|
|
42
|
-
const agentSettings = await aiSettingsService.getAgentSettings(agentId);
|
|
43
|
-
const currentVariant =
|
|
44
|
-
agentSettings?.selectedVariants?.[template.id] || DEFAULT_VARIANT;
|
|
45
|
-
setSelectedVariant(currentVariant);
|
|
46
|
-
})();
|
|
47
|
-
}, [template.id, aiSettingsService, agentId]);
|
|
48
|
-
|
|
49
|
-
const isInvalidVariant = !variantIds.includes(selectedVariant);
|
|
50
|
-
|
|
51
|
-
const handleVariantChange = async (event: React.ChangeEvent<HTMLSelectElement>) => {
|
|
52
|
-
const newVariant = event.target.value;
|
|
53
|
-
setSelectedVariant(newVariant);
|
|
54
|
-
|
|
55
|
-
const agentSettings = await aiSettingsService.getAgentSettings(agentId);
|
|
56
|
-
const selectedVariants = agentSettings?.selectedVariants || {};
|
|
57
|
-
|
|
58
|
-
const updatedVariants = { ...selectedVariants };
|
|
59
|
-
if (newVariant === DEFAULT_VARIANT) {
|
|
60
|
-
delete updatedVariants[template.id];
|
|
61
|
-
} else {
|
|
62
|
-
updatedVariants[template.id] = newVariant;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
await aiSettingsService.updateAgentSettings(agentId, {
|
|
66
|
-
selectedVariants: updatedVariants,
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const openTemplate = () => {
|
|
71
|
-
const templateId = selectedVariant === DEFAULT_VARIANT ? template.id : selectedVariant;
|
|
72
|
-
const selectedTemplate = promptService.getRawPrompt(templateId);
|
|
73
|
-
promptCustomizationService.editTemplate(templateId, selectedTemplate?.template || '');
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const resetTemplate = () => {
|
|
77
|
-
const templateId = selectedVariant === DEFAULT_VARIANT ? template.id : selectedVariant;
|
|
78
|
-
promptCustomizationService.resetTemplate(templateId);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<div className="template-renderer">
|
|
83
|
-
<div className="settings-section-title template-header">
|
|
84
|
-
<strong>{template.id}</strong>
|
|
85
|
-
</div>
|
|
86
|
-
<div className="template-controls">
|
|
87
|
-
{(variantIds.length > 1 || isInvalidVariant) && (
|
|
88
|
-
<>
|
|
89
|
-
<label htmlFor={`variant-selector-${template.id}`} className="template-select-label">
|
|
90
|
-
Select Variant:
|
|
91
|
-
</label>
|
|
92
|
-
<select
|
|
93
|
-
id={`variant-selector-${template.id}`}
|
|
94
|
-
className={`theia-select template-variant-selector ${isInvalidVariant ? 'error' : ''}`}
|
|
95
|
-
value={isInvalidVariant ? 'invalid' : selectedVariant}
|
|
96
|
-
onChange={handleVariantChange}
|
|
97
|
-
>
|
|
98
|
-
{isInvalidVariant && (
|
|
99
|
-
<option value="invalid" disabled>
|
|
100
|
-
The selected variant is no longer available
|
|
101
|
-
</option>
|
|
102
|
-
)}
|
|
103
|
-
{variantIds.map(variantId => (
|
|
104
|
-
<option key={variantId} value={variantId}>
|
|
105
|
-
{variantId}
|
|
106
|
-
</option>
|
|
107
|
-
))}
|
|
108
|
-
</select>
|
|
109
|
-
</>
|
|
110
|
-
)}
|
|
111
|
-
<button
|
|
112
|
-
className="theia-button main"
|
|
113
|
-
onClick={openTemplate}
|
|
114
|
-
disabled={isInvalidVariant}
|
|
115
|
-
>
|
|
116
|
-
Edit
|
|
117
|
-
</button>
|
|
118
|
-
<button
|
|
119
|
-
className="theia-button secondary"
|
|
120
|
-
onClick={resetTemplate}
|
|
121
|
-
disabled={isInvalidVariant}
|
|
122
|
-
>
|
|
123
|
-
Reset
|
|
124
|
-
</button>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
);
|
|
128
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
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 { codicon, ReactWidget } from '@theia/core/lib/browser';
|
|
18
|
-
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
-
import * as React from '@theia/core/shared/react';
|
|
20
|
-
import { Agent, AIVariable, AIVariableService } from '../../common';
|
|
21
|
-
import { AIAgentConfigurationWidget } from './agent-configuration-widget';
|
|
22
|
-
import { AIConfigurationSelectionService } from './ai-configuration-service';
|
|
23
|
-
import { AgentService } from '../../common/agent-service';
|
|
24
|
-
|
|
25
|
-
@injectable()
|
|
26
|
-
export class AIVariableConfigurationWidget extends ReactWidget {
|
|
27
|
-
|
|
28
|
-
static readonly ID = 'ai-variable-configuration-container-widget';
|
|
29
|
-
static readonly LABEL = 'Variables';
|
|
30
|
-
|
|
31
|
-
@inject(AIVariableService)
|
|
32
|
-
protected readonly variableService: AIVariableService;
|
|
33
|
-
|
|
34
|
-
@inject(AgentService)
|
|
35
|
-
protected readonly agentService: AgentService;
|
|
36
|
-
|
|
37
|
-
@inject(AIConfigurationSelectionService)
|
|
38
|
-
protected readonly aiConfigurationSelectionService: AIConfigurationSelectionService;
|
|
39
|
-
|
|
40
|
-
@postConstruct()
|
|
41
|
-
protected init(): void {
|
|
42
|
-
this.id = AIVariableConfigurationWidget.ID;
|
|
43
|
-
this.title.label = AIVariableConfigurationWidget.LABEL;
|
|
44
|
-
this.title.closable = false;
|
|
45
|
-
this.update();
|
|
46
|
-
this.toDispose.push(this.variableService.onDidChangeVariables(() => this.update()));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
protected render(): React.ReactNode {
|
|
50
|
-
return <div className='configuration-variables-list'>
|
|
51
|
-
<ul>
|
|
52
|
-
{this.variableService.getVariables().map(variable =>
|
|
53
|
-
<li key={variable.id} className='variable-item' >
|
|
54
|
-
<div className='settings-section-title settings-section-category-title' style={{ paddingLeft: 0, paddingBottom: 10 }}>{variable.name}</div>
|
|
55
|
-
<small>{variable.id}</small>
|
|
56
|
-
<small>{variable.description}</small>
|
|
57
|
-
{this.renderReferencedVariables(variable)}
|
|
58
|
-
{this.renderArgs(variable)}
|
|
59
|
-
</li>
|
|
60
|
-
)}
|
|
61
|
-
</ul>
|
|
62
|
-
</div>;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
protected renderReferencedVariables(variable: AIVariable): React.ReactNode | undefined {
|
|
66
|
-
const agents = this.getAgentsForVariable(variable);
|
|
67
|
-
if (agents.length === 0) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return <div>
|
|
72
|
-
<h3>Agents</h3>
|
|
73
|
-
<ul className='variable-references'>
|
|
74
|
-
{agents.map(agent => <li key={agent.id} className='theia-TreeNode theia-CompositeTreeNode theia-ExpandableTreeNode theia-mod-selected'>
|
|
75
|
-
<div onClick={() => { this.showAgentConfiguration(agent); }} className='variable-reference'>
|
|
76
|
-
<span>{agent.name}</span>
|
|
77
|
-
<i className={codicon('chevron-right')}></i>
|
|
78
|
-
</div></li>)}
|
|
79
|
-
</ul>
|
|
80
|
-
</div>;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
protected renderArgs(variable: AIVariable): React.ReactNode | undefined {
|
|
84
|
-
if (variable.args === undefined || variable.args.length === 0) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return <div className='variable-args-container'>
|
|
89
|
-
<h3>Variable Arguments</h3>
|
|
90
|
-
<div className='variable-args'>
|
|
91
|
-
{variable.args.map(arg =>
|
|
92
|
-
<React.Fragment key={arg.name}>
|
|
93
|
-
<span>{arg.name}</span>
|
|
94
|
-
<small>{arg.description}</small>
|
|
95
|
-
</React.Fragment>
|
|
96
|
-
)}
|
|
97
|
-
</div>
|
|
98
|
-
</div>;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
protected showAgentConfiguration(agent: Agent): void {
|
|
102
|
-
this.aiConfigurationSelectionService.setActiveAgent(agent);
|
|
103
|
-
this.aiConfigurationSelectionService.selectConfigurationTab(AIAgentConfigurationWidget.ID);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
protected getAgentsForVariable(variable: AIVariable): Agent[] {
|
|
107
|
-
return this.agentService.getAgents().filter(a => a.variables?.includes(variable.id));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
@@ -1,127 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
import { MaybePromise } from '@theia/core';
|
|
17
|
-
import { injectable } from '@theia/core/shared/inversify';
|
|
18
|
-
import { AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest, AIVariableResolver, AIVariableService, ResolvedAIVariable } from './variable-service';
|
|
19
|
-
|
|
20
|
-
export namespace TomorrowVariableArgs {
|
|
21
|
-
export const IN_UNIX_SECONDS = 'inUnixSeconds';
|
|
22
|
-
export const IN_ISO_8601 = 'inIso8601';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const TOMORROW_VARIABLE: AIVariable = {
|
|
26
|
-
id: 'tomorrow-provider',
|
|
27
|
-
description: 'Does something for tomorrow',
|
|
28
|
-
name: 'tomorrow',
|
|
29
|
-
args: [
|
|
30
|
-
{ name: TomorrowVariableArgs.IN_ISO_8601, description: 'Returns the current date in ISO 8601 format' },
|
|
31
|
-
{ name: TomorrowVariableArgs.IN_UNIX_SECONDS, description: 'Returns the current date in unix seconds format' }
|
|
32
|
-
]
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export interface ResolvedTomorrowVariable extends ResolvedAIVariable {
|
|
36
|
-
date: Date;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@injectable()
|
|
40
|
-
export class TomorrowVariableContribution implements AIVariableContribution, AIVariableResolver {
|
|
41
|
-
registerVariables(service: AIVariableService): void {
|
|
42
|
-
service.registerResolver(TOMORROW_VARIABLE, this);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise<number> {
|
|
46
|
-
return 1;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise<ResolvedAIVariable | undefined> {
|
|
50
|
-
if (request.variable.name === TOMORROW_VARIABLE.name) {
|
|
51
|
-
return this.resolveTomorrowVariable(request);
|
|
52
|
-
}
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private resolveTomorrowVariable(request: AIVariableResolutionRequest): ResolvedTomorrowVariable {
|
|
57
|
-
const date = new Date(+new Date() + 86400000);
|
|
58
|
-
if (request.arg === TomorrowVariableArgs.IN_ISO_8601) {
|
|
59
|
-
return { variable: request.variable, value: date.toISOString(), date };
|
|
60
|
-
}
|
|
61
|
-
if (request.arg === TomorrowVariableArgs.IN_UNIX_SECONDS) {
|
|
62
|
-
return { variable: request.variable, value: Math.round(date.getTime() / 1000).toString(), date };
|
|
63
|
-
}
|
|
64
|
-
return { variable: request.variable, value: date.toDateString(), date };
|
|
65
|
-
}
|
|
66
|
-
}
|