@theia/ai-ide 1.66.0-next.73 → 1.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/lib/browser/ai-terminal-functions.d.ts +13 -0
  2. package/lib/browser/ai-terminal-functions.d.ts.map +1 -0
  3. package/lib/browser/ai-terminal-functions.js +114 -0
  4. package/lib/browser/ai-terminal-functions.js.map +1 -0
  5. package/lib/browser/frontend-module.d.ts.map +1 -1
  6. package/lib/browser/frontend-module.js +6 -0
  7. package/lib/browser/frontend-module.js.map +1 -1
  8. package/lib/browser/project-info-agent.d.ts +13 -0
  9. package/lib/browser/project-info-agent.d.ts.map +1 -0
  10. package/lib/browser/project-info-agent.js +45 -0
  11. package/lib/browser/project-info-agent.js.map +1 -0
  12. package/lib/browser/workspace-functions.js +1 -1
  13. package/lib/common/ai-ide-preferences.d.ts +1 -0
  14. package/lib/common/ai-ide-preferences.d.ts.map +1 -1
  15. package/lib/common/ai-ide-preferences.js +12 -1
  16. package/lib/common/ai-ide-preferences.js.map +1 -1
  17. package/lib/common/ai-terminal-functions.d.ts +2 -0
  18. package/lib/common/ai-terminal-functions.d.ts.map +1 -0
  19. package/lib/common/ai-terminal-functions.js +20 -0
  20. package/lib/common/ai-terminal-functions.js.map +1 -0
  21. package/lib/common/orchestrator-chat-agent.d.ts +16 -2
  22. package/lib/common/orchestrator-chat-agent.d.ts.map +1 -1
  23. package/lib/common/orchestrator-chat-agent.js +45 -5
  24. package/lib/common/orchestrator-chat-agent.js.map +1 -1
  25. package/lib/common/orchestrator-prompt-template.js +1 -1
  26. package/lib/common/project-info-prompt-template.d.ts +6 -0
  27. package/lib/common/project-info-prompt-template.d.ts.map +1 -0
  28. package/lib/common/project-info-prompt-template.js +145 -0
  29. package/lib/common/project-info-prompt-template.js.map +1 -0
  30. package/package.json +21 -21
  31. package/src/browser/ai-terminal-functions.ts +105 -0
  32. package/src/browser/frontend-module.ts +7 -0
  33. package/src/browser/project-info-agent.ts +42 -0
  34. package/src/browser/workspace-functions.ts +1 -1
  35. package/src/common/ai-ide-preferences.ts +12 -0
  36. package/src/common/ai-terminal-functions.ts +18 -0
  37. package/src/common/orchestrator-chat-agent.ts +59 -8
  38. package/src/common/orchestrator-prompt-template.ts +1 -1
  39. package/src/common/project-info-prompt-template.ts +163 -0
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.projectInfoSystemVariants = exports.projectInfoTemplateVariants = exports.PROJECT_INFO_TEMPLATE_PROMPT_ID = exports.PROJECT_INFO_SYSTEM_PROMPT_TEMPLATE_ID = void 0;
4
+ const workspace_functions_1 = require("./workspace-functions");
5
+ const context_variables_1 = require("./context-variables");
6
+ const context_functions_1 = require("./context-functions");
7
+ const file_changeset_function_ids_1 = require("./file-changeset-function-ids");
8
+ exports.PROJECT_INFO_SYSTEM_PROMPT_TEMPLATE_ID = 'project-info-system';
9
+ exports.PROJECT_INFO_TEMPLATE_PROMPT_ID = 'project-info-template';
10
+ exports.projectInfoTemplateVariants = {
11
+ id: exports.PROJECT_INFO_TEMPLATE_PROMPT_ID,
12
+ defaultVariant: {
13
+ id: 'project-info-template-default',
14
+ template: `## Project Info Template Structure
15
+
16
+ ### Architecture Overview
17
+ [Brief description of what the project does, Key architectural decisions, patterns, and structure.]
18
+
19
+ ### Key Technologies
20
+ [List of main technologies, frameworks, libraries]
21
+
22
+ ### Essential Development Patterns
23
+ Examples for key patterns (refer via relative file paths)
24
+
25
+ ### File Structure
26
+ [Important directories/packages and their contents]
27
+
28
+ ### Build & Development
29
+ [How to build and run the project.]
30
+
31
+ ### Testing
32
+ [What kind of tests exist, test organization and test patterns. Examples for different types of tests (as relative file paths)]
33
+
34
+ ### Coding Guidelines
35
+ [Coding standards, conventions, practices. Examples for key practices (as relative file paths), rules for imports, indentation]
36
+
37
+ ### Additional Notes
38
+ [Any other important information for agents to understand the project and write code for it. Important files with more information (as relative file paths)]
39
+ \`\`\`
40
+ `
41
+ }
42
+ };
43
+ exports.projectInfoSystemVariants = {
44
+ id: exports.PROJECT_INFO_SYSTEM_PROMPT_TEMPLATE_ID,
45
+ defaultVariant: {
46
+ id: 'project-info-system-default',
47
+ template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
48
+ Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
49
+ https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
50
+ # Instructions
51
+
52
+ You are the ProjectInfo agent, an AI assistant specialized in managing project information files. Your role is to help users create, update,
53
+ and maintain the \`.prompts/project-info.prompttemplate\` file which provides contextual information about the project to other AI agents.
54
+
55
+ ## Project Info Guidelines
56
+ The project info is an artifact that will be handed over to agents to understand the current workspace, project and codebase.
57
+ Do not include obvious instructions, generic information, generic development practices or things that can be very easily discovered.
58
+ Focus on non-obvious and project-specific facts as well as specific guidelines and patterns.
59
+ Try to keep the project info minimal and avoid duplicates.
60
+
61
+ ## Your Capabilities
62
+
63
+ ### Initially Create Project Info
64
+ For initial project info creation, start by determining the user's preferred working mode:
65
+
66
+ **Step 1: Define mode of working**
67
+ Ask the user about the preferred working mode:
68
+
69
+ 1. "Auto-exploration - Agent explores and creates an initial suggestion",
70
+ 2. "Manual - User provides all necessary input with your guidance"
71
+
72
+ IMPORTANT: Remember the chosen mode and stick to it until the user requests otherwise!
73
+
74
+ - In automatic mode, create an initial version of the project info yourself by exploring the workspace
75
+ - In manual mode, guide the user section by section and ask for additional information.
76
+ Whenever you ask a question to the user, offer the option that you answer the question for them.
77
+
78
+ **Step 2: Final tasks**
79
+ After completing all sections or if you feel the user is done, offer the user to do an automatic refinement:
80
+ "Would you like me to review and finalize the project information?",
81
+ - In this final refinement, particularly focus on relevance and potential duplications and the "Project Info Guidelines"
82
+ - Then, ask for final user review. Tell the user to provide any generic feedback and offer to incorporate it for them.
83
+ - Finally remind them to accept the final version in the change set
84
+
85
+ ### Complete Project Info
86
+ - If a project info is incomplete, offer the user to complete it
87
+
88
+ ### Update Project Info
89
+ - Modify existing project info based on user requirements
90
+ - Do not use a specific workflow for this
91
+
92
+ ## Workspace Analysis Guidelines
93
+
94
+ **Auto-Discovery File Patterns**
95
+ When auto-discovering project information or exploring the workspace structure, ALWAYS prioritize examining these file patterns that commonly contain agent instructions
96
+ and project documentation:
97
+ - .github/copilot-instructions.md
98
+ - AGENT.md
99
+ - AGENTS.md
100
+ - CLAUDE.md
101
+ - .cursorrules
102
+ - .windsurfrules
103
+ - .clinerules
104
+ - .cursor
105
+ - rules/**
106
+ - .windsurf/rules/**
107
+ - .clinerules/**
108
+ - README.md
109
+ - .md files in the root level if they contain documentation
110
+
111
+ Use the **~{${workspace_functions_1.FIND_FILES_BY_PATTERN_FUNCTION_ID}}** function with these patterns to discover relevant configuration and documentation files.
112
+
113
+ ## Context Retrieval
114
+ Use the following functions to interact with the workspace files when needed:
115
+ - **~{${workspace_functions_1.GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**: List files and directories
116
+ - **~{${workspace_functions_1.FILE_CONTENT_FUNCTION_ID}}**: Get content of specific files
117
+ - **~{${workspace_functions_1.FIND_FILES_BY_PATTERN_FUNCTION_ID}}**: Find files by glob patterns like '**/*.json'
118
+ - **~{${workspace_functions_1.SEARCH_IN_WORKSPACE_FUNCTION_ID}}**: Search file contents
119
+
120
+ Navigate step-by-step and confirm paths. Use **~{${context_functions_1.UPDATE_CONTEXT_FILES_FUNCTION_ID}}** to remember important files for later reference.
121
+
122
+ ## File Modification - SUGGEST ONLY
123
+ Use these functions liberally to suggest file changes. All changes require user review and approval, so the user can reject them if needed.
124
+
125
+ - **~{${file_changeset_function_ids_1.SUGGEST_FILE_CONTENT_ID}}**: Propose complete file content (for creating new templates or complete rewrites)
126
+ - **~{${file_changeset_function_ids_1.SUGGEST_FILE_REPLACEMENTS_ID}}**: Propose targeted replacements of specific text sections
127
+ - **~{${file_changeset_function_ids_1.GET_PROPOSED_CHANGES_ID}}**: View current proposed changes before making additional ones
128
+ - **~{${file_changeset_function_ids_1.CLEAR_FILE_CHANGES_ID}}**: Clear all pending changes for a file to start fresh
129
+
130
+ {{prompt:${exports.PROJECT_INFO_TEMPLATE_PROMPT_ID}}}
131
+
132
+ ## Additional Context
133
+ {{${context_variables_1.CONTEXT_FILES_VARIABLE_ID}}}
134
+
135
+ ## Workflow Guidelines
136
+
137
+ When creating project info for the first time:
138
+ 1. **Always start by asking about the user's preferred mode** (auto-exploration or manual) and stick to it
139
+ 2. **After initial suggestions or provided content**: Always ask for refinement and additional information
140
+
141
+ Remember: Proactively help users maintain accurate project information for better AI assistance.
142
+ `
143
+ }
144
+ };
145
+ //# sourceMappingURL=project-info-prompt-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-info-prompt-template.js","sourceRoot":"","sources":["../../src/common/project-info-prompt-template.ts"],"names":[],"mappings":";;;AAWA,+DAG+B;AAC/B,2DAAgE;AAChE,2DAAuE;AACvE,+EAKuC;AAE1B,QAAA,sCAAsC,GAAG,qBAAqB,CAAC;AAC/D,QAAA,+BAA+B,GAAG,uBAAuB,CAAC;AAE1D,QAAA,2BAA2B,GAAqB;IACzD,EAAE,EAAE,uCAA+B;IACnC,cAAc,EAAE;QACZ,EAAE,EAAE,+BAA+B;QACnC,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BjB;KACI;CACJ,CAAC;AAEW,QAAA,yBAAyB,GAAqB;IACvD,EAAE,EAAE,8CAAsC;IAC1C,cAAc,EAAE;QACZ,EAAE,EAAE,6BAA6B;QACjC,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgEJ,uDAAiC;;;;QAIvC,yDAAmC;QACnC,8CAAwB;QACxB,uDAAiC;QACjC,qDAA+B;;mDAEY,oDAAgC;;;;;QAK3E,qDAAuB;QACvB,0DAA4B;QAC5B,qDAAuB;QACvB,mDAAqB;;WAElB,uCAA+B;;;IAGtC,6CAAyB;;;;;;;;;CAS5B;KACI;CACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/ai-ide",
3
- "version": "1.66.0-next.73+6d82794da",
3
+ "version": "1.66.0",
4
4
  "description": "AI IDE Agents Extension",
5
5
  "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0",
6
6
  "repository": {
@@ -15,23 +15,23 @@
15
15
  "theia-extension"
16
16
  ],
17
17
  "dependencies": {
18
- "@theia/ai-chat": "1.66.0-next.73+6d82794da",
19
- "@theia/ai-chat-ui": "1.66.0-next.73+6d82794da",
20
- "@theia/ai-core": "1.66.0-next.73+6d82794da",
21
- "@theia/ai-mcp": "1.66.0-next.73+6d82794da",
22
- "@theia/core": "1.66.0-next.73+6d82794da",
23
- "@theia/debug": "1.66.0-next.73+6d82794da",
24
- "@theia/editor": "1.66.0-next.73+6d82794da",
25
- "@theia/filesystem": "1.66.0-next.73+6d82794da",
26
- "@theia/markers": "1.66.0-next.73+6d82794da",
27
- "@theia/monaco": "1.66.0-next.73+6d82794da",
28
- "@theia/navigator": "1.66.0-next.73+6d82794da",
29
- "@theia/preferences": "1.66.0-next.73+6d82794da",
30
- "@theia/scm": "1.66.0-next.73+6d82794da",
31
- "@theia/search-in-workspace": "1.66.0-next.73+6d82794da",
32
- "@theia/task": "1.66.0-next.73+6d82794da",
33
- "@theia/terminal": "1.66.0-next.73+6d82794da",
34
- "@theia/workspace": "1.66.0-next.73+6d82794da",
18
+ "@theia/ai-chat": "1.66.0",
19
+ "@theia/ai-chat-ui": "1.66.0",
20
+ "@theia/ai-core": "1.66.0",
21
+ "@theia/ai-mcp": "1.66.0",
22
+ "@theia/core": "1.66.0",
23
+ "@theia/debug": "1.66.0",
24
+ "@theia/editor": "1.66.0",
25
+ "@theia/filesystem": "1.66.0",
26
+ "@theia/markers": "1.66.0",
27
+ "@theia/monaco": "1.66.0",
28
+ "@theia/navigator": "1.66.0",
29
+ "@theia/preferences": "1.66.0",
30
+ "@theia/scm": "1.66.0",
31
+ "@theia/search-in-workspace": "1.66.0",
32
+ "@theia/task": "1.66.0",
33
+ "@theia/terminal": "1.66.0",
34
+ "@theia/workspace": "1.66.0",
35
35
  "date-fns": "^4.1.0",
36
36
  "ignore": "^6.0.0",
37
37
  "js-yaml": "^4.1.0",
@@ -43,8 +43,8 @@
43
43
  "access": "public"
44
44
  },
45
45
  "devDependencies": {
46
- "@theia/cli": "1.66.0-next.73+6d82794da",
47
- "@theia/test": "1.66.0-next.73+6d82794da"
46
+ "@theia/cli": "1.66.0",
47
+ "@theia/test": "1.66.0"
48
48
  },
49
49
  "theiaExtensions": [
50
50
  {
@@ -68,5 +68,5 @@
68
68
  "nyc": {
69
69
  "extends": "../../configs/nyc.json"
70
70
  },
71
- "gitHead": "6d82794da24e16f75d70eaac3a4178a29e822e82"
71
+ "gitHead": "dc03613006449e67b722a8c2e75c9a62585d5da8"
72
72
  }
@@ -0,0 +1,105 @@
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
+ import { MutableChatRequestModel } from '@theia/ai-chat';
18
+ import { ToolProvider, ToolRequest } from '@theia/ai-core';
19
+ import { inject, injectable } from '@theia/core/shared/inversify';
20
+ import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
21
+ import { SUGGEST_TERMINAL_COMMAND_ID } from '../common/ai-terminal-functions';
22
+ import { WorkspaceService } from '@theia/workspace/lib/browser';
23
+ import { TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget';
24
+ import { waitForEvent } from '@theia/core/lib/common/promise-util';
25
+ import { ApplicationShell } from '@theia/core/lib/browser';
26
+
27
+ @injectable()
28
+ export class SuggestTerminalCommand implements ToolProvider {
29
+ static ID = SUGGEST_TERMINAL_COMMAND_ID;
30
+
31
+ @inject(TerminalService)
32
+ protected readonly terminalService: TerminalService;
33
+
34
+ @inject(WorkspaceService)
35
+ protected readonly workspaceService: WorkspaceService;
36
+
37
+ @inject(ApplicationShell)
38
+ protected readonly applicationShell: ApplicationShell;
39
+
40
+ getTool(): ToolRequest {
41
+ return {
42
+ id: SuggestTerminalCommand.ID,
43
+ name: SuggestTerminalCommand.ID,
44
+ description: `Proposes executing a command in the terminal.\n
45
+ This tool will automatically write the command into the terminal buffer.\n
46
+ Execution of the command is up to the user.`,
47
+ parameters: {
48
+ type: 'object',
49
+ properties: {
50
+ command: {
51
+ type: 'string',
52
+ description: `The content of the command to write to the terminal buffer.\n
53
+ ALWAYS provide the COMPLETE intended content of the command, without any truncation or omissions.\n
54
+ You MUST include ALL parts of the command.`
55
+ }
56
+ },
57
+ required: ['command']
58
+ },
59
+ handler: async (args: string, ctx: MutableChatRequestModel): Promise<string> => {
60
+ if (ctx?.response?.cancellationToken?.isCancellationRequested) {
61
+ return JSON.stringify({ error: 'Operation cancelled by user' });
62
+ }
63
+ // Ensure that there is a workspace
64
+ let activeTerminal: TerminalWidget | undefined = this.terminalService.lastUsedTerminal;
65
+ if (!activeTerminal || activeTerminal.isDisposed) {
66
+ try {
67
+ activeTerminal = await this.terminalService.newTerminal({});
68
+ this.terminalService.open(activeTerminal, { mode: 'activate' });
69
+ await activeTerminal.start();
70
+ // Wait until the terminal prompt is emitted
71
+ await waitForEvent(activeTerminal.onOutput, 3000);
72
+ } catch (error) {
73
+ return JSON.stringify({ error: `Error executing tool 'suggestTerminalCommand': ${error}` });
74
+ }
75
+ } else {
76
+ this.terminalService.open(activeTerminal, { mode: 'activate' });
77
+ }
78
+ let command: string;
79
+ try {
80
+ const { command: parsedCommand } = JSON.parse(args);
81
+ command = parsedCommand;
82
+ } catch (error) {
83
+ return JSON.stringify({ error: `Error parsing arguments for tool 'suggestTerminalCommand': ${error}` });
84
+ }
85
+ if (!this.isValidCommand(command)) {
86
+ return JSON.stringify({ error: 'Error validating command generated by \'suggestTerminalCommand\'' });
87
+ };
88
+ // Clear the current input line by sending Ctrl+A (move to start) and Ctrl+K (delete to end)
89
+ activeTerminal.sendText('\x01\x0b');
90
+ activeTerminal.sendText(command);
91
+ return `Proposed executing the terminal command ${command}. The user will review and potentially execute the command.`;
92
+ }
93
+ };
94
+ }
95
+
96
+ protected isValidCommand(command: string): boolean {
97
+ // Command should not be empty and should not contain control characters
98
+ const CONTROL_CHAR_REGEX = /[\u0000-\u001F\u007F]/; // ASCII control range
99
+ if (!command || CONTROL_CHAR_REGEX.test(command)) {
100
+ return false;
101
+ }
102
+ return true;
103
+ }
104
+ }
105
+
@@ -94,6 +94,8 @@ import { AIActivationService } from '@theia/ai-core/lib/browser';
94
94
  import { AIIdeActivationServiceImpl } from './ai-ide-activation-service';
95
95
  import { AiConfigurationPreferences } from '../common/ai-configuration-preferences';
96
96
  import { TaskContextAgent } from './task-context-agent';
97
+ import { ProjectInfoAgent } from './project-info-agent';
98
+ import { SuggestTerminalCommand } from './ai-terminal-functions';
97
99
 
98
100
  export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
99
101
  bind(PreferenceContribution).toConstantValue({ schema: aiIdePreferenceSchema });
@@ -113,6 +115,9 @@ export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
113
115
 
114
116
  bind(TaskContextAgent).toSelf().inSingletonScope();
115
117
  bind(Agent).toService(TaskContextAgent);
118
+ bind(ProjectInfoAgent).toSelf().inSingletonScope();
119
+ bind(Agent).toService(ProjectInfoAgent);
120
+ bind(ChatAgent).toService(ProjectInfoAgent);
116
121
 
117
122
  bind(OrchestratorChatAgent).toSelf().inSingletonScope();
118
123
  bind(Agent).toService(OrchestratorChatAgent);
@@ -263,4 +268,6 @@ export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
263
268
  createWidget: () => ctx.container.get(AIPromptFragmentsConfigurationWidget)
264
269
  }))
265
270
  .inSingletonScope();
271
+
272
+ bindToolProvider(SuggestTerminalCommand, bind);
266
273
  });
@@ -0,0 +1,42 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 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
+ import { AbstractStreamParsingChatAgent } from '@theia/ai-chat';
17
+ import { LanguageModelRequirement } from '@theia/ai-core';
18
+ import { injectable } from '@theia/core/shared/inversify';
19
+ import { projectInfoSystemVariants, projectInfoTemplateVariants } from '../common/project-info-prompt-template';
20
+ import { nls } from '@theia/core';
21
+
22
+ @injectable()
23
+ export class ProjectInfoAgent extends AbstractStreamParsingChatAgent {
24
+
25
+ name = 'ProjectInfo';
26
+ id = 'ProjectInfo';
27
+ languageModelRequirements: LanguageModelRequirement[] = [{
28
+ purpose: 'chat',
29
+ identifier: 'default/code',
30
+ }];
31
+ protected defaultLanguageModelPurpose: string = 'chat';
32
+
33
+ override description = nls.localize('theia/ai/workspace/projectInfoAgent/description',
34
+ 'An AI assistant for managing project information templates. This agent helps create, update, and review the .prompts/project-info.prompttemplate file which provides ' +
35
+ 'context about your project to other AI agents. It can analyze your workspace to suggest project information or update existing templates based on your requirements.');
36
+
37
+ override tags: string[] = [...this.tags, 'Alpha'];
38
+
39
+ override prompts = [projectInfoSystemVariants, projectInfoTemplateVariants];
40
+ protected override systemPromptId: string | undefined = projectInfoSystemVariants.id;
41
+
42
+ }
@@ -145,7 +145,7 @@ export class GetWorkspaceDirectoryStructure implements ToolProvider {
145
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
- properties: {}
148
+ properties: {},
149
149
  },
150
150
  handler: (_: string, ctx: MutableChatRequestModel) => {
151
151
  const cancellationToken = ctx.response.cancellationToken;
@@ -19,6 +19,7 @@ import { nls, PreferenceSchema } from '@theia/core';
19
19
 
20
20
  // We reuse the context key for the preference name
21
21
  export const PREFERENCE_NAME_ENABLE_AI = 'ai-features.AiEnable.enableAI';
22
+ export const PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST = 'ai-features.orchestrator.excludedAgents';
22
23
 
23
24
  export const aiIdePreferenceSchema: PreferenceSchema = {
24
25
  properties: {
@@ -37,6 +38,17 @@ export const aiIdePreferenceSchema: PreferenceSchema = {
37
38
  LLM provider below. Also see [the documentation](https://theia-ide.org/docs/user_ai/)**.'),
38
39
  type: 'boolean',
39
40
  default: false,
41
+ },
42
+ [PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST]: {
43
+ title: AI_CORE_PREFERENCES_TITLE,
44
+ markdownDescription: nls.localize('theia/ai/ide/orchestrator/excludedAgents/mdDescription',
45
+ 'List of agent IDs that the orchestrator is not allowed to delegate to. ' +
46
+ 'These agents will not be visible to the orchestrator when selecting an agent to handle a request.'),
47
+ type: 'array',
48
+ items: {
49
+ type: 'string'
50
+ },
51
+ default: ['ClaudeCode'],
40
52
  }
41
53
  }
42
54
  };
@@ -0,0 +1,18 @@
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_TERMINAL_COMMAND_ID = 'suggestTerminalCommand';
18
+
@@ -14,14 +14,15 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { getJsonOfText, getTextOfResponse, LanguageModel, LanguageModelMessage, LanguageModelRequirement, LanguageModelResponse } from '@theia/ai-core';
17
+ import { AIVariableContext, getJsonOfText, getTextOfResponse, LanguageModel, LanguageModelMessage, LanguageModelRequirement, LanguageModelResponse } from '@theia/ai-core';
18
18
  import { inject, injectable } from '@theia/core/shared/inversify';
19
19
  import { ChatAgentService } from '@theia/ai-chat/lib/common/chat-agent-service';
20
20
  import { ChatToolRequest } from '@theia/ai-chat/lib/common/chat-tool-request-service';
21
- import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents';
21
+ import { AbstractStreamParsingChatAgent, SystemMessageDescription } from '@theia/ai-chat/lib/common/chat-agents';
22
22
  import { MutableChatRequestModel, InformationalChatResponseContentImpl } from '@theia/ai-chat/lib/common/chat-model';
23
- import { generateUuid, nls } from '@theia/core';
23
+ import { generateUuid, nls, PreferenceService } from '@theia/core';
24
24
  import { orchestratorTemplate } from './orchestrator-prompt-template';
25
+ import { PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST } from './ai-ide-preferences';
25
26
 
26
27
  export const OrchestratorChatAgentId = 'Orchestrator';
27
28
  const OrchestratorRequestIdKey = 'orchestratorRequestIdKey';
@@ -41,6 +42,12 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
41
42
  'This agent analyzes the user request against the description of all available chat agents and selects the best fitting agent to answer the request \
42
43
  (by using AI).The user\'s request will be directly delegated to the selected agent without further confirmation.');
43
44
  override iconClass: string = 'codicon codicon-symbol-boolean';
45
+ override agentSpecificVariables = [{
46
+ name: 'availableChatAgents',
47
+ description: nls.localize('theia/ai/chat/orchestrator/vars/availableChatAgents/description',
48
+ 'The list of chat agents that the orchestrator can delegate to, excluding agents specified in the exclusion list preference.'),
49
+ usedInPrompt: true
50
+ }];
44
51
 
45
52
  protected override systemPromptId: string = orchestratorTemplate.id;
46
53
 
@@ -49,6 +56,41 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
49
56
  @inject(ChatAgentService)
50
57
  protected chatAgentService: ChatAgentService;
51
58
 
59
+ @inject(PreferenceService)
60
+ protected preferenceService: PreferenceService;
61
+
62
+ protected override async getSystemMessageDescription(context: AIVariableContext): Promise<SystemMessageDescription | undefined> {
63
+ if (this.systemPromptId === undefined) {
64
+ return undefined;
65
+ }
66
+
67
+ const excludedAgents = this.preferenceService.get<string[]>(PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST, ['ClaudeCode']);
68
+ const availableAgents = this.getAvailableAgentsForDelegation(excludedAgents);
69
+ const availableChatAgentsValue = availableAgents.map(agent => prettyPrintAgentInMd(agent)).join('\n');
70
+
71
+ const resolvedPrompt = await this.promptService.getResolvedPromptFragment(
72
+ this.systemPromptId,
73
+ { availableChatAgents: availableChatAgentsValue },
74
+ context
75
+ );
76
+
77
+ return resolvedPrompt ? SystemMessageDescription.fromResolvedPromptFragment(resolvedPrompt) : undefined;
78
+ }
79
+
80
+ protected getAvailableAgentsForDelegation(excludedAgents: string[]): Array<{ id: string; name: string; description: string }> {
81
+ return this.chatAgentService.getAgents()
82
+ .filter(agent => agent.id !== this.id && !excludedAgents.includes(agent.id))
83
+ .map(agent => ({
84
+ id: agent.id,
85
+ name: agent.name,
86
+ description: agent.description
87
+ }));
88
+ }
89
+
90
+ protected getExcludedAgentIds(): string[] {
91
+ return this.preferenceService.get<string[]>(PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST, ['ClaudeCode']);
92
+ }
93
+
52
94
  override async invoke(request: MutableChatRequestModel): Promise<void> {
53
95
  request.response.addProgressMessage({ content: nls.localize('theia/ai/ide/orchestrator/progressMessage', 'Determining the most appropriate agent'), status: 'inProgress' });
54
96
  // We use a dedicated id for the orchestrator request
@@ -88,11 +130,12 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
88
130
  const responseText = await getTextOfResponse(response);
89
131
 
90
132
  let agentIds: string[] = [];
133
+ const excludedAgents = this.getExcludedAgentIds();
91
134
 
92
135
  try {
93
136
  const jsonResponse = await getJsonOfText(responseText);
94
137
  if (Array.isArray(jsonResponse)) {
95
- agentIds = jsonResponse.filter((id: string) => id !== this.id);
138
+ agentIds = jsonResponse.filter((id: string) => id !== this.id && !excludedAgents.includes(id));
96
139
  }
97
140
  } catch (error: unknown) {
98
141
  // The llm sometimes does not return a parseable result
@@ -107,10 +150,11 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
107
150
  agentIds = [this.fallBackChatAgentId];
108
151
  }
109
152
 
110
- // check if selected (or fallback) agent exists
111
- if (!this.chatAgentService.getAgent(agentIds[0])) {
112
- this.logger.error(`Chat agent ${agentIds[0]} not found. Falling back to first registered agent.`);
113
- const firstRegisteredAgent = this.chatAgentService.getAgents().filter(a => a.id !== this.id)[0]?.id;
153
+ // check if selected (or fallback) agent exists and is not excluded
154
+ if (!this.chatAgentService.getAgent(agentIds[0]) || excludedAgents.includes(agentIds[0])) {
155
+ this.logger.error(`Chat agent ${agentIds[0]} not found or excluded. Falling back to first available agent.`);
156
+ const firstRegisteredAgent = this.chatAgentService.getAgents()
157
+ .filter(a => a.id !== this.id && !excludedAgents.includes(a.id))[0]?.id;
114
158
  if (firstRegisteredAgent) {
115
159
  agentIds = [firstRegisteredAgent];
116
160
  } else {
@@ -142,3 +186,10 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
142
186
  await agent.invoke(originalRequest);
143
187
  }
144
188
  }
189
+
190
+ function prettyPrintAgentInMd(agent: { id: string; name: string; description: string }): string {
191
+ return `- ${agent.id}
192
+ - *ID*: ${agent.id}
193
+ - *Name*: ${agent.name}
194
+ - *Description*: ${agent.description.replace(/\n/g, ' ')}`;
195
+ }
@@ -48,6 +48,6 @@ You must only use the \`id\` attribute of the agent, never the name.
48
48
 
49
49
  ## List of Currently Available Chat Agents
50
50
 
51
- {{chatAgents}}
51
+ {{availableChatAgents}}
52
52
  `}
53
53
  };