@theia/ai-ide 1.66.0-next.32 → 1.66.0-next.44

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.
@@ -1 +1 @@
1
- {"version":3,"file":"frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AA0E/D,wBA0JG"}
1
+ {"version":3,"file":"frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AA4E/D,wBAiKG"}
@@ -32,6 +32,7 @@ const file_changeset_functions_1 = require("./file-changeset-functions");
32
32
  const orchestrator_chat_agent_1 = require("../common/orchestrator-chat-agent");
33
33
  const universal_chat_agent_1 = require("../common/universal-chat-agent");
34
34
  const app_tester_chat_agent_1 = require("./app-tester-chat-agent");
35
+ const github_chat_agent_1 = require("./github-chat-agent");
35
36
  const command_chat_agents_1 = require("../common/command-chat-agents");
36
37
  const context_functions_1 = require("./context-functions");
37
38
  const agent_configuration_widget_1 = require("./ai-configuration/agent-configuration-widget");
@@ -48,6 +49,7 @@ const chat_tree_view_1 = require("@theia/ai-chat-ui/lib/browser/chat-tree-view")
48
49
  const ide_chat_welcome_message_provider_1 = require("./ide-chat-welcome-message-provider");
49
50
  const token_usage_configuration_widget_1 = require("./ai-configuration/token-usage-configuration-widget");
50
51
  const task_background_summary_variable_1 = require("./task-background-summary-variable");
52
+ const github_repo_variable_contribution_1 = require("./github-repo-variable-contribution");
51
53
  const task_context_file_storage_service_1 = require("./task-context-file-storage-service");
52
54
  const task_context_service_1 = require("@theia/ai-chat/lib/browser/task-context-service");
53
55
  const core_1 = require("@theia/core");
@@ -83,6 +85,9 @@ exports.default = new inversify_1.ContainerModule((bind, _unbind, _isBound, rebi
83
85
  bind(app_tester_chat_agent_1.AppTesterChatAgent).toSelf().inSingletonScope();
84
86
  bind(common_2.Agent).toService(app_tester_chat_agent_1.AppTesterChatAgent);
85
87
  bind(common_1.ChatAgent).toService(app_tester_chat_agent_1.AppTesterChatAgent);
88
+ bind(github_chat_agent_1.GitHubChatAgent).toSelf().inSingletonScope();
89
+ bind(common_2.Agent).toService(github_chat_agent_1.GitHubChatAgent);
90
+ bind(common_1.ChatAgent).toService(github_chat_agent_1.GitHubChatAgent);
86
91
  bind(browser_automation_protocol_1.BrowserAutomation).toDynamicValue(ctx => {
87
92
  const provider = ctx.container.get(browser_1.RemoteConnectionProvider);
88
93
  return provider.createProxy(browser_automation_protocol_1.browserAutomationPath);
@@ -180,6 +185,8 @@ exports.default = new inversify_1.ContainerModule((bind, _unbind, _isBound, rebi
180
185
  .inSingletonScope();
181
186
  bind(task_background_summary_variable_1.TaskContextSummaryVariableContribution).toSelf().inSingletonScope();
182
187
  bind(common_2.AIVariableContribution).toService(task_background_summary_variable_1.TaskContextSummaryVariableContribution);
188
+ bind(github_repo_variable_contribution_1.GitHubRepoVariableContribution).toSelf().inSingletonScope();
189
+ bind(common_2.AIVariableContribution).toService(github_repo_variable_contribution_1.GitHubRepoVariableContribution);
183
190
  bind(task_context_file_storage_service_1.TaskContextFileStorageService).toSelf().inSingletonScope();
184
191
  rebind(task_context_service_1.TaskContextStorageService).toService(task_context_file_storage_service_1.TaskContextFileStorageService);
185
192
  bind(core_1.CommandContribution).to(summarize_session_command_contribution_1.SummarizeSessionCommandContribution);
@@ -1 +1 @@
1
- {"version":3,"file":"frontend-module.js","sourceRoot":"","sources":["../../src/browser/frontend-module.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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EAAE,CAAC;IAC/C,IAAI,CAAC,uBAAa,CAAC;SACd,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpB,EAAE,EAAE,kEAA+B,CAAC,EAAE;QACtC,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,kEAA+B,CAAC;KACzE,CAAC,CAAC;SACF,gBAAgB,EAAE,CAAC;IAExB,IAAI,CAAC,yEAAsC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACzE,IAAI,CAAC,+BAAsB,CAAC,CAAC,SAAS,CAAC,yEAAsC,CAAC,CAAC;IAE/E,IAAI,CAAC,kEAA8B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACjE,IAAI,CAAC,+BAAsB,CAAC,CAAC,SAAS,CAAC,kEAA8B,CAAC,CAAC;IACvE,IAAI,CAAC,iEAA6B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAChE,MAAM,CAAC,gDAAyB,CAAC,CAAC,SAAS,CAAC,iEAA6B,CAAC,CAAC;IAE3E,IAAI,CAAC,0BAAmB,CAAC,CAAC,EAAE,CAAC,4EAAmC,CAAC,CAAC;IAClE,IAAI,CAAC,4EAAoC,CAAC,CAAC,MAAM,EAAE,CAAC;IACpD,IAAI,CAAC,uBAAa,CAAC;SACd,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpB,EAAE,EAAE,4EAAoC,CAAC,EAAE;QAC3C,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,4EAAoC,CAAC;KAC9E,CAAC,CAAC;SACF,gBAAgB,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents';
2
+ import { MutableChatRequestModel } from '@theia/ai-chat/lib/common/chat-model';
3
+ import { LanguageModelRequirement } from '@theia/ai-core/lib/common';
4
+ import { MCPFrontendService, MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager';
5
+ import { CommandService } from '@theia/core';
6
+ import { PreferenceService } from '@theia/core/lib/common';
7
+ import { EditorManager } from '@theia/editor/lib/browser';
8
+ import { FileService } from '@theia/filesystem/lib/browser/file-service';
9
+ export declare const GitHubChatAgentId = "GitHub";
10
+ export declare class GitHubChatAgent extends AbstractStreamParsingChatAgent {
11
+ protected readonly mcpService: MCPFrontendService;
12
+ protected readonly preferenceService: PreferenceService;
13
+ protected readonly commandService: CommandService;
14
+ protected readonly editorManager: EditorManager;
15
+ protected readonly fileService: FileService;
16
+ id: string;
17
+ name: string;
18
+ languageModelRequirements: LanguageModelRequirement[];
19
+ protected defaultLanguageModelPurpose: string;
20
+ description: string;
21
+ iconClass: string;
22
+ protected systemPromptId: string;
23
+ prompts: {
24
+ id: string;
25
+ defaultVariant: import("@theia/ai-core/lib/common").BasePromptFragment;
26
+ variants: never[];
27
+ }[];
28
+ /**
29
+ * Override invoke to check if the GitHub MCP server is configured and running,
30
+ * and if not, offer to configure or start it.
31
+ */
32
+ invoke(request: MutableChatRequestModel): Promise<void>;
33
+ protected requiresConfiguration(): Promise<boolean>;
34
+ protected requiresStartingServer(): Promise<boolean>;
35
+ protected startServer(): Promise<void>;
36
+ protected offerConfiguration(): Promise<void>;
37
+ /**
38
+ * Opens the user preferences JSON file and attempts to focus on the GitHub server configuration.
39
+ */
40
+ protected openAndFocusOnGitHubConfig(serverName: string): Promise<void>;
41
+ /**
42
+ * Starts the GitHub MCP server if it doesn't exist or isn't running.
43
+ *
44
+ * @returns A promise that resolves when the server is started
45
+ */
46
+ ensureServerStarted(server: MCPServerDescription): Promise<void>;
47
+ }
48
+ //# sourceMappingURL=github-chat-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-chat-agent.d.ts","sourceRoot":"","sources":["../../src/browser/github-chat-agent.ts"],"names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AAO,CAAC;cAK1C,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;cAI5B,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAanD;;OAEG;cACa,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6C7E;;;;OAIG;IACG,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBzE"}
@@ -0,0 +1,220 @@
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
+ exports.GitHubChatAgent = exports.GitHubChatAgentId = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const chat_agents_1 = require("@theia/ai-chat/lib/common/chat-agents");
21
+ const chat_model_1 = require("@theia/ai-chat/lib/common/chat-model");
22
+ const mcp_server_manager_1 = require("@theia/ai-mcp/lib/common/mcp-server-manager");
23
+ const core_1 = require("@theia/core");
24
+ const inversify_1 = require("@theia/core/shared/inversify");
25
+ const mcp_preferences_1 = require("@theia/ai-mcp/lib/common/mcp-preferences");
26
+ const common_1 = require("@theia/core/lib/common");
27
+ const preference_types_1 = require("@theia/preferences/lib/browser/util/preference-types");
28
+ const browser_1 = require("@theia/editor/lib/browser");
29
+ const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
30
+ const github_prompt_template_1 = require("./github-prompt-template");
31
+ exports.GitHubChatAgentId = 'GitHub';
32
+ let GitHubChatAgent = class GitHubChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.id = exports.GitHubChatAgentId;
36
+ this.name = exports.GitHubChatAgentId;
37
+ this.languageModelRequirements = [{
38
+ purpose: 'chat',
39
+ identifier: 'default/code',
40
+ }];
41
+ this.defaultLanguageModelPurpose = 'chat';
42
+ this.description = core_1.nls.localize('theia/ai/chat/github/description', 'This agent helps you interact with GitHub repositories, issues, pull requests, and other GitHub '
43
+ + 'features through the GitHub MCP server. '
44
+ + 'It can help you manage your repositories, create issues, handle pull requests, and perform various GitHub operations.');
45
+ this.iconClass = 'codicon codicon-github';
46
+ this.systemPromptId = 'github-system';
47
+ this.prompts = [{ id: 'github-system', defaultVariant: github_prompt_template_1.githubTemplate, variants: [] }];
48
+ }
49
+ /**
50
+ * Override invoke to check if the GitHub MCP server is configured and running,
51
+ * and if not, offer to configure or start it.
52
+ */
53
+ async invoke(request) {
54
+ try {
55
+ if (await this.requiresConfiguration()) {
56
+ // Ask the user if they want to configure the GitHub server
57
+ request.response.response.addContent(new chat_model_1.QuestionResponseContentImpl('The GitHub MCP server is not configured. Would you like to configure it now? '
58
+ + 'This will open the settings.json file where you can add your GitHub access token.', [
59
+ { text: 'Yes, configure GitHub server', value: 'configure' },
60
+ { text: 'No, cancel', value: 'cancel' }
61
+ ], request, async (selectedOption) => {
62
+ if (selectedOption.value === 'configure') {
63
+ await this.offerConfiguration();
64
+ request.response.response.addContent(new chat_model_1.MarkdownChatResponseContentImpl('Settings file opened. Please add your GitHub Personal Access Token to the `serverAuthToken` property in the GitHub server configuration, then '
65
+ + ' save and try again.\n\n' +
66
+ 'You can create a Personal Access Token at: https://github.com/settings/tokens'));
67
+ request.response.complete();
68
+ }
69
+ else {
70
+ request.response.response.addContent(new chat_model_1.MarkdownChatResponseContentImpl('GitHub server configuration cancelled.'
71
+ + ' Please configure the GitHub MCP server to use this agent.'));
72
+ request.response.complete();
73
+ }
74
+ }));
75
+ request.response.waitForInput();
76
+ return;
77
+ }
78
+ if (await this.requiresStartingServer()) {
79
+ // Ask the user if they want to start the server
80
+ request.response.response.addContent(new chat_model_1.QuestionResponseContentImpl('The GitHub MCP server is configured but not running. Would you like to start it now?', [
81
+ { text: 'Yes, start the server', value: 'yes' },
82
+ { text: 'No, cancel', value: 'no' }
83
+ ], request, async (selectedOption) => {
84
+ if (selectedOption.value === 'yes') {
85
+ const progress = request.response.addProgressMessage({ content: 'Starting GitHub MCP server.', show: 'whileIncomplete' });
86
+ try {
87
+ await this.startServer();
88
+ request.response.updateProgressMessage({ ...progress, show: 'whileIncomplete', status: 'completed' });
89
+ await super.invoke(request);
90
+ }
91
+ catch (error) {
92
+ request.response.response.addContent(new chat_model_1.ErrorChatResponseContentImpl(new Error('Failed to start GitHub MCP server: ' + (error instanceof Error ? error.message : String(error)))));
93
+ request.response.complete();
94
+ }
95
+ }
96
+ else {
97
+ request.response.response.addContent(new chat_model_1.MarkdownChatResponseContentImpl('Please start the GitHub MCP server to use this agent.'));
98
+ request.response.complete();
99
+ }
100
+ }));
101
+ request.response.waitForInput();
102
+ return;
103
+ }
104
+ // If already configured and running, continue as normal
105
+ await super.invoke(request);
106
+ }
107
+ catch (error) {
108
+ request.response.response.addContent(new chat_model_1.ErrorChatResponseContentImpl(new Error('Error checking GitHub MCP server status: ' + (error instanceof Error ? error.message : String(error)))));
109
+ request.response.complete();
110
+ }
111
+ }
112
+ async requiresConfiguration() {
113
+ const serverConfigured = await this.mcpService.hasServer(github_prompt_template_1.REQUIRED_GITHUB_MCP_SERVERS[0].name);
114
+ return !serverConfigured;
115
+ }
116
+ async requiresStartingServer() {
117
+ const serverStarted = await this.mcpService.isServerStarted(github_prompt_template_1.REQUIRED_GITHUB_MCP_SERVERS[0].name);
118
+ return !serverStarted;
119
+ }
120
+ async startServer() {
121
+ await this.ensureServerStarted(github_prompt_template_1.REQUIRED_GITHUB_MCP_SERVERS[0]);
122
+ }
123
+ async offerConfiguration() {
124
+ const currentServers = this.preferenceService.get(mcp_preferences_1.MCP_SERVERS_PREF, {});
125
+ const githubServer = github_prompt_template_1.REQUIRED_GITHUB_MCP_SERVERS[0];
126
+ const { name, ...serverWithoutName } = githubServer;
127
+ await this.preferenceService.set(mcp_preferences_1.MCP_SERVERS_PREF, {
128
+ ...currentServers,
129
+ [name]: serverWithoutName
130
+ }, common_1.PreferenceScope.User);
131
+ await this.openAndFocusOnGitHubConfig(name);
132
+ }
133
+ /**
134
+ * Opens the user preferences JSON file and attempts to focus on the GitHub server configuration.
135
+ */
136
+ async openAndFocusOnGitHubConfig(serverName) {
137
+ try {
138
+ const configUri = this.preferenceService.getConfigUri(common_1.PreferenceScope.User);
139
+ if (!configUri) {
140
+ this.logger.debug('Could not get config URI for user preferences');
141
+ return;
142
+ }
143
+ if (!await this.fileService.exists(configUri)) {
144
+ await this.fileService.create(configUri);
145
+ }
146
+ const content = await this.fileService.read(configUri);
147
+ const text = content.value;
148
+ const preferencePattern = `"${mcp_preferences_1.MCP_SERVERS_PREF}"`;
149
+ const preferenceMatch = text.indexOf(preferencePattern);
150
+ let selection;
151
+ if (preferenceMatch !== -1) {
152
+ const serverPattern = `"${serverName}"`;
153
+ const serverMatch = text.indexOf(serverPattern, preferenceMatch);
154
+ if (serverMatch !== -1) {
155
+ const lines = text.substring(0, serverMatch).split('\n');
156
+ const line = lines.length - 1;
157
+ const character = lines[lines.length - 1].length;
158
+ selection = {
159
+ start: { line, character }
160
+ };
161
+ }
162
+ }
163
+ await this.editorManager.open(configUri, {
164
+ selection
165
+ });
166
+ }
167
+ catch (error) {
168
+ this.logger.debug('Failed to open and focus on GitHub configuration:', error);
169
+ // Fallback to just opening the preferences file
170
+ await this.commandService.executeCommand(preference_types_1.PreferencesCommands.OPEN_USER_PREFERENCES_JSON.id);
171
+ }
172
+ }
173
+ /**
174
+ * Starts the GitHub MCP server if it doesn't exist or isn't running.
175
+ *
176
+ * @returns A promise that resolves when the server is started
177
+ */
178
+ async ensureServerStarted(server) {
179
+ try {
180
+ if (!(await this.mcpService.hasServer(server.name))) {
181
+ const currentServers = this.preferenceService.get(mcp_preferences_1.MCP_SERVERS_PREF, {});
182
+ const { name, ...serverWithoutName } = server;
183
+ await this.preferenceService.set(mcp_preferences_1.MCP_SERVERS_PREF, { ...currentServers, [name]: serverWithoutName }, common_1.PreferenceScope.User);
184
+ await this.mcpService.addOrUpdateServer(server);
185
+ }
186
+ if (!(await this.mcpService.isServerStarted(server.name))) {
187
+ await this.mcpService.startServer(server.name);
188
+ }
189
+ }
190
+ catch (error) {
191
+ this.logger.error(`Error starting GitHub MCP server ${server.name}: ${error}`);
192
+ throw error;
193
+ }
194
+ }
195
+ };
196
+ exports.GitHubChatAgent = GitHubChatAgent;
197
+ tslib_1.__decorate([
198
+ (0, inversify_1.inject)(mcp_server_manager_1.MCPFrontendService),
199
+ tslib_1.__metadata("design:type", Object)
200
+ ], GitHubChatAgent.prototype, "mcpService", void 0);
201
+ tslib_1.__decorate([
202
+ (0, inversify_1.inject)(common_1.PreferenceService),
203
+ tslib_1.__metadata("design:type", Object)
204
+ ], GitHubChatAgent.prototype, "preferenceService", void 0);
205
+ tslib_1.__decorate([
206
+ (0, inversify_1.inject)(core_1.CommandService),
207
+ tslib_1.__metadata("design:type", Object)
208
+ ], GitHubChatAgent.prototype, "commandService", void 0);
209
+ tslib_1.__decorate([
210
+ (0, inversify_1.inject)(browser_1.EditorManager),
211
+ tslib_1.__metadata("design:type", browser_1.EditorManager)
212
+ ], GitHubChatAgent.prototype, "editorManager", void 0);
213
+ tslib_1.__decorate([
214
+ (0, inversify_1.inject)(file_service_1.FileService),
215
+ tslib_1.__metadata("design:type", file_service_1.FileService)
216
+ ], GitHubChatAgent.prototype, "fileService", void 0);
217
+ exports.GitHubChatAgent = GitHubChatAgent = tslib_1.__decorate([
218
+ (0, inversify_1.injectable)()
219
+ ], GitHubChatAgent);
220
+ //# sourceMappingURL=github-chat-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-chat-agent.js","sourceRoot":"","sources":["../../src/browser/github-chat-agent.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,uEAAuF;AACvF,qEAA2K;AAE3K,oFAAuG;AACvG,sCAAkD;AAClD,4DAAkE;AAClE,8EAA4E;AAC5E,mDAA4E;AAC5E,2FAA2F;AAC3F,uDAA0D;AAC1D,6EAAyE;AACzE,qEAAuF;AAE1E,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAGnC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,4CAA8B;IAA5D;;QAiBH,OAAE,GAAW,yBAAiB,CAAC;QAC/B,SAAI,GAAG,yBAAiB,CAAC;QACzB,8BAAyB,GAA+B,CAAC;gBACrD,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,cAAc;aAC7B,CAAC,CAAC;QACO,gCAA2B,GAAW,MAAM,CAAC;QAC9C,gBAAW,GAAG,UAAG,CAAC,QAAQ,CAAC,kCAAkC,EAAE,kGAAkG;cACpK,0CAA0C;cAC1C,uHAAuH,CAAC,CAAC;QAEtH,cAAS,GAAW,wBAAwB,CAAC;QACnC,mBAAc,GAAW,eAAe,CAAC;QACnD,YAAO,GAAG,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,cAAc,EAAE,uCAAc,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IAiL/F,CAAC;IA/KG;;;OAGG;IACM,KAAK,CAAC,MAAM,CAAC,OAAgC;QAClD,IAAI,CAAC;YACD,IAAI,MAAM,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;gB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AAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACnD,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oCAAoC,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;YAC/E,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;CACJ,CAAA;AA/MY,0CAAe;AAGL;IADlB,IAAA,kBAAM,EAAC,uCAAkB,CAAC;;mDACuB;AAG/B;IADlB,IAAA,kBAAM,EAAC,0BAAiB,CAAC;;0DAC8B;AAGrC;IADlB,IAAA,kBAAM,EAAC,qBAAc,CAAC;;uDAC2B;AAG/B;IADlB,IAAA,kBAAM,EAAC,uBAAa,CAAC;sCACY,uBAAa;sDAAC;AAG7B;IADlB,IAAA,kBAAM,EAAC,0BAAW,CAAC;sCACY,0BAAW;oDAAC;0BAfnC,eAAe;IAD3B,IAAA,sBAAU,GAAE;GACA,eAAe,CA+M3B"}
@@ -0,0 +1,6 @@
1
+ import { BasePromptFragment } from '@theia/ai-core/lib/common';
2
+ import { MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager';
3
+ export declare const GITHUB_REPO_NAME_VARIABLE_ID = "githubRepoName";
4
+ export declare const REQUIRED_GITHUB_MCP_SERVERS: MCPServerDescription[];
5
+ export declare const githubTemplate: BasePromptFragment;
6
+ //# sourceMappingURL=github-prompt-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-prompt-template.d.ts","sourceRoot":"","sources":["../../src/browser/github-prompt-template.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAEnF,eAAO,MAAM,4BAA4B,mBAAmB,CAAC;AAE7D,eAAO,MAAM,2BAA2B,EAAE,oBAAoB,EAM7D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,kBAwB5B,CAAC"}
@@ -0,0 +1,53 @@
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
+ exports.githubTemplate = exports.REQUIRED_GITHUB_MCP_SERVERS = exports.GITHUB_REPO_NAME_VARIABLE_ID = void 0;
19
+ const ai_chat_1 = require("@theia/ai-chat");
20
+ exports.GITHUB_REPO_NAME_VARIABLE_ID = 'githubRepoName';
21
+ exports.REQUIRED_GITHUB_MCP_SERVERS = [
22
+ {
23
+ 'name': 'github',
24
+ 'serverUrl': 'https://api.githubcopilot.com/mcp/',
25
+ 'serverAuthToken': 'your_github_token_here'
26
+ }
27
+ ];
28
+ exports.githubTemplate = {
29
+ id: 'github-system-default',
30
+ template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
31
+ Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
32
+ https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
33
+
34
+ You are GitHub Agent, an AI assistant integrated into Theia IDE specifically designed to help developers interact with GitHub repositories.
35
+ Your role is to help users manage GitHub repositories, issues, pull requests, and other GitHub-related tasks through the GitHub MCP server.
36
+
37
+ ## Current Repository Context
38
+ {{${exports.GITHUB_REPO_NAME_VARIABLE_ID}}}
39
+
40
+ ## Available GitHub Tools
41
+ You have access to GitHub functionality through the MCP server:
42
+ {{prompt:mcp_github_tools}}
43
+
44
+ ## Important Notes
45
+ - Be mindful of rate limits and use batch operations when appropriate
46
+ - Provide clear error messages and suggestions for resolution when operations fail
47
+
48
+ ## Current Context
49
+ Some files and other pieces of data may have been added by the user to the context of the chat. If any have, the details can be found below.
50
+ {{${ai_chat_1.CHAT_CONTEXT_DETAILS_VARIABLE_ID}}}
51
+ `
52
+ };
53
+ //# sourceMappingURL=github-prompt-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-prompt-template.js","sourceRoot":"","sources":["../../src/browser/github-prompt-template.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,IAAI;;;AAGJ,4CAAkE;AAGrD,QAAA,4BAA4B,GAAG,gBAAgB,CAAC;AAEhD,QAAA,2BAA2B,GAA2B;IAC/D;QACI,MAAM,EAAE,QAAQ;QAChB,WAAW,EAAE,oCAAoC;QACjD,iBAAiB,EAAE,wBAAwB;KAC9C;CACJ,CAAC;AAEW,QAAA,cAAc,GAAuB;IAC9C,EAAE,EAAE,uBAAuB;IAC3B,QAAQ,EAAE;;;;;;;;IAQV,oCAA4B;;;;;;;;;;;;IAY5B,0CAAgC;CACnC;CACA,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { MaybePromise } from '@theia/core';
2
+ import { AIVariableContribution, AIVariableResolver, AIVariableService, AIVariableResolutionRequest, AIVariableContext, ResolvedAIVariable, AIVariable } from '@theia/ai-core/lib/common';
3
+ import { ScmService } from '@theia/scm/lib/browser/scm-service';
4
+ import { GitRepositoryProvider } from '@theia/git/lib/browser/git-repository-provider';
5
+ import { Git } from '@theia/git/lib/common';
6
+ export declare const GITHUB_REPO_NAME_VARIABLE: AIVariable;
7
+ export declare class GitHubRepoVariableContribution implements AIVariableContribution, AIVariableResolver {
8
+ protected readonly scmService: ScmService;
9
+ protected readonly repositoryProvider: GitRepositoryProvider;
10
+ protected readonly git: Git;
11
+ registerVariables(service: AIVariableService): void;
12
+ canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise<number>;
13
+ resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise<ResolvedAIVariable | undefined>;
14
+ private isGitHubRemote;
15
+ private extractRepoNameFromGitHubUrl;
16
+ }
17
+ //# sourceMappingURL=github-repo-variable-contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-repo-variable-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/github-repo-variable-contribution.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAO,MAAM,aAAa,CAAC;AAChD,OAAO,EACH,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,eAAO,MAAM,yBAAyB,EAAE,UAIvC,CAAC;AAEF,qBACa,8BAA+B,YAAW,sBAAsB,EAAE,kBAAkB;IAG7F,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAG1C,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,qBAAqB,CAAC;IAG7D,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAE5B,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAInD,UAAU,CAAC,OAAO,EAAE,2BAA2B,EAAE,OAAO,EAAE,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC;IAa5F,OAAO,CAAC,OAAO,EAAE,2BAA2B,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAmCxH,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,4BAA4B;CAcvC"}
@@ -0,0 +1,101 @@
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
+ exports.GitHubRepoVariableContribution = exports.GITHUB_REPO_NAME_VARIABLE = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const core_1 = require("@theia/core");
22
+ const scm_service_1 = require("@theia/scm/lib/browser/scm-service");
23
+ const git_repository_provider_1 = require("@theia/git/lib/browser/git-repository-provider");
24
+ const common_1 = require("@theia/git/lib/common");
25
+ exports.GITHUB_REPO_NAME_VARIABLE = {
26
+ id: 'github-repo-name-provider',
27
+ name: 'githubRepoName',
28
+ description: core_1.nls.localize('theia/ai/ide/githubRepoName/description', 'The name of the current GitHub repository (e.g., "eclipse-theia/theia")')
29
+ };
30
+ let GitHubRepoVariableContribution = class GitHubRepoVariableContribution {
31
+ registerVariables(service) {
32
+ service.registerResolver(exports.GITHUB_REPO_NAME_VARIABLE, this);
33
+ }
34
+ canResolve(request, context) {
35
+ if (request.variable.name !== exports.GITHUB_REPO_NAME_VARIABLE.name) {
36
+ return 0;
37
+ }
38
+ const selectedRepo = this.repositoryProvider.selectedRepository;
39
+ if (!selectedRepo) {
40
+ return 0;
41
+ }
42
+ return 1;
43
+ }
44
+ async resolve(request, context) {
45
+ if (request.variable.name !== exports.GITHUB_REPO_NAME_VARIABLE.name) {
46
+ return undefined;
47
+ }
48
+ const repository = this.repositoryProvider.selectedRepository;
49
+ if (!repository) {
50
+ return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
51
+ }
52
+ try {
53
+ const remotes = await this.git.remote(repository, { verbose: true });
54
+ // Find GitHub remote (prefer 'origin', then any GitHub remote)
55
+ const githubRemote = remotes.find(remote => remote.name === 'origin' && this.isGitHubRemote(remote.fetch)) || remotes.find(remote => this.isGitHubRemote(remote.fetch));
56
+ if (!githubRemote) {
57
+ return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
58
+ }
59
+ const repoName = this.extractRepoNameFromGitHubUrl(githubRemote.fetch);
60
+ if (!repoName) {
61
+ return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
62
+ }
63
+ return { variable: request.variable, value: `You are currently working with the GitHub repository: **${repoName}**` };
64
+ }
65
+ catch (error) {
66
+ console.warn('Failed to resolve GitHub repository name:', error);
67
+ return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
68
+ }
69
+ }
70
+ isGitHubRemote(remoteUrl) {
71
+ return remoteUrl.includes('github.com');
72
+ }
73
+ extractRepoNameFromGitHubUrl(url) {
74
+ const httpsMatch = url.match(/https:\/\/github\.com\/([^\/]+\/[^\/]+?)(?:\.git)?$/);
75
+ if (httpsMatch) {
76
+ return httpsMatch[1];
77
+ }
78
+ const sshMatch = url.match(/git@github\.com:([^\/]+\/[^\/]+?)(?:\.git)?$/);
79
+ if (sshMatch) {
80
+ return sshMatch[1];
81
+ }
82
+ return undefined;
83
+ }
84
+ };
85
+ exports.GitHubRepoVariableContribution = GitHubRepoVariableContribution;
86
+ tslib_1.__decorate([
87
+ (0, inversify_1.inject)(scm_service_1.ScmService),
88
+ tslib_1.__metadata("design:type", scm_service_1.ScmService)
89
+ ], GitHubRepoVariableContribution.prototype, "scmService", void 0);
90
+ tslib_1.__decorate([
91
+ (0, inversify_1.inject)(git_repository_provider_1.GitRepositoryProvider),
92
+ tslib_1.__metadata("design:type", git_repository_provider_1.GitRepositoryProvider)
93
+ ], GitHubRepoVariableContribution.prototype, "repositoryProvider", void 0);
94
+ tslib_1.__decorate([
95
+ (0, inversify_1.inject)(common_1.Git),
96
+ tslib_1.__metadata("design:type", Object)
97
+ ], GitHubRepoVariableContribution.prototype, "git", void 0);
98
+ exports.GitHubRepoVariableContribution = GitHubRepoVariableContribution = tslib_1.__decorate([
99
+ (0, inversify_1.injectable)()
100
+ ], GitHubRepoVariableContribution);
101
+ //# sourceMappingURL=github-repo-variable-contribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-repo-variable-contribution.js","sourceRoot":"","sources":["../../src/browser/github-repo-variable-contribution.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,4DAAkE;AAClE,sCAAgD;AAUhD,oEAAgE;AAChE,4FAAuF;AACvF,kDAA4C;AAE/B,QAAA,yBAAyB,GAAe;IACjD,EAAE,EAAE,2BAA2B;IAC/B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,UAAG,CAAC,QAAQ,CAAC,yCAAyC,EAAE,yEAAyE,CAAC;CAClJ,CAAC;AAGK,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAWvC,iBAAiB,CAAC,OAA0B;QACxC,OAAO,CAAC,gBAAgB,CAAC,iCAAyB,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC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,YAAG,CAAC;;2DACgB;yCATnB,8BAA8B;IAD1C,IAAA,sBAAU,GAAE;GACA,8BAA8B,CAiF1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/ai-ide",
3
- "version": "1.66.0-next.32+0e85731b8",
3
+ "version": "1.66.0-next.44+5b6e49d13",
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,20 +15,24 @@
15
15
  "theia-extension"
16
16
  ],
17
17
  "dependencies": {
18
- "@theia/ai-chat": "1.66.0-next.32+0e85731b8",
19
- "@theia/ai-chat-ui": "1.66.0-next.32+0e85731b8",
20
- "@theia/ai-core": "1.66.0-next.32+0e85731b8",
21
- "@theia/ai-mcp": "1.66.0-next.32+0e85731b8",
22
- "@theia/core": "1.66.0-next.32+0e85731b8",
23
- "@theia/debug": "1.66.0-next.32+0e85731b8",
24
- "@theia/filesystem": "1.66.0-next.32+0e85731b8",
25
- "@theia/markers": "1.66.0-next.32+0e85731b8",
26
- "@theia/monaco": "1.66.0-next.32+0e85731b8",
27
- "@theia/navigator": "1.66.0-next.32+0e85731b8",
28
- "@theia/search-in-workspace": "1.66.0-next.32+0e85731b8",
29
- "@theia/task": "1.66.0-next.32+0e85731b8",
30
- "@theia/terminal": "1.66.0-next.32+0e85731b8",
31
- "@theia/workspace": "1.66.0-next.32+0e85731b8",
18
+ "@theia/ai-chat": "1.66.0-next.44+5b6e49d13",
19
+ "@theia/ai-chat-ui": "1.66.0-next.44+5b6e49d13",
20
+ "@theia/ai-core": "1.66.0-next.44+5b6e49d13",
21
+ "@theia/ai-mcp": "1.66.0-next.44+5b6e49d13",
22
+ "@theia/core": "1.66.0-next.44+5b6e49d13",
23
+ "@theia/debug": "1.66.0-next.44+5b6e49d13",
24
+ "@theia/editor": "1.66.0-next.44+5b6e49d13",
25
+ "@theia/filesystem": "1.66.0-next.44+5b6e49d13",
26
+ "@theia/git": "1.65.0",
27
+ "@theia/markers": "1.66.0-next.44+5b6e49d13",
28
+ "@theia/monaco": "1.66.0-next.44+5b6e49d13",
29
+ "@theia/navigator": "1.66.0-next.44+5b6e49d13",
30
+ "@theia/preferences": "1.66.0-next.44+5b6e49d13",
31
+ "@theia/scm": "1.66.0-next.44+5b6e49d13",
32
+ "@theia/search-in-workspace": "1.66.0-next.44+5b6e49d13",
33
+ "@theia/task": "1.66.0-next.44+5b6e49d13",
34
+ "@theia/terminal": "1.66.0-next.44+5b6e49d13",
35
+ "@theia/workspace": "1.66.0-next.44+5b6e49d13",
32
36
  "date-fns": "^4.1.0",
33
37
  "ignore": "^6.0.0",
34
38
  "js-yaml": "^4.1.0",
@@ -39,8 +43,8 @@
39
43
  "access": "public"
40
44
  },
41
45
  "devDependencies": {
42
- "@theia/cli": "1.66.0-next.32+0e85731b8",
43
- "@theia/test": "1.66.0-next.32+0e85731b8"
46
+ "@theia/cli": "1.66.0-next.44+5b6e49d13",
47
+ "@theia/test": "1.66.0-next.44+5b6e49d13"
44
48
  },
45
49
  "theiaExtensions": [
46
50
  {
@@ -64,5 +68,5 @@
64
68
  "nyc": {
65
69
  "extends": "../../configs/nyc.json"
66
70
  },
67
- "gitHead": "0e85731b8d6b22ec862ca4ef7a35a9b81a744107"
71
+ "gitHead": "5b6e49d139f9abbb18e233f138497a33a0758222"
68
72
  }
@@ -61,6 +61,7 @@ import {
61
61
  import { OrchestratorChatAgent, OrchestratorChatAgentId } from '../common/orchestrator-chat-agent';
62
62
  import { UniversalChatAgent, UniversalChatAgentId } from '../common/universal-chat-agent';
63
63
  import { AppTesterChatAgent } from './app-tester-chat-agent';
64
+ import { GitHubChatAgent } from './github-chat-agent';
64
65
  import { CommandChatAgent } from '../common/command-chat-agents';
65
66
  import { ListChatContext, ResolveChatContext, AddFileToChatContext } from './context-functions';
66
67
  import { AIAgentConfigurationWidget } from './ai-configuration/agent-configuration-widget';
@@ -77,6 +78,7 @@ import { ChatWelcomeMessageProvider } from '@theia/ai-chat-ui/lib/browser/chat-t
77
78
  import { IdeChatWelcomeMessageProvider } from './ide-chat-welcome-message-provider';
78
79
  import { AITokenUsageConfigurationWidget } from './ai-configuration/token-usage-configuration-widget';
79
80
  import { TaskContextSummaryVariableContribution } from './task-background-summary-variable';
81
+ import { GitHubRepoVariableContribution } from './github-repo-variable-contribution';
80
82
  import { TaskContextFileStorageService } from './task-context-file-storage-service';
81
83
  import { TaskContextStorageService } from '@theia/ai-chat/lib/browser/task-context-service';
82
84
  import { CommandContribution, PreferenceContribution } from '@theia/core';
@@ -120,6 +122,10 @@ export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
120
122
  bind(AppTesterChatAgent).toSelf().inSingletonScope();
121
123
  bind(Agent).toService(AppTesterChatAgent);
122
124
  bind(ChatAgent).toService(AppTesterChatAgent);
125
+
126
+ bind(GitHubChatAgent).toSelf().inSingletonScope();
127
+ bind(Agent).toService(GitHubChatAgent);
128
+ bind(ChatAgent).toService(GitHubChatAgent);
123
129
  bind(BrowserAutomation).toDynamicValue(ctx => {
124
130
  const provider = ctx.container.get<ServiceConnectionProvider>(RemoteConnectionProvider);
125
131
  return provider.createProxy<BrowserAutomation>(browserAutomationPath);
@@ -233,6 +239,9 @@ export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
233
239
 
234
240
  bind(TaskContextSummaryVariableContribution).toSelf().inSingletonScope();
235
241
  bind(AIVariableContribution).toService(TaskContextSummaryVariableContribution);
242
+
243
+ bind(GitHubRepoVariableContribution).toSelf().inSingletonScope();
244
+ bind(AIVariableContribution).toService(GitHubRepoVariableContribution);
236
245
  bind(TaskContextFileStorageService).toSelf().inSingletonScope();
237
246
  rebind(TaskContextStorageService).toService(TaskContextFileStorageService);
238
247
 
@@ -0,0 +1,240 @@
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 { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents';
18
+ import { ErrorChatResponseContentImpl, MarkdownChatResponseContentImpl, MutableChatRequestModel, QuestionResponseContentImpl } from '@theia/ai-chat/lib/common/chat-model';
19
+ import { LanguageModelRequirement } from '@theia/ai-core/lib/common';
20
+ import { MCPFrontendService, MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager';
21
+ import { nls, CommandService } from '@theia/core';
22
+ import { inject, injectable } from '@theia/core/shared/inversify';
23
+ import { MCP_SERVERS_PREF } from '@theia/ai-mcp/lib/common/mcp-preferences';
24
+ import { PreferenceScope, PreferenceService } from '@theia/core/lib/common';
25
+ import { PreferencesCommands } from '@theia/preferences/lib/browser/util/preference-types';
26
+ import { EditorManager } from '@theia/editor/lib/browser';
27
+ import { FileService } from '@theia/filesystem/lib/browser/file-service';
28
+ import { githubTemplate, REQUIRED_GITHUB_MCP_SERVERS } from './github-prompt-template';
29
+
30
+ export const GitHubChatAgentId = 'GitHub';
31
+
32
+ @injectable()
33
+ export class GitHubChatAgent extends AbstractStreamParsingChatAgent {
34
+
35
+ @inject(MCPFrontendService)
36
+ protected readonly mcpService: MCPFrontendService;
37
+
38
+ @inject(PreferenceService)
39
+ protected readonly preferenceService: PreferenceService;
40
+
41
+ @inject(CommandService)
42
+ protected readonly commandService: CommandService;
43
+
44
+ @inject(EditorManager)
45
+ protected readonly editorManager: EditorManager;
46
+
47
+ @inject(FileService)
48
+ protected readonly fileService: FileService;
49
+
50
+ id: string = GitHubChatAgentId;
51
+ name = GitHubChatAgentId;
52
+ languageModelRequirements: LanguageModelRequirement[] = [{
53
+ purpose: 'chat',
54
+ identifier: 'default/code',
55
+ }];
56
+ protected defaultLanguageModelPurpose: string = 'chat';
57
+ override description = nls.localize('theia/ai/chat/github/description', 'This agent helps you interact with GitHub repositories, issues, pull requests, and other GitHub '
58
+ + 'features through the GitHub MCP server. '
59
+ + 'It can help you manage your repositories, create issues, handle pull requests, and perform various GitHub operations.');
60
+
61
+ override iconClass: string = 'codicon codicon-github';
62
+ protected override systemPromptId: string = 'github-system';
63
+ override prompts = [{ id: 'github-system', defaultVariant: githubTemplate, variants: [] }];
64
+
65
+ /**
66
+ * Override invoke to check if the GitHub MCP server is configured and running,
67
+ * and if not, offer to configure or start it.
68
+ */
69
+ override async invoke(request: MutableChatRequestModel): Promise<void> {
70
+ try {
71
+ if (await this.requiresConfiguration()) {
72
+ // Ask the user if they want to configure the GitHub server
73
+ request.response.response.addContent(new QuestionResponseContentImpl(
74
+ 'The GitHub MCP server is not configured. Would you like to configure it now? '
75
+ + 'This will open the settings.json file where you can add your GitHub access token.',
76
+ [
77
+ { text: 'Yes, configure GitHub server', value: 'configure' },
78
+ { text: 'No, cancel', value: 'cancel' }
79
+ ],
80
+ request,
81
+ async selectedOption => {
82
+ if (selectedOption.value === 'configure') {
83
+ await this.offerConfiguration();
84
+ request.response.response.addContent(new MarkdownChatResponseContentImpl(
85
+ 'Settings file opened. Please add your GitHub Personal Access Token to the `serverAuthToken` property in the GitHub server configuration, then '
86
+ + ' save and try again.\n\n' +
87
+ 'You can create a Personal Access Token at: https://github.com/settings/tokens'
88
+ ));
89
+ request.response.complete();
90
+ } else {
91
+ request.response.response.addContent(new MarkdownChatResponseContentImpl('GitHub server configuration cancelled.'
92
+ + ' Please configure the GitHub MCP server to use this agent.'));
93
+ request.response.complete();
94
+ }
95
+ }
96
+ ));
97
+ request.response.waitForInput();
98
+ return;
99
+ }
100
+
101
+ if (await this.requiresStartingServer()) {
102
+ // Ask the user if they want to start the server
103
+ request.response.response.addContent(new QuestionResponseContentImpl(
104
+ 'The GitHub MCP server is configured but not running. Would you like to start it now?',
105
+ [
106
+ { text: 'Yes, start the server', value: 'yes' },
107
+ { text: 'No, cancel', value: 'no' }
108
+ ],
109
+ request,
110
+ async selectedOption => {
111
+ if (selectedOption.value === 'yes') {
112
+ const progress = request.response.addProgressMessage({ content: 'Starting GitHub MCP server.', show: 'whileIncomplete' });
113
+ try {
114
+ await this.startServer();
115
+ request.response.updateProgressMessage({ ...progress, show: 'whileIncomplete', status: 'completed' });
116
+ await super.invoke(request);
117
+ } catch (error) {
118
+ request.response.response.addContent(new ErrorChatResponseContentImpl(
119
+ new Error('Failed to start GitHub MCP server: ' + (error instanceof Error ? error.message : String(error)))
120
+ ));
121
+ request.response.complete();
122
+ }
123
+ } else {
124
+ request.response.response.addContent(new MarkdownChatResponseContentImpl('Please start the GitHub MCP server to use this agent.'));
125
+ request.response.complete();
126
+ }
127
+ }
128
+ ));
129
+ request.response.waitForInput();
130
+ return;
131
+ }
132
+
133
+ // If already configured and running, continue as normal
134
+ await super.invoke(request);
135
+ } catch (error) {
136
+ request.response.response.addContent(new ErrorChatResponseContentImpl(
137
+ new Error('Error checking GitHub MCP server status: ' + (error instanceof Error ? error.message : String(error)))
138
+ ));
139
+ request.response.complete();
140
+ }
141
+ }
142
+
143
+ protected async requiresConfiguration(): Promise<boolean> {
144
+ const serverConfigured = await this.mcpService.hasServer(REQUIRED_GITHUB_MCP_SERVERS[0].name);
145
+ return !serverConfigured;
146
+ }
147
+
148
+ protected async requiresStartingServer(): Promise<boolean> {
149
+ const serverStarted = await this.mcpService.isServerStarted(REQUIRED_GITHUB_MCP_SERVERS[0].name);
150
+ return !serverStarted;
151
+ }
152
+
153
+ protected async startServer(): Promise<void> {
154
+ await this.ensureServerStarted(REQUIRED_GITHUB_MCP_SERVERS[0]);
155
+ }
156
+
157
+ protected async offerConfiguration(): Promise<void> {
158
+ const currentServers = this.preferenceService.get<Record<string, MCPServerDescription>>(MCP_SERVERS_PREF, {});
159
+ const githubServer = REQUIRED_GITHUB_MCP_SERVERS[0];
160
+
161
+ const { name, ...serverWithoutName } = githubServer;
162
+ await this.preferenceService.set(MCP_SERVERS_PREF, {
163
+ ...currentServers,
164
+ [name]: serverWithoutName
165
+ }, PreferenceScope.User);
166
+
167
+ await this.openAndFocusOnGitHubConfig(name);
168
+ }
169
+
170
+ /**
171
+ * Opens the user preferences JSON file and attempts to focus on the GitHub server configuration.
172
+ */
173
+ protected async openAndFocusOnGitHubConfig(serverName: string): Promise<void> {
174
+ try {
175
+ const configUri = this.preferenceService.getConfigUri(PreferenceScope.User);
176
+ if (!configUri) {
177
+ this.logger.debug('Could not get config URI for user preferences');
178
+ return;
179
+ }
180
+
181
+ if (!await this.fileService.exists(configUri)) {
182
+ await this.fileService.create(configUri);
183
+ }
184
+
185
+ const content = await this.fileService.read(configUri);
186
+ const text = content.value;
187
+
188
+ const preferencePattern = `"${MCP_SERVERS_PREF}"`;
189
+ const preferenceMatch = text.indexOf(preferencePattern);
190
+
191
+ let selection: { start: { line: number; character: number } } | undefined;
192
+
193
+ if (preferenceMatch !== -1) {
194
+ const serverPattern = `"${serverName}"`;
195
+ const serverMatch = text.indexOf(serverPattern, preferenceMatch);
196
+
197
+ if (serverMatch !== -1) {
198
+ const lines = text.substring(0, serverMatch).split('\n');
199
+ const line = lines.length - 1;
200
+ const character = lines[lines.length - 1].length;
201
+
202
+ selection = {
203
+ start: { line, character }
204
+ };
205
+ }
206
+ }
207
+
208
+ await this.editorManager.open(configUri, {
209
+ selection
210
+ });
211
+ } catch (error) {
212
+ this.logger.debug('Failed to open and focus on GitHub configuration:', error);
213
+ // Fallback to just opening the preferences file
214
+ await this.commandService.executeCommand(PreferencesCommands.OPEN_USER_PREFERENCES_JSON.id);
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Starts the GitHub MCP server if it doesn't exist or isn't running.
220
+ *
221
+ * @returns A promise that resolves when the server is started
222
+ */
223
+ async ensureServerStarted(server: MCPServerDescription): Promise<void> {
224
+ try {
225
+ if (!(await this.mcpService.hasServer(server.name))) {
226
+ const currentServers = this.preferenceService.get<Record<string, MCPServerDescription>>(MCP_SERVERS_PREF, {});
227
+ const { name, ...serverWithoutName } = server;
228
+ await this.preferenceService.set(MCP_SERVERS_PREF, { ...currentServers, [name]: serverWithoutName }, PreferenceScope.User);
229
+ await this.mcpService.addOrUpdateServer(server);
230
+ }
231
+
232
+ if (!(await this.mcpService.isServerStarted(server.name))) {
233
+ await this.mcpService.startServer(server.name);
234
+ }
235
+ } catch (error) {
236
+ this.logger.error(`Error starting GitHub MCP server ${server.name}: ${error}`);
237
+ throw error;
238
+ }
239
+ }
240
+ }
@@ -0,0 +1,55 @@
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 { BasePromptFragment } from '@theia/ai-core/lib/common';
18
+ import { CHAT_CONTEXT_DETAILS_VARIABLE_ID } from '@theia/ai-chat';
19
+ import { MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager';
20
+
21
+ export const GITHUB_REPO_NAME_VARIABLE_ID = 'githubRepoName';
22
+
23
+ export const REQUIRED_GITHUB_MCP_SERVERS: MCPServerDescription[] = [
24
+ {
25
+ 'name': 'github',
26
+ 'serverUrl': 'https://api.githubcopilot.com/mcp/',
27
+ 'serverAuthToken': 'your_github_token_here'
28
+ }
29
+ ];
30
+
31
+ export const githubTemplate: BasePromptFragment = {
32
+ id: 'github-system-default',
33
+ template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
34
+ Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
35
+ https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
36
+
37
+ You are GitHub Agent, an AI assistant integrated into Theia IDE specifically designed to help developers interact with GitHub repositories.
38
+ Your role is to help users manage GitHub repositories, issues, pull requests, and other GitHub-related tasks through the GitHub MCP server.
39
+
40
+ ## Current Repository Context
41
+ {{${GITHUB_REPO_NAME_VARIABLE_ID}}}
42
+
43
+ ## Available GitHub Tools
44
+ You have access to GitHub functionality through the MCP server:
45
+ {{prompt:mcp_github_tools}}
46
+
47
+ ## Important Notes
48
+ - Be mindful of rate limits and use batch operations when appropriate
49
+ - Provide clear error messages and suggestions for resolution when operations fail
50
+
51
+ ## Current Context
52
+ Some files and other pieces of data may have been added by the user to the context of the chat. If any have, the details can be found below.
53
+ {{${CHAT_CONTEXT_DETAILS_VARIABLE_ID}}}
54
+ `
55
+ };
@@ -0,0 +1,120 @@
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 { injectable, inject } from '@theia/core/shared/inversify';
18
+ import { MaybePromise, nls } from '@theia/core';
19
+ import {
20
+ AIVariableContribution,
21
+ AIVariableResolver,
22
+ AIVariableService,
23
+ AIVariableResolutionRequest,
24
+ AIVariableContext,
25
+ ResolvedAIVariable,
26
+ AIVariable
27
+ } from '@theia/ai-core/lib/common';
28
+ import { ScmService } from '@theia/scm/lib/browser/scm-service';
29
+ import { GitRepositoryProvider } from '@theia/git/lib/browser/git-repository-provider';
30
+ import { Git } from '@theia/git/lib/common';
31
+
32
+ export const GITHUB_REPO_NAME_VARIABLE: AIVariable = {
33
+ id: 'github-repo-name-provider',
34
+ name: 'githubRepoName',
35
+ description: nls.localize('theia/ai/ide/githubRepoName/description', 'The name of the current GitHub repository (e.g., "eclipse-theia/theia")')
36
+ };
37
+
38
+ @injectable()
39
+ export class GitHubRepoVariableContribution implements AIVariableContribution, AIVariableResolver {
40
+
41
+ @inject(ScmService)
42
+ protected readonly scmService: ScmService;
43
+
44
+ @inject(GitRepositoryProvider)
45
+ protected readonly repositoryProvider: GitRepositoryProvider;
46
+
47
+ @inject(Git)
48
+ protected readonly git: Git;
49
+
50
+ registerVariables(service: AIVariableService): void {
51
+ service.registerResolver(GITHUB_REPO_NAME_VARIABLE, this);
52
+ }
53
+
54
+ canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise<number> {
55
+ if (request.variable.name !== GITHUB_REPO_NAME_VARIABLE.name) {
56
+ return 0;
57
+ }
58
+
59
+ const selectedRepo = this.repositoryProvider.selectedRepository;
60
+ if (!selectedRepo) {
61
+ return 0;
62
+ }
63
+
64
+ return 1;
65
+ }
66
+
67
+ async resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise<ResolvedAIVariable | undefined> {
68
+ if (request.variable.name !== GITHUB_REPO_NAME_VARIABLE.name) {
69
+ return undefined;
70
+ }
71
+
72
+ const repository = this.repositoryProvider.selectedRepository;
73
+ if (!repository) {
74
+ return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
75
+ }
76
+
77
+ try {
78
+ const remotes = await this.git.remote(repository, { verbose: true });
79
+
80
+ // Find GitHub remote (prefer 'origin', then any GitHub remote)
81
+ const githubRemote = remotes.find(remote =>
82
+ remote.name === 'origin' && this.isGitHubRemote(remote.fetch)
83
+ ) || remotes.find(remote => this.isGitHubRemote(remote.fetch));
84
+
85
+ if (!githubRemote) {
86
+ return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
87
+ }
88
+
89
+ const repoName = this.extractRepoNameFromGitHubUrl(githubRemote.fetch);
90
+ if (!repoName) {
91
+ return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
92
+ }
93
+
94
+ return { variable: request.variable, value: `You are currently working with the GitHub repository: **${repoName}**` };
95
+
96
+ } catch (error) {
97
+ console.warn('Failed to resolve GitHub repository name:', error);
98
+ return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
99
+ }
100
+ }
101
+
102
+ private isGitHubRemote(remoteUrl: string): boolean {
103
+ return remoteUrl.includes('github.com');
104
+ }
105
+
106
+ private extractRepoNameFromGitHubUrl(url: string): string | undefined {
107
+
108
+ const httpsMatch = url.match(/https:\/\/github\.com\/([^\/]+\/[^\/]+?)(?:\.git)?$/);
109
+ if (httpsMatch) {
110
+ return httpsMatch[1];
111
+ }
112
+
113
+ const sshMatch = url.match(/git@github\.com:([^\/]+\/[^\/]+?)(?:\.git)?$/);
114
+ if (sshMatch) {
115
+ return sshMatch[1];
116
+ }
117
+
118
+ return undefined;
119
+ }
120
+ }