@theia/ai-ide 1.65.0-next.19 → 1.65.0-next.39
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/tools-configuration-widget.d.ts +4 -2
- package/lib/browser/ai-configuration/tools-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/tools-configuration-widget.js +6 -4
- package/lib/browser/ai-configuration/tools-configuration-widget.js.map +1 -1
- package/lib/browser/ai-ide-activation-service.d.ts +2 -2
- package/lib/browser/ai-ide-activation-service.d.ts.map +1 -1
- package/lib/browser/ai-ide-activation-service.js +2 -3
- package/lib/browser/ai-ide-activation-service.js.map +1 -1
- package/lib/browser/app-tester-chat-agent.d.ts +1 -1
- package/lib/browser/app-tester-chat-agent.d.ts.map +1 -1
- package/lib/browser/app-tester-chat-agent.js +4 -4
- package/lib/browser/app-tester-chat-agent.js.map +1 -1
- package/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +7 -6
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/task-context-file-storage-service.d.ts +3 -3
- package/lib/browser/task-context-file-storage-service.d.ts.map +1 -1
- package/lib/browser/task-context-file-storage-service.js +5 -5
- package/lib/browser/task-context-file-storage-service.js.map +1 -1
- package/lib/browser/template-preference-contribution.d.ts +2 -1
- package/lib/browser/template-preference-contribution.d.ts.map +1 -1
- package/lib/browser/template-preference-contribution.js +5 -6
- package/lib/browser/template-preference-contribution.js.map +1 -1
- package/lib/browser/workspace-functions.d.ts +12 -2
- package/lib/browser/workspace-functions.d.ts.map +1 -1
- package/lib/browser/workspace-functions.js +179 -18
- package/lib/browser/workspace-functions.js.map +1 -1
- package/lib/browser/workspace-functions.spec.js +1 -1
- package/lib/browser/workspace-functions.spec.js.map +1 -1
- package/lib/browser/workspace-search-provider.d.ts +1 -1
- package/lib/browser/workspace-search-provider.d.ts.map +1 -1
- package/lib/browser/workspace-search-provider.js +2 -2
- package/lib/browser/workspace-search-provider.js.map +1 -1
- package/lib/browser/workspace-search-provider.spec.js +1 -2
- package/lib/browser/workspace-search-provider.spec.js.map +1 -1
- package/lib/{browser/ai-configuration → common}/ai-configuration-preferences.d.ts +1 -1
- package/lib/common/ai-configuration-preferences.d.ts.map +1 -0
- package/lib/{browser/ai-configuration → common}/ai-configuration-preferences.js +0 -1
- package/lib/common/ai-configuration-preferences.js.map +1 -0
- package/lib/{browser → common}/ai-ide-preferences.d.ts +1 -1
- package/lib/common/ai-ide-preferences.d.ts.map +1 -0
- package/lib/{browser → common}/ai-ide-preferences.js +3 -4
- package/lib/common/ai-ide-preferences.js.map +1 -0
- package/lib/common/architect-prompt-template.d.ts.map +1 -1
- package/lib/common/architect-prompt-template.js +2 -0
- package/lib/common/architect-prompt-template.js.map +1 -1
- package/lib/common/coder-replace-prompt-template.d.ts.map +1 -1
- package/lib/common/coder-replace-prompt-template.js +3 -0
- package/lib/common/coder-replace-prompt-template.js.map +1 -1
- package/lib/common/workspace-functions.d.ts +1 -0
- package/lib/common/workspace-functions.d.ts.map +1 -1
- package/lib/common/workspace-functions.js +2 -1
- package/lib/common/workspace-functions.js.map +1 -1
- package/lib/{browser → common}/workspace-preferences.d.ts +1 -1
- package/lib/common/workspace-preferences.d.ts.map +1 -0
- package/lib/{browser → common}/workspace-preferences.js +0 -1
- package/lib/common/workspace-preferences.js.map +1 -0
- package/lib/node/backend-module.d.ts.map +1 -1
- package/lib/node/backend-module.js +6 -0
- package/lib/node/backend-module.js.map +1 -1
- package/package.json +18 -18
- package/src/browser/ai-configuration/tools-configuration-widget.tsx +4 -2
- package/src/browser/ai-ide-activation-service.ts +4 -4
- package/src/browser/app-tester-chat-agent.ts +2 -2
- package/src/browser/frontend-module.ts +13 -6
- package/src/browser/task-context-file-storage-service.ts +6 -6
- package/src/browser/template-preference-contribution.ts +3 -3
- package/src/browser/workspace-functions.spec.ts +2 -2
- package/src/browser/workspace-functions.ts +199 -18
- package/src/browser/workspace-search-provider.spec.ts +1 -2
- package/src/browser/workspace-search-provider.ts +2 -2
- package/src/{browser/ai-configuration → common}/ai-configuration-preferences.ts +1 -2
- package/src/{browser → common}/ai-ide-preferences.ts +3 -5
- package/src/common/architect-prompt-template.ts +3 -1
- package/src/common/coder-replace-prompt-template.ts +4 -0
- package/src/common/workspace-functions.ts +1 -0
- package/src/{browser → common}/workspace-preferences.ts +1 -3
- package/src/node/backend-module.ts +8 -1
- package/lib/browser/ai-configuration/ai-configuration-preferences.d.ts.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-preferences.js.map +0 -1
- package/lib/browser/ai-ide-preferences.d.ts.map +0 -1
- package/lib/browser/ai-ide-preferences.js.map +0 -1
- package/lib/browser/workspace-preferences.d.ts.map +0 -1
- package/lib/browser/workspace-preferences.js.map +0 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
import { ToolProvider, ToolRequest } from '@theia/ai-core';
|
|
17
|
-
import { CancellationToken, Disposable, URI } from '@theia/core';
|
|
17
|
+
import { CancellationToken, Disposable, PreferenceService, URI } from '@theia/core';
|
|
18
18
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
19
|
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
20
20
|
import { FileStat } from '@theia/filesystem/lib/common/files';
|
|
@@ -22,12 +22,12 @@ import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
|
22
22
|
import {
|
|
23
23
|
FILE_CONTENT_FUNCTION_ID, GET_FILE_DIAGNOSTICS_ID,
|
|
24
24
|
GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID,
|
|
25
|
-
GET_WORKSPACE_FILE_LIST_FUNCTION_ID
|
|
25
|
+
GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FIND_FILES_BY_PATTERN_FUNCTION_ID
|
|
26
26
|
} from '../common/workspace-functions';
|
|
27
27
|
import ignore from 'ignore';
|
|
28
28
|
import { Minimatch } from 'minimatch';
|
|
29
|
-
import {
|
|
30
|
-
import { CONSIDER_GITIGNORE_PREF, USER_EXCLUDE_PATTERN_PREF } from '
|
|
29
|
+
import { OpenerService, open } from '@theia/core/lib/browser';
|
|
30
|
+
import { CONSIDER_GITIGNORE_PREF, USER_EXCLUDE_PATTERN_PREF } from '../common/workspace-preferences';
|
|
31
31
|
import { MonacoWorkspace } from '@theia/monaco/lib/browser/monaco-workspace';
|
|
32
32
|
import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service';
|
|
33
33
|
import { ProblemManager } from '@theia/markers/lib/browser';
|
|
@@ -141,8 +141,8 @@ export class GetWorkspaceDirectoryStructure implements ToolProvider {
|
|
|
141
141
|
return {
|
|
142
142
|
id: GetWorkspaceDirectoryStructure.ID,
|
|
143
143
|
name: GetWorkspaceDirectoryStructure.ID,
|
|
144
|
-
description:
|
|
145
|
-
|
|
144
|
+
description: 'Retrieve the complete directory structure of the workspace, listing only directories (no file contents). ' +
|
|
145
|
+
'This structure excludes specific directories, such as node_modules and hidden files, ensuring paths are within workspace boundaries.',
|
|
146
146
|
parameters: {
|
|
147
147
|
type: 'object',
|
|
148
148
|
properties: {}
|
|
@@ -209,15 +209,17 @@ export class FileContentFunction implements ToolProvider {
|
|
|
209
209
|
return {
|
|
210
210
|
id: FileContentFunction.ID,
|
|
211
211
|
name: FileContentFunction.ID,
|
|
212
|
-
description:
|
|
213
|
-
|
|
212
|
+
description: 'Return the content of a specified file within the workspace. ' +
|
|
213
|
+
'The file path must be provided relative to the workspace root. Only files within ' +
|
|
214
|
+
'workspace boundaries are accessible; attempting to access files outside the workspace will return an error.',
|
|
214
215
|
parameters: {
|
|
215
216
|
type: 'object',
|
|
216
217
|
properties: {
|
|
217
218
|
file: {
|
|
218
219
|
type: 'string',
|
|
219
|
-
description:
|
|
220
|
-
|
|
220
|
+
description: 'The relative path to the target file within the workspace. ' +
|
|
221
|
+
'This path is resolved from the workspace root, and only files within the workspace ' +
|
|
222
|
+
'boundaries are accessible. Attempting to access paths outside the workspace will result in an error.',
|
|
221
223
|
}
|
|
222
224
|
},
|
|
223
225
|
required: ['file']
|
|
@@ -289,14 +291,16 @@ export class GetWorkspaceFileList implements ToolProvider {
|
|
|
289
291
|
properties: {
|
|
290
292
|
path: {
|
|
291
293
|
type: 'string',
|
|
292
|
-
description:
|
|
293
|
-
|
|
294
|
+
description: 'Optional relative path to a directory within the workspace. ' +
|
|
295
|
+
'If no path is specified, the function lists contents directly in the workspace root. ' +
|
|
296
|
+
'Paths are resolved within workspace boundaries only; paths outside the workspace or unvalidated paths will result in an error.'
|
|
294
297
|
}
|
|
295
298
|
},
|
|
296
299
|
required: ['path']
|
|
297
300
|
},
|
|
298
|
-
description:
|
|
299
|
-
|
|
301
|
+
description: 'List files and directories within a specified workspace directory. ' +
|
|
302
|
+
'Paths are relative to the workspace root, and only workspace-contained paths are allowed. ' +
|
|
303
|
+
'If no path is provided, the root contents are listed. Paths outside the workspace will result in an error.',
|
|
300
304
|
handler: (arg_string: string, ctx: MutableChatRequestModel) => {
|
|
301
305
|
const args = JSON.parse(arg_string);
|
|
302
306
|
const cancellationToken = ctx.response.cancellationToken;
|
|
@@ -394,15 +398,17 @@ export class FileDiagnosticProvider implements ToolProvider {
|
|
|
394
398
|
id: FileDiagnosticProvider.ID,
|
|
395
399
|
name: FileDiagnosticProvider.ID,
|
|
396
400
|
description:
|
|
397
|
-
'A function to retrieve diagnostics associated with a specific file in the workspace.
|
|
398
|
-
|
|
401
|
+
'A function to retrieve diagnostics associated with a specific file in the workspace. ' +
|
|
402
|
+
'It will return a list of problems that includes the surrounding text a message describing the problem, ' +
|
|
403
|
+
'and optionally a code and a codeDescription field describing that code.',
|
|
399
404
|
parameters: {
|
|
400
405
|
type: 'object',
|
|
401
406
|
properties: {
|
|
402
407
|
file: {
|
|
403
408
|
type: 'string',
|
|
404
|
-
description:
|
|
405
|
-
|
|
409
|
+
description: 'The relative path to the target file within the workspace. ' +
|
|
410
|
+
'This path is resolved from the workspace root, and only files within the workspace ' +
|
|
411
|
+
'boundaries are accessible. Attempting to access paths outside the workspace will result in an error.'
|
|
406
412
|
}
|
|
407
413
|
},
|
|
408
414
|
required: ['file']
|
|
@@ -517,3 +523,178 @@ export class FileDiagnosticProvider implements ToolProvider {
|
|
|
517
523
|
return { end: { character: Number.MAX_SAFE_INTEGER, line: endLine }, start: { character: 0, line: startLine } };
|
|
518
524
|
}
|
|
519
525
|
}
|
|
526
|
+
|
|
527
|
+
@injectable()
|
|
528
|
+
export class FindFilesByPattern implements ToolProvider {
|
|
529
|
+
static ID = FIND_FILES_BY_PATTERN_FUNCTION_ID;
|
|
530
|
+
|
|
531
|
+
@inject(WorkspaceFunctionScope)
|
|
532
|
+
protected readonly workspaceScope: WorkspaceFunctionScope;
|
|
533
|
+
|
|
534
|
+
@inject(PreferenceService)
|
|
535
|
+
protected readonly preferences: PreferenceService;
|
|
536
|
+
|
|
537
|
+
@inject(FileService)
|
|
538
|
+
protected readonly fileService: FileService;
|
|
539
|
+
|
|
540
|
+
getTool(): ToolRequest {
|
|
541
|
+
return {
|
|
542
|
+
id: FindFilesByPattern.ID,
|
|
543
|
+
name: FindFilesByPattern.ID,
|
|
544
|
+
description: 'Find files in the workspace that match a given glob pattern. ' +
|
|
545
|
+
'This function allows efficient discovery of files using patterns like \'**/*.ts\' for all TypeScript files or ' +
|
|
546
|
+
'\'src/**/*.js\' for JavaScript files in the src directory. The function respects gitignore patterns and user exclusions, ' +
|
|
547
|
+
'returns relative paths from the workspace root, and limits results to 200 files maximum.',
|
|
548
|
+
parameters: {
|
|
549
|
+
type: 'object',
|
|
550
|
+
properties: {
|
|
551
|
+
pattern: {
|
|
552
|
+
type: 'string',
|
|
553
|
+
description: 'Glob pattern to match files against. ' +
|
|
554
|
+
'Examples: \'**/*.ts\' (all TypeScript files), \'src/**/*.js\' (JS files in src), ' +
|
|
555
|
+
'\'**/*.{js,ts}\' (JS or TS files), \'**/test/**\' (files in test directories). ' +
|
|
556
|
+
'Patterns are matched against paths relative to the workspace root.'
|
|
557
|
+
},
|
|
558
|
+
exclude: {
|
|
559
|
+
type: 'array',
|
|
560
|
+
items: { type: 'string' },
|
|
561
|
+
description: 'Optional array of glob patterns to exclude from results. ' +
|
|
562
|
+
'Examples: [\'**/*.spec.ts\', \'**/*.test.js\', \'node_modules/**\']. ' +
|
|
563
|
+
'If not specified, common exclusions like node_modules, .git, and dist are applied automatically.'
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
required: ['pattern']
|
|
567
|
+
},
|
|
568
|
+
handler: (arg_string: string, ctx: MutableChatRequestModel) => {
|
|
569
|
+
const args = JSON.parse(arg_string);
|
|
570
|
+
const cancellationToken = ctx.response.cancellationToken;
|
|
571
|
+
return this.findFiles(args.pattern, args.exclude, cancellationToken);
|
|
572
|
+
},
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
private async findFiles(pattern: string, excludePatterns?: string[], cancellationToken?: CancellationToken): Promise<string> {
|
|
577
|
+
if (cancellationToken?.isCancellationRequested) {
|
|
578
|
+
return JSON.stringify({ error: 'Operation cancelled by user' });
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
let workspaceRoot;
|
|
582
|
+
try {
|
|
583
|
+
workspaceRoot = await this.workspaceScope.getWorkspaceRoot();
|
|
584
|
+
} catch (error) {
|
|
585
|
+
return JSON.stringify({ error: error.message });
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
try {
|
|
589
|
+
// Build ignore patterns from gitignore and user preferences
|
|
590
|
+
const ignorePatterns = await this.buildIgnorePatterns(workspaceRoot);
|
|
591
|
+
|
|
592
|
+
const allExcludes = [...ignorePatterns];
|
|
593
|
+
if (excludePatterns && excludePatterns.length > 0) {
|
|
594
|
+
allExcludes.push(...excludePatterns);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
if (cancellationToken?.isCancellationRequested) {
|
|
598
|
+
return JSON.stringify({ error: 'Operation cancelled by user' });
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
const patternMatcher = new Minimatch(pattern, { dot: false });
|
|
602
|
+
const excludeMatchers = allExcludes.map(excludePattern => new Minimatch(excludePattern, { dot: true }));
|
|
603
|
+
const files: string[] = [];
|
|
604
|
+
const maxResults = 200;
|
|
605
|
+
|
|
606
|
+
await this.traverseDirectory(workspaceRoot, workspaceRoot, patternMatcher, excludeMatchers, files, maxResults, cancellationToken);
|
|
607
|
+
|
|
608
|
+
if (cancellationToken?.isCancellationRequested) {
|
|
609
|
+
return JSON.stringify({ error: 'Operation cancelled by user' });
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const result: { files: string[]; totalFound?: number; truncated?: boolean } = {
|
|
613
|
+
files: files.slice(0, maxResults)
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
if (files.length > maxResults) {
|
|
617
|
+
result.totalFound = files.length;
|
|
618
|
+
result.truncated = true;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return JSON.stringify(result);
|
|
622
|
+
|
|
623
|
+
} catch (error) {
|
|
624
|
+
return JSON.stringify({ error: `Failed to find files: ${error.message}` });
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
private async buildIgnorePatterns(workspaceRoot: URI): Promise<string[]> {
|
|
629
|
+
const patterns: string[] = [];
|
|
630
|
+
|
|
631
|
+
// Get user exclude patterns from preferences
|
|
632
|
+
const userExcludePatterns = this.preferences.get<string[]>(USER_EXCLUDE_PATTERN_PREF, []);
|
|
633
|
+
patterns.push(...userExcludePatterns);
|
|
634
|
+
|
|
635
|
+
// Add gitignore patterns if enabled
|
|
636
|
+
const shouldConsiderGitIgnore = this.preferences.get(CONSIDER_GITIGNORE_PREF, false);
|
|
637
|
+
if (shouldConsiderGitIgnore) {
|
|
638
|
+
try {
|
|
639
|
+
const gitignoreUri = workspaceRoot.resolve('.gitignore');
|
|
640
|
+
const gitignoreContent = await this.fileService.read(gitignoreUri);
|
|
641
|
+
const gitignoreLines = gitignoreContent.value
|
|
642
|
+
.split('\n')
|
|
643
|
+
.map(line => line.trim())
|
|
644
|
+
.filter(line => line && !line.startsWith('#'));
|
|
645
|
+
patterns.push(...gitignoreLines);
|
|
646
|
+
} catch {
|
|
647
|
+
// Gitignore file doesn't exist or can't be read, continue without it
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
return patterns;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
private async traverseDirectory(
|
|
655
|
+
currentUri: URI,
|
|
656
|
+
workspaceRoot: URI,
|
|
657
|
+
patternMatcher: Minimatch,
|
|
658
|
+
excludeMatchers: Minimatch[],
|
|
659
|
+
results: string[],
|
|
660
|
+
maxResults: number,
|
|
661
|
+
cancellationToken?: CancellationToken
|
|
662
|
+
): Promise<void> {
|
|
663
|
+
if (cancellationToken?.isCancellationRequested || results.length >= maxResults) {
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
try {
|
|
668
|
+
const stat = await this.fileService.resolve(currentUri);
|
|
669
|
+
if (!stat || !stat.isDirectory || !stat.children) {
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
for (const child of stat.children) {
|
|
674
|
+
if (cancellationToken?.isCancellationRequested || results.length >= maxResults) {
|
|
675
|
+
break;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
const relativePath = workspaceRoot.relative(child.resource)?.toString();
|
|
679
|
+
if (!relativePath) {
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const shouldExclude = excludeMatchers.some(matcher => matcher.match(relativePath)) ||
|
|
684
|
+
(await this.workspaceScope.shouldExclude(child));
|
|
685
|
+
|
|
686
|
+
if (shouldExclude) {
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
if (child.isDirectory) {
|
|
691
|
+
await this.traverseDirectory(child.resource, workspaceRoot, patternMatcher, excludeMatchers, results, maxResults, cancellationToken);
|
|
692
|
+
} else if (patternMatcher.match(relativePath)) {
|
|
693
|
+
results.push(relativePath);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
} catch {
|
|
697
|
+
// If we can't access a directory, skip it
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { expect } from 'chai';
|
|
18
|
-
import { CancellationTokenSource } from '@theia/core';
|
|
18
|
+
import { CancellationTokenSource, PreferenceService } from '@theia/core';
|
|
19
19
|
import { WorkspaceSearchProvider } from './workspace-search-provider';
|
|
20
20
|
import { MutableChatRequestModel, MutableChatResponseModel } from '@theia/ai-chat';
|
|
21
21
|
import { Container } from '@theia/core/shared/inversify';
|
|
22
22
|
import { SearchInWorkspaceService, SearchInWorkspaceCallbacks } from '@theia/search-in-workspace/lib/browser/search-in-workspace-service';
|
|
23
23
|
import { WorkspaceFunctionScope } from './workspace-functions';
|
|
24
|
-
import { PreferenceService } from '@theia/core/lib/browser';
|
|
25
24
|
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
26
25
|
import { URI } from '@theia/core/lib/common/uri';
|
|
27
26
|
import { SearchInWorkspaceOptions } from '@theia/search-in-workspace/lib/common/search-in-workspace-interface';
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
import { MutableChatRequestModel } from '@theia/ai-chat';
|
|
18
18
|
import { ToolProvider, ToolRequest } from '@theia/ai-core';
|
|
19
19
|
import { CancellationToken } from '@theia/core';
|
|
20
|
-
import { PreferenceService } from '@theia/core/lib/
|
|
20
|
+
import { PreferenceService } from '@theia/core/lib/common/preferences/preference-service';
|
|
21
21
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
22
22
|
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
23
23
|
import { SearchInWorkspaceService, SearchInWorkspaceCallbacks } from '@theia/search-in-workspace/lib/browser/search-in-workspace-service';
|
|
24
24
|
import { SearchInWorkspaceResult, SearchInWorkspaceOptions } from '@theia/search-in-workspace/lib/common/search-in-workspace-interface';
|
|
25
25
|
import { SEARCH_IN_WORKSPACE_FUNCTION_ID } from '../common/workspace-functions';
|
|
26
26
|
import { WorkspaceFunctionScope } from './workspace-functions';
|
|
27
|
-
import { SEARCH_IN_WORKSPACE_MAX_RESULTS_PREF } from '
|
|
27
|
+
import { SEARCH_IN_WORKSPACE_MAX_RESULTS_PREF } from '../common/workspace-preferences';
|
|
28
28
|
import { optimizeSearchResults } from '../common/workspace-search-provider-util';
|
|
29
29
|
|
|
30
30
|
@injectable()
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { nls } from '@theia/core';
|
|
18
|
-
import { PreferenceSchema } from '@theia/core/lib/
|
|
18
|
+
import { PreferenceSchema } from '@theia/core/lib/common';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* These preferences are not intended to reflect real settings.
|
|
@@ -23,7 +23,6 @@ import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference
|
|
|
23
23
|
* in case the user looks in the preferences editor UI to find the configuration.
|
|
24
24
|
*/
|
|
25
25
|
export const AiConfigurationPreferences: PreferenceSchema = {
|
|
26
|
-
type: 'object',
|
|
27
26
|
properties: {
|
|
28
27
|
'ai-features.agentSettings.details': {
|
|
29
28
|
type: 'null',
|
|
@@ -14,15 +14,13 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { AI_CORE_PREFERENCES_TITLE
|
|
18
|
-
import { nls } from '@theia/core';
|
|
19
|
-
import { PreferenceSchema } from '@theia/core/lib/browser';
|
|
17
|
+
import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common';
|
|
18
|
+
import { nls, PreferenceSchema } from '@theia/core';
|
|
20
19
|
|
|
21
20
|
// We reuse the context key for the preference name
|
|
22
|
-
export const PREFERENCE_NAME_ENABLE_AI =
|
|
21
|
+
export const PREFERENCE_NAME_ENABLE_AI = 'ai-features.AiEnable.enableAI';
|
|
23
22
|
|
|
24
23
|
export const aiIdePreferenceSchema: PreferenceSchema = {
|
|
25
|
-
type: 'object',
|
|
26
24
|
properties: {
|
|
27
25
|
[PREFERENCE_NAME_ENABLE_AI]: {
|
|
28
26
|
title: AI_CORE_PREFERENCES_TITLE,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { PromptVariantSet } from '@theia/ai-core/lib/common';
|
|
12
12
|
import {
|
|
13
13
|
GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FILE_CONTENT_FUNCTION_ID, SEARCH_IN_WORKSPACE_FUNCTION_ID,
|
|
14
|
-
GET_FILE_DIAGNOSTICS_ID
|
|
14
|
+
GET_FILE_DIAGNOSTICS_ID, FIND_FILES_BY_PATTERN_FUNCTION_ID
|
|
15
15
|
} from './workspace-functions';
|
|
16
16
|
import { CONTEXT_FILES_VARIABLE_ID, TASK_CONTEXT_SUMMARY_VARIABLE_ID } from './context-variables';
|
|
17
17
|
import { UPDATE_CONTEXT_FILES_FUNCTION_ID } from './context-functions';
|
|
@@ -38,6 +38,7 @@ implement the change plan. If you refer to files, always mention the workspace-r
|
|
|
38
38
|
Use the following functions to interact with the workspace files if you require context:
|
|
39
39
|
- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**
|
|
40
40
|
- **~{${FILE_CONTENT_FUNCTION_ID}}**
|
|
41
|
+
- **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}** (find files by glob patterns like '**/*.ts')
|
|
41
42
|
- **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}**
|
|
42
43
|
|
|
43
44
|
If you cannot find good search terms, navigate the directory structure.
|
|
@@ -74,6 +75,7 @@ implement the change plan. If you refer to files, always mention the workspace-r
|
|
|
74
75
|
Use the following functions to interact with the workspace files as needed:
|
|
75
76
|
- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**: Lists files and directories in a specific directory.
|
|
76
77
|
- **~{${FILE_CONTENT_FUNCTION_ID}}**: Retrieves the content of a specific file.
|
|
78
|
+
- **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}**: Find files by glob patterns like '**/*.ts'.
|
|
77
79
|
|
|
78
80
|
### Workspace Navigation Guidelines
|
|
79
81
|
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
FILE_CONTENT_FUNCTION_ID,
|
|
17
17
|
GET_FILE_DIAGNOSTICS_ID,
|
|
18
18
|
SEARCH_IN_WORKSPACE_FUNCTION_ID,
|
|
19
|
+
FIND_FILES_BY_PATTERN_FUNCTION_ID,
|
|
19
20
|
LIST_TASKS_FUNCTION_ID,
|
|
20
21
|
RUN_TASK_FUNCTION_ID
|
|
21
22
|
} from './workspace-functions';
|
|
@@ -74,6 +75,7 @@ Never guess or hallucinate file content or structure. Use tools for all workspac
|
|
|
74
75
|
### Workspace Exploration
|
|
75
76
|
- ~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}} — list contents of a specific directory
|
|
76
77
|
- ~{${FILE_CONTENT_FUNCTION_ID}} — retrieve the content of a file
|
|
78
|
+
- ~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}} — find files matching glob patterns (e.g., '**/*.ts' for all TypeScript files)
|
|
77
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 \
|
|
78
80
|
search for files you already know the path for)
|
|
79
81
|
- ~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}} — bookmark important files for context
|
|
@@ -168,6 +170,7 @@ which will be reviewed and accepted by the user.
|
|
|
168
170
|
Use the following functions to interact with the workspace files if you require context:
|
|
169
171
|
- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**
|
|
170
172
|
- **~{${FILE_CONTENT_FUNCTION_ID}}**
|
|
173
|
+
- **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}** (find files by glob patterns like '**/*.ts')
|
|
171
174
|
- **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}**
|
|
172
175
|
|
|
173
176
|
If you cannot find good search terms, navigate the directory structure.
|
|
@@ -238,6 +241,7 @@ which will be reviewed and accepted by the user.
|
|
|
238
241
|
Use the following functions to interact with the workspace files if you require context:
|
|
239
242
|
- **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**
|
|
240
243
|
- **~{${FILE_CONTENT_FUNCTION_ID}}**
|
|
244
|
+
- **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}** (find files by glob patterns like '**/*.ts')
|
|
241
245
|
- **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}**
|
|
242
246
|
|
|
243
247
|
If you cannot find good search terms, navigate the directory structure.
|
|
@@ -18,6 +18,7 @@ export const GET_WORKSPACE_FILE_LIST_FUNCTION_ID = 'getWorkspaceFileList';
|
|
|
18
18
|
export const GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID = 'getWorkspaceDirectoryStructure';
|
|
19
19
|
export const GET_FILE_DIAGNOSTICS_ID = 'getFileDiagnostics';
|
|
20
20
|
export const SEARCH_IN_WORKSPACE_FUNCTION_ID = 'searchInWorkspace';
|
|
21
|
+
export const FIND_FILES_BY_PATTERN_FUNCTION_ID = 'findFilesByPattern';
|
|
21
22
|
export const LIST_TASKS_FUNCTION_ID = 'listTasks';
|
|
22
23
|
export const RUN_TASK_FUNCTION_ID = 'runTask';
|
|
23
24
|
export const LIST_LAUNCH_CONFIGURATIONS_FUNCTION_ID = 'listLaunchConfigurations';
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { nls } from '@theia/core';
|
|
18
|
-
import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution';
|
|
17
|
+
import { nls, PreferenceSchema } from '@theia/core';
|
|
19
18
|
|
|
20
19
|
export const CONSIDER_GITIGNORE_PREF = 'ai-features.workspaceFunctions.considerGitIgnore';
|
|
21
20
|
export const USER_EXCLUDE_PATTERN_PREF = 'ai-features.workspaceFunctions.userExcludes';
|
|
@@ -29,7 +28,6 @@ const CONFLICT_RESOLUTION_DESCRIPTION = 'When templates with the same ID (filena
|
|
|
29
28
|
(highest) > workspace directories > global directories (lowest).';
|
|
30
29
|
|
|
31
30
|
export const WorkspacePreferencesSchema: PreferenceSchema = {
|
|
32
|
-
type: 'object',
|
|
33
31
|
properties: {
|
|
34
32
|
[CONSIDER_GITIGNORE_PREF]: {
|
|
35
33
|
type: 'boolean',
|
|
@@ -14,11 +14,14 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { ConnectionHandler, RpcConnectionHandler } from '@theia/core';
|
|
17
|
+
import { ConnectionHandler, PreferenceContribution, RpcConnectionHandler } from '@theia/core';
|
|
18
18
|
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
19
19
|
import { BrowserAutomation, browserAutomationPath, type BrowserAutomationClient } from '../common/browser-automation-protocol';
|
|
20
20
|
import { BrowserAutomationImpl } from './app-tester-agent/browser-automation-impl';
|
|
21
21
|
import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module';
|
|
22
|
+
import { WorkspacePreferencesSchema } from '../common/workspace-preferences';
|
|
23
|
+
import { AiConfigurationPreferences } from '../common/ai-configuration-preferences';
|
|
24
|
+
import { aiIdePreferenceSchema } from '../common/ai-ide-preferences';
|
|
22
25
|
|
|
23
26
|
const browserAutomationModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => {
|
|
24
27
|
bind(BrowserAutomation).to(BrowserAutomationImpl).inSingletonScope();
|
|
@@ -33,6 +36,10 @@ const browserAutomationModule = ConnectionContainerModule.create(({ bind, bindBa
|
|
|
33
36
|
});
|
|
34
37
|
|
|
35
38
|
export default new ContainerModule(bind => {
|
|
39
|
+
bind(PreferenceContribution).toConstantValue({ schema: aiIdePreferenceSchema });
|
|
40
|
+
bind(PreferenceContribution).toConstantValue({ schema: WorkspacePreferencesSchema });
|
|
41
|
+
bind(PreferenceContribution).toConstantValue({ schema: AiConfigurationPreferences });
|
|
42
|
+
|
|
36
43
|
bind(ConnectionContainerModule).toConstantValue(browserAutomationModule);
|
|
37
44
|
|
|
38
45
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-configuration-preferences.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/ai-configuration-preferences.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAE/F;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,gBAyBxC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-configuration-preferences.js","sourceRoot":"","sources":["../../../src/browser/ai-configuration/ai-configuration-preferences.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,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,sCAAkC;AAGlC;;;;GAIG;AACU,QAAA,0BAA0B,GAAqB;IACxD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,mCAAmC,EAAE;YACjC,IAAI,EAAE,MAAM;YACZ,mBAAmB,EAAE,UAAG,CAAC,QAAQ,CAAC,gCAAgC,EAC9D,gKAAgK,EAChK,8BAA8B,CACjC;SACJ;QACD,qCAAqC,EAAE;YACnC,IAAI,EAAE,MAAM;YACZ,mBAAmB,EAAE,UAAG,CAAC,QAAQ,CAAC,0CAA0C,EACxE,0GAA0G,EAC1G,8BAA8B,CACjC;SACJ;QACD,oCAAoC,EAAE;YAClC,IAAI,EAAE,MAAM;YACZ,mBAAmB,EAAE,UAAG,CAAC,QAAQ,CAAC,0CAA0C,EACxE,0GAA0G,EAC1G,8BAA8B,CACjC;SACJ;KACJ;CACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-ide-preferences.d.ts","sourceRoot":"","sources":["../../src/browser/ai-ide-preferences.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"}
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-preferences.d.ts","sourceRoot":"","sources":["../../src/browser/workspace-preferences.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAE/F,eAAO,MAAM,uBAAuB,qDAAqD,CAAC;AAC1F,eAAO,MAAM,yBAAyB,gDAAgD,CAAC;AACvF,eAAO,MAAM,oCAAoC,oDAAoD,CAAC;AACtG,eAAO,MAAM,0CAA0C,6DAA6D,CAAC;AACrH,eAAO,MAAM,0CAA0C,mDAAmD,CAAC;AAC3G,eAAO,MAAM,oCAAoC,uDAAuD,CAAC;AACzG,eAAO,MAAM,mCAAmC,4DAA4D,CAAC;AAK7G,eAAO,MAAM,0BAA0B,EAAE,gBAmExC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-preferences.js","sourceRoot":"","sources":["../../src/browser/workspace-preferences.ts"],"names":[],"mappings":"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"}
|