@theia/ai-ide 1.63.0-next.0 โ 1.63.0-next.52
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 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.js +6 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts +0 -1
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js +0 -1
- package/lib/browser/ai-configuration/prompt-fragments-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 +28 -0
- package/lib/browser/ai-configuration/tools-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/tools-configuration-widget.js +148 -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/architect-agent.d.ts.map +1 -1
- package/lib/browser/architect-agent.js +4 -1
- package/lib/browser/architect-agent.js.map +1 -1
- 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 +1 -0
- package/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +21 -5
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/summarize-session-command-contribution.d.ts +6 -1
- package/lib/browser/summarize-session-command-contribution.d.ts.map +1 -1
- package/lib/browser/summarize-session-command-contribution.js +53 -4
- package/lib/browser/summarize-session-command-contribution.js.map +1 -1
- package/lib/browser/task-context-file-storage-service.d.ts +4 -2
- package/lib/browser/task-context-file-storage-service.d.ts.map +1 -1
- package/lib/browser/task-context-file-storage-service.js +19 -9
- package/lib/browser/task-context-file-storage-service.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-preferences.d.ts +1 -0
- package/lib/browser/workspace-preferences.d.ts.map +1 -1
- package/lib/browser/workspace-preferences.js +9 -1
- package/lib/browser/workspace-preferences.js.map +1 -1
- package/lib/browser/workspace-search-provider.d.ts +7 -1
- package/lib/browser/workspace-search-provider.d.ts.map +1 -1
- package/lib/browser/workspace-search-provider.js +73 -11
- package/lib/browser/workspace-search-provider.js.map +1 -1
- package/lib/browser/workspace-search-provider.spec.d.ts +2 -0
- package/lib/browser/workspace-search-provider.spec.d.ts.map +1 -0
- package/lib/browser/workspace-search-provider.spec.js +227 -0
- package/lib/browser/workspace-search-provider.spec.js.map +1 -0
- package/lib/common/architect-prompt-template.d.ts +1 -0
- package/lib/common/architect-prompt-template.d.ts.map +1 -1
- package/lib/common/architect-prompt-template.js +166 -5
- package/lib/common/architect-prompt-template.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/lib/common/summarize-session-commands.d.ts +1 -0
- package/lib/common/summarize-session-commands.d.ts.map +1 -1
- package/lib/common/summarize-session-commands.js +5 -1
- package/lib/common/summarize-session-commands.js.map +1 -1
- package/lib/common/workspace-search-provider-util.d.ts +17 -0
- package/lib/common/workspace-search-provider-util.d.ts.map +1 -0
- package/lib/common/workspace-search-provider-util.js +51 -0
- package/lib/common/workspace-search-provider-util.js.map +1 -0
- package/package.json +19 -18
- package/src/browser/ai-configuration/ai-configuration-view-contribution.ts +1 -1
- package/src/browser/ai-configuration/ai-configuration-widget.tsx +6 -1
- package/src/browser/ai-configuration/prompt-fragments-configuration-widget.tsx +0 -1
- package/src/browser/ai-configuration/token-usage-configuration-widget.tsx +63 -4
- package/src/browser/ai-configuration/tools-configuration-widget.tsx +178 -0
- package/src/browser/app-tester-chat-agent.ts +178 -0
- package/src/browser/architect-agent.ts +5 -2
- package/src/browser/coder-agent.ts +5 -5
- package/src/browser/file-changeset-functions.ts +236 -89
- package/src/browser/frontend-module.ts +33 -10
- package/src/browser/style/index.css +84 -11
- package/src/browser/summarize-session-command-contribution.ts +58 -6
- package/src/browser/task-context-file-storage-service.ts +20 -10
- package/src/browser/workspace-functions.ts +7 -11
- package/src/browser/workspace-preferences.ts +9 -0
- package/src/browser/workspace-search-provider.spec.ts +255 -0
- package/src/browser/workspace-search-provider.ts +78 -11
- package/src/common/architect-prompt-template.ts +165 -5
- package/src/common/coder-replace-prompt-template.ts +101 -65
- package/src/common/file-changeset-function-ids.ts +22 -0
- package/src/common/summarize-session-commands.ts +5 -0
- package/src/common/workspace-search-provider-util.ts +50 -0
|
@@ -17,13 +17,15 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.WorkspaceSearchProvider = void 0;
|
|
19
19
|
const tslib_1 = require("tslib");
|
|
20
|
+
const preference_service_1 = require("@theia/core/lib/browser/preferences/preference-service");
|
|
20
21
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
|
|
21
23
|
const search_in_workspace_service_1 = require("@theia/search-in-workspace/lib/browser/search-in-workspace-service");
|
|
22
24
|
const workspace_functions_1 = require("../common/workspace-functions");
|
|
25
|
+
const workspace_functions_2 = require("./workspace-functions");
|
|
26
|
+
const workspace_preferences_1 = require("./workspace-preferences");
|
|
27
|
+
const workspace_search_provider_util_1 = require("../common/workspace-search-provider-util");
|
|
23
28
|
let WorkspaceSearchProvider = class WorkspaceSearchProvider {
|
|
24
|
-
constructor() {
|
|
25
|
-
this.MAX_RESULTS = 50;
|
|
26
|
-
}
|
|
27
29
|
getTool() {
|
|
28
30
|
return {
|
|
29
31
|
id: workspace_functions_1.SEARCH_IN_WORKSPACE_FUNCTION_ID,
|
|
@@ -32,6 +34,7 @@ let WorkspaceSearchProvider = class WorkspaceSearchProvider {
|
|
|
32
34
|
The search uses case-insensitive string matching or regular expressions (controlled by the `useRegExp` parameter). \
|
|
33
35
|
It returns a list of matching files, including the file path (URI), the line number, and the full text content of each matching line. \
|
|
34
36
|
Multi-word patterns must match exactly (including spaces, case-insensitively). \
|
|
37
|
+
For best results, use specific search terms and consider filtering by file extensions or limiting to specific subdirectories to avoid overwhelming results. \
|
|
35
38
|
For complex searches, prefer multiple simpler queries over one complex query or regular expression.',
|
|
36
39
|
parameters: {
|
|
37
40
|
type: 'object',
|
|
@@ -43,6 +46,18 @@ let WorkspaceSearchProvider = class WorkspaceSearchProvider {
|
|
|
43
46
|
useRegExp: {
|
|
44
47
|
type: 'boolean',
|
|
45
48
|
description: 'Set to true if the query is a regular expression.',
|
|
49
|
+
},
|
|
50
|
+
fileExtensions: {
|
|
51
|
+
type: 'array',
|
|
52
|
+
items: {
|
|
53
|
+
type: 'string'
|
|
54
|
+
},
|
|
55
|
+
description: 'Optional array of file extensions to search in (e.g., ["ts", "js", "py"]). If not specified, searches all files.'
|
|
56
|
+
},
|
|
57
|
+
subDirectoryPath: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Optional subdirectory path to limit search scope. Use relative paths from workspace root ' +
|
|
60
|
+
'(e.g., "packages/ai-ide/src", "packages/core/src/browser"). If not specified, searches entire workspace.'
|
|
46
61
|
}
|
|
47
62
|
},
|
|
48
63
|
required: ['query', 'useRegExp']
|
|
@@ -50,13 +65,31 @@ let WorkspaceSearchProvider = class WorkspaceSearchProvider {
|
|
|
50
65
|
handler: (argString, ctx) => { var _a; return this.handleSearch(argString, (_a = ctx === null || ctx === void 0 ? void 0 : ctx.response) === null || _a === void 0 ? void 0 : _a.cancellationToken); }
|
|
51
66
|
};
|
|
52
67
|
}
|
|
68
|
+
async determineSearchRoots(subDirectoryPath) {
|
|
69
|
+
const workspaceRoot = await this.workspaceScope.getWorkspaceRoot();
|
|
70
|
+
if (!subDirectoryPath) {
|
|
71
|
+
return [workspaceRoot.toString()];
|
|
72
|
+
}
|
|
73
|
+
const subDirUri = workspaceRoot.resolve(subDirectoryPath);
|
|
74
|
+
this.workspaceScope.ensureWithinWorkspace(subDirUri, workspaceRoot);
|
|
75
|
+
try {
|
|
76
|
+
const stat = await this.fileService.resolve(subDirUri);
|
|
77
|
+
if (!stat || !stat.isDirectory) {
|
|
78
|
+
throw new Error(`Subdirectory '${subDirectoryPath}' does not exist or is not a directory`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
throw new Error(`Invalid subdirectory path '${subDirectoryPath}': ${error.message}`);
|
|
83
|
+
}
|
|
84
|
+
return [subDirUri.toString()];
|
|
85
|
+
}
|
|
53
86
|
async handleSearch(argString, cancellationToken) {
|
|
54
87
|
try {
|
|
55
88
|
const args = JSON.parse(argString);
|
|
56
89
|
const results = [];
|
|
57
90
|
let expectedSearchId;
|
|
58
91
|
let searchCompleted = false;
|
|
59
|
-
const searchPromise = new Promise((resolve, reject) => {
|
|
92
|
+
const searchPromise = new Promise(async (resolve, reject) => {
|
|
60
93
|
const callbacks = {
|
|
61
94
|
onResult: (id, result) => {
|
|
62
95
|
if (expectedSearchId !== undefined && id !== expectedSearchId) {
|
|
@@ -76,20 +109,26 @@ let WorkspaceSearchProvider = class WorkspaceSearchProvider {
|
|
|
76
109
|
}
|
|
77
110
|
searchCompleted = true;
|
|
78
111
|
if (error) {
|
|
79
|
-
reject(new Error(
|
|
112
|
+
reject(new Error('Search failed: ' + error));
|
|
80
113
|
}
|
|
81
114
|
else {
|
|
82
115
|
resolve(results);
|
|
83
116
|
}
|
|
84
117
|
}
|
|
85
118
|
};
|
|
119
|
+
// Use one more than our actual maximum. this way we can determine if we have more results than our maximum and warn the user
|
|
120
|
+
const maxResultsForTheiaAPI = this.preferenceService.get(workspace_preferences_1.SEARCH_IN_WORKSPACE_MAX_RESULTS_PREF, 30) + 1;
|
|
86
121
|
const options = {
|
|
87
122
|
useRegExp: args.useRegExp,
|
|
88
123
|
matchCase: false,
|
|
89
124
|
matchWholeWord: false,
|
|
90
|
-
maxResults:
|
|
125
|
+
maxResults: maxResultsForTheiaAPI,
|
|
91
126
|
};
|
|
92
|
-
|
|
127
|
+
if (args.fileExtensions && args.fileExtensions.length > 0) {
|
|
128
|
+
options.include = args.fileExtensions.map(ext => `**/*.${ext}`);
|
|
129
|
+
}
|
|
130
|
+
await this.determineSearchRoots(args.subDirectoryPath)
|
|
131
|
+
.then(rootUris => this.searchService.searchWithCallback(args.query, rootUris, callbacks, options))
|
|
93
132
|
.then(id => {
|
|
94
133
|
expectedSearchId = id;
|
|
95
134
|
cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.onCancellationRequested(() => {
|
|
@@ -111,10 +150,21 @@ let WorkspaceSearchProvider = class WorkspaceSearchProvider {
|
|
|
111
150
|
}, 30000);
|
|
112
151
|
});
|
|
113
152
|
const finalResults = await Promise.race([searchPromise, timeoutPromise]);
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
153
|
+
const maxResults = this.preferenceService.get(workspace_preferences_1.SEARCH_IN_WORKSPACE_MAX_RESULTS_PREF, 30);
|
|
154
|
+
const workspaceRoot = await this.workspaceScope.getWorkspaceRoot();
|
|
155
|
+
const formattedResults = (0, workspace_search_provider_util_1.optimizeSearchResults)(finalResults, workspaceRoot);
|
|
156
|
+
let numberOfMatchesInFinalResults = 0;
|
|
157
|
+
for (const result of finalResults) {
|
|
158
|
+
numberOfMatchesInFinalResults += result.matches.length;
|
|
159
|
+
}
|
|
160
|
+
if (numberOfMatchesInFinalResults > maxResults) {
|
|
161
|
+
return JSON.stringify({
|
|
162
|
+
info: 'Search limit exceeded: Found ' + maxResults + '+ results. ' +
|
|
163
|
+
'Please refine your search with more specific terms or use file extension filters. ' +
|
|
164
|
+
'You can increase the limit in preferences under \'ai-features.workspaceFunctions.searchMaxResults\'.',
|
|
165
|
+
incompleteResults: formattedResults
|
|
166
|
+
});
|
|
167
|
+
}
|
|
118
168
|
return JSON.stringify(formattedResults);
|
|
119
169
|
}
|
|
120
170
|
catch (error) {
|
|
@@ -127,6 +177,18 @@ tslib_1.__decorate([
|
|
|
127
177
|
(0, inversify_1.inject)(search_in_workspace_service_1.SearchInWorkspaceService),
|
|
128
178
|
tslib_1.__metadata("design:type", search_in_workspace_service_1.SearchInWorkspaceService)
|
|
129
179
|
], WorkspaceSearchProvider.prototype, "searchService", void 0);
|
|
180
|
+
tslib_1.__decorate([
|
|
181
|
+
(0, inversify_1.inject)(workspace_functions_2.WorkspaceFunctionScope),
|
|
182
|
+
tslib_1.__metadata("design:type", workspace_functions_2.WorkspaceFunctionScope)
|
|
183
|
+
], WorkspaceSearchProvider.prototype, "workspaceScope", void 0);
|
|
184
|
+
tslib_1.__decorate([
|
|
185
|
+
(0, inversify_1.inject)(preference_service_1.PreferenceService),
|
|
186
|
+
tslib_1.__metadata("design:type", Object)
|
|
187
|
+
], WorkspaceSearchProvider.prototype, "preferenceService", void 0);
|
|
188
|
+
tslib_1.__decorate([
|
|
189
|
+
(0, inversify_1.inject)(file_service_1.FileService),
|
|
190
|
+
tslib_1.__metadata("design:type", file_service_1.FileService)
|
|
191
|
+
], WorkspaceSearchProvider.prototype, "fileService", void 0);
|
|
130
192
|
exports.WorkspaceSearchProvider = WorkspaceSearchProvider = tslib_1.__decorate([
|
|
131
193
|
(0, inversify_1.injectable)()
|
|
132
194
|
], WorkspaceSearchProvider);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-search-provider.js","sourceRoot":"","sources":["../../src/browser/workspace-search-provider.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;;;;AAKhF,4DAAkE;AAClE,oHAA0I;AAE1I,uEAAgF;
|
|
1
|
+
{"version":3,"file":"workspace-search-provider.js","sourceRoot":"","sources":["../../src/browser/workspace-search-provider.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;;;;AAKhF,+FAA2F;AAC3F,4DAAkE;AAClE,6EAAyE;AACzE,oHAA0I;AAE1I,uEAAgF;AAChF,+DAA+D;AAC/D,mEAA+E;AAC/E,6FAAiF;AAG1E,IAAM,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oFAAoF;wBACpF,sGAAsG;oBAC1G,iBAAiB,EAAE,gBAAgB;iBACtC,CAAC,CAAC;YACP,CAAC;YAED,OAAO,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAE5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,0BAA0B,EAAE,CAAC,CAAC;QAClF,CAAC;IACL,CAAC;CACJ,CAAA;AAjLY,0DAAuB;AAGb;IADlB,IAAA,kBAAM,EAAC,sDAAwB,CAAC;sCACC,sDAAwB;8DAAC;AAGxC;IADlB,IAAA,kBAAM,EAAC,4CAAsB,CAAC;sCACI,4CAAsB;+DAAC;AAGvC;IADlB,IAAA,kBAAM,EAAC,sCAAiB,CAAC;;kEAC8B;AAGrC;IADlB,IAAA,kBAAM,EAAC,0BAAW,CAAC;sCACY,0BAAW;4DAAC;kCAZnC,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CAiLnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-search-provider.spec.d.ts","sourceRoot":"","sources":["../../src/browser/workspace-search-provider.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,227 @@
|
|
|
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
|
+
const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
|
|
19
|
+
const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
|
|
20
|
+
let disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
|
21
|
+
frontend_application_config_provider_1.FrontendApplicationConfigProvider.set({});
|
|
22
|
+
const chai_1 = require("chai");
|
|
23
|
+
const core_1 = require("@theia/core");
|
|
24
|
+
const workspace_search_provider_util_1 = require("../common/workspace-search-provider-util");
|
|
25
|
+
disableJSDOM();
|
|
26
|
+
describe('WorkspaceSearchProvider - Token Optimization', () => {
|
|
27
|
+
before(() => {
|
|
28
|
+
disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
|
29
|
+
});
|
|
30
|
+
after(() => {
|
|
31
|
+
disableJSDOM();
|
|
32
|
+
});
|
|
33
|
+
describe('optimizeSearchResults method', () => {
|
|
34
|
+
it('should preserve all information while optimizing format', () => {
|
|
35
|
+
const workspaceRoot = new core_1.URI('file:///workspace');
|
|
36
|
+
const mockResults = [
|
|
37
|
+
{
|
|
38
|
+
root: 'file:///workspace',
|
|
39
|
+
fileUri: 'file:///workspace/src/test.ts',
|
|
40
|
+
matches: [
|
|
41
|
+
{
|
|
42
|
+
line: 1,
|
|
43
|
+
character: 5,
|
|
44
|
+
length: 8,
|
|
45
|
+
lineText: ' const test = "hello"; '
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
line: 5,
|
|
49
|
+
character: 10,
|
|
50
|
+
length: 4,
|
|
51
|
+
lineText: '\t\tfunction test() { }\n'
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
root: 'file:///workspace',
|
|
57
|
+
fileUri: 'file:///workspace/lib/utils.js',
|
|
58
|
+
matches: [
|
|
59
|
+
{
|
|
60
|
+
line: 10,
|
|
61
|
+
character: 0,
|
|
62
|
+
length: 6,
|
|
63
|
+
lineText: 'export default function() {}'
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
const result = (0, workspace_search_provider_util_1.optimizeSearchResults)(mockResults, workspaceRoot);
|
|
69
|
+
(0, chai_1.expect)(result).to.have.length(2);
|
|
70
|
+
// First file
|
|
71
|
+
(0, chai_1.expect)(result[0]).to.deep.equal({
|
|
72
|
+
file: 'src/test.ts',
|
|
73
|
+
matches: [
|
|
74
|
+
{
|
|
75
|
+
line: 1,
|
|
76
|
+
text: 'const test = "hello";'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
line: 5,
|
|
80
|
+
text: 'function test() { }'
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
// Second file
|
|
85
|
+
(0, chai_1.expect)(result[1]).to.deep.equal({
|
|
86
|
+
file: 'lib/utils.js',
|
|
87
|
+
matches: [
|
|
88
|
+
{
|
|
89
|
+
line: 10,
|
|
90
|
+
text: 'export default function() {}'
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
it('should handle LinePreview objects correctly', () => {
|
|
96
|
+
const workspaceRoot = new core_1.URI('file:///workspace');
|
|
97
|
+
const linePreview = {
|
|
98
|
+
text: ' preview text with spaces ',
|
|
99
|
+
character: 5
|
|
100
|
+
};
|
|
101
|
+
const mockResults = [
|
|
102
|
+
{
|
|
103
|
+
root: 'file:///workspace',
|
|
104
|
+
fileUri: 'file:///workspace/preview.ts',
|
|
105
|
+
matches: [
|
|
106
|
+
{
|
|
107
|
+
line: 3,
|
|
108
|
+
character: 5,
|
|
109
|
+
length: 7,
|
|
110
|
+
lineText: linePreview
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
const result = (0, workspace_search_provider_util_1.optimizeSearchResults)(mockResults, workspaceRoot);
|
|
116
|
+
(0, chai_1.expect)(result[0].matches[0]).to.deep.equal({
|
|
117
|
+
line: 3,
|
|
118
|
+
text: 'preview text with spaces'
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
it('should handle empty LinePreview text gracefully', () => {
|
|
122
|
+
const workspaceRoot = new core_1.URI('file:///workspace');
|
|
123
|
+
const linePreview = {
|
|
124
|
+
text: '',
|
|
125
|
+
character: 0
|
|
126
|
+
};
|
|
127
|
+
const mockResults = [
|
|
128
|
+
{
|
|
129
|
+
root: 'file:///workspace',
|
|
130
|
+
fileUri: 'file:///workspace/empty.ts',
|
|
131
|
+
matches: [
|
|
132
|
+
{
|
|
133
|
+
line: 1,
|
|
134
|
+
character: 0,
|
|
135
|
+
length: 0,
|
|
136
|
+
lineText: linePreview
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
];
|
|
141
|
+
const result = (0, workspace_search_provider_util_1.optimizeSearchResults)(mockResults, workspaceRoot);
|
|
142
|
+
(0, chai_1.expect)(result[0].matches[0]).to.deep.equal({
|
|
143
|
+
line: 1,
|
|
144
|
+
text: ''
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
it('should preserve semantic whitespace within lines', () => {
|
|
148
|
+
const workspaceRoot = new core_1.URI('file:///workspace');
|
|
149
|
+
const mockResults = [
|
|
150
|
+
{
|
|
151
|
+
root: 'file:///workspace',
|
|
152
|
+
fileUri: 'file:///workspace/spaces.ts',
|
|
153
|
+
matches: [
|
|
154
|
+
{
|
|
155
|
+
line: 1,
|
|
156
|
+
character: 0,
|
|
157
|
+
length: 20,
|
|
158
|
+
lineText: ' if (a && b) { '
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
const result = (0, workspace_search_provider_util_1.optimizeSearchResults)(mockResults, workspaceRoot);
|
|
164
|
+
(0, chai_1.expect)(result[0].matches[0].text).to.equal('if (a && b) {');
|
|
165
|
+
});
|
|
166
|
+
it('should use absolute URI when relative path cannot be determined', () => {
|
|
167
|
+
const workspaceRoot = new core_1.URI('file:///different-workspace');
|
|
168
|
+
const mockResults = [
|
|
169
|
+
{
|
|
170
|
+
root: 'file:///workspace',
|
|
171
|
+
fileUri: 'file:///workspace/outside.ts',
|
|
172
|
+
matches: [
|
|
173
|
+
{
|
|
174
|
+
line: 1,
|
|
175
|
+
character: 0,
|
|
176
|
+
length: 4,
|
|
177
|
+
lineText: 'test'
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
];
|
|
182
|
+
const result = (0, workspace_search_provider_util_1.optimizeSearchResults)(mockResults, workspaceRoot);
|
|
183
|
+
(0, chai_1.expect)(result[0].file).to.equal('file:///workspace/outside.ts');
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
describe('token efficiency validation', () => {
|
|
187
|
+
it('should produce more compact JSON than original format', () => {
|
|
188
|
+
const workspaceRoot = new core_1.URI('file:///workspace');
|
|
189
|
+
const mockResults = [
|
|
190
|
+
{
|
|
191
|
+
root: 'file:///workspace',
|
|
192
|
+
fileUri: 'file:///workspace/src/test.ts',
|
|
193
|
+
matches: [
|
|
194
|
+
{
|
|
195
|
+
line: 1,
|
|
196
|
+
character: 5,
|
|
197
|
+
length: 8,
|
|
198
|
+
lineText: ' const test = "hello"; '
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
];
|
|
203
|
+
// Original format (simulated)
|
|
204
|
+
const originalFormat = JSON.stringify([{
|
|
205
|
+
root: 'file:///workspace',
|
|
206
|
+
fileUri: 'file:///workspace/src/test.ts',
|
|
207
|
+
matches: [{
|
|
208
|
+
line: 1,
|
|
209
|
+
character: 5,
|
|
210
|
+
length: 8,
|
|
211
|
+
lineText: ' const test = "hello"; '
|
|
212
|
+
}]
|
|
213
|
+
}]);
|
|
214
|
+
// Optimized format
|
|
215
|
+
const optimizedResults = (0, workspace_search_provider_util_1.optimizeSearchResults)(mockResults, workspaceRoot);
|
|
216
|
+
const optimizedFormat = JSON.stringify(optimizedResults);
|
|
217
|
+
// The optimized format should be significantly shorter
|
|
218
|
+
(0, chai_1.expect)(optimizedFormat.length).to.be.lessThan(originalFormat.length);
|
|
219
|
+
// But should preserve essential information
|
|
220
|
+
const parsed = JSON.parse(optimizedFormat);
|
|
221
|
+
(0, chai_1.expect)(parsed[0].file).to.equal('src/test.ts');
|
|
222
|
+
(0, chai_1.expect)(parsed[0].matches[0].line).to.equal(1);
|
|
223
|
+
(0, chai_1.expect)(parsed[0].matches[0].text).to.equal('const test = "hello";');
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
//# sourceMappingURL=workspace-search-provider.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-search-provider.spec.js","sourceRoot":"","sources":["../../src/browser/workspace-search-provider.spec.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,uHAAiH;AACjH,8DAAiE;AACjE,IAAI,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC;AACjC,wEAAiC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAE1C,+BAA8B;AAC9B,sCAAkC;AAElC,6FAAiF;AAEjF,YAAY,EAAE,CAAC;AAEf,QAAQ,CAAC,8CAA8C,EAAE,GAAG,EAAE;IAE1D,MAAM,CAAC,GAAG,EAAE;QACR,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,GAAG,E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qB,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC;YAC3E,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;YAEzD,uDAAuD;YACvD,IAAA,aAAM,EAAC,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAErE,4CAA4C;YAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAC3C,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAC/C,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PromptVariantSet } from '@theia/ai-core/lib/common';
|
|
2
2
|
export declare const ARCHITECT_TASK_SUMMARY_PROMPT_TEMPLATE_ID = "architect-task-summary";
|
|
3
|
+
export declare const ARCHITECT_TASK_SUMMARY_UPDATE_PROMPT_TEMPLATE_ID = "architect-update-task-summary";
|
|
3
4
|
export declare const architectVariants: PromptVariantSet;
|
|
4
5
|
//# sourceMappingURL=architect-prompt-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architect-prompt-template.d.ts","sourceRoot":"","sources":["../../src/common/architect-prompt-template.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAQ7D,eAAO,MAAM,yCAAyC,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"architect-prompt-template.d.ts","sourceRoot":"","sources":["../../src/common/architect-prompt-template.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAQ7D,eAAO,MAAM,yCAAyC,2BAA2B,CAAC;AAClF,eAAO,MAAM,gDAAgD,kCAAkC,CAAC;AAEhG,eAAO,MAAM,iBAAiB,kBAyP7B,CAAC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.architectVariants = exports.ARCHITECT_TASK_SUMMARY_PROMPT_TEMPLATE_ID = void 0;
|
|
3
|
+
exports.architectVariants = exports.ARCHITECT_TASK_SUMMARY_UPDATE_PROMPT_TEMPLATE_ID = exports.ARCHITECT_TASK_SUMMARY_PROMPT_TEMPLATE_ID = void 0;
|
|
4
4
|
const workspace_functions_1 = require("./workspace-functions");
|
|
5
5
|
const context_variables_1 = require("./context-variables");
|
|
6
6
|
const context_functions_1 = require("./context-functions");
|
|
7
7
|
exports.ARCHITECT_TASK_SUMMARY_PROMPT_TEMPLATE_ID = 'architect-task-summary';
|
|
8
|
+
exports.ARCHITECT_TASK_SUMMARY_UPDATE_PROMPT_TEMPLATE_ID = 'architect-update-task-summary';
|
|
8
9
|
exports.architectVariants = {
|
|
9
10
|
id: 'architect-system',
|
|
10
11
|
defaultVariant: {
|
|
11
12
|
id: 'architect-system-default',
|
|
12
13
|
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
13
|
-
Made improvements or adaptations to this prompt template? We
|
|
14
|
+
Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
|
|
14
15
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
15
16
|
# Instructions
|
|
16
17
|
|
|
@@ -42,12 +43,13 @@ Always look at the relevant files to understand your task using the function ~{$
|
|
|
42
43
|
{
|
|
43
44
|
id: 'architect-system-next',
|
|
44
45
|
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
45
|
-
Made improvements or adaptations to this prompt template? We
|
|
46
|
+
Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
|
|
46
47
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
47
48
|
# Instructions
|
|
48
49
|
|
|
49
|
-
You are an AI assistant integrated into Theia IDE, designed to assist software developers. You can
|
|
50
|
-
|
|
50
|
+
You are an AI assistant integrated into Theia IDE, designed to assist software developers. You can only change the files added to the context, but you can navigate and read the
|
|
51
|
+
users workspace using the provided functions.\
|
|
52
|
+
Therefore describe and explain the details or procedures necessary to achieve the desired outcome. If file changes are necessary to help the user, be \
|
|
51
53
|
aware that there is another agent called 'Coder' that can suggest file changes. In this case you can create a description on what to do and tell the user to ask '@Coder' to \
|
|
52
54
|
implement the change plan. If you refer to files, always mention the workspace-relative path.\
|
|
53
55
|
|
|
@@ -92,6 +94,165 @@ Skip irrelevant information, e.g. for discussions, only sum up the final result.
|
|
|
92
94
|
4. If any part of the task is ambiguous, note the ambiguity so that it can be clarified later.
|
|
93
95
|
|
|
94
96
|
Focus on providing actionable steps and implementation guidance. The coding agent needs practical help with this specific coding task.
|
|
97
|
+
|
|
98
|
+
Use the following format, but only include the sections that were discussed in the conversation:
|
|
99
|
+
|
|
100
|
+
# Task Context: [Title Here]
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 1. ๐ Task Definition
|
|
105
|
+
|
|
106
|
+
**Problem Statement / Goal:**
|
|
107
|
+
[Describe what needs to be achieved and why.]
|
|
108
|
+
|
|
109
|
+
**Scope:**
|
|
110
|
+
- **In Scope:**
|
|
111
|
+
[Features, components, or behaviors to be included.]
|
|
112
|
+
- **Out of Scope:**
|
|
113
|
+
[What explicitly won't be part of this task.]
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 2. ๐ง Design and Implementation
|
|
118
|
+
|
|
119
|
+
**Design Overview:**
|
|
120
|
+
[Summary of architecture and major design decisions.]
|
|
121
|
+
|
|
122
|
+
**Implementation Plan:**
|
|
123
|
+
1. [First major step]
|
|
124
|
+
2. [Second major step]
|
|
125
|
+
3. [Third major step]
|
|
126
|
+
|
|
127
|
+
**Technology Choices:**
|
|
128
|
+
- [Frameworks, libraries, services, tools]
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 3. ๐งช Testing
|
|
133
|
+
|
|
134
|
+
### 3.1 ๐ ๏ธ Automated Testing (by Coder)
|
|
135
|
+
|
|
136
|
+
**Automated Test Strategy:**
|
|
137
|
+
[What should be covered by automated tests.]
|
|
138
|
+
|
|
139
|
+
**Test Cases Implemented:**
|
|
140
|
+
- [Unit test 1]
|
|
141
|
+
- [Integration test 1]
|
|
142
|
+
- [E2E test 1]
|
|
143
|
+
|
|
144
|
+
**Test Coverage Targets:**
|
|
145
|
+
[e.g., Minimum 80% code coverage, all workflows tested.]
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
### 3.2 ๐ฏ Manual Testing (by Tester)
|
|
150
|
+
|
|
151
|
+
**Manual Testing Strategy:**
|
|
152
|
+
[What manual tests will focus on (e.g., usability, edge cases, exploratory testing).]
|
|
153
|
+
|
|
154
|
+
**Test Setup Instructions:**
|
|
155
|
+
- [Environment setup steps, accounts needed, special configurations]
|
|
156
|
+
|
|
157
|
+
**Test Cases / Test Steps:**
|
|
158
|
+
1. [Action 1]
|
|
159
|
+
2. [Action 2]
|
|
160
|
+
3. [Action 3]
|
|
161
|
+
|
|
162
|
+
**Expected Results:**
|
|
163
|
+
- [Expected behavior at each step]
|
|
164
|
+
|
|
165
|
+
**Known Risks / Focus Areas:**
|
|
166
|
+
- [Potential weak spots, UX concerns, edge cases]
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 4. ๐ฆ Deliverables
|
|
171
|
+
|
|
172
|
+
**Expected Artifacts:**
|
|
173
|
+
- [Code modules]
|
|
174
|
+
- [Documentation]
|
|
175
|
+
- [Configuration files]
|
|
176
|
+
- [Test reports]
|
|
177
|
+
|
|
178
|
+
**PR Information:**
|
|
179
|
+
- **PR Title:** [Suggested title for the pull request]
|
|
180
|
+
- **PR Description:** [What was implemented, high-level changes, decisions]
|
|
181
|
+
- **Verification Steps:** [Instructions for verifying the PR manually or automatically]
|
|
182
|
+
|
|
183
|
+
**Additional Notes:**
|
|
184
|
+
- [Dependencies]
|
|
185
|
+
- [Migration steps if needed]
|
|
186
|
+
- [Special reviewer instructions]
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 5. ๐ Current Status
|
|
191
|
+
|
|
192
|
+
**Progress Summary:**
|
|
193
|
+
[Short free-text update about how far the task has progressed.]
|
|
194
|
+
|
|
195
|
+
**Completed Items:**
|
|
196
|
+
- [List of what has been fully implemented, tested, or merged.]
|
|
197
|
+
|
|
198
|
+
**Open Items:**
|
|
199
|
+
- [List of remaining tasks, missing parts.]
|
|
200
|
+
|
|
201
|
+
**Current Issues / Risks:**
|
|
202
|
+
- [Open problems, bugs found during testing, architectural blockers.]
|
|
203
|
+
|
|
204
|
+
**Next Steps:**
|
|
205
|
+
- [Immediate action items, who should act next.]
|
|
206
|
+
`
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: exports.ARCHITECT_TASK_SUMMARY_UPDATE_PROMPT_TEMPLATE_ID,
|
|
210
|
+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
211
|
+
Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
|
|
212
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
213
|
+
You are an AI assistant integrated into Theia IDE, designed to update task context files. You can interact provided task context file and propose changes.
|
|
214
|
+
|
|
215
|
+
# Task Document Update Instructions
|
|
216
|
+
|
|
217
|
+
You are an AI agent tasked with updating a technical document based on the current discussion. Your job is to provide the COMPLETE UPDATED DOCUMENT as your response, not\
|
|
218
|
+
commentary about the document.
|
|
219
|
+
|
|
220
|
+
## Analysis Requirements
|
|
221
|
+
|
|
222
|
+
1. **Review the Current Discussion**:
|
|
223
|
+
- Analyze the entire conversation
|
|
224
|
+
- Identify new information, decisions, and changes
|
|
225
|
+
|
|
226
|
+
2. **Examine the Existing Document**:
|
|
227
|
+
- Understand its structure and purpose
|
|
228
|
+
- Identify sections that need updates
|
|
229
|
+
|
|
230
|
+
3. **Update the Document**:
|
|
231
|
+
- Maintain the original structure and formatting
|
|
232
|
+
- Add new information from the discussion
|
|
233
|
+
- Update existing information
|
|
234
|
+
- Remove outdated information if necessary
|
|
235
|
+
- Ensure coherence and organization
|
|
236
|
+
|
|
237
|
+
## IMPORTANT: Response Format
|
|
238
|
+
|
|
239
|
+
YOUR ENTIRE RESPONSE MUST BE THE UPDATED DOCUMENT ONLY. Do not include:
|
|
240
|
+
- Any commentary about what you changed
|
|
241
|
+
- Introduction or explanation text
|
|
242
|
+
- Markdown fences or syntax indicators
|
|
243
|
+
- Clarifying questions
|
|
244
|
+
|
|
245
|
+
Simply output the complete updated document as plain text, which will directly replace the existing document.
|
|
246
|
+
|
|
247
|
+
## Guidelines
|
|
248
|
+
|
|
249
|
+
- Be thorough in capturing all relevant information
|
|
250
|
+
- Maintain the original document's style and tone
|
|
251
|
+
- Use clear, concise language
|
|
252
|
+
- Preserve all formatting from the original document
|
|
253
|
+
- Ensure technical accuracy in all updates
|
|
254
|
+
|
|
255
|
+
{{${context_variables_1.TASK_CONTEXT_SUMMARY_VARIABLE_ID}}}
|
|
95
256
|
`
|
|
96
257
|
}
|
|
97
258
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architect-prompt-template.js","sourceRoot":"","sources":["../../src/common/architect-prompt-template.ts"],"names":[],"mappings":";;;AAWA,+DAG+B;AAC/B,2DAAkG;AAClG,2DAAuE;AAE1D,QAAA,yCAAyC,GAAG,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"architect-prompt-template.js","sourceRoot":"","sources":["../../src/common/architect-prompt-template.ts"],"names":[],"mappings":";;;AAWA,+DAG+B;AAC/B,2DAAkG;AAClG,2DAAuE;AAE1D,QAAA,yCAAyC,GAAG,wBAAwB,CAAC;AACrE,QAAA,gDAAgD,GAAG,+BAA+B,CAAC;AAEnF,QAAA,iBAAiB,GAAqB;IAC/C,EAAE,EAAE,kBAAkB;IACtB,cAAc,EAAE;QACZ,EAAE,EAAE,0BAA0B;QAC9B,QAAQ,EAAE;;;;;;;;;;;QAWV,mEAA6C;QAC7C,yDAAmC;QACnC,8CAAwB;;;;;;;;;;iFAUiD,8CAAwB;IACrG,6CAAyB;;;CAG5B;KACI;IACD,QAAQ,EAAE;QACN;YACI,EAAE,EAAE,uBAAuB;YAC3B,QAAQ,EAAE;;;;;;;;;;;;;QAad,mEAA6C;QAC7C,yDAAmC;QACnC,8CAAwB;QACxB,qDAA+B;;gFAEyC,oDAAgC;;;;sHAIM,6CAAuB;;;iFAG5D,8CAAwB;IACrG,6CAAyB;;;;IAIzB,oDAAgC;CACnC;SACQ;QACD;YACI,EAAE,EAAE,iDAAyC;YAC7C,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8HrB;SACQ;QACD;YACI,EAAE,EAAE,wDAAgD;YACpD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6ClB,oDAAgC;CACnC;SAAE;KACE;CACJ,CAAC"}
|