@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable-service.js","sourceRoot":"","sources":["../../src/common/variable-service.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;AAChF;;;gGAGgG;AAChG,gKAAgK;;;;AAEhK,sCAAsH;AACtH,4DAAyE;
|
|
1
|
+
{"version":3,"file":"variable-service.js","sourceRoot":"","sources":["../../src/common/variable-service.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;AAChF;;;gGAGgG;AAChG,gKAAgK;;;;AAEhK,sCAAsH;AACtH,4DAAyE;AAuBzE,IAAiB,UAAU,CAO1B;AAPD,WAAiB,UAAU;IACvB,SAAgB,EAAE,CAAC,GAAY;QAC3B,OAAO,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;YACnC,IAAI,IAAI,GAAG;YACX,MAAM,IAAI,GAAG;YACb,aAAa,IAAI,GAAG,CAAC;IAC7B,CAAC;IALe,aAAE,KAKjB,CAAA;AACL,CAAC,EAPgB,UAAU,0BAAV,UAAU,QAO1B;AAOD,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AE,EAAE,OAAO,CAAC,CAAA,CAAC;QACrE,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACvD,CAAC;CACJ,CAAA;AA3IY,4DAAwB;AASN;IAA1B,IAAA,kBAAM,EAAC,cAAO,CAAC;;wDAA2B;mCATlC,wBAAwB;IADpC,IAAA,sBAAU,GAAE;IAaJ,mBAAA,IAAA,kBAAM,EAAC,2BAAoB,CAAC,CAAA;IAAE,mBAAA,IAAA,iBAAK,EAAC,8BAAsB,CAAC,CAAA;;GAZvD,wBAAwB,CA2IpC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.59.0-next.62+9e43c93ad",
|
|
4
4
|
"description": "Theia - AI Core",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.
|
|
7
|
-
"@theia/editor": "1.
|
|
8
|
-
"@theia/filesystem": "1.
|
|
9
|
-
"@theia/monaco": "1.
|
|
6
|
+
"@theia/core": "1.59.0-next.62+9e43c93ad",
|
|
7
|
+
"@theia/editor": "1.59.0-next.62+9e43c93ad",
|
|
8
|
+
"@theia/filesystem": "1.59.0-next.62+9e43c93ad",
|
|
9
|
+
"@theia/monaco": "1.59.0-next.62+9e43c93ad",
|
|
10
10
|
"@theia/monaco-editor-core": "1.96.302",
|
|
11
|
-
"@theia/output": "1.
|
|
12
|
-
"@theia/variable-resolver": "1.
|
|
13
|
-
"@theia/workspace": "1.
|
|
11
|
+
"@theia/output": "1.59.0-next.62+9e43c93ad",
|
|
12
|
+
"@theia/variable-resolver": "1.59.0-next.62+9e43c93ad",
|
|
13
|
+
"@theia/workspace": "1.59.0-next.62+9e43c93ad",
|
|
14
14
|
"@types/js-yaml": "^4.0.9",
|
|
15
15
|
"js-yaml": "^4.1.0",
|
|
16
16
|
"minimatch": "^5.1.0",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"watch": "theiaext watch"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@theia/ext-scripts": "1.58.
|
|
55
|
+
"@theia/ext-scripts": "1.58.0"
|
|
56
56
|
},
|
|
57
57
|
"nyc": {
|
|
58
58
|
"extends": "../../configs/nyc.json"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "9e43c93ad61ea977db3974207bac5d7c1fd3ccd6"
|
|
61
61
|
}
|
|
@@ -17,13 +17,13 @@ import { inject, injectable } from '@theia/core/shared/inversify';
|
|
|
17
17
|
import { FrontendApplicationContribution, PreferenceService } from '@theia/core/lib/browser';
|
|
18
18
|
import { Emitter, MaybePromise, Event, } from '@theia/core';
|
|
19
19
|
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
20
|
-
import {
|
|
20
|
+
import { PREFERENCE_NAME_ENABLE_AI } from './ai-core-preferences';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Context key for the
|
|
23
|
+
* Context key for the AI features. It is set to `true` if the feature is enabled.
|
|
24
24
|
*/
|
|
25
25
|
// We reuse the enablement preference for the context key
|
|
26
|
-
export const
|
|
26
|
+
export const ENABLE_AI_CONTEXT_KEY = PREFERENCE_NAME_ENABLE_AI;
|
|
27
27
|
|
|
28
28
|
@injectable()
|
|
29
29
|
export class AIActivationService implements FrontendApplicationContribution {
|
|
@@ -33,23 +33,23 @@ export class AIActivationService implements FrontendApplicationContribution {
|
|
|
33
33
|
@inject(PreferenceService)
|
|
34
34
|
protected preferenceService: PreferenceService;
|
|
35
35
|
|
|
36
|
-
protected
|
|
36
|
+
protected isAiEnabledKey: ContextKey<boolean>;
|
|
37
37
|
|
|
38
|
-
protected
|
|
38
|
+
protected onDidChangeAIEnabled = new Emitter<boolean>();
|
|
39
39
|
get onDidChangeActiveStatus(): Event<boolean> {
|
|
40
|
-
return this.
|
|
40
|
+
return this.onDidChangeAIEnabled.event;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
get isActive(): boolean {
|
|
44
|
-
return this.
|
|
44
|
+
return this.isAiEnabledKey.get() ?? false;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
initialize(): MaybePromise<void> {
|
|
48
|
-
this.
|
|
48
|
+
this.isAiEnabledKey = this.contextKeyService.createKey(ENABLE_AI_CONTEXT_KEY, false);
|
|
49
49
|
this.preferenceService.onPreferenceChanged(e => {
|
|
50
|
-
if (e.preferenceName ===
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
50
|
+
if (e.preferenceName === PREFERENCE_NAME_ENABLE_AI) {
|
|
51
|
+
this.isAiEnabledKey.set(e.newValue);
|
|
52
|
+
this.onDidChangeAIEnabled.fire(e.newValue);
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -42,21 +42,17 @@ import {
|
|
|
42
42
|
LanguageModelDelegateClientImpl,
|
|
43
43
|
} from './frontend-language-model-registry';
|
|
44
44
|
|
|
45
|
-
import {
|
|
45
|
+
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
46
46
|
import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
47
47
|
import { LanguageGrammarDefinitionContribution } from '@theia/monaco/lib/browser/textmate';
|
|
48
|
-
|
|
49
|
-
import { AIConfigurationSelectionService } from './ai-configuration/ai-configuration-service';
|
|
50
|
-
import { AIAgentConfigurationViewContribution } from './ai-configuration/ai-configuration-view-contribution';
|
|
51
|
-
import { AIConfigurationContainerWidget } from './ai-configuration/ai-configuration-widget';
|
|
52
|
-
import { AIVariableConfigurationWidget } from './ai-configuration/variable-configuration-widget';
|
|
48
|
+
|
|
53
49
|
import { AICoreFrontendApplicationContribution } from './ai-core-frontend-application-contribution';
|
|
54
50
|
import { bindAICorePreferences } from './ai-core-preferences';
|
|
55
51
|
import { AISettingsServiceImpl } from './ai-settings-service';
|
|
56
52
|
import { FrontendPromptCustomizationServiceImpl } from './frontend-prompt-customization-service';
|
|
57
|
-
import { FrontendVariableService } from './frontend-variable-service';
|
|
53
|
+
import { DefaultFrontendVariableService, FrontendVariableService } from './frontend-variable-service';
|
|
58
54
|
import { PromptTemplateContribution } from './prompttemplate-contribution';
|
|
59
|
-
import {
|
|
55
|
+
import { FileVariableContribution } from './file-variable-contribution';
|
|
60
56
|
import { TheiaVariableContribution } from './theia-variable-contribution';
|
|
61
57
|
import { TodayVariableContribution } from '../common/today-variable-contribution';
|
|
62
58
|
import { AgentsVariableContribution } from '../common/agents-variable-contribution';
|
|
@@ -103,44 +99,22 @@ export default new ContainerModule(bind => {
|
|
|
103
99
|
bind(CommandContribution).toService(PromptTemplateContribution);
|
|
104
100
|
bind(TabBarToolbarContribution).toService(PromptTemplateContribution);
|
|
105
101
|
|
|
106
|
-
bind(AIConfigurationSelectionService).toSelf().inSingletonScope();
|
|
107
|
-
bind(AIConfigurationContainerWidget).toSelf();
|
|
108
|
-
bind(WidgetFactory)
|
|
109
|
-
.toDynamicValue(ctx => ({
|
|
110
|
-
id: AIConfigurationContainerWidget.ID,
|
|
111
|
-
createWidget: () => ctx.container.get(AIConfigurationContainerWidget)
|
|
112
|
-
}))
|
|
113
|
-
.inSingletonScope();
|
|
114
|
-
|
|
115
|
-
bindViewContribution(bind, AIAgentConfigurationViewContribution);
|
|
116
102
|
bind(AISettingsService).to(AISettingsServiceImpl).inRequestScope();
|
|
117
103
|
bindContributionProvider(bind, AIVariableContribution);
|
|
118
|
-
bind(
|
|
104
|
+
bind(DefaultFrontendVariableService).toSelf().inSingletonScope();
|
|
105
|
+
bind(FrontendVariableService).toService(DefaultFrontendVariableService);
|
|
119
106
|
bind(AIVariableService).toService(FrontendVariableService);
|
|
120
107
|
bind(FrontendApplicationContribution).toService(FrontendVariableService);
|
|
121
|
-
|
|
108
|
+
|
|
109
|
+
bind(TheiaVariableContribution).toSelf().inSingletonScope();
|
|
110
|
+
bind(AIVariableContribution).toService(TheiaVariableContribution);
|
|
111
|
+
|
|
122
112
|
bind(AIVariableContribution).to(TodayVariableContribution).inSingletonScope();
|
|
123
|
-
bind(AIVariableContribution).to(
|
|
113
|
+
bind(AIVariableContribution).to(FileVariableContribution).inSingletonScope();
|
|
124
114
|
bind(AIVariableContribution).to(AgentsVariableContribution).inSingletonScope();
|
|
125
115
|
|
|
126
116
|
bind(FrontendApplicationContribution).to(AICoreFrontendApplicationContribution).inSingletonScope();
|
|
127
117
|
|
|
128
|
-
bind(AIVariableConfigurationWidget).toSelf();
|
|
129
|
-
bind(WidgetFactory)
|
|
130
|
-
.toDynamicValue(ctx => ({
|
|
131
|
-
id: AIVariableConfigurationWidget.ID,
|
|
132
|
-
createWidget: () => ctx.container.get(AIVariableConfigurationWidget)
|
|
133
|
-
}))
|
|
134
|
-
.inSingletonScope();
|
|
135
|
-
|
|
136
|
-
bind(AIAgentConfigurationWidget).toSelf();
|
|
137
|
-
bind(WidgetFactory)
|
|
138
|
-
.toDynamicValue(ctx => ({
|
|
139
|
-
id: AIAgentConfigurationWidget.ID,
|
|
140
|
-
createWidget: () => ctx.container.get(AIAgentConfigurationWidget)
|
|
141
|
-
}))
|
|
142
|
-
.inSingletonScope();
|
|
143
|
-
|
|
144
118
|
bind(ToolInvocationRegistry).to(ToolInvocationRegistryImpl).inSingletonScope();
|
|
145
119
|
bindContributionProvider(bind, ToolProvider);
|
|
146
120
|
|
|
@@ -14,37 +14,40 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
+
import { nls } from '@theia/core';
|
|
17
18
|
import { PreferenceContribution, PreferenceProxy, PreferenceSchema } from '@theia/core/lib/browser';
|
|
18
19
|
import { PreferenceProxyFactory } from '@theia/core/lib/browser/preferences/injectable-preference-proxy';
|
|
19
20
|
import { interfaces } from '@theia/core/shared/inversify';
|
|
20
21
|
|
|
21
|
-
export const AI_CORE_PREFERENCES_TITLE = '✨ AI Features [
|
|
22
|
-
export const
|
|
22
|
+
export const AI_CORE_PREFERENCES_TITLE = nls.localize('theia/ai/core/prefs/title', '✨ AI Features [Alpha]');
|
|
23
|
+
export const PREFERENCE_NAME_ENABLE_AI = 'ai-features.AiEnable.enableAI';
|
|
23
24
|
export const PREFERENCE_NAME_PROMPT_TEMPLATES = 'ai-features.promptTemplates.promptTemplatesFolder';
|
|
24
25
|
export const PREFERENCE_NAME_REQUEST_SETTINGS = 'ai-features.modelSettings.requestSettings';
|
|
25
26
|
|
|
26
27
|
export const aiCorePreferenceSchema: PreferenceSchema = {
|
|
27
28
|
type: 'object',
|
|
28
29
|
properties: {
|
|
29
|
-
[
|
|
30
|
+
[PREFERENCE_NAME_ENABLE_AI]: {
|
|
30
31
|
title: AI_CORE_PREFERENCES_TITLE,
|
|
31
|
-
markdownDescription: '
|
|
32
|
+
markdownDescription: nls.localize('theia/ai/core/enableAI/mdDescription',
|
|
33
|
+
'❗ This setting allows you to access the latest AI capabilities (Alpha version).\
|
|
32
34
|
\n\
|
|
33
|
-
Please note that these features are in an
|
|
34
|
-
undergo
|
|
35
|
+
Please note that these features are in an alpha phase, which means they may \
|
|
36
|
+
undergo changes and will be further improved. It is important to be aware that these features may generate\
|
|
35
37
|
continuous requests to the language models (LLMs) you provide access to. This might incur costs that you\
|
|
36
38
|
need to monitor closely. By enabling this option, you acknowledge these risks.\
|
|
37
39
|
\n\
|
|
38
40
|
**Please note! The settings below in this section will only take effect\n\
|
|
39
41
|
once the main feature setting is enabled. After enabling the feature, you need to configure at least one\
|
|
40
|
-
LLM provider below. Also see [the documentation](https://theia-ide.org/docs/user_ai/)**.',
|
|
42
|
+
LLM provider below. Also see [the documentation](https://theia-ide.org/docs/user_ai/)**.'),
|
|
41
43
|
type: 'boolean',
|
|
42
44
|
default: false,
|
|
43
45
|
},
|
|
44
46
|
[PREFERENCE_NAME_PROMPT_TEMPLATES]: {
|
|
45
47
|
title: AI_CORE_PREFERENCES_TITLE,
|
|
46
|
-
description: '
|
|
47
|
-
|
|
48
|
+
description: nls.localize('theia/ai/core/promptTemplates/description',
|
|
49
|
+
'Folder for storing customized prompt templates. If not customized the user config directory is used. Please consider to use a folder, which is\
|
|
50
|
+
under version control to manage your variants of prompt templates.'),
|
|
48
51
|
type: 'string',
|
|
49
52
|
default: '',
|
|
50
53
|
typeDetails: {
|
|
@@ -58,12 +61,12 @@ export const aiCorePreferenceSchema: PreferenceSchema = {
|
|
|
58
61
|
},
|
|
59
62
|
},
|
|
60
63
|
[PREFERENCE_NAME_REQUEST_SETTINGS]: {
|
|
61
|
-
title: 'Custom Request Settings',
|
|
62
|
-
markdownDescription: 'Allows specifying custom request settings for multiple models.\n\
|
|
64
|
+
title: nls.localize('theia/ai/core/requestSettings/title', 'Custom Request Settings'),
|
|
65
|
+
markdownDescription: nls.localize('theia/ai/core/requestSettings/mdDescription', 'Allows specifying custom request settings for multiple models.\n\
|
|
63
66
|
Each object represents the configuration for a specific model. The `modelId` field specifies the model ID, `requestSettings` defines model-specific settings.\n\
|
|
64
67
|
The `providerId` field is optional and allows you to apply the settings to a specific provider. If not set, the settings will be applied to all providers.\n\
|
|
65
68
|
Example providerIds: huggingface, openai, ollama, llamafile.\n\
|
|
66
|
-
Refer to [our documentation](https://theia-ide.org/docs/user_ai/#custom-request-settings) for more information.',
|
|
69
|
+
Refer to [our documentation](https://theia-ide.org/docs/user_ai/#custom-request-settings) for more information.'),
|
|
67
70
|
type: 'array',
|
|
68
71
|
items: {
|
|
69
72
|
type: 'object',
|
|
@@ -88,7 +91,7 @@ export const aiCorePreferenceSchema: PreferenceSchema = {
|
|
|
88
91
|
}
|
|
89
92
|
};
|
|
90
93
|
export interface AICoreConfiguration {
|
|
91
|
-
[
|
|
94
|
+
[PREFERENCE_NAME_ENABLE_AI]: boolean | undefined;
|
|
92
95
|
[PREFERENCE_NAME_PROMPT_TEMPLATES]: string | undefined;
|
|
93
96
|
[PREFERENCE_NAME_REQUEST_SETTINGS]: Array<{
|
|
94
97
|
modelId: string;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { CommandRegistry, MenuModelRegistry } from '@theia/core';
|
|
17
17
|
import { AbstractViewContribution, CommonMenus, KeybindingRegistry, PreferenceService, Widget } from '@theia/core/lib/browser';
|
|
18
18
|
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
-
import { AIActivationService,
|
|
19
|
+
import { AIActivationService, ENABLE_AI_CONTEXT_KEY } from './ai-activation-service';
|
|
20
20
|
import { AICommandHandlerFactory } from './ai-command-handler-factory';
|
|
21
21
|
|
|
22
22
|
@injectable()
|
|
@@ -49,7 +49,7 @@ export class AIViewContribution<T extends Widget> extends AbstractViewContributi
|
|
|
49
49
|
}
|
|
50
50
|
this.quickView?.registerItem({
|
|
51
51
|
label: this.viewLabel,
|
|
52
|
-
when:
|
|
52
|
+
when: ENABLE_AI_CONTEXT_KEY,
|
|
53
53
|
open: () => this.openView({ activate: true })
|
|
54
54
|
});
|
|
55
55
|
|
|
@@ -59,7 +59,7 @@ export class AIViewContribution<T extends Widget> extends AbstractViewContributi
|
|
|
59
59
|
if (this.toggleCommand) {
|
|
60
60
|
menus.registerMenuAction(CommonMenus.VIEW_VIEWS, {
|
|
61
61
|
commandId: this.toggleCommand.id,
|
|
62
|
-
when:
|
|
62
|
+
when: ENABLE_AI_CONTEXT_KEY,
|
|
63
63
|
label: this.viewLabel
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -68,7 +68,7 @@ export class AIViewContribution<T extends Widget> extends AbstractViewContributi
|
|
|
68
68
|
if (this.toggleCommand && this.options.toggleKeybinding) {
|
|
69
69
|
keybindings.registerKeybinding({
|
|
70
70
|
command: this.toggleCommand.id,
|
|
71
|
-
when:
|
|
71
|
+
when: ENABLE_AI_CONTEXT_KEY,
|
|
72
72
|
keybinding: this.options.toggleKeybinding
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2025 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 { Path, URI } from '@theia/core';
|
|
18
|
+
import { codiconArray } from '@theia/core/lib/browser';
|
|
19
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
20
|
+
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
21
|
+
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
|
|
22
|
+
import {
|
|
23
|
+
AIVariable,
|
|
24
|
+
AIVariableContext,
|
|
25
|
+
AIVariableContribution,
|
|
26
|
+
AIVariableResolutionRequest,
|
|
27
|
+
AIVariableResolver,
|
|
28
|
+
AIVariableService,
|
|
29
|
+
ResolvedAIContextVariable,
|
|
30
|
+
} from '../common/variable-service';
|
|
31
|
+
|
|
32
|
+
export namespace FileVariableArgs {
|
|
33
|
+
export const uri = 'uri';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const FILE_VARIABLE: AIVariable = {
|
|
37
|
+
id: 'file-provider',
|
|
38
|
+
description: 'Resolves the contents of a file',
|
|
39
|
+
name: 'file',
|
|
40
|
+
label: 'File',
|
|
41
|
+
iconClasses: codiconArray('file'),
|
|
42
|
+
isContextVariable: true,
|
|
43
|
+
args: [{ name: FileVariableArgs.uri, description: 'The URI of the requested file.' }]
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
@injectable()
|
|
47
|
+
export class FileVariableContribution implements AIVariableContribution, AIVariableResolver {
|
|
48
|
+
@inject(FileService)
|
|
49
|
+
protected readonly fileService: FileService;
|
|
50
|
+
|
|
51
|
+
@inject(WorkspaceService)
|
|
52
|
+
protected readonly wsService: WorkspaceService;
|
|
53
|
+
|
|
54
|
+
registerVariables(service: AIVariableService): void {
|
|
55
|
+
service.registerResolver(FILE_VARIABLE, this);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async canResolve(request: AIVariableResolutionRequest, _: AIVariableContext): Promise<number> {
|
|
59
|
+
return request.variable.name === FILE_VARIABLE.name ? 1 : 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async resolve(request: AIVariableResolutionRequest, _: AIVariableContext): Promise<ResolvedAIContextVariable | undefined> {
|
|
63
|
+
if (request.variable.name !== FILE_VARIABLE.name || request.arg === undefined) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const path = request.arg;
|
|
68
|
+
const absoluteUri = await this.makeAbsolute(path);
|
|
69
|
+
if (!absoluteUri) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const content = await this.fileService.readFile(absoluteUri);
|
|
75
|
+
return {
|
|
76
|
+
variable: request.variable,
|
|
77
|
+
value: await this.wsService.getWorkspaceRelativePath(absoluteUri),
|
|
78
|
+
contextValue: content.value.toString()
|
|
79
|
+
};
|
|
80
|
+
} catch (error) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
protected async makeAbsolute(pathStr: string): Promise<URI | undefined> {
|
|
86
|
+
const path = new Path(Path.normalizePathSeparator(pathStr));
|
|
87
|
+
if (!path.isAbsolute) {
|
|
88
|
+
const workspaceRoots = this.wsService.tryGetRoots();
|
|
89
|
+
const wsUris = workspaceRoots.map(root => root.resource.resolve(path));
|
|
90
|
+
for (const uri of wsUris) {
|
|
91
|
+
if (await this.fileService.exists(uri)) {
|
|
92
|
+
return uri;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const argUri = new URI(pathStr);
|
|
97
|
+
if (await this.fileService.exists(argUri)) {
|
|
98
|
+
return argUri;
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -14,13 +14,58 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import { DefaultAIVariableService } from '../common';
|
|
17
|
+
import { Disposable } from '@theia/core';
|
|
19
18
|
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
19
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
20
|
+
import { AIVariableContext, AIVariableResolutionRequest, AIVariableService, DefaultAIVariableService } from '../common';
|
|
21
|
+
|
|
22
|
+
export type AIVariableDropHandler = (event: DragEvent, context: AIVariableContext) => Promise<AIVariableDropResult | undefined>;
|
|
23
|
+
|
|
24
|
+
export interface AIVariableDropResult {
|
|
25
|
+
variables: AIVariableResolutionRequest[],
|
|
26
|
+
text?: string
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const FrontendVariableService = Symbol('FrontendVariableService');
|
|
30
|
+
export interface FrontendVariableService extends AIVariableService {
|
|
31
|
+
registerDropHandler(handler: AIVariableDropHandler): Disposable;
|
|
32
|
+
unregisterDropHandler(handler: AIVariableDropHandler): void;
|
|
33
|
+
getDropResult(event: DragEvent, context: AIVariableContext): Promise<AIVariableDropResult>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface FrontendVariableContribution {
|
|
37
|
+
registerVariables(service: FrontendVariableService): void;
|
|
38
|
+
}
|
|
20
39
|
|
|
21
40
|
@injectable()
|
|
22
|
-
export class
|
|
41
|
+
export class DefaultFrontendVariableService extends DefaultAIVariableService implements FrontendApplicationContribution {
|
|
42
|
+
protected dropHandlers = new Set<AIVariableDropHandler>();
|
|
43
|
+
|
|
23
44
|
onStart(): void {
|
|
24
45
|
this.initContributions();
|
|
25
46
|
}
|
|
47
|
+
|
|
48
|
+
registerDropHandler(handler: AIVariableDropHandler): Disposable {
|
|
49
|
+
this.dropHandlers.add(handler);
|
|
50
|
+
return Disposable.create(() => this.unregisterDropHandler(handler));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
unregisterDropHandler(handler: AIVariableDropHandler): void {
|
|
54
|
+
this.dropHandlers.delete(handler);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async getDropResult(event: DragEvent, context: AIVariableContext): Promise<AIVariableDropResult> {
|
|
58
|
+
let text: string | undefined = undefined;
|
|
59
|
+
const variables: AIVariableResolutionRequest[] = [];
|
|
60
|
+
for (const handler of this.dropHandlers) {
|
|
61
|
+
const result = await handler(event, context);
|
|
62
|
+
if (result) {
|
|
63
|
+
variables.push(...result.variables);
|
|
64
|
+
if (text === undefined) {
|
|
65
|
+
text = result.text;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return { variables, text };
|
|
70
|
+
}
|
|
26
71
|
}
|
package/src/browser/index.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
18
|
import { GrammarDefinition, GrammarDefinitionProvider, LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate';
|
|
19
19
|
import * as monaco from '@theia/monaco-editor-core';
|
|
20
|
-
import { Command, CommandContribution, CommandRegistry, MessageService } from '@theia/core';
|
|
20
|
+
import { Command, CommandContribution, CommandRegistry, MessageService, nls } from '@theia/core';
|
|
21
21
|
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
22
22
|
|
|
23
23
|
import { codicon, Widget } from '@theia/core/lib/browser';
|
|
@@ -245,7 +245,7 @@ export class PromptTemplateContribution implements LanguageGrammarDefinitionCont
|
|
|
245
245
|
registry.registerItem({
|
|
246
246
|
id: DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS.id,
|
|
247
247
|
command: DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS.id,
|
|
248
|
-
tooltip: 'Discard Customizations'
|
|
248
|
+
tooltip: nls.localize('theia/ai/core/discardCustomPrompt/tooltip', 'Discard Customizations')
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
}
|
|
@@ -14,10 +14,14 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
|
|
17
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
17
18
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
19
|
import { VariableRegistry, VariableResolverService } from '@theia/variable-resolver/lib/browser';
|
|
19
20
|
import { AIVariableContribution, AIVariableResolver, AIVariableService, AIVariableResolutionRequest, AIVariableContext, ResolvedAIVariable } from '../common';
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Integrates the Theia VariableRegistry with the Theia AI VariableService
|
|
24
|
+
*/
|
|
21
25
|
@injectable()
|
|
22
26
|
export class TheiaVariableContribution implements AIVariableContribution, AIVariableResolver {
|
|
23
27
|
@inject(VariableResolverService)
|
|
@@ -29,12 +33,21 @@ export class TheiaVariableContribution implements AIVariableContribution, AIVari
|
|
|
29
33
|
@inject(FrontendApplicationStateService)
|
|
30
34
|
protected readonly stateService: FrontendApplicationStateService;
|
|
31
35
|
|
|
36
|
+
protected variableRenameMap: Map<string, string> = new Map([
|
|
37
|
+
['file', 'currentFilePath'],
|
|
38
|
+
]);
|
|
39
|
+
|
|
32
40
|
registerVariables(service: AIVariableService): void {
|
|
33
41
|
this.stateService.reachedState('initialized_layout').then(() => {
|
|
34
42
|
// some variable contributions in Theia are done as part of the onStart, same as our AI variable contributions
|
|
35
43
|
// we therefore wait for all of them to be registered before we register we map them to our own
|
|
36
44
|
this.variableRegistry.getVariables().forEach(variable => {
|
|
37
|
-
|
|
45
|
+
const variableName = this.variableRenameMap.has(variable.name) ? this.variableRenameMap.get(variable.name)! : variable.name;
|
|
46
|
+
service.registerResolver({
|
|
47
|
+
id: `theia-${variable.name}`,
|
|
48
|
+
name: variableName,
|
|
49
|
+
description: variable.description ?? nls.localize('theia/ai/core/variable-contribution/builtInVariable', 'Theia Built-in Variable')
|
|
50
|
+
}, this);
|
|
38
51
|
});
|
|
39
52
|
});
|
|
40
53
|
}
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
17
17
|
import { AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest, AIVariableResolver, AIVariableService, ResolvedAIVariable } from './variable-service';
|
|
18
|
-
import { MaybePromise } from '@theia/core';
|
|
18
|
+
import { MaybePromise, nls } from '@theia/core';
|
|
19
19
|
import { AgentService } from './agent-service';
|
|
20
20
|
|
|
21
21
|
export const AGENTS_VARIABLE: AIVariable = {
|
|
22
22
|
id: 'agents',
|
|
23
23
|
name: 'agents',
|
|
24
|
-
description: 'Returns the list of agents available in the system'
|
|
24
|
+
description: nls.localize('theia/ai/core/agentsVariable/description', 'Returns the list of agents available in the system')
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export interface ResolvedAgentsVariable extends ResolvedAIVariable {
|
package/src/common/index.ts
CHANGED
|
@@ -23,8 +23,8 @@ export * from './language-model-util';
|
|
|
23
23
|
export * from './language-model';
|
|
24
24
|
export * from './prompt-service';
|
|
25
25
|
export * from './prompt-service-util';
|
|
26
|
+
export * from './prompt-text';
|
|
26
27
|
export * from './protocol';
|
|
27
28
|
export * from './today-variable-contribution';
|
|
28
|
-
export * from './tomorrow-variable-contribution';
|
|
29
29
|
export * from './variable-service';
|
|
30
30
|
export * from './settings-service';
|
|
@@ -64,21 +64,4 @@ export const getJsonOfText = (text: string): unknown => {
|
|
|
64
64
|
throw new Error('Invalid response format');
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export const toolRequestToPromptText = (toolRequest: ToolRequest): string => {
|
|
68
|
-
const parameters = toolRequest.parameters;
|
|
69
|
-
let paramsText = '';
|
|
70
|
-
// parameters are supposed to be as a JSON schema. Thus, derive the parameters from its properties definition
|
|
71
|
-
if (parameters) {
|
|
72
|
-
const properties = parameters.properties;
|
|
73
|
-
paramsText = Object.keys(properties)
|
|
74
|
-
.map(key => {
|
|
75
|
-
const param = properties[key];
|
|
76
|
-
return `${key}: ${param.type}`;
|
|
77
|
-
})
|
|
78
|
-
.join(', ');
|
|
79
|
-
}
|
|
80
|
-
const descriptionText = toolRequest.description
|
|
81
|
-
? `: ${toolRequest.description}`
|
|
82
|
-
: '';
|
|
83
|
-
return `You can call function: ${toolRequest.id}(${paramsText})${descriptionText}`;
|
|
84
|
-
};
|
|
67
|
+
export const toolRequestToPromptText = (toolRequest: ToolRequest): string => `${toolRequest.id}`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2025 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 namespace PromptText {
|
|
18
|
+
export const AGENT_CHAR = '@';
|
|
19
|
+
export const VARIABLE_CHAR = '#';
|
|
20
|
+
export const FUNCTION_CHAR = '~';
|
|
21
|
+
export const VARIABLE_SEPARATOR_CHAR = ':';
|
|
22
|
+
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
//
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
|
-
import { MaybePromise } from '@theia/core';
|
|
16
|
+
import { MaybePromise, nls } from '@theia/core';
|
|
17
17
|
import { injectable } from '@theia/core/shared/inversify';
|
|
18
18
|
import { AIVariable, ResolvedAIVariable, AIVariableContribution, AIVariableResolver, AIVariableService, AIVariableResolutionRequest, AIVariableContext } from './variable-service';
|
|
19
19
|
|
|
@@ -24,11 +24,15 @@ export namespace TodayVariableArgs {
|
|
|
24
24
|
|
|
25
25
|
export const TODAY_VARIABLE: AIVariable = {
|
|
26
26
|
id: 'today-provider',
|
|
27
|
-
description: 'Does something for today',
|
|
27
|
+
description: nls.localize('theia/ai/core/todayVariable/description', 'Does something for today'),
|
|
28
28
|
name: 'today',
|
|
29
29
|
args: [
|
|
30
|
-
{
|
|
31
|
-
|
|
30
|
+
{
|
|
31
|
+
name: 'Format',
|
|
32
|
+
description: nls.localize('theia/ai/core/todayVariable/format/description', 'The format of the date'),
|
|
33
|
+
enum: [TodayVariableArgs.IN_ISO_8601, TodayVariableArgs.IN_UNIX_SECONDS],
|
|
34
|
+
isOptional: true
|
|
35
|
+
}
|
|
32
36
|
]
|
|
33
37
|
};
|
|
34
38
|
|