@theia/ai-ide 1.64.0-next.28 → 1.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +5 -2
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/agent-configuration-widget.js +15 -1
- package/lib/browser/ai-configuration/agent-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts +6 -1
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-service.js +10 -1
- package/lib/browser/ai-configuration/ai-configuration-service.js.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts +2 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.js +7 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/language-model-renderer.d.ts +4 -2
- package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +1 -1
- package/lib/browser/ai-configuration/language-model-renderer.js +49 -71
- package/lib/browser/ai-configuration/language-model-renderer.js.map +1 -1
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts +41 -0
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.js +225 -0
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts +7 -3
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js +35 -13
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +1 -1
- package/lib/browser/ai-configuration/template-settings-renderer.js +11 -6
- package/lib/browser/ai-configuration/template-settings-renderer.js.map +1 -1
- package/lib/browser/ai-ide-activation-service.d.ts +18 -0
- package/lib/browser/ai-ide-activation-service.d.ts.map +1 -0
- package/lib/browser/ai-ide-activation-service.js +72 -0
- package/lib/browser/ai-ide-activation-service.js.map +1 -0
- package/lib/browser/ai-ide-preferences.d.ts +4 -0
- package/lib/browser/ai-ide-preferences.d.ts.map +1 -0
- package/lib/browser/ai-ide-preferences.js +43 -0
- package/lib/browser/ai-ide-preferences.js.map +1 -0
- package/lib/browser/app-tester-chat-agent.d.ts +3 -6
- package/lib/browser/app-tester-chat-agent.d.ts.map +1 -1
- package/lib/browser/app-tester-chat-agent.js +6 -71
- package/lib/browser/app-tester-chat-agent.js.map +1 -1
- package/lib/browser/app-tester-prompt-template.d.ts +6 -0
- package/lib/browser/app-tester-prompt-template.d.ts.map +1 -0
- package/lib/browser/app-tester-prompt-template.js +79 -0
- package/lib/browser/app-tester-prompt-template.js.map +1 -0
- package/lib/browser/architect-agent.js +1 -1
- package/lib/browser/architect-agent.js.map +1 -1
- package/lib/browser/coder-agent.js +1 -1
- package/lib/browser/coder-agent.js.map +1 -1
- package/lib/browser/context-functions.d.ts.map +1 -1
- package/lib/browser/context-functions.js +12 -0
- package/lib/browser/context-functions.js.map +1 -1
- package/lib/browser/context-functions.spec.d.ts +2 -0
- package/lib/browser/context-functions.spec.d.ts.map +1 -0
- package/lib/browser/context-functions.spec.js +93 -0
- package/lib/browser/context-functions.spec.js.map +1 -0
- package/lib/browser/file-changeset-function.spec.d.ts +2 -0
- package/lib/browser/file-changeset-function.spec.d.ts.map +1 -0
- package/lib/browser/file-changeset-function.spec.js +45 -0
- package/lib/browser/file-changeset-function.spec.js.map +1 -0
- package/lib/browser/file-changeset-functions.d.ts +13 -3
- package/lib/browser/file-changeset-functions.d.ts.map +1 -1
- package/lib/browser/file-changeset-functions.js +100 -29
- package/lib/browser/file-changeset-functions.js.map +1 -1
- package/lib/browser/file-changeset-functions.spec.d.ts +2 -0
- package/lib/browser/file-changeset-functions.spec.d.ts.map +1 -0
- package/lib/browser/file-changeset-functions.spec.js +161 -0
- package/lib/browser/file-changeset-functions.spec.js.map +1 -0
- package/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +20 -0
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/ide-chat-welcome-message-provider.js +2 -2
- package/lib/browser/ide-chat-welcome-message-provider.js.map +1 -1
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.d.ts +2 -0
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.d.ts.map +1 -0
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.js +52 -0
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.js.map +1 -0
- package/lib/browser/workspace-functions.d.ts +3 -3
- package/lib/browser/workspace-functions.d.ts.map +1 -1
- package/lib/browser/workspace-functions.js +79 -28
- package/lib/browser/workspace-functions.js.map +1 -1
- package/lib/browser/workspace-functions.spec.d.ts +2 -0
- package/lib/browser/workspace-functions.spec.d.ts.map +1 -0
- package/lib/browser/workspace-functions.spec.js +161 -0
- package/lib/browser/workspace-functions.spec.js.map +1 -0
- package/lib/browser/workspace-launch-provider.d.ts +24 -0
- package/lib/browser/workspace-launch-provider.d.ts.map +1 -0
- package/lib/browser/workspace-launch-provider.js +216 -0
- package/lib/browser/workspace-launch-provider.js.map +1 -0
- package/lib/browser/workspace-launch-provider.spec.d.ts +2 -0
- package/lib/browser/workspace-launch-provider.spec.d.ts.map +1 -0
- package/lib/browser/workspace-launch-provider.spec.js +245 -0
- package/lib/browser/workspace-launch-provider.spec.js.map +1 -0
- package/lib/browser/workspace-search-provider.d.ts.map +1 -1
- package/lib/browser/workspace-search-provider.js +9 -0
- package/lib/browser/workspace-search-provider.js.map +1 -1
- package/lib/browser/workspace-search-provider.spec.js +59 -203
- package/lib/browser/workspace-search-provider.spec.js.map +1 -1
- package/lib/browser/workspace-task-provider.d.ts.map +1 -1
- package/lib/browser/workspace-task-provider.js +8 -1
- package/lib/browser/workspace-task-provider.js.map +1 -1
- package/lib/browser/workspace-task-provider.spec.d.ts +2 -0
- package/lib/browser/workspace-task-provider.spec.d.ts.map +1 -0
- package/lib/browser/workspace-task-provider.spec.js +109 -0
- package/lib/browser/workspace-task-provider.spec.js.map +1 -0
- package/lib/common/architect-prompt-template.d.ts.map +1 -1
- package/lib/common/architect-prompt-template.js +11 -0
- package/lib/common/architect-prompt-template.js.map +1 -1
- package/lib/common/command-chat-agents.js +1 -1
- package/lib/common/command-chat-agents.js.map +1 -1
- package/lib/common/orchestrator-chat-agent.js +1 -1
- package/lib/common/orchestrator-chat-agent.js.map +1 -1
- package/lib/common/universal-chat-agent.js +1 -1
- package/lib/common/universal-chat-agent.js.map +1 -1
- package/lib/common/workspace-functions.d.ts +3 -0
- package/lib/common/workspace-functions.d.ts.map +1 -1
- package/lib/common/workspace-functions.js +4 -1
- package/lib/common/workspace-functions.js.map +1 -1
- package/package.json +18 -17
- package/src/browser/ai-configuration/agent-configuration-widget.tsx +18 -2
- package/src/browser/ai-configuration/ai-configuration-service.ts +14 -1
- package/src/browser/ai-configuration/ai-configuration-widget.tsx +7 -1
- package/src/browser/ai-configuration/language-model-renderer.tsx +87 -59
- package/src/browser/ai-configuration/model-aliases-configuration-widget.tsx +279 -0
- package/src/browser/ai-configuration/prompt-fragments-configuration-widget.tsx +43 -13
- package/src/browser/ai-configuration/template-settings-renderer.tsx +11 -7
- package/src/browser/ai-ide-activation-service.ts +65 -0
- package/src/browser/ai-ide-preferences.ts +44 -0
- package/src/browser/app-tester-chat-agent.ts +5 -73
- package/src/browser/app-tester-prompt-template.ts +81 -0
- package/src/browser/architect-agent.ts +1 -1
- package/src/browser/coder-agent.ts +1 -1
- package/src/browser/context-functions.spec.ts +102 -0
- package/src/browser/context-functions.ts +11 -0
- package/src/browser/file-changeset-function.spec.ts +52 -0
- package/src/browser/file-changeset-functions.spec.ts +212 -0
- package/src/browser/file-changeset-functions.ts +102 -25
- package/src/browser/frontend-module.ts +29 -1
- package/src/browser/ide-chat-welcome-message-provider.tsx +4 -4
- package/src/browser/style/index.css +111 -6
- package/src/browser/test/tool-provider-cancellation-test-util.spec.ts +60 -0
- package/src/browser/workspace-functions.spec.ts +199 -0
- package/src/browser/workspace-functions.ts +105 -32
- package/src/browser/workspace-launch-provider.spec.ts +320 -0
- package/src/browser/workspace-launch-provider.ts +231 -0
- package/src/browser/workspace-search-provider.spec.ts +79 -229
- package/src/browser/workspace-search-provider.ts +10 -1
- package/src/browser/workspace-task-provider.spec.ts +125 -0
- package/src/browser/workspace-task-provider.ts +7 -2
- package/src/common/architect-prompt-template.ts +11 -0
- package/src/common/command-chat-agents.ts +1 -1
- package/src/common/orchestrator-chat-agent.ts +1 -1
- package/src/common/universal-chat-agent.ts +1 -1
- package/src/common/workspace-functions.ts +3 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AIIdeActivationServiceImpl = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// *****************************************************************************
|
|
6
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
7
|
+
//
|
|
8
|
+
// This program and the accompanying materials are made available under the
|
|
9
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
+
//
|
|
12
|
+
// This Source Code may also be made available under the following Secondary
|
|
13
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
+
// with the GNU Classpath Exception which is available at
|
|
16
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
17
|
+
//
|
|
18
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
19
|
+
// *****************************************************************************
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
22
|
+
const core_1 = require("@theia/core");
|
|
23
|
+
const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
|
|
24
|
+
const ai_activation_service_1 = require("@theia/ai-core/lib/browser/ai-activation-service");
|
|
25
|
+
const ai_ide_preferences_1 = require("./ai-ide-preferences");
|
|
26
|
+
/**
|
|
27
|
+
* Implements AI Activation Service based on preferences.
|
|
28
|
+
*/
|
|
29
|
+
let AIIdeActivationServiceImpl = class AIIdeActivationServiceImpl {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.onDidChangeAIEnabled = new core_1.Emitter();
|
|
32
|
+
}
|
|
33
|
+
get onDidChangeActiveStatus() {
|
|
34
|
+
return this.onDidChangeAIEnabled.event;
|
|
35
|
+
}
|
|
36
|
+
get isActive() {
|
|
37
|
+
var _a;
|
|
38
|
+
return (_a = this.isAiEnabledKey.get()) !== null && _a !== void 0 ? _a : false;
|
|
39
|
+
}
|
|
40
|
+
updateEnableValue(value) {
|
|
41
|
+
if (value !== this.isAiEnabledKey.get()) {
|
|
42
|
+
this.isAiEnabledKey.set(value);
|
|
43
|
+
this.onDidChangeAIEnabled.fire(value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
initialize() {
|
|
47
|
+
this.isAiEnabledKey = this.contextKeyService.createKey(ai_activation_service_1.ENABLE_AI_CONTEXT_KEY, false);
|
|
48
|
+
// make sure we don't miss once preferences are ready
|
|
49
|
+
this.preferenceService.ready.then(() => {
|
|
50
|
+
const enableValue = this.preferenceService.get(ai_ide_preferences_1.PREFERENCE_NAME_ENABLE_AI, false);
|
|
51
|
+
this.updateEnableValue(enableValue);
|
|
52
|
+
});
|
|
53
|
+
this.preferenceService.onPreferenceChanged(e => {
|
|
54
|
+
if (e.preferenceName === ai_ide_preferences_1.PREFERENCE_NAME_ENABLE_AI) {
|
|
55
|
+
this.updateEnableValue(e.newValue);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.AIIdeActivationServiceImpl = AIIdeActivationServiceImpl;
|
|
61
|
+
tslib_1.__decorate([
|
|
62
|
+
(0, inversify_1.inject)(context_key_service_1.ContextKeyService),
|
|
63
|
+
tslib_1.__metadata("design:type", Object)
|
|
64
|
+
], AIIdeActivationServiceImpl.prototype, "contextKeyService", void 0);
|
|
65
|
+
tslib_1.__decorate([
|
|
66
|
+
(0, inversify_1.inject)(browser_1.PreferenceService),
|
|
67
|
+
tslib_1.__metadata("design:type", Object)
|
|
68
|
+
], AIIdeActivationServiceImpl.prototype, "preferenceService", void 0);
|
|
69
|
+
exports.AIIdeActivationServiceImpl = AIIdeActivationServiceImpl = tslib_1.__decorate([
|
|
70
|
+
(0, inversify_1.injectable)()
|
|
71
|
+
], AIIdeActivationServiceImpl);
|
|
72
|
+
//# sourceMappingURL=ai-ide-activation-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-ide-activation-service.js","sourceRoot":"","sources":["../../src/browser/ai-ide-activation-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,4DAAkE;AAClE,qDAA6F;AAC7F,sCAA4D;AAC5D,qFAA4F;AAC5F,4FAA8G;AAC9G,6DAAiE;AAEjE;;GAEG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAAhC;QASO,yBAAoB,GAAG,IAAI,cAAO,EAAW,CAAC;IA6B5D,CAAC;IA5BG,IAAI,uBAAuB;QACvB,OAAO,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC;IAC3C,CAAC;IAED,IAAI,QAAQ;;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.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,eAAO,MAAM,yBAAyB,kCAAwB,CAAC;AAE/D,eAAO,MAAM,qBAAqB,EAAE,gBAoBnC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.aiIdePreferenceSchema = exports.PREFERENCE_NAME_ENABLE_AI = void 0;
|
|
19
|
+
const browser_1 = require("@theia/ai-core/lib/browser");
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
21
|
+
// We reuse the context key for the preference name
|
|
22
|
+
exports.PREFERENCE_NAME_ENABLE_AI = browser_1.ENABLE_AI_CONTEXT_KEY;
|
|
23
|
+
exports.aiIdePreferenceSchema = {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
[exports.PREFERENCE_NAME_ENABLE_AI]: {
|
|
27
|
+
title: browser_1.AI_CORE_PREFERENCES_TITLE,
|
|
28
|
+
markdownDescription: core_1.nls.localize('theia/ai/ide/enableAI/mdDescription', '❗ This setting allows you to access the latest AI capabilities (Beta version).\
|
|
29
|
+
\n\
|
|
30
|
+
Please note that these features are in a beta phase, which means they may \
|
|
31
|
+
undergo changes and will be further improved. It is important to be aware that these features may generate\
|
|
32
|
+
continuous requests to the language models (LLMs) you provide access to. This might incur costs that you\
|
|
33
|
+
need to monitor closely. By enabling this option, you acknowledge these risks.\
|
|
34
|
+
\n\
|
|
35
|
+
**Please note! The settings below in this section will only take effect\n\
|
|
36
|
+
once the main feature setting is enabled. After enabling the feature, you need to configure at least one\
|
|
37
|
+
LLM provider below. Also see [the documentation](https://theia-ide.org/docs/user_ai/)**.'),
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
default: false,
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=ai-ide-preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-ide-preferences.js","sourceRoot":"","sources":["../../src/browser/ai-ide-preferences.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;;;AAEhF,wDAA8F;AAC9F,sCAAkC;AAGlC,mDAAmD;AACtC,QAAA,yBAAyB,GAAG,+BAAqB,CAAC;AAElD,QAAA,qBAAqB,GAAqB;IACnD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,CAAC,iCAAyB,CAAC,EAAE;YACzB,KAAK,EAAE,mCAAyB;YAChC,mBAAmB,EAAE,UAAG,CAAC,QAAQ,CAAC,qCAAqC,EACnE;;;;;;;;;qGASqF,CAAC;YAC1F,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACjB;KACJ;CACJ,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents';
|
|
2
2
|
import { MutableChatRequestModel } from '@theia/ai-chat/lib/common/chat-model';
|
|
3
|
-
import {
|
|
3
|
+
import { LanguageModelRequirement } from '@theia/ai-core/lib/common';
|
|
4
4
|
import { MCPFrontendService, MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager';
|
|
5
5
|
import { PreferenceService } from '@theia/core/lib/browser';
|
|
6
|
-
export declare const REQUIRED_MCP_SERVERS: MCPServerDescription[];
|
|
7
|
-
export declare const appTesterTemplate: BasePromptFragment;
|
|
8
|
-
export declare const appTesterTemplateVariant: BasePromptFragment;
|
|
9
6
|
export declare const AppTesterChatAgentId = "AppTester";
|
|
10
7
|
export declare class AppTesterChatAgent extends AbstractStreamParsingChatAgent {
|
|
11
8
|
protected readonly mcpService: MCPFrontendService;
|
|
@@ -19,8 +16,8 @@ export declare class AppTesterChatAgent extends AbstractStreamParsingChatAgent {
|
|
|
19
16
|
protected systemPromptId: string;
|
|
20
17
|
prompts: {
|
|
21
18
|
id: string;
|
|
22
|
-
defaultVariant: BasePromptFragment;
|
|
23
|
-
variants: BasePromptFragment[];
|
|
19
|
+
defaultVariant: import("@theia/ai-core/lib/common").BasePromptFragment;
|
|
20
|
+
variants: import("@theia/ai-core/lib/common").BasePromptFragment[];
|
|
24
21
|
}[];
|
|
25
22
|
/**
|
|
26
23
|
* Override invoke to check if the Playwright MCP server is running, and if not, ask the user if it should be started.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-tester-chat-agent.d.ts","sourceRoot":"","sources":["../../src/browser/app-tester-chat-agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-tester-chat-agent.d.ts","sourceRoot":"","sources":["../../src/browser/app-tester-chat-agent.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAiE,uBAAuB,EAA+B,MAAM,sCAAsC,CAAC;AAC3K,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAIvG,OAAO,EAAmB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG7E,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAChD,qBACa,kBAAmB,SAAQ,8BAA8B;IAGlE,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAExD,EAAE,EAAE,MAAM,CAAwB;IAClC,IAAI,SAAwB;IAC5B,yBAAyB,EAAE,wBAAwB,EAAE,CAGlD;IACH,SAAS,CAAC,2BAA2B,EAAE,MAAM,CAAU;IAC9C,WAAW,SACmF;IAE9F,SAAS,EAAE,MAAM,CAA4B;IACtD,UAAmB,cAAc,EAAE,MAAM,CAAuB;IACvD,OAAO;;;;QAA0G;IAE1H;;OAEG;IACY,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;cA8CtD,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;cAK3C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7C;;;;OAIG;IACG,oBAAoB,CAAC,GAAG,OAAO,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CA4BhF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable max-len */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.AppTesterChatAgent = exports.AppTesterChatAgentId =
|
|
4
|
+
exports.AppTesterChatAgent = exports.AppTesterChatAgentId = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
// *****************************************************************************
|
|
7
7
|
// Copyright (C) 2024 EclipseSource GmbH.
|
|
@@ -18,7 +18,6 @@ const tslib_1 = require("tslib");
|
|
|
18
18
|
//
|
|
19
19
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
20
20
|
// *****************************************************************************
|
|
21
|
-
const ai_chat_1 = require("@theia/ai-chat");
|
|
22
21
|
const chat_agents_1 = require("@theia/ai-chat/lib/common/chat-agents");
|
|
23
22
|
const chat_model_1 = require("@theia/ai-chat/lib/common/chat-model");
|
|
24
23
|
const mcp_server_manager_1 = require("@theia/ai-mcp/lib/common/mcp-server-manager");
|
|
@@ -26,71 +25,7 @@ const core_1 = require("@theia/core");
|
|
|
26
25
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
27
26
|
const mcp_preferences_1 = require("@theia/ai-mcp/lib/browser/mcp-preferences");
|
|
28
27
|
const browser_1 = require("@theia/core/lib/browser");
|
|
29
|
-
const
|
|
30
|
-
exports.REQUIRED_MCP_SERVERS = [
|
|
31
|
-
{
|
|
32
|
-
name: 'playwright',
|
|
33
|
-
command: 'npx',
|
|
34
|
-
args: ['-y', '@playwright/mcp@latest',
|
|
35
|
-
'--cdp-endpoint',
|
|
36
|
-
'http://localhost:9222/'],
|
|
37
|
-
autostart: false,
|
|
38
|
-
env: {},
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: 'playwright-visual',
|
|
42
|
-
command: 'npx',
|
|
43
|
-
args: ['-y', '@playwright/mcp@latest', '--vision',
|
|
44
|
-
'--cdp-endpoint',
|
|
45
|
-
'http://localhost:9222/'],
|
|
46
|
-
autostart: false,
|
|
47
|
-
env: {},
|
|
48
|
-
}
|
|
49
|
-
];
|
|
50
|
-
// Prompt templates
|
|
51
|
-
exports.appTesterTemplate = {
|
|
52
|
-
id: 'app-tester-system-default',
|
|
53
|
-
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
54
|
-
Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
|
|
55
|
-
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
56
|
-
|
|
57
|
-
You are AppTester, an AI assistant integrated into Theia IDE specifically designed to help developers test running applications using Playwright.
|
|
58
|
-
Your role is to inspect the application for user-specified test scenarios through the Playwright MCP server.
|
|
59
|
-
|
|
60
|
-
## Your Workflow
|
|
61
|
-
1. Help the user build and launch their application
|
|
62
|
-
2. Use Playwright browser automation to validate test scenarios
|
|
63
|
-
3. Report results and provide actionable feedback
|
|
64
|
-
4. Help fix issues when needed
|
|
65
|
-
|
|
66
|
-
## Available Playwright Testing Tools
|
|
67
|
-
You have access to these powerful automation tools:
|
|
68
|
-
${exports.REQUIRED_MCP_SERVERS.map(server => `{{prompt:mcp_${server.name}_tools}}`)}
|
|
69
|
-
|
|
70
|
-
- **~{${app_tester_chat_functions_1.LAUNCH_BROWSER_FUNCTION_ID}}**: Launch the browser. This is required before performing any browser interactions. Always launch a new browser when starting a test session.
|
|
71
|
-
- **~{${app_tester_chat_functions_1.IS_BROWSER_RUNNING_FUNCTION_ID}}**: Check if the browser is running. If a tool fails by saying that the connection failed, you can verify the connection by using this tool.
|
|
72
|
-
- **~{${app_tester_chat_functions_1.CLOSE_BROWSER_FUNCTION_ID}}**: Close the browser.
|
|
73
|
-
- **~{${app_tester_chat_functions_1.QUERY_DOM_FUNCTION_ID}}**: Query the DOM for specific elements and their properties. Only use when explicitly requested by the user.
|
|
74
|
-
- **browser_snapshot**: Capture the current state of the page for verification or debugging purposes.
|
|
75
|
-
|
|
76
|
-
Prefer snapshots for investigating the page.
|
|
77
|
-
|
|
78
|
-
## Workflow Approach
|
|
79
|
-
1. **Understand Requirements**: Ask the user to clearly define what needs to be tested
|
|
80
|
-
2. **Launch Browser**: Start a fresh browser instance for testing
|
|
81
|
-
3. **Navigate and Test**: Execute the test scenario methodically
|
|
82
|
-
4. **Document Results**: Provide detailed results with screenshots when helpful
|
|
83
|
-
5. **Clean Up**: Always close the browser when testing is complete
|
|
84
|
-
|
|
85
|
-
## Current Context
|
|
86
|
-
Some files and other pieces of data may have been added by the user to the context of the chat. If any have, the details can be found below.
|
|
87
|
-
{{${ai_chat_1.CHAT_CONTEXT_DETAILS_VARIABLE_ID}}}
|
|
88
|
-
`
|
|
89
|
-
};
|
|
90
|
-
exports.appTesterTemplateVariant = {
|
|
91
|
-
id: 'app-tester-system-empty',
|
|
92
|
-
template: '',
|
|
93
|
-
};
|
|
28
|
+
const app_tester_prompt_template_1 = require("./app-tester-prompt-template");
|
|
94
29
|
exports.AppTesterChatAgentId = 'AppTester';
|
|
95
30
|
let AppTesterChatAgent = class AppTesterChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
|
|
96
31
|
constructor() {
|
|
@@ -99,14 +34,14 @@ let AppTesterChatAgent = class AppTesterChatAgent extends chat_agents_1.Abstract
|
|
|
99
34
|
this.name = exports.AppTesterChatAgentId;
|
|
100
35
|
this.languageModelRequirements = [{
|
|
101
36
|
purpose: 'chat',
|
|
102
|
-
identifier: '
|
|
37
|
+
identifier: 'default/code',
|
|
103
38
|
}];
|
|
104
39
|
this.defaultLanguageModelPurpose = 'chat';
|
|
105
40
|
this.description = core_1.nls.localize('theia/ai/chat/app-tester/description', 'This agent tests your application user interface to verify user-specified test scenarios through the Playwright MCP server. '
|
|
106
41
|
+ 'It can automate testing workflows and provide detailed feedback on application functionality.');
|
|
107
42
|
this.iconClass = 'codicon codicon-beaker';
|
|
108
43
|
this.systemPromptId = 'app-tester-system';
|
|
109
|
-
this.prompts = [{ id: 'app-tester-system', defaultVariant:
|
|
44
|
+
this.prompts = [{ id: 'app-tester-system', defaultVariant: app_tester_prompt_template_1.appTesterTemplate, variants: [app_tester_prompt_template_1.appTesterTemplateVariant] }];
|
|
110
45
|
}
|
|
111
46
|
/**
|
|
112
47
|
* Override invoke to check if the Playwright MCP server is running, and if not, ask the user if it should be started.
|
|
@@ -151,11 +86,11 @@ let AppTesterChatAgent = class AppTesterChatAgent extends chat_agents_1.Abstract
|
|
|
151
86
|
}
|
|
152
87
|
}
|
|
153
88
|
async requiresStartingServers() {
|
|
154
|
-
const allStarted = await Promise.all(
|
|
89
|
+
const allStarted = await Promise.all(app_tester_prompt_template_1.REQUIRED_MCP_SERVERS.map(server => this.mcpService.isServerStarted(server.name)));
|
|
155
90
|
return allStarted.some(started => !started);
|
|
156
91
|
}
|
|
157
92
|
async startServers() {
|
|
158
|
-
await this.ensureServersStarted(...
|
|
93
|
+
await this.ensureServersStarted(...app_tester_prompt_template_1.REQUIRED_MCP_SERVERS);
|
|
159
94
|
}
|
|
160
95
|
/**
|
|
161
96
|
* Starts the Playwright MCP server if it doesn't exist or isn't running.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-tester-chat-agent.js","sourceRoot":"","sources":["../../src/browser/app-tester-chat-agent.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;;AAE5B,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF,
|
|
1
|
+
{"version":3,"file":"app-tester-chat-agent.js","sourceRoot":"","sources":["../../src/browser/app-tester-chat-agent.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;;AAE5B,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF,uEAAuF;AACvF,qEAA2K;AAE3K,oFAAuG;AACvG,sCAAkC;AAClC,4DAAkE;AAClE,+EAA6E;AAC7E,qDAA6E;AAC7E,6EAAiH;AAEpG,QAAA,o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AM,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,kCAAgB,EAAE,EAAE,GAAG,cAAc,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,yBAAe,CAAC,IAAI,CAAC,CAAC;gBACvH,MAAM,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YACpD,CAAC;YAED,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;gBAClC,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACnD,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;YACtF,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;CACJ,CAAA;AAjHY,gDAAkB;AAGR;IADlB,IAAA,kBAAM,EAAC,uCAAkB,CAAC;;sDACuB;AAG/B;IADlB,IAAA,kBAAM,EAAC,2BAAiB,CAAC;;6DAC8B;6BAN/C,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAiH9B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BasePromptFragment } from '@theia/ai-core/lib/common';
|
|
2
|
+
import { MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager';
|
|
3
|
+
export declare const REQUIRED_MCP_SERVERS: MCPServerDescription[];
|
|
4
|
+
export declare const appTesterTemplate: BasePromptFragment;
|
|
5
|
+
export declare const appTesterTemplateVariant: BasePromptFragment;
|
|
6
|
+
//# sourceMappingURL=app-tester-prompt-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-tester-prompt-template.d.ts","sourceRoot":"","sources":["../../src/browser/app-tester-prompt-template.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAEnF,eAAO,MAAM,oBAAoB,EAAE,oBAAoB,EAmBtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,kBAsC/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,kBAGtC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/tslint/config */
|
|
3
|
+
// *****************************************************************************
|
|
4
|
+
// Copyright (C) 2025 EclipseSource GmbH and others.
|
|
5
|
+
//
|
|
6
|
+
// This file is licensed under the MIT License.
|
|
7
|
+
// See LICENSE-MIT.txt in the project root for license information.
|
|
8
|
+
// https://opensource.org/license/mit.
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
// *****************************************************************************
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.appTesterTemplateVariant = exports.appTesterTemplate = exports.REQUIRED_MCP_SERVERS = void 0;
|
|
14
|
+
const ai_chat_1 = require("@theia/ai-chat");
|
|
15
|
+
const app_tester_chat_functions_1 = require("../common/app-tester-chat-functions");
|
|
16
|
+
exports.REQUIRED_MCP_SERVERS = [
|
|
17
|
+
{
|
|
18
|
+
name: 'playwright',
|
|
19
|
+
command: 'npx',
|
|
20
|
+
args: ['-y', '@playwright/mcp@latest',
|
|
21
|
+
'--cdp-endpoint',
|
|
22
|
+
'http://localhost:9222/'],
|
|
23
|
+
autostart: false,
|
|
24
|
+
env: {},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'playwright-visual',
|
|
28
|
+
command: 'npx',
|
|
29
|
+
args: ['-y', '@playwright/mcp@latest', '--vision',
|
|
30
|
+
'--cdp-endpoint',
|
|
31
|
+
'http://localhost:9222/'],
|
|
32
|
+
autostart: false,
|
|
33
|
+
env: {},
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
exports.appTesterTemplate = {
|
|
37
|
+
id: 'app-tester-system-default',
|
|
38
|
+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
39
|
+
Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
|
|
40
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
41
|
+
|
|
42
|
+
You are AppTester, an AI assistant integrated into Theia IDE specifically designed to help developers test running applications using Playwright.
|
|
43
|
+
Your role is to inspect the application for user-specified test scenarios through the Playwright MCP server.
|
|
44
|
+
|
|
45
|
+
## Your Workflow
|
|
46
|
+
1. Help the user build and launch their application
|
|
47
|
+
2. Use Playwright browser automation to validate test scenarios
|
|
48
|
+
3. Report results and provide actionable feedback
|
|
49
|
+
4. Help fix issues when needed
|
|
50
|
+
|
|
51
|
+
## Available Playwright Testing Tools
|
|
52
|
+
You have access to these powerful automation tools:
|
|
53
|
+
${exports.REQUIRED_MCP_SERVERS.map(server => `{{prompt:mcp_${server.name}_tools}}`)}
|
|
54
|
+
|
|
55
|
+
- **~{${app_tester_chat_functions_1.LAUNCH_BROWSER_FUNCTION_ID}}**: Launch the browser. This is required before performing any browser interactions. Always launch a new browser when starting a test session.
|
|
56
|
+
- **~{${app_tester_chat_functions_1.IS_BROWSER_RUNNING_FUNCTION_ID}}**: Check if the browser is running. If a tool fails by saying that the connection failed, you can verify the connection by using this tool.
|
|
57
|
+
- **~{${app_tester_chat_functions_1.CLOSE_BROWSER_FUNCTION_ID}}**: Close the browser.
|
|
58
|
+
- **~{${app_tester_chat_functions_1.QUERY_DOM_FUNCTION_ID}}**: Query the DOM for specific elements and their properties. Only use when explicitly requested by the user.
|
|
59
|
+
- **browser_snapshot**: Capture the current state of the page for verification or debugging purposes.
|
|
60
|
+
|
|
61
|
+
Prefer snapshots for investigating the page.
|
|
62
|
+
|
|
63
|
+
## Workflow Approach
|
|
64
|
+
1. **Understand Requirements**: Ask the user to clearly define what needs to be tested
|
|
65
|
+
2. **Launch Browser**: Start a fresh browser instance for testing
|
|
66
|
+
3. **Navigate and Test**: Execute the test scenario methodically
|
|
67
|
+
4. **Document Results**: Provide detailed results with screenshots when helpful
|
|
68
|
+
5. **Clean Up**: Always close the browser when testing is complete
|
|
69
|
+
|
|
70
|
+
## Current Context
|
|
71
|
+
Some files and other pieces of data may have been added by the user to the context of the chat. If any have, the details can be found below.
|
|
72
|
+
{{${ai_chat_1.CHAT_CONTEXT_DETAILS_VARIABLE_ID}}}
|
|
73
|
+
`
|
|
74
|
+
};
|
|
75
|
+
exports.appTesterTemplateVariant = {
|
|
76
|
+
id: 'app-tester-system-empty',
|
|
77
|
+
template: '',
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=app-tester-prompt-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-tester-prompt-template.js","sourceRoot":"","sources":["../../src/browser/app-tester-prompt-template.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,+CAA+C;AAC/C,mEAAmE;AACnE,sCAAsC;AACtC,EAAE;AACF,+BAA+B;AAC/B,gFAAgF;;;AAGhF,4CAAkE;AAClE,mFAAmK;AAGtJ,QAAA,oBAAoB,GAA2B;IACxD;QACI,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,IAAI,EAAE,wBAAwB;YACjC,gBAAgB;YAChB,wBAAwB,CAAC;QAC7B,SAAS,EAAE,KAAK;QAChB,GAAG,EAAE,EAAE;KACV;IACD;QACI,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,IAAI,EAAE,wBAAwB,EAAE,UAAU;YAC7C,gBAAgB;YAChB,wBAAwB,CAAC;QAC7B,SAAS,EAAE,KAAK;QAChB,GAAG,EAAE,EAAE;KACV;CACJ,CAAC;AAEW,QAAA,iBAAiB,GAAuB;IACjD,EAAE,EAAE,2BAA2B;IAC/B,QAAQ,EAAE;;;;;;;;;;;;;;;EAeZ,4BAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,gBAAgB,MAAM,CAAC,IAAI,UAAU,CAAC;;QAEnE,sDAA0B;QAC1B,0DAA8B;QAC9B,qDAAyB;QACzB,iDAAqB;;;;;;;;;;;;;;IAczB,0CAAgC;CACnC;CACA,CAAC;AAEW,QAAA,wBAAwB,GAAuB;IACxD,EAAE,EAAE,yBAAyB;IAC7B,QAAQ,EAAE,EAAE;CACf,CAAC"}
|
|
@@ -31,7 +31,7 @@ let ArchitectAgent = class ArchitectAgent extends common_1.AbstractStreamParsing
|
|
|
31
31
|
this.id = 'Architect';
|
|
32
32
|
this.languageModelRequirements = [{
|
|
33
33
|
purpose: 'chat',
|
|
34
|
-
identifier: '
|
|
34
|
+
identifier: 'default/code',
|
|
35
35
|
}];
|
|
36
36
|
this.defaultLanguageModelPurpose = 'chat';
|
|
37
37
|
this.description = core_1.nls.localize('theia/ai/workspace/workspaceAgent/description', 'An AI assistant integrated into Theia IDE, designed to assist software developers. This agent can access the users workspace, it can get a list of all available files \
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architect-agent.js","sourceRoot":"","sources":["../../src/browser/architect-agent.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,sDAAkK;AAElK,4DAAkE;AAClE,mFAA4G;AAC5G,uEAA8G;AAC9G,sCAAkC;AAClC,kFAA+E;AAC/E,qFAA8H;AAGvH,I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C,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAuC;QACjD,MAAM,KAAK,GAAG,yBAAgB,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC,CAAC;QAClG,IAAI,CAAC,CAAC,KAAK,YAAY,yBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QACjE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YACnB,KAAK,CAAC,cAAc,CAAC;gBACjB,IAAI,uCAAkB,CAAC,wDAAwD,mEAAsC,CAAC,EAAE,IAAI,CAAC;gBAC7H,IAAI,uCAAkB,CAAC,yCAAyC,2DAA8B,CAAC,EAAE,IAAI,CAAC;aACzG,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACJ,CAAA;AAnCY,wCAAc;AACiB;IAAvC,IAAA,kBAAM,EAAC,oBAAW,CAAC;;mDAA6C;yBADxD,cAAc;IAD1B,IAAA,sBAAU,GAAE;GACA,cAAc,CAmC1B"}
|
|
@@ -32,7 +32,7 @@ let CoderAgent = class CoderAgent extends common_1.AbstractStreamParsingChatAgen
|
|
|
32
32
|
this.name = 'Coder';
|
|
33
33
|
this.languageModelRequirements = [{
|
|
34
34
|
purpose: 'chat',
|
|
35
|
-
identifier: '
|
|
35
|
+
identifier: 'default/code',
|
|
36
36
|
}];
|
|
37
37
|
this.defaultLanguageModelPurpose = 'chat';
|
|
38
38
|
this.description = core_1.nls.localize('theia/ai/workspace/coderAgent/description', 'An AI assistant integrated into Theia IDE, designed to assist software developers. This agent can access the users workspace, it can get a list of all available files \
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coder-agent.js","sourceRoot":"","sources":["../../src/browser/coder-agent.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,sDAAkK;AAClK,4DAAkE;AAClE,uEAA6J;AAC7J,2FAAgL;AAChL,yEAAgE;AAEhE,sCAAkC;AAClC,kFAA+E;AAC/E,yFAAiH;AAG1G,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,uCAA8B;IAAvD;;QAEH,OAAE,GAAW,OAAO,CAAC;QACrB,SAAI,GAAG,OAAO,CAAC;QACf,8BAAyB,GAA+B,CAAC;gBACrD,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"coder-agent.js","sourceRoot":"","sources":["../../src/browser/coder-agent.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,sDAAkK;AAClK,4DAAkE;AAClE,uEAA6J;AAC7J,2FAAgL;AAChL,yEAAgE;AAEhE,sCAAkC;AAClC,kFAA+E;AAC/E,yFAAiH;AAG1G,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,uCAA8B;IAAvD;;QAEH,OAAE,GAAW,OAAO,CAAC;QACrB,SAAI,GAAG,OAAO,CAAC;QACf,8BAAyB,GAA+B,CAAC;gBACrD,OAAO,EAAE,MAAM;gBACf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E,CAAC;YAClB,KAAK,CAAC,cAAc,CAAC;gBACjB;oBACI,IAAI,EAAE,UAAU;oBAChB,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,iDAAiD,EAAE,CAAC;oBACrH,OAAO,EAAE,gDAAgD;iBAC5D;aACJ,CAAC,CAAC;QACP,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,uCAAkB,CAAC,4DAA4D,oDAA+B,CAAC,EAAE,kBAAkB;sBACvJ,6DAA6D,iCAAY,CAAC,6BAA6B,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5H,CAAC;IACL,CAAC;CAEJ,CAAA;AA5CY,gCAAU;AACqB;IAAvC,IAAA,kBAAM,EAAC,oBAAW,CAAC;;+CAA6C;qBADxD,UAAU;IADtB,IAAA,sBAAU,GAAE;GACA,UAAU,CA4CtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-functions.d.ts","sourceRoot":"","sources":["../../src/browser/context-functions.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK3D,qBACa,eAAgB,YAAW,YAAY;IAChD,MAAM,CAAC,EAAE,SAAiC;IAE1C,OAAO,IAAI,WAAW;
|
|
1
|
+
{"version":3,"file":"context-functions.d.ts","sourceRoot":"","sources":["../../src/browser/context-functions.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK3D,qBACa,eAAgB,YAAW,YAAY;IAChD,MAAM,CAAC,EAAE,SAAiC;IAE1C,OAAO,IAAI,WAAW;CAqBzB;AAED,qBACa,kBAAmB,YAAW,YAAY;IACnD,MAAM,CAAC,EAAE,SAAoC;IAE7C,OAAO,IAAI,WAAW;CAkCzB;AAED,qBACa,oBAAqB,YAAW,YAAY;IACrD,MAAM,CAAC,EAAE,SAAoC;IAE7C,OAAO,IAAI,WAAW;CA+BzB"}
|
|
@@ -28,6 +28,10 @@ let ListChatContext = ListChatContext_1 = class ListChatContext {
|
|
|
28
28
|
name: ListChatContext_1.ID,
|
|
29
29
|
description: 'Returns the list of context elements (such as files) specified by the user manually as part of the chat request.',
|
|
30
30
|
handler: async (_, ctx) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
if ((_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.response) === null || _a === void 0 ? void 0 : _a.cancellationToken) === null || _b === void 0 ? void 0 : _b.isCancellationRequested) {
|
|
33
|
+
return JSON.stringify({ error: 'Operation cancelled by user' });
|
|
34
|
+
}
|
|
31
35
|
const result = ctx.context.variables.map(contextElement => ({
|
|
32
36
|
id: contextElement.variable.id + contextElement.arg,
|
|
33
37
|
type: contextElement.variable.name
|
|
@@ -63,6 +67,10 @@ let ResolveChatContext = ResolveChatContext_1 = class ResolveChatContext {
|
|
|
63
67
|
required: ['contextElementId']
|
|
64
68
|
},
|
|
65
69
|
handler: async (args, ctx) => {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
if ((_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.response) === null || _a === void 0 ? void 0 : _a.cancellationToken) === null || _b === void 0 ? void 0 : _b.isCancellationRequested) {
|
|
72
|
+
return JSON.stringify({ error: 'Operation cancelled by user' });
|
|
73
|
+
}
|
|
66
74
|
const { contextElementId } = JSON.parse(args);
|
|
67
75
|
const variable = ctx.context.variables.find(contextElement => contextElement.variable.id + contextElement.arg === contextElementId);
|
|
68
76
|
if (variable) {
|
|
@@ -101,6 +109,10 @@ let AddFileToChatContext = AddFileToChatContext_1 = class AddFileToChatContext {
|
|
|
101
109
|
},
|
|
102
110
|
description: 'Adds one or more files to the context of the current chat session, and returns the current list of files in the context.',
|
|
103
111
|
handler: async (arg, ctx) => {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
if ((_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.response) === null || _a === void 0 ? void 0 : _a.cancellationToken) === null || _b === void 0 ? void 0 : _b.isCancellationRequested) {
|
|
114
|
+
return JSON.stringify({ error: 'Operation cancelled by user' });
|
|
115
|
+
}
|
|
104
116
|
const { filesToAdd } = JSON.parse(arg);
|
|
105
117
|
ctx.session.context.addVariables(...filesToAdd.map(file => ({ arg: file, variable: file_variable_contribution_1.FILE_VARIABLE })));
|
|
106
118
|
const result = ctx.session.context.getVariables().filter(candidate => candidate.variable.id === file_variable_contribution_1.FILE_VARIABLE.id && !!candidate.arg)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-functions.js","sourceRoot":"","sources":["../../src/browser/context-functions.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;;AAIhF,4DAA0D;AAC1D,mEAAgJ;AAChJ,sGAAsF;AAG/E,IAAM,eAAe,uBAArB,MAAM,eAAe;IAGxB,OAAO;QACH,OAAO;YACH,EAAE,EAAE,iBAAe,CAAC,EAAE;YACtB,IAAI,EAAE,iBAAe,CAAC,EAAE;YACxB,WAAW,EAAE,kHAAkH;YAC/H,OAAO,EAAE,KAAK,EAAE,CAAS,EAAE,GAA4B,EAAmB,EAAE
|
|
1
|
+
{"version":3,"file":"context-functions.js","sourceRoot":"","sources":["../../src/browser/context-functions.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAu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,SAAS,CAAC,GAAG,CAAC;qBAC/H,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;gBAEzC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAClC,CAAC;SACJ,CAAC;IACN,CAAC;;AAjCQ,oDAAoB;AACtB,uBAAE,GAAG,oDAAgC,AAAnC,CAAoC;+BADpC,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CAkChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-functions.spec.d.ts","sourceRoot":"","sources":["../../src/browser/context-functions.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// *****************************************************************************
|
|
4
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
5
|
+
//
|
|
6
|
+
// This program and the accompanying materials are made available under the
|
|
7
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
8
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
9
|
+
//
|
|
10
|
+
// This Source Code may also be made available under the following Secondary
|
|
11
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
12
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
13
|
+
// with the GNU Classpath Exception which is available at
|
|
14
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
15
|
+
//
|
|
16
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
17
|
+
// *****************************************************************************
|
|
18
|
+
const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
|
|
19
|
+
let disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
|
20
|
+
const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
|
|
21
|
+
frontend_application_config_provider_1.FrontendApplicationConfigProvider.set({});
|
|
22
|
+
const chai_1 = require("chai");
|
|
23
|
+
const context_functions_1 = require("./context-functions");
|
|
24
|
+
const core_1 = require("@theia/core");
|
|
25
|
+
const assert_1 = require("assert");
|
|
26
|
+
disableJSDOM();
|
|
27
|
+
describe('Context Functions Cancellation Tests', () => {
|
|
28
|
+
let cancellationTokenSource;
|
|
29
|
+
let mockCtx;
|
|
30
|
+
before(() => {
|
|
31
|
+
disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
|
32
|
+
});
|
|
33
|
+
after(() => {
|
|
34
|
+
// Disable JSDOM after all tests
|
|
35
|
+
disableJSDOM();
|
|
36
|
+
});
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
cancellationTokenSource = new core_1.CancellationTokenSource();
|
|
39
|
+
const context = {
|
|
40
|
+
addVariables: () => { },
|
|
41
|
+
getVariables: () => { var _a; return (_a = mockCtx.context) === null || _a === void 0 ? void 0 : _a.variables; }
|
|
42
|
+
};
|
|
43
|
+
mockCtx = {
|
|
44
|
+
response: {
|
|
45
|
+
cancellationToken: cancellationTokenSource.token
|
|
46
|
+
},
|
|
47
|
+
context: {
|
|
48
|
+
variables: [{
|
|
49
|
+
variable: { id: 'file1', name: 'File' },
|
|
50
|
+
arg: '/path/to/file',
|
|
51
|
+
contextValue: 'file content'
|
|
52
|
+
}]
|
|
53
|
+
},
|
|
54
|
+
session: {
|
|
55
|
+
context
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
afterEach(() => {
|
|
60
|
+
cancellationTokenSource.dispose();
|
|
61
|
+
});
|
|
62
|
+
it('ListChatContext should respect cancellation token', async () => {
|
|
63
|
+
const listChatContext = new context_functions_1.ListChatContext();
|
|
64
|
+
cancellationTokenSource.cancel();
|
|
65
|
+
const result = await listChatContext.getTool().handler('', mockCtx);
|
|
66
|
+
if (typeof result !== 'string') {
|
|
67
|
+
(0, assert_1.fail)(`Wrong tool call result type: ${result}`);
|
|
68
|
+
}
|
|
69
|
+
const jsonResponse = JSON.parse(result);
|
|
70
|
+
(0, chai_1.expect)(jsonResponse.error).to.equal('Operation cancelled by user');
|
|
71
|
+
});
|
|
72
|
+
it('ResolveChatContext should respect cancellation token', async () => {
|
|
73
|
+
const resolveChatContext = new context_functions_1.ResolveChatContext();
|
|
74
|
+
cancellationTokenSource.cancel();
|
|
75
|
+
const result = await resolveChatContext.getTool().handler('{"contextElementId":"file1/path/to/file"}', mockCtx);
|
|
76
|
+
if (typeof result !== 'string') {
|
|
77
|
+
(0, assert_1.fail)(`Wrong tool call result type: ${result}`);
|
|
78
|
+
}
|
|
79
|
+
const jsonResponse = JSON.parse(result);
|
|
80
|
+
(0, chai_1.expect)(jsonResponse.error).to.equal('Operation cancelled by user');
|
|
81
|
+
});
|
|
82
|
+
it('AddFileToChatContext should respect cancellation token', async () => {
|
|
83
|
+
const addFileToChatContext = new context_functions_1.AddFileToChatContext();
|
|
84
|
+
cancellationTokenSource.cancel();
|
|
85
|
+
const result = await addFileToChatContext.getTool().handler('{"filesToAdd":["/new/path/to/file"]}', mockCtx);
|
|
86
|
+
if (typeof result !== 'string') {
|
|
87
|
+
(0, assert_1.fail)(`Wrong tool call result type: ${result}`);
|
|
88
|
+
}
|
|
89
|
+
const jsonResponse = JSON.parse(result);
|
|
90
|
+
(0, chai_1.expect)(jsonResponse.error).to.equal('Operation cancelled by user');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=context-functions.spec.js.map
|