@theia/ai-ide 1.62.1 → 1.63.0-next.24
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/ai-configuration-view-contribution.js +1 -1
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.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 +6 -0
- package/lib/browser/ai-configuration/ai-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/token-usage-configuration-widget.d.ts +1 -0
- package/lib/browser/ai-configuration/token-usage-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/token-usage-configuration-widget.js +25 -3
- package/lib/browser/ai-configuration/token-usage-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/tools-configuration-widget.d.ts +29 -0
- package/lib/browser/ai-configuration/tools-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/tools-configuration-widget.js +163 -0
- package/lib/browser/ai-configuration/tools-configuration-widget.js.map +1 -0
- package/lib/browser/app-tester-chat-agent.d.ts +36 -0
- package/lib/browser/app-tester-chat-agent.d.ts.map +1 -0
- package/lib/browser/app-tester-chat-agent.js +172 -0
- package/lib/browser/app-tester-chat-agent.js.map +1 -0
- package/lib/browser/coder-agent.d.ts.map +1 -1
- package/lib/browser/coder-agent.js +3 -3
- package/lib/browser/coder-agent.js.map +1 -1
- package/lib/browser/file-changeset-functions.d.ts +25 -6
- package/lib/browser/file-changeset-functions.d.ts.map +1 -1
- package/lib/browser/file-changeset-functions.js +248 -106
- package/lib/browser/file-changeset-functions.js.map +1 -1
- package/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +20 -5
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/workspace-functions.d.ts.map +1 -1
- package/lib/browser/workspace-functions.js +6 -10
- package/lib/browser/workspace-functions.js.map +1 -1
- package/lib/browser/workspace-search-provider.d.ts +2 -0
- package/lib/browser/workspace-search-provider.d.ts.map +1 -1
- package/lib/browser/workspace-search-provider.js +26 -4
- package/lib/browser/workspace-search-provider.js.map +1 -1
- package/lib/common/coder-replace-prompt-template.d.ts +4 -5
- package/lib/common/coder-replace-prompt-template.d.ts.map +1 -1
- package/lib/common/coder-replace-prompt-template.js +95 -67
- package/lib/common/coder-replace-prompt-template.js.map +1 -1
- package/lib/common/file-changeset-function-ids.d.ts +7 -0
- package/lib/common/file-changeset-function-ids.d.ts.map +1 -0
- package/lib/common/file-changeset-function-ids.js +25 -0
- package/lib/common/file-changeset-function-ids.js.map +1 -0
- package/package.json +17 -17
- package/src/browser/ai-configuration/ai-configuration-view-contribution.ts +1 -1
- package/src/browser/ai-configuration/ai-configuration-widget.tsx +6 -0
- package/src/browser/ai-configuration/token-usage-configuration-widget.tsx +63 -4
- package/src/browser/ai-configuration/tools-configuration-widget.tsx +193 -0
- package/src/browser/app-tester-chat-agent.ts +178 -0
- package/src/browser/coder-agent.ts +5 -5
- package/src/browser/file-changeset-functions.ts +236 -89
- package/src/browser/frontend-module.ts +31 -10
- package/src/browser/style/index.css +78 -0
- package/src/browser/workspace-functions.ts +7 -11
- package/src/browser/workspace-search-provider.ts +27 -6
- package/src/common/coder-replace-prompt-template.ts +101 -65
- package/src/common/file-changeset-function-ids.ts +22 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable max-len */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AppTesterChatAgent = exports.AppTesterChatAgentId = exports.appTesterTemplateVariant = exports.appTesterTemplate = exports.EXPECTED_MCP_SERVER_NAME = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
// *****************************************************************************
|
|
7
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
8
|
+
//
|
|
9
|
+
// This program and the accompanying materials are made available under the
|
|
10
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
11
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
12
|
+
//
|
|
13
|
+
// This Source Code may also be made available under the following Secondary
|
|
14
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
15
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
16
|
+
// with the GNU Classpath Exception which is available at
|
|
17
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
18
|
+
//
|
|
19
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
20
|
+
// *****************************************************************************
|
|
21
|
+
const ai_chat_1 = require("@theia/ai-chat");
|
|
22
|
+
const chat_agents_1 = require("@theia/ai-chat/lib/common/chat-agents");
|
|
23
|
+
const chat_model_1 = require("@theia/ai-chat/lib/common/chat-model");
|
|
24
|
+
const mcp_server_manager_1 = require("@theia/ai-mcp/lib/common/mcp-server-manager");
|
|
25
|
+
const core_1 = require("@theia/core");
|
|
26
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
27
|
+
const mcp_preferences_1 = require("@theia/ai-mcp/lib/browser/mcp-preferences");
|
|
28
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
29
|
+
exports.EXPECTED_MCP_SERVER_NAME = 'playwright';
|
|
30
|
+
// Prompt templates
|
|
31
|
+
exports.appTesterTemplate = {
|
|
32
|
+
id: 'app-tester-system-default',
|
|
33
|
+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
34
|
+
Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
|
|
35
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
36
|
+
|
|
37
|
+
You are AppTester, an AI assistant integrated into Theia IDE specifically designed to help developers test running applications using Playwright.
|
|
38
|
+
Your role is to inspect the application for user-specified test scenarios through the Playwright MCP server.
|
|
39
|
+
|
|
40
|
+
## Your Workflow
|
|
41
|
+
1. Help the user build and launch their application
|
|
42
|
+
2. Use Playwright browser automation to validate test scenarios
|
|
43
|
+
3. Report results and provide actionable feedback
|
|
44
|
+
4. Help fix issues when needed
|
|
45
|
+
|
|
46
|
+
## Available Playwright Testing Tools
|
|
47
|
+
You have access to these powerful automation tools: {{prompt:mcp_${exports.EXPECTED_MCP_SERVER_NAME}_tools}}
|
|
48
|
+
|
|
49
|
+
## Workflow Approach
|
|
50
|
+
1. **Understand Requirements**: Ask the user to clearly define what needs to be tested
|
|
51
|
+
2. **Launch Browser**: Start a fresh browser instance for testing
|
|
52
|
+
3. **Navigate and Test**: Execute the test scenario methodically
|
|
53
|
+
4. **Document Results**: Provide detailed results with screenshots when helpful
|
|
54
|
+
5. **Clean Up**: Always close the browser when testing is complete
|
|
55
|
+
|
|
56
|
+
## Current Context
|
|
57
|
+
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.
|
|
58
|
+
{{${ai_chat_1.CHAT_CONTEXT_DETAILS_VARIABLE_ID}}}
|
|
59
|
+
`
|
|
60
|
+
};
|
|
61
|
+
exports.appTesterTemplateVariant = {
|
|
62
|
+
id: 'app-tester-system-empty',
|
|
63
|
+
template: '',
|
|
64
|
+
};
|
|
65
|
+
exports.AppTesterChatAgentId = 'AppTester';
|
|
66
|
+
let AppTesterChatAgent = class AppTesterChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
|
|
67
|
+
constructor() {
|
|
68
|
+
super(...arguments);
|
|
69
|
+
this.id = exports.AppTesterChatAgentId;
|
|
70
|
+
this.name = exports.AppTesterChatAgentId;
|
|
71
|
+
this.languageModelRequirements = [{
|
|
72
|
+
purpose: 'chat',
|
|
73
|
+
identifier: 'openai/gpt-4o',
|
|
74
|
+
}];
|
|
75
|
+
this.defaultLanguageModelPurpose = 'chat';
|
|
76
|
+
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. '
|
|
77
|
+
+ 'It can automate testing workflows and provide detailed feedback on application functionality.');
|
|
78
|
+
this.iconClass = 'codicon codicon-beaker';
|
|
79
|
+
this.systemPromptId = 'app-tester-prompt';
|
|
80
|
+
this.prompts = [{ id: 'app-tester-prompt', defaultVariant: exports.appTesterTemplate, variants: [exports.appTesterTemplateVariant] }];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Override invoke to check if the Playwright MCP server is running, and if not, ask the user if it should be started.
|
|
84
|
+
*/
|
|
85
|
+
async invoke(request) {
|
|
86
|
+
try {
|
|
87
|
+
const startedServers = await this.mcpService.getStartedServers();
|
|
88
|
+
if (!startedServers.includes(exports.EXPECTED_MCP_SERVER_NAME)) {
|
|
89
|
+
// Ask the user if they want to start the server
|
|
90
|
+
request.response.response.addContent(new chat_model_1.QuestionResponseContentImpl('The Playwright MCP server is not running. Would you like to start it now? This may install the Playwright MCP server.', [
|
|
91
|
+
{ text: 'Yes, start the server', value: 'yes' },
|
|
92
|
+
{ text: 'No, cancel', value: 'no' }
|
|
93
|
+
], request, async (selectedOption) => {
|
|
94
|
+
if (selectedOption.value === 'yes') {
|
|
95
|
+
// Show progress
|
|
96
|
+
const progress = request.response.addProgressMessage({ content: 'Starting Playwright MCP server.', show: 'whileIncomplete' });
|
|
97
|
+
try {
|
|
98
|
+
await this.startPlaywrightMCPServer();
|
|
99
|
+
// Remove progress, continue with normal flow
|
|
100
|
+
request.response.updateProgressMessage({ ...progress, show: 'whileIncomplete', status: 'completed' });
|
|
101
|
+
await super.invoke(request);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
request.response.response.addContent(new chat_model_1.ErrorChatResponseContentImpl(new Error('Failed to start Playwright MCP server: ' + (error instanceof Error ? error.message : String(error)))));
|
|
105
|
+
request.response.complete();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
// Continue without starting the server
|
|
110
|
+
request.response.response.addContent(new chat_model_1.MarkdownChatResponseContentImpl('Please setup the MCP server.'));
|
|
111
|
+
request.response.complete();
|
|
112
|
+
}
|
|
113
|
+
}));
|
|
114
|
+
request.response.waitForInput();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
// If already running, continue as normal
|
|
118
|
+
await super.invoke(request);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
request.response.response.addContent(new chat_model_1.ErrorChatResponseContentImpl(new Error('Error checking Playwright MCP server status: ' + (error instanceof Error ? error.message : String(error)))));
|
|
122
|
+
request.response.complete();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Starts the Playwright MCP server if it doesn't exist or isn't running.
|
|
127
|
+
*
|
|
128
|
+
* @returns A promise that resolves when the server is started
|
|
129
|
+
*/
|
|
130
|
+
async startPlaywrightMCPServer() {
|
|
131
|
+
try {
|
|
132
|
+
const startedServers = await this.mcpService.getStartedServers();
|
|
133
|
+
if (startedServers.includes(exports.EXPECTED_MCP_SERVER_NAME)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const mcpServer = {
|
|
137
|
+
name: exports.EXPECTED_MCP_SERVER_NAME,
|
|
138
|
+
command: 'npx',
|
|
139
|
+
args: ['-y', '@playwright/mcp@latest'],
|
|
140
|
+
autostart: false,
|
|
141
|
+
env: {},
|
|
142
|
+
};
|
|
143
|
+
const availableServers = await this.mcpService.getServerNames();
|
|
144
|
+
if (!availableServers.includes(exports.EXPECTED_MCP_SERVER_NAME)) {
|
|
145
|
+
const currentServers = this.preferenceService.get(mcp_preferences_1.MCP_SERVERS_PREF, {});
|
|
146
|
+
await this.preferenceService.set(mcp_preferences_1.MCP_SERVERS_PREF, {
|
|
147
|
+
...currentServers,
|
|
148
|
+
mcpServer
|
|
149
|
+
}, browser_1.PreferenceScope.User);
|
|
150
|
+
await this.mcpService.addOrUpdateServer(mcpServer);
|
|
151
|
+
}
|
|
152
|
+
await this.mcpService.startServer(exports.EXPECTED_MCP_SERVER_NAME);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
this.logger.error(`Error starting Playwright MCP server: ${error}`);
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
exports.AppTesterChatAgent = AppTesterChatAgent;
|
|
161
|
+
tslib_1.__decorate([
|
|
162
|
+
(0, inversify_1.inject)(mcp_server_manager_1.MCPFrontendService),
|
|
163
|
+
tslib_1.__metadata("design:type", Object)
|
|
164
|
+
], AppTesterChatAgent.prototype, "mcpService", void 0);
|
|
165
|
+
tslib_1.__decorate([
|
|
166
|
+
(0, inversify_1.inject)(browser_1.PreferenceService),
|
|
167
|
+
tslib_1.__metadata("design:type", Object)
|
|
168
|
+
], AppTesterChatAgent.prototype, "preferenceService", void 0);
|
|
169
|
+
exports.AppTesterChatAgent = AppTesterChatAgent = tslib_1.__decorate([
|
|
170
|
+
(0, inversify_1.injectable)()
|
|
171
|
+
], AppTesterChatAgent);
|
|
172
|
+
//# sourceMappingURL=app-tester-chat-agent.js.map
|
|
@@ -0,0 +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,4CAAkE;AAClE,uEAAuF;AACvF,qEAA2K;AAE3K,oFAAuG;AACvG,sCAAkC;AAClC,4DAAkE;AAClE,+EAA6E;AAC7E,qDAA6E;AAEhE,QAAA,wBAAwB,GAAG,YAAY,CAAC;AAErD,mBAAmB;AACN,QAAA,iBAAiB,GAAuB;IAClD,EAA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,MAAM,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;YACtD,CAAC;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,gCAAwB,CAAC,CAAC;QAC/D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,KAAK,EAAE,CAAC,CAAC;YACpE,MAAM,KAAK,CAAC;QACf,CAAC;IACJ,CAAC;CACH,CAAA;AA5GY,gDAAkB;AAGT;IADlB,IAAA,kBAAM,EAAC,uCAAkB,CAAC;;sDACuB;AAG/B;IADlB,IAAA,kBAAM,EAAC,2BAAiB,CAAC;;6DAC8B;6BAN9C,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CA4G9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coder-agent.d.ts","sourceRoot":"","sources":["../../src/browser/coder-agent.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,8BAA8B,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAoB,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAKlK,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAK5E,qBACa,UAAW,SAAQ,8BAA8B;IACrC,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IACjE,EAAE,EAAE,MAAM,CAAW;IACrB,IAAI,SAAW;IACf,yBAAyB,EAAE,wBAAwB,EAAE,CAGlD;IACH,SAAS,CAAC,2BAA2B,EAAE,MAAM,CAAU;IAE9C,WAAW,SAGgB;IAC3B,OAAO,EAAE,gBAAgB,EAAE,CAIjC;IACM,SAAS,
|
|
1
|
+
{"version":3,"file":"coder-agent.d.ts","sourceRoot":"","sources":["../../src/browser/coder-agent.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,8BAA8B,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAoB,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAKlK,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAK5E,qBACa,UAAW,SAAQ,8BAA8B;IACrC,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IACjE,EAAE,EAAE,MAAM,CAAW;IACrB,IAAI,SAAW;IACf,yBAAyB,EAAE,wBAAwB,EAAE,CAGlD;IACH,SAAS,CAAC,2BAA2B,EAAE,MAAM,CAAU;IAE9C,WAAW,SAGgB;IAC3B,OAAO,EAAE,gBAAgB,EAAE,CAIjC;IACM,SAAS,WAAyI;IAC3J,UAAmB,cAAc,EAAE,MAAM,GAAG,SAAS,CAA0B;IAChE,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBxE"}
|
|
@@ -40,10 +40,10 @@ let CoderAgent = class CoderAgent extends common_1.AbstractStreamParsingChatAgen
|
|
|
40
40
|
tasks involving file changes.');
|
|
41
41
|
this.prompts = [{
|
|
42
42
|
id: coder_replace_prompt_template_1.CODER_SYSTEM_PROMPT_ID,
|
|
43
|
-
defaultVariant: (0, coder_replace_prompt_template_1.
|
|
44
|
-
variants: [(0, coder_replace_prompt_template_1.
|
|
43
|
+
defaultVariant: (0, coder_replace_prompt_template_1.getCoderPromptTemplateEdit)(),
|
|
44
|
+
variants: [(0, coder_replace_prompt_template_1.getCoderPromptTemplateSimpleEdit)(), (0, coder_replace_prompt_template_1.getCoderAgentModePromptTemplate)()]
|
|
45
45
|
}];
|
|
46
|
-
this.functions = [workspace_functions_1.GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID, workspace_functions_1.GET_WORKSPACE_FILE_LIST_FUNCTION_ID, workspace_functions_1.FILE_CONTENT_FUNCTION_ID, file_changeset_functions_1.
|
|
46
|
+
this.functions = [workspace_functions_1.GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID, workspace_functions_1.GET_WORKSPACE_FILE_LIST_FUNCTION_ID, workspace_functions_1.FILE_CONTENT_FUNCTION_ID, file_changeset_functions_1.SuggestFileContent.ID];
|
|
47
47
|
this.systemPromptId = coder_replace_prompt_template_1.CODER_SYSTEM_PROMPT_ID;
|
|
48
48
|
}
|
|
49
49
|
async invoke(request) {
|
|
@@ -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,
|
|
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,C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,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,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"}
|
|
@@ -3,7 +3,14 @@ import { WorkspaceFunctionScope } from './workspace-functions';
|
|
|
3
3
|
import { ChangeSetFileElementFactory } from '@theia/ai-chat/lib/browser/change-set-file-element';
|
|
4
4
|
import { MutableChatRequestModel } from '@theia/ai-chat';
|
|
5
5
|
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class SuggestFileContent implements ToolProvider {
|
|
7
|
+
static ID: string;
|
|
8
|
+
protected readonly workspaceFunctionScope: WorkspaceFunctionScope;
|
|
9
|
+
fileService: FileService;
|
|
10
|
+
protected readonly fileChangeFactory: ChangeSetFileElementFactory;
|
|
11
|
+
getTool(): ToolRequest;
|
|
12
|
+
}
|
|
13
|
+
export declare class WriteFileContent implements ToolProvider {
|
|
7
14
|
static ID: string;
|
|
8
15
|
protected readonly workspaceFunctionScope: WorkspaceFunctionScope;
|
|
9
16
|
fileService: FileService;
|
|
@@ -16,31 +23,43 @@ export declare class ReplaceContentInFileFunctionHelper {
|
|
|
16
23
|
protected readonly fileChangeFactory: ChangeSetFileElementFactory;
|
|
17
24
|
private replacer;
|
|
18
25
|
constructor();
|
|
19
|
-
getToolMetadata(supportMultipleReplace?: boolean): {
|
|
26
|
+
getToolMetadata(supportMultipleReplace?: boolean, immediateApplication?: boolean): {
|
|
20
27
|
description: string;
|
|
21
28
|
parameters: ToolRequestParameters;
|
|
22
29
|
};
|
|
23
30
|
createChangesetFromToolCall(toolCallString: string, ctx: MutableChatRequestModel): Promise<string>;
|
|
31
|
+
writeChangesetFromToolCall(toolCallString: string, ctx: MutableChatRequestModel): Promise<string>;
|
|
32
|
+
private processReplacementsCommon;
|
|
24
33
|
private findExistingChangeElement;
|
|
25
34
|
clearFileChanges(path: string, ctx: MutableChatRequestModel): Promise<string>;
|
|
26
35
|
getProposedFileState(path: string, ctx: MutableChatRequestModel): Promise<string>;
|
|
27
36
|
}
|
|
28
|
-
export declare class
|
|
37
|
+
export declare class SimpleSuggestFileReplacements implements ToolProvider {
|
|
38
|
+
static ID: string;
|
|
39
|
+
protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper;
|
|
40
|
+
getTool(): ToolRequest;
|
|
41
|
+
}
|
|
42
|
+
export declare class SimpleWriteFileReplacements implements ToolProvider {
|
|
43
|
+
static ID: string;
|
|
44
|
+
protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper;
|
|
45
|
+
getTool(): ToolRequest;
|
|
46
|
+
}
|
|
47
|
+
export declare class SuggestFileReplacements implements ToolProvider {
|
|
29
48
|
static ID: string;
|
|
30
49
|
protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper;
|
|
31
50
|
getTool(): ToolRequest;
|
|
32
51
|
}
|
|
33
|
-
export declare class
|
|
52
|
+
export declare class WriteFileReplacements implements ToolProvider {
|
|
34
53
|
static ID: string;
|
|
35
54
|
protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper;
|
|
36
55
|
getTool(): ToolRequest;
|
|
37
56
|
}
|
|
38
|
-
export declare class
|
|
57
|
+
export declare class ClearFileChanges implements ToolProvider {
|
|
39
58
|
static ID: string;
|
|
40
59
|
protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper;
|
|
41
60
|
getTool(): ToolRequest;
|
|
42
61
|
}
|
|
43
|
-
export declare class
|
|
62
|
+
export declare class GetProposedFileState implements ToolProvider {
|
|
44
63
|
static ID: string;
|
|
45
64
|
protected readonly replaceContentInFileFunctionHelper: ReplaceContentInFileFunctionHelper;
|
|
46
65
|
getTool(): ToolRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-changeset-functions.d.ts","sourceRoot":"","sources":["../../src/browser/file-changeset-functions.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAmC,MAAM,gBAAgB,CAAC;AACnH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"file-changeset-functions.d.ts","sourceRoot":"","sources":["../../src/browser/file-changeset-functions.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAmC,MAAM,gBAAgB,CAAC;AACnH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAA8C,2BAA2B,EAAE,MAAM,oDAAoD,CAAC;AAC7I,OAAO,EAAa,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAazE,qBACa,kBAAmB,YAAW,YAAY;IACnD,MAAM,CAAC,EAAE,SAA2B;IAGpC,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAGlE,WAAW,EAAE,WAAW,CAAC;IAGzB,SA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