@theia/ai-ide 1.63.0-next.0 → 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
|
@@ -157,27 +157,26 @@ export class GetWorkspaceDirectoryStructure implements ToolProvider {
|
|
|
157
157
|
@inject(WorkspaceFunctionScope)
|
|
158
158
|
protected workspaceScope: WorkspaceFunctionScope;
|
|
159
159
|
|
|
160
|
-
private async getDirectoryStructure(): Promise<string
|
|
160
|
+
private async getDirectoryStructure(): Promise<Record<string, unknown>> {
|
|
161
161
|
let workspaceRoot;
|
|
162
162
|
try {
|
|
163
163
|
workspaceRoot = await this.workspaceScope.getWorkspaceRoot();
|
|
164
164
|
} catch (error) {
|
|
165
|
-
return
|
|
165
|
+
return { error: error.message };
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
return this.buildDirectoryStructure(workspaceRoot);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
private async buildDirectoryStructure(uri: URI
|
|
171
|
+
private async buildDirectoryStructure(uri: URI): Promise<Record<string, unknown>> {
|
|
172
172
|
const stat = await this.fileService.resolve(uri);
|
|
173
|
-
const result: string
|
|
173
|
+
const result: Record<string, unknown> = {};
|
|
174
174
|
|
|
175
175
|
if (stat && stat.isDirectory && stat.children) {
|
|
176
176
|
for (const child of stat.children) {
|
|
177
177
|
if (!child.isDirectory || await this.workspaceScope.shouldExclude(child)) { continue; };
|
|
178
|
-
const
|
|
179
|
-
result.
|
|
180
|
-
result.push(...await this.buildDirectoryStructure(child.resource, `${path}`));
|
|
178
|
+
const dirName = child.resource.path.base;
|
|
179
|
+
result[dirName] = await this.buildDirectoryStructure(child.resource);
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
|
|
@@ -323,10 +322,7 @@ export class GetWorkspaceFileList implements ToolProvider {
|
|
|
323
322
|
if (await this.workspaceScope.shouldExclude(child)) {
|
|
324
323
|
continue;
|
|
325
324
|
};
|
|
326
|
-
|
|
327
|
-
if (relativePath) {
|
|
328
|
-
result.push(relativePath.toString());
|
|
329
|
-
}
|
|
325
|
+
result.push(child.resource.path.base);
|
|
330
326
|
}
|
|
331
327
|
}
|
|
332
328
|
}
|
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
import { MutableChatRequestModel } from '@theia/ai-chat';
|
|
18
18
|
import { ToolProvider, ToolRequest } from '@theia/ai-core';
|
|
19
|
-
import { CancellationToken } from '@theia/core';
|
|
19
|
+
import { CancellationToken, URI } from '@theia/core';
|
|
20
20
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
21
21
|
import { SearchInWorkspaceService, SearchInWorkspaceCallbacks } from '@theia/search-in-workspace/lib/browser/search-in-workspace-service';
|
|
22
22
|
import { SearchInWorkspaceResult, SearchInWorkspaceOptions } from '@theia/search-in-workspace/lib/common/search-in-workspace-interface';
|
|
23
23
|
import { SEARCH_IN_WORKSPACE_FUNCTION_ID } from '../common/workspace-functions';
|
|
24
|
+
import { WorkspaceFunctionScope } from './workspace-functions';
|
|
24
25
|
|
|
25
26
|
@injectable()
|
|
26
27
|
export class WorkspaceSearchProvider implements ToolProvider {
|
|
@@ -28,6 +29,9 @@ export class WorkspaceSearchProvider implements ToolProvider {
|
|
|
28
29
|
@inject(SearchInWorkspaceService)
|
|
29
30
|
protected readonly searchService: SearchInWorkspaceService;
|
|
30
31
|
|
|
32
|
+
@inject(WorkspaceFunctionScope)
|
|
33
|
+
protected readonly workspaceScope: WorkspaceFunctionScope;
|
|
34
|
+
|
|
31
35
|
private readonly MAX_RESULTS = 50;
|
|
32
36
|
|
|
33
37
|
getTool(): ToolRequest {
|
|
@@ -38,6 +42,7 @@ export class WorkspaceSearchProvider implements ToolProvider {
|
|
|
38
42
|
The search uses case-insensitive string matching or regular expressions (controlled by the `useRegExp` parameter). \
|
|
39
43
|
It returns a list of matching files, including the file path (URI), the line number, and the full text content of each matching line. \
|
|
40
44
|
Multi-word patterns must match exactly (including spaces, case-insensitively). \
|
|
45
|
+
For best results, use specific search terms and consider filtering by file extensions to avoid overwhelming results. \
|
|
41
46
|
For complex searches, prefer multiple simpler queries over one complex query or regular expression.',
|
|
42
47
|
parameters: {
|
|
43
48
|
type: 'object',
|
|
@@ -49,6 +54,13 @@ export class WorkspaceSearchProvider implements ToolProvider {
|
|
|
49
54
|
useRegExp: {
|
|
50
55
|
type: 'boolean',
|
|
51
56
|
description: 'Set to true if the query is a regular expression.',
|
|
57
|
+
},
|
|
58
|
+
fileExtensions: {
|
|
59
|
+
type: 'array',
|
|
60
|
+
items: {
|
|
61
|
+
type: 'string'
|
|
62
|
+
},
|
|
63
|
+
description: 'Optional array of file extensions to search in (e.g., ["ts", "js", "py"]). If not specified, searches all files.'
|
|
52
64
|
}
|
|
53
65
|
},
|
|
54
66
|
required: ['query', 'useRegExp']
|
|
@@ -59,7 +71,7 @@ export class WorkspaceSearchProvider implements ToolProvider {
|
|
|
59
71
|
|
|
60
72
|
private async handleSearch(argString: string, cancellationToken?: CancellationToken): Promise<string> {
|
|
61
73
|
try {
|
|
62
|
-
const args: { query: string, useRegExp: boolean } = JSON.parse(argString);
|
|
74
|
+
const args: { query: string, useRegExp: boolean, fileExtensions?: string[] } = JSON.parse(argString);
|
|
63
75
|
const results: SearchInWorkspaceResult[] = [];
|
|
64
76
|
let expectedSearchId: number | undefined;
|
|
65
77
|
let searchCompleted = false;
|
|
@@ -102,6 +114,10 @@ export class WorkspaceSearchProvider implements ToolProvider {
|
|
|
102
114
|
maxResults: this.MAX_RESULTS,
|
|
103
115
|
};
|
|
104
116
|
|
|
117
|
+
if (args.fileExtensions && args.fileExtensions.length > 0) {
|
|
118
|
+
options.include = args.fileExtensions.map(ext => `**/*.${ext}`);
|
|
119
|
+
}
|
|
120
|
+
|
|
105
121
|
this.searchService.search(args.query, callbacks, options)
|
|
106
122
|
.then(id => {
|
|
107
123
|
expectedSearchId = id;
|
|
@@ -128,10 +144,15 @@ export class WorkspaceSearchProvider implements ToolProvider {
|
|
|
128
144
|
|
|
129
145
|
const finalResults = await Promise.race([searchPromise, timeoutPromise]);
|
|
130
146
|
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
const workspaceRoot = await this.workspaceScope.getWorkspaceRoot();
|
|
148
|
+
const formattedResults = finalResults.map(r => {
|
|
149
|
+
const fileUri = new URI(r.fileUri);
|
|
150
|
+
const relativePath = workspaceRoot.relative(fileUri);
|
|
151
|
+
return {
|
|
152
|
+
file: relativePath ? relativePath.toString() : r.fileUri,
|
|
153
|
+
matches: r.matches.map(m => ({ line: m.line, text: m.lineText }))
|
|
154
|
+
};
|
|
155
|
+
});
|
|
135
156
|
|
|
136
157
|
return JSON.stringify(formattedResults);
|
|
137
158
|
|
|
@@ -22,18 +22,26 @@ import {
|
|
|
22
22
|
} from './workspace-functions';
|
|
23
23
|
import { CONTEXT_FILES_VARIABLE_ID, TASK_CONTEXT_SUMMARY_VARIABLE_ID } from './context-variables';
|
|
24
24
|
import { UPDATE_CONTEXT_FILES_FUNCTION_ID } from './context-functions';
|
|
25
|
+
import {
|
|
26
|
+
SUGGEST_FILE_CONTENT_ID,
|
|
27
|
+
WRITE_FILE_CONTENT_ID,
|
|
28
|
+
SUGGEST_FILE_REPLACEMENTS_ID,
|
|
29
|
+
WRITE_FILE_REPLACEMENTS_ID,
|
|
30
|
+
CLEAR_FILE_CHANGES_ID,
|
|
31
|
+
GET_PROPOSED_CHANGES_ID
|
|
32
|
+
} from './file-changeset-function-ids';
|
|
25
33
|
|
|
26
34
|
export const CODER_SYSTEM_PROMPT_ID = 'coder-prompt';
|
|
27
|
-
|
|
28
|
-
export const
|
|
29
|
-
export const
|
|
35
|
+
|
|
36
|
+
export const CODER_SIMPLE_EDIT_TEMPLATE_ID = 'coder-simple-edit';
|
|
37
|
+
export const CODER_EDIT_TEMPLATE_ID = 'coder-edit';
|
|
30
38
|
export const CODER_AGENT_MODE_TEMPLATE_ID = 'coder-agent-mode';
|
|
31
39
|
|
|
32
40
|
export function getCoderAgentModePromptTemplate(): BasePromptFragment {
|
|
33
41
|
return {
|
|
34
42
|
id: CODER_AGENT_MODE_TEMPLATE_ID,
|
|
35
43
|
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
36
|
-
Made improvements or adaptations to this prompt template? We
|
|
44
|
+
Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
|
|
37
45
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
38
46
|
You are an **autonomous AI agent** embedded in the Theia IDE to assist developers with tasks like implementing features, fixing bugs, or improving code quality.
|
|
39
47
|
You must independently analyze, fix, validate, and finalize all changes — only yield control when all relevant tasks are completed.
|
|
@@ -43,6 +51,7 @@ You must independently analyze, fix, validate, and finalize all changes — only
|
|
|
43
51
|
## Autonomy and Persistence
|
|
44
52
|
You are an agent. **Do not stop until** the entire task is complete:
|
|
45
53
|
- All code changes are applied
|
|
54
|
+
- The build succeeds
|
|
46
55
|
- All lint issues are resolved
|
|
47
56
|
- All relevant tests pass
|
|
48
57
|
- New tests are written when needed
|
|
@@ -64,31 +73,32 @@ After each tool call:
|
|
|
64
73
|
Never guess or hallucinate file content or structure. Use tools for all workspace interactions:
|
|
65
74
|
|
|
66
75
|
### Workspace Exploration
|
|
67
|
-
- ~{
|
|
68
|
-
- ~{
|
|
69
|
-
- ~{
|
|
70
|
-
- ~{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### ✍️ Code Editing
|
|
76
|
+
- ~{${GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID}} — view overall structure
|
|
77
|
+
- ~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}} — list contents of a specific directory
|
|
78
|
+
- ~{${FILE_CONTENT_FUNCTION_ID}} — retrieve the content of a file
|
|
79
|
+
- ~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}} — locate references or patterns (only search if you are missing information, always prefer examples that are explicitly provided, never \
|
|
80
|
+
search for files you already know the path for)
|
|
81
|
+
- ~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}} — bookmark important files for context
|
|
82
|
+
|
|
83
|
+
### Code Editing
|
|
77
84
|
- Before editing, always retrieve file content
|
|
78
85
|
- Use:
|
|
79
|
-
- ~{
|
|
80
|
-
- ~{
|
|
81
|
-
- ~{
|
|
82
|
-
- For incremental changes, use multiple ~{
|
|
83
|
-
- Use the reset parameter with ~{
|
|
86
|
+
- ~{${WRITE_FILE_REPLACEMENTS_ID}} — to immediately apply targeted code changes (no user review)
|
|
87
|
+
- ~{${WRITE_FILE_CONTENT_ID}} — to immediately overwrite a file with new content (no user review)
|
|
88
|
+
- ~{${CLEAR_FILE_CHANGES_ID}} — clear all pending changes for a file
|
|
89
|
+
- For incremental changes, use multiple ~{${WRITE_FILE_REPLACEMENTS_ID}} calls
|
|
90
|
+
- Use the reset parameter with ~{${WRITE_FILE_REPLACEMENTS_ID}} to clear previous changes
|
|
91
|
+
|
|
92
|
+
### Validation
|
|
93
|
+
- ~{${GET_FILE_DIAGNOSTICS_ID}} — detect syntax, lint, or type errors
|
|
84
94
|
|
|
85
95
|
### Testing & Tasks
|
|
86
|
-
- Use ~{
|
|
87
|
-
- Use ~{
|
|
96
|
+
- Use ~{${LIST_TASKS_FUNCTION_ID}} to discover available test and lint tasks
|
|
97
|
+
- Use ~{${RUN_TASK_FUNCTION_ID}} to run linting, building, or test suites
|
|
88
98
|
|
|
89
99
|
### Test Authoring
|
|
90
100
|
If no relevant tests exist:
|
|
91
|
-
- Create new test files (propose using
|
|
101
|
+
- Create new test files (propose using suggestFileContent)
|
|
92
102
|
- Use patterns from existing tests
|
|
93
103
|
- Ensure new tests validate new behavior or prevent regressions
|
|
94
104
|
|
|
@@ -125,7 +135,7 @@ The following files have been provided for additional context. Some of them may
|
|
|
125
135
|
Always look at the relevant files to understand your task using the function ~{${FILE_CONTENT_FUNCTION_ID}}
|
|
126
136
|
{{${CONTEXT_FILES_VARIABLE_ID}}}
|
|
127
137
|
|
|
128
|
-
# Previously
|
|
138
|
+
# Previously Changed Files
|
|
129
139
|
|
|
130
140
|
{{changeSetSummary}}
|
|
131
141
|
|
|
@@ -133,6 +143,8 @@ Always look at the relevant files to understand your task using the function ~{$
|
|
|
133
143
|
|
|
134
144
|
{{prompt:project-info}}
|
|
135
145
|
|
|
146
|
+
{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}}
|
|
147
|
+
|
|
136
148
|
# Final Instruction
|
|
137
149
|
You are an autonomous AI agent. Do not stop until:
|
|
138
150
|
- All errors are fixed
|
|
@@ -141,48 +153,56 @@ You are an autonomous AI agent. Do not stop until:
|
|
|
141
153
|
- New tests are created if needed
|
|
142
154
|
- No further action is required
|
|
143
155
|
`,
|
|
144
|
-
...({ variantOf:
|
|
156
|
+
...({ variantOf: CODER_EDIT_TEMPLATE_ID }),
|
|
145
157
|
};
|
|
146
158
|
}
|
|
147
159
|
|
|
148
|
-
export function
|
|
160
|
+
export function getCoderPromptTemplateEdit(): BasePromptFragment {
|
|
149
161
|
return {
|
|
150
|
-
id:
|
|
162
|
+
id: CODER_EDIT_TEMPLATE_ID,
|
|
151
163
|
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
152
|
-
Made improvements or adaptations to this prompt template? We
|
|
164
|
+
Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
|
|
153
165
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
154
|
-
You are an AI assistant integrated into Theia IDE, designed to assist software developers with code tasks. You can interact with the code base and suggest changes
|
|
166
|
+
You are an AI assistant integrated into Theia IDE, designed to assist software developers with code tasks. You can interact with the code base and suggest changes, \
|
|
167
|
+
which will be reviewed and accepted by the user.
|
|
155
168
|
|
|
156
169
|
## Context Retrieval
|
|
157
170
|
Use the following functions to interact with the workspace files if you require context:
|
|
158
171
|
- **~{${GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID}}**
|
|
159
172
|
- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**
|
|
160
173
|
- **~{${FILE_CONTENT_FUNCTION_ID}}**
|
|
161
|
-
- **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}**
|
|
174
|
+
- **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}** (only search if you are missing information, always prefer examples that are explicitly provided, never search for files \
|
|
175
|
+
you already know the path for)
|
|
162
176
|
|
|
163
177
|
Remember file locations that are relevant for completing your tasks using **~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}}**
|
|
164
178
|
Only add files that are really relevant to look at later.
|
|
165
179
|
|
|
166
|
-
## File Validation
|
|
167
|
-
Use the following function to retrieve a list of problems in a file if the user requests fixes in a given file: **~{${GET_FILE_DIAGNOSTICS_ID}}**
|
|
168
|
-
|
|
169
180
|
## Propose Code Changes
|
|
170
|
-
To propose code changes or any file changes to the user, never
|
|
181
|
+
To propose code changes or any file changes to the user, never just output them as part of your response, but use the following functions for each file you want to propose \
|
|
182
|
+
changes for.
|
|
183
|
+
This also applies for newly created files!
|
|
171
184
|
|
|
172
|
-
|
|
173
|
-
- **
|
|
174
|
-
- **View Pending Changes**: Use ~{changeSet_getProposedFileState} to see the current proposed state of a file, including all pending changes.
|
|
185
|
+
- **Always Retrieve Current Content**: Use getFileContent to get the original content of the target file.
|
|
186
|
+
- **View Pending Changes**: Use ~{${GET_PROPOSED_CHANGES_ID}} to see the current proposed state of a file, including all pending changes.
|
|
175
187
|
- **Change Content**: Use one of these methods to propose changes:
|
|
176
|
-
- ~{
|
|
177
|
-
- ~{
|
|
178
|
-
- If ~{
|
|
179
|
-
- ~{
|
|
188
|
+
- ~{${SUGGEST_FILE_REPLACEMENTS_ID}}: For targeted replacements of specific text sections. Multiple calls will merge changes unless you set the reset parameter to true.
|
|
189
|
+
- ~{${SUGGEST_FILE_CONTENT_ID}}: For complete file rewrites when you need to replace the entire content.
|
|
190
|
+
- If ~{${SUGGEST_FILE_REPLACEMENTS_ID}} continuously fails use ~{${SUGGEST_FILE_CONTENT_ID}}.
|
|
191
|
+
- ~{${CLEAR_FILE_CHANGES_ID}}: To clear all pending changes for a file and start fresh.
|
|
180
192
|
|
|
181
|
-
The changes will be presented as an applicable diff to the user in any case.
|
|
193
|
+
The changes will be presented as an applicable diff to the user in any case. The user can then accept or reject each change individually. Before you run tasks that depend on the \
|
|
194
|
+
changes beeing applied, you must wait for the user to review and accept the changes!
|
|
182
195
|
|
|
183
196
|
## Tasks
|
|
184
197
|
|
|
185
198
|
The user might want you to execute some task. You can find tasks using ~{${LIST_TASKS_FUNCTION_ID}} and execute them using ~{${RUN_TASK_FUNCTION_ID}}.
|
|
199
|
+
Be aware that tasks operate on the workspace. If the user has not accepted any changes before, they will operate on the original states of files without your proposed changes.
|
|
200
|
+
Never execute a task without confirming with the user whether this is wanted!
|
|
201
|
+
|
|
202
|
+
## File Validation
|
|
203
|
+
|
|
204
|
+
Use the following function to retrieve a list of problems in a file if the user requests fixes in a given file: **~{${GET_FILE_DIAGNOSTICS_ID}}**
|
|
205
|
+
Be aware this function operates on the workspace. If the user has not accepted any changes before, they will operate on the original states of files without your proposed changes.
|
|
186
206
|
|
|
187
207
|
## Additional Context
|
|
188
208
|
|
|
@@ -197,42 +217,50 @@ You have previously proposed changes for the following files. Some suggestions m
|
|
|
197
217
|
{{prompt:project-info}}
|
|
198
218
|
|
|
199
219
|
{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
220
|
+
|
|
221
|
+
## Final Instruction
|
|
222
|
+
- Your task is to propose changes to be reviewed by the user
|
|
223
|
+
- Tasks such as building or liniting run on the workspace state, the user has to accept the changes beforehand
|
|
224
|
+
- Do not run a build or any error checking before the users asks you to
|
|
225
|
+
- Focus on the task that the user described
|
|
226
|
+
`};
|
|
203
227
|
}
|
|
204
|
-
|
|
228
|
+
|
|
229
|
+
export function getCoderPromptTemplateSimpleEdit(): BasePromptFragment {
|
|
205
230
|
return {
|
|
206
|
-
id:
|
|
231
|
+
id: CODER_SIMPLE_EDIT_TEMPLATE_ID,
|
|
207
232
|
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
208
|
-
Made improvements or adaptations to this prompt template? We
|
|
233
|
+
Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
|
|
209
234
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
210
|
-
You are an AI assistant integrated into Theia IDE, designed to assist software developers with code tasks. You can interact with the code base and suggest changes
|
|
235
|
+
You are an AI assistant integrated into Theia IDE, designed to assist software developers with code tasks. You can interact with the code base and suggest changes \
|
|
236
|
+
which will be reviewed and accepted by the user.
|
|
211
237
|
|
|
212
238
|
## Context Retrieval
|
|
213
239
|
Use the following functions to interact with the workspace files if you require context:
|
|
214
|
-
- **~{${GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID}}
|
|
215
|
-
- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}
|
|
216
|
-
- **~{${FILE_CONTENT_FUNCTION_ID}}
|
|
217
|
-
- **~{${
|
|
240
|
+
- **~{${GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID}}**
|
|
241
|
+
- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**
|
|
242
|
+
- **~{${FILE_CONTENT_FUNCTION_ID}}**
|
|
243
|
+
- **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}** (only search if you are missing information, always prefer examples that are explicitly provided, never search for files \
|
|
244
|
+
you already know the path for)
|
|
218
245
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
- **~{${GET_FILE_DIAGNOSTICS_ID}}**: Retrieves a list of problems identified in a given file by tool integrations such as language servers and linters.
|
|
246
|
+
Remember file locations that are relevant for completing your tasks using **~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}}**
|
|
247
|
+
Only add files that are really relevant to look at later.
|
|
222
248
|
|
|
223
249
|
## Propose Code Changes
|
|
224
|
-
To propose code changes or any file changes to the user, never
|
|
250
|
+
To propose code changes or any file changes to the user, never just output them as part of your response, but use the following functions for each file you want to propose \
|
|
251
|
+
changes for.
|
|
252
|
+
This also applies for newly created files!
|
|
225
253
|
|
|
226
|
-
|
|
227
|
-
- **
|
|
228
|
-
- **View Pending Changes**: Use ~{changeSet_getProposedFileState} to see the current proposed state of a file, including all pending changes.
|
|
254
|
+
- **Always Retrieve Current Content**: Use getFileContent to get the original content of the target file.
|
|
255
|
+
- **View Pending Changes**: Use ~{${GET_PROPOSED_CHANGES_ID}} to see the current proposed state of a file, including all pending changes.
|
|
229
256
|
- **Change Content**: Use one of these methods to propose changes:
|
|
230
|
-
- ~{
|
|
231
|
-
- ~{
|
|
232
|
-
- If ~{
|
|
233
|
-
- ~{
|
|
257
|
+
- ~{${SUGGEST_FILE_REPLACEMENTS_ID}}: For targeted replacements of specific text sections. Multiple calls will merge changes unless you set the reset parameter to true.
|
|
258
|
+
- ~{${SUGGEST_FILE_CONTENT_ID}}: For complete file rewrites when you need to replace the entire content.
|
|
259
|
+
- If ~{${SUGGEST_FILE_REPLACEMENTS_ID}} continuously fails use ~{${SUGGEST_FILE_CONTENT_ID}}.
|
|
260
|
+
- ~{${CLEAR_FILE_CHANGES_ID}}: To clear all pending changes for a file and start fresh.
|
|
234
261
|
|
|
235
|
-
The changes will be presented as an applicable diff to the user in any case.
|
|
262
|
+
The changes will be presented as an applicable diff to the user in any case. The user can then accept or reject each change individually. Before you run tasks that depend on the \
|
|
263
|
+
changes beeing applied, you must wait for the user to review and accept the changes!
|
|
236
264
|
|
|
237
265
|
## Additional Context
|
|
238
266
|
|
|
@@ -240,12 +268,20 @@ The following files have been provided for additional context. Some of them may
|
|
|
240
268
|
Always look at the relevant files to understand your task using the function ~{${FILE_CONTENT_FUNCTION_ID}}
|
|
241
269
|
{{${CONTEXT_FILES_VARIABLE_ID}}}
|
|
242
270
|
|
|
271
|
+
## Previously Proposed Changes
|
|
272
|
+
You have previously proposed changes for the following files. Some suggestions may have been accepted by the user, while others may still be pending.
|
|
243
273
|
{{${CHANGE_SET_SUMMARY_VARIABLE_ID}}}
|
|
244
274
|
|
|
245
275
|
{{prompt:project-info}}
|
|
246
276
|
|
|
247
277
|
{{${TASK_CONTEXT_SUMMARY_VARIABLE_ID}}}
|
|
278
|
+
|
|
279
|
+
## Final Instruction
|
|
280
|
+
- Your task is to propose changes to be reviewed by the user
|
|
281
|
+
- Tasks such as building or liniting run on the workspace state, the user has to accept the changes beforehand
|
|
282
|
+
- Do not run a build or any error checking before the users asks you to
|
|
283
|
+
- Focus on the task that the user described
|
|
248
284
|
`,
|
|
249
|
-
...(
|
|
285
|
+
...({ variantOf: CODER_EDIT_TEMPLATE_ID }),
|
|
250
286
|
};
|
|
251
287
|
}
|
|
@@ -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 const SUGGEST_FILE_CONTENT_ID = 'suggestFileContent';
|
|
18
|
+
export const WRITE_FILE_CONTENT_ID = 'writeFileContent';
|
|
19
|
+
export const SUGGEST_FILE_REPLACEMENTS_ID = 'suggestFileReplacements';
|
|
20
|
+
export const WRITE_FILE_REPLACEMENTS_ID = 'writeFileReplacements';
|
|
21
|
+
export const CLEAR_FILE_CHANGES_ID = 'clearFileChanges';
|
|
22
|
+
export const GET_PROPOSED_CHANGES_ID = 'getProposedFileState';
|