@theia/ai-ide 1.67.0-next.59 → 1.67.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 (119) hide show
  1. package/lib/browser/address-pr-review-command-contribution.d.ts +9 -0
  2. package/lib/browser/address-pr-review-command-contribution.d.ts.map +1 -0
  3. package/lib/browser/address-pr-review-command-contribution.js +176 -0
  4. package/lib/browser/address-pr-review-command-contribution.js.map +1 -0
  5. package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +12 -6
  6. package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +1 -1
  7. package/lib/browser/ai-configuration/agent-configuration-widget.js +158 -106
  8. package/lib/browser/ai-configuration/agent-configuration-widget.js.map +1 -1
  9. package/lib/browser/ai-configuration/base/ai-card-grid-configuration-widget.d.ts +32 -0
  10. package/lib/browser/ai-configuration/base/ai-card-grid-configuration-widget.d.ts.map +1 -0
  11. package/lib/browser/ai-configuration/base/ai-card-grid-configuration-widget.js +55 -0
  12. package/lib/browser/ai-configuration/base/ai-card-grid-configuration-widget.js.map +1 -0
  13. package/lib/browser/ai-configuration/base/ai-configuration-base-widget.d.ts +14 -0
  14. package/lib/browser/ai-configuration/base/ai-configuration-base-widget.d.ts.map +1 -0
  15. package/lib/browser/ai-configuration/base/ai-configuration-base-widget.js +35 -0
  16. package/lib/browser/ai-configuration/base/ai-configuration-base-widget.js.map +1 -0
  17. package/lib/browser/ai-configuration/base/ai-hierarchical-configuration-widget.d.ts +23 -0
  18. package/lib/browser/ai-configuration/base/ai-hierarchical-configuration-widget.d.ts.map +1 -0
  19. package/lib/browser/ai-configuration/base/ai-hierarchical-configuration-widget.js +60 -0
  20. package/lib/browser/ai-configuration/base/ai-hierarchical-configuration-widget.js.map +1 -0
  21. package/lib/browser/ai-configuration/base/ai-list-detail-configuration-widget.d.ts +56 -0
  22. package/lib/browser/ai-configuration/base/ai-list-detail-configuration-widget.d.ts.map +1 -0
  23. package/lib/browser/ai-configuration/base/ai-list-detail-configuration-widget.js +96 -0
  24. package/lib/browser/ai-configuration/base/ai-list-detail-configuration-widget.js.map +1 -0
  25. package/lib/browser/ai-configuration/base/ai-table-configuration-widget.d.ts +45 -0
  26. package/lib/browser/ai-configuration/base/ai-table-configuration-widget.d.ts.map +1 -0
  27. package/lib/browser/ai-configuration/base/ai-table-configuration-widget.js +66 -0
  28. package/lib/browser/ai-configuration/base/ai-table-configuration-widget.js.map +1 -0
  29. package/lib/browser/ai-configuration/components/configuration-section.d.ts +13 -0
  30. package/lib/browser/ai-configuration/components/configuration-section.d.ts.map +1 -0
  31. package/lib/browser/ai-configuration/components/configuration-section.js +28 -0
  32. package/lib/browser/ai-configuration/components/configuration-section.js.map +1 -0
  33. package/lib/browser/ai-configuration/components/empty-state.d.ts +11 -0
  34. package/lib/browser/ai-configuration/components/empty-state.d.ts.map +1 -0
  35. package/lib/browser/ai-configuration/components/empty-state.js +26 -0
  36. package/lib/browser/ai-configuration/components/empty-state.js.map +1 -0
  37. package/lib/browser/ai-configuration/components/expandable-section.d.ts +14 -0
  38. package/lib/browser/ai-configuration/components/expandable-section.d.ts.map +1 -0
  39. package/lib/browser/ai-configuration/components/expandable-section.js +31 -0
  40. package/lib/browser/ai-configuration/components/expandable-section.js.map +1 -0
  41. package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +1 -1
  42. package/lib/browser/ai-configuration/language-model-renderer.js +23 -22
  43. package/lib/browser/ai-configuration/language-model-renderer.js.map +1 -1
  44. package/lib/browser/ai-configuration/mcp-configuration-widget.d.ts +0 -1
  45. package/lib/browser/ai-configuration/mcp-configuration-widget.d.ts.map +1 -1
  46. package/lib/browser/ai-configuration/mcp-configuration-widget.js +88 -82
  47. package/lib/browser/ai-configuration/mcp-configuration-widget.js.map +1 -1
  48. package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts +8 -22
  49. package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts.map +1 -1
  50. package/lib/browser/ai-configuration/model-aliases-configuration-widget.js +49 -78
  51. package/lib/browser/ai-configuration/model-aliases-configuration-widget.js.map +1 -1
  52. package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js +10 -10
  53. package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js.map +1 -1
  54. package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +1 -1
  55. package/lib/browser/ai-configuration/template-settings-renderer.js +11 -11
  56. package/lib/browser/ai-configuration/template-settings-renderer.js.map +1 -1
  57. package/lib/browser/ai-configuration/token-usage-configuration-widget.d.ts +7 -8
  58. package/lib/browser/ai-configuration/token-usage-configuration-widget.d.ts.map +1 -1
  59. package/lib/browser/ai-configuration/token-usage-configuration-widget.js +93 -79
  60. package/lib/browser/ai-configuration/token-usage-configuration-widget.js.map +1 -1
  61. package/lib/browser/ai-configuration/tools-configuration-widget.d.ts +12 -7
  62. package/lib/browser/ai-configuration/tools-configuration-widget.d.ts.map +1 -1
  63. package/lib/browser/ai-configuration/tools-configuration-widget.js +45 -37
  64. package/lib/browser/ai-configuration/tools-configuration-widget.js.map +1 -1
  65. package/lib/browser/ai-configuration/variable-configuration-widget.d.ts +8 -4
  66. package/lib/browser/ai-configuration/variable-configuration-widget.d.ts.map +1 -1
  67. package/lib/browser/ai-configuration/variable-configuration-widget.js +61 -28
  68. package/lib/browser/ai-configuration/variable-configuration-widget.js.map +1 -1
  69. package/lib/browser/analyze-gh-ticket-command-contribution.d.ts +9 -0
  70. package/lib/browser/analyze-gh-ticket-command-contribution.d.ts.map +1 -0
  71. package/lib/browser/analyze-gh-ticket-command-contribution.js +172 -0
  72. package/lib/browser/analyze-gh-ticket-command-contribution.js.map +1 -0
  73. package/lib/browser/default-chat-agent-recommendation-service.d.ts +5 -0
  74. package/lib/browser/default-chat-agent-recommendation-service.d.ts.map +1 -0
  75. package/lib/browser/default-chat-agent-recommendation-service.js +47 -0
  76. package/lib/browser/default-chat-agent-recommendation-service.js.map +1 -0
  77. package/lib/browser/frontend-module.d.ts.map +1 -1
  78. package/lib/browser/frontend-module.js +9 -3
  79. package/lib/browser/frontend-module.js.map +1 -1
  80. package/lib/browser/ide-chat-welcome-message-provider.d.ts +36 -0
  81. package/lib/browser/ide-chat-welcome-message-provider.d.ts.map +1 -1
  82. package/lib/browser/ide-chat-welcome-message-provider.js +204 -1
  83. package/lib/browser/ide-chat-welcome-message-provider.js.map +1 -1
  84. package/lib/browser/implement-gh-ticket-command-contribution.d.ts +9 -0
  85. package/lib/browser/implement-gh-ticket-command-contribution.d.ts.map +1 -0
  86. package/lib/browser/implement-gh-ticket-command-contribution.js +156 -0
  87. package/lib/browser/implement-gh-ticket-command-contribution.js.map +1 -0
  88. package/package.json +21 -21
  89. package/src/browser/address-pr-review-command-contribution.ts +180 -0
  90. package/src/browser/ai-configuration/agent-configuration-widget.tsx +258 -137
  91. package/src/browser/ai-configuration/base/ai-card-grid-configuration-widget.tsx +72 -0
  92. package/src/browser/ai-configuration/base/ai-configuration-base-widget.tsx +37 -0
  93. package/src/browser/ai-configuration/base/ai-hierarchical-configuration-widget.tsx +51 -0
  94. package/src/browser/ai-configuration/base/ai-list-detail-configuration-widget.tsx +140 -0
  95. package/src/browser/ai-configuration/base/ai-table-configuration-widget.tsx +107 -0
  96. package/src/browser/ai-configuration/components/configuration-section.tsx +37 -0
  97. package/src/browser/ai-configuration/components/empty-state.tsx +30 -0
  98. package/src/browser/ai-configuration/components/expandable-section.tsx +51 -0
  99. package/src/browser/ai-configuration/language-model-renderer.tsx +68 -63
  100. package/src/browser/ai-configuration/mcp-configuration-widget.tsx +82 -87
  101. package/src/browser/ai-configuration/model-aliases-configuration-widget.tsx +93 -107
  102. package/src/browser/ai-configuration/prompt-fragments-configuration-widget.tsx +10 -10
  103. package/src/browser/ai-configuration/template-settings-renderer.tsx +25 -29
  104. package/src/browser/ai-configuration/token-usage-configuration-widget.tsx +131 -131
  105. package/src/browser/ai-configuration/tools-configuration-widget.tsx +70 -61
  106. package/src/browser/ai-configuration/variable-configuration-widget.tsx +95 -45
  107. package/src/browser/analyze-gh-ticket-command-contribution.ts +176 -0
  108. package/src/browser/default-chat-agent-recommendation-service.ts +43 -0
  109. package/src/browser/frontend-module.ts +12 -7
  110. package/src/browser/ide-chat-welcome-message-provider.tsx +300 -2
  111. package/src/browser/implement-gh-ticket-command-contribution.ts +160 -0
  112. package/src/browser/style/ai-configuration-base.css +90 -0
  113. package/src/browser/style/ai-configuration-cards.css +60 -0
  114. package/src/browser/style/ai-configuration-hierarchical.css +61 -0
  115. package/src/browser/style/ai-configuration-list-detail.css +88 -0
  116. package/src/browser/style/ai-configuration-table.css +73 -0
  117. package/src/browser/style/index.css +596 -261
  118. package/src/browser/style/widgets/mcp-configuration.css +253 -0
  119. package/src/browser/style/widgets/model-aliases-configuration.css +74 -0
@@ -17,7 +17,7 @@
17
17
  import '../../src/browser/style/index.css';
18
18
 
19
19
  import { ContainerModule } from '@theia/core/shared/inversify';
20
- import { ChatAgent, DefaultChatAgentId, FallbackChatAgentId } from '@theia/ai-chat/lib/common';
20
+ import { ChatAgent, ChatAgentRecommendationService } from '@theia/ai-chat/lib/common';
21
21
  import { Agent, AIVariableContribution, bindToolProvider } from '@theia/ai-core/lib/common';
22
22
  import { ArchitectAgent } from './architect-agent';
23
23
  import { CoderAgent } from './coder-agent';
@@ -60,8 +60,8 @@ import {
60
60
  DefaultFileChangeSetTitleProvider,
61
61
  ReplaceContentInFileFunctionHelperV2
62
62
  } from './file-changeset-functions';
63
- import { OrchestratorChatAgent, OrchestratorChatAgentId } from '../common/orchestrator-chat-agent';
64
- import { UniversalChatAgent, UniversalChatAgentId } from '../common/universal-chat-agent';
63
+ import { OrchestratorChatAgent } from '../common/orchestrator-chat-agent';
64
+ import { UniversalChatAgent } from '../common/universal-chat-agent';
65
65
  import { AppTesterChatAgent } from './app-tester-chat-agent';
66
66
  import { GitHubChatAgent } from './github-chat-agent';
67
67
  import { CommandChatAgent } from '../common/command-chat-agents';
@@ -78,6 +78,7 @@ import { TemplatePreferenceContribution } from './template-preference-contributi
78
78
  import { AIMCPConfigurationWidget } from './ai-configuration/mcp-configuration-widget';
79
79
  import { ChatWelcomeMessageProvider } from '@theia/ai-chat-ui/lib/browser/chat-tree-view';
80
80
  import { IdeChatWelcomeMessageProvider } from './ide-chat-welcome-message-provider';
81
+ import { DefaultChatAgentRecommendationService } from './default-chat-agent-recommendation-service';
81
82
  import { AITokenUsageConfigurationWidget } from './ai-configuration/token-usage-configuration-widget';
82
83
  import { TaskContextSummaryVariableContribution } from './task-background-summary-variable';
83
84
  import { GitHubRepoVariableContribution } from './github-repo-variable-contribution';
@@ -99,6 +100,9 @@ import { SuggestTerminalCommand } from './ai-terminal-functions';
99
100
  import { ContextFileValidationService } from '@theia/ai-chat/lib/browser/context-file-validation-service';
100
101
  import { ContextFileValidationServiceImpl } from './context-file-validation-service-impl';
101
102
  import { RememberCommandContribution } from './remember-command-contribution';
103
+ import { FixGitHubTicketCommandContribution } from './implement-gh-ticket-command-contribution';
104
+ import { AnalyzesGhTicketCommandContribution } from './analyze-gh-ticket-command-contribution';
105
+ import { AddressGhReviewCommandContribution } from './address-pr-review-command-contribution';
102
106
 
103
107
  export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
104
108
  bind(PreferenceContribution).toConstantValue({ schema: aiIdePreferenceSchema });
@@ -146,10 +150,8 @@ export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
146
150
  bind(Agent).toService(CommandChatAgent);
147
151
  bind(ChatAgent).toService(CommandChatAgent);
148
152
 
149
- bind(DefaultChatAgentId).toConstantValue({ id: OrchestratorChatAgentId });
150
- bind(FallbackChatAgentId).toConstantValue({ id: UniversalChatAgentId });
151
-
152
- bind(ChatWelcomeMessageProvider).to(IdeChatWelcomeMessageProvider);
153
+ bind(ChatWelcomeMessageProvider).to(IdeChatWelcomeMessageProvider).inSingletonScope();
154
+ bind(ChatAgentRecommendationService).to(DefaultChatAgentRecommendationService).inSingletonScope();
153
155
 
154
156
  bindToolProvider(GetWorkspaceFileList, bind);
155
157
  bindToolProvider(FileContentFunction, bind);
@@ -278,4 +280,7 @@ export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
278
280
  bind(ContextFileValidationService).toService(ContextFileValidationServiceImpl);
279
281
 
280
282
  bind(FrontendApplicationContribution).to(RememberCommandContribution);
283
+ bind(FrontendApplicationContribution).to(FixGitHubTicketCommandContribution);
284
+ bind(FrontendApplicationContribution).to(AddressGhReviewCommandContribution);
285
+ bind(FrontendApplicationContribution).to(AnalyzesGhTicketCommandContribution);
281
286
  });
@@ -17,9 +17,15 @@
17
17
  import { ChatWelcomeMessageProvider } from '@theia/ai-chat-ui/lib/browser/chat-tree-view';
18
18
  import * as React from '@theia/core/shared/react';
19
19
  import { nls } from '@theia/core/lib/common/nls';
20
- import { inject, injectable } from '@theia/core/shared/inversify';
20
+ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
21
21
  import { CommonCommands, LocalizedMarkdown, MarkdownRenderer } from '@theia/core/lib/browser';
22
+ import { AlertMessage } from '@theia/core/lib/browser/widgets/alert-message';
22
23
  import { OPEN_AI_CONFIG_VIEW } from './ai-configuration/ai-configuration-view-contribution';
24
+ import { CommandRegistry, DisposableCollection, Emitter, Event, PreferenceScope } from '@theia/core';
25
+ import { AgentService, FrontendLanguageModelRegistry } from '@theia/ai-core/lib/common';
26
+ import { PreferenceService } from '@theia/core/lib/common';
27
+ import { DEFAULT_CHAT_AGENT_PREF, BYPASS_MODEL_REQUIREMENT_PREF } from '@theia/ai-chat/lib/common/ai-chat-preferences';
28
+ import { ChatAgentRecommendationService, ChatAgentService } from '@theia/ai-chat/lib/common';
23
29
 
24
30
  const TheiaIdeAiLogo = ({ width = 200, height = 200, className = '' }) =>
25
31
  <svg
@@ -60,8 +66,138 @@ export class IdeChatWelcomeMessageProvider implements ChatWelcomeMessageProvider
60
66
  @inject(MarkdownRenderer)
61
67
  protected readonly markdownRenderer: MarkdownRenderer;
62
68
 
69
+ @inject(CommandRegistry)
70
+ protected readonly commandRegistry: CommandRegistry;
71
+
72
+ @inject(FrontendLanguageModelRegistry)
73
+ protected languageModelRegistry: FrontendLanguageModelRegistry;
74
+
75
+ @inject(PreferenceService)
76
+ protected preferenceService: PreferenceService;
77
+
78
+ @inject(ChatAgentRecommendationService)
79
+ protected recommendationService: ChatAgentRecommendationService;
80
+
81
+ @inject(ChatAgentService)
82
+ protected chatAgentService: ChatAgentService;
83
+
84
+ @inject(AgentService)
85
+ protected agentService: AgentService;
86
+
87
+ protected readonly toDispose = new DisposableCollection();
88
+ protected _hasReadyModels = false;
89
+ protected _modelRequirementBypassed = false;
90
+ protected _defaultAgent = '';
91
+ protected modelConfig: { hasModels: boolean; errorMessages: string[] } | undefined;
92
+
93
+ protected readonly onStateChangedEmitter = new Emitter<void>();
94
+
95
+ get onStateChanged(): Event<void> {
96
+ return this.onStateChangedEmitter.event;
97
+ }
98
+
99
+ @postConstruct()
100
+ protected init(): void {
101
+ this.checkLanguageModelStatus();
102
+ this.toDispose.push(
103
+ this.languageModelRegistry.onChange(() => {
104
+ this.checkLanguageModelStatus();
105
+ })
106
+ );
107
+ this.toDispose.push(
108
+ this.preferenceService.onPreferenceChanged(e => {
109
+ if (e.preferenceName === DEFAULT_CHAT_AGENT_PREF) {
110
+ const effectiveValue = this.preferenceService.get<string>(DEFAULT_CHAT_AGENT_PREF, '');
111
+ if (this._defaultAgent !== effectiveValue) {
112
+ this._defaultAgent = effectiveValue;
113
+ this.notifyStateChanged();
114
+ }
115
+ } else if (e.preferenceName === BYPASS_MODEL_REQUIREMENT_PREF) {
116
+ const effectiveValue = this.preferenceService.get<boolean>(BYPASS_MODEL_REQUIREMENT_PREF, false);
117
+ if (this._modelRequirementBypassed !== effectiveValue) {
118
+ this._modelRequirementBypassed = effectiveValue;
119
+ this.notifyStateChanged();
120
+ }
121
+ }
122
+ })
123
+ );
124
+ this.toDispose.push(
125
+ this.agentService.onDidChangeAgents(() => {
126
+ this.notifyStateChanged();
127
+ })
128
+ );
129
+ this.analyzeModelConfiguration().then(config => {
130
+ this.modelConfig = config;
131
+ this.notifyStateChanged();
132
+ });
133
+ this.preferenceService.ready.then(() => {
134
+ const defaultAgentValue = this.preferenceService.get(DEFAULT_CHAT_AGENT_PREF, '');
135
+ const bypassValue = this.preferenceService.get(BYPASS_MODEL_REQUIREMENT_PREF, false);
136
+ this._defaultAgent = defaultAgentValue;
137
+ this._modelRequirementBypassed = bypassValue;
138
+ this.notifyStateChanged();
139
+ });
140
+ }
141
+
142
+ protected async checkLanguageModelStatus(): Promise<void> {
143
+ const models = await this.languageModelRegistry.getLanguageModels();
144
+ this._hasReadyModels = models.some(model => model.status.status === 'ready');
145
+ this.modelConfig = await this.analyzeModelConfiguration();
146
+ this.notifyStateChanged();
147
+ }
148
+
149
+ protected async analyzeModelConfiguration(): Promise<{ hasModels: boolean; errorMessages: string[] }> {
150
+ const models = await this.languageModelRegistry.getLanguageModels();
151
+ const hasModels = models.length > 0;
152
+ const unavailableModels = models.filter(model => model.status.status === 'unavailable');
153
+ const errorMessages = unavailableModels
154
+ .map(model => model.status.message)
155
+ .filter((msg): msg is string => !!msg);
156
+ const uniqueErrorMessages = [...new Set(errorMessages)];
157
+ return { hasModels, errorMessages: uniqueErrorMessages };
158
+ }
159
+
160
+ protected notifyStateChanged(): void {
161
+ this.onStateChangedEmitter.fire();
162
+ }
163
+
164
+ get hasReadyModels(): boolean {
165
+ return this._hasReadyModels;
166
+ }
167
+
168
+ get modelRequirementBypassed(): boolean {
169
+ return this._modelRequirementBypassed;
170
+ }
171
+
172
+ get defaultAgent(): string {
173
+ return this._defaultAgent;
174
+ }
175
+
176
+ protected setModelRequirementBypassed(bypassed: boolean): void {
177
+ this.preferenceService.set(BYPASS_MODEL_REQUIREMENT_PREF, bypassed, PreferenceScope.User);
178
+ }
179
+
180
+ protected setDefaultAgent(agentId: string): void {
181
+ this.preferenceService.set(DEFAULT_CHAT_AGENT_PREF, agentId, PreferenceScope.User);
182
+ }
183
+
184
+ dispose(): void {
185
+ this.toDispose.dispose();
186
+ this.onStateChangedEmitter.dispose();
187
+ }
188
+
63
189
  renderWelcomeMessage(): React.ReactNode {
64
- return <div className={'theia-WelcomeMessage'}>
190
+ if (!this._hasReadyModels && !this._modelRequirementBypassed) {
191
+ return this.renderModelConfigurationScreen();
192
+ }
193
+ if (!this._defaultAgent) {
194
+ return this.renderAgentSelectionScreen();
195
+ }
196
+ return this.renderWelcomeScreen();
197
+ }
198
+
199
+ protected renderWelcomeScreen(): React.ReactNode {
200
+ return <div className={'theia-WelcomeMessage'} key="normal-welcome">
65
201
  <TheiaIdeAiLogo width={200} height={200} className="theia-WelcomeMessage-Logo" />
66
202
  <LocalizedMarkdown
67
203
  localizationKey="theia/ai/ide/chatWelcomeMessage"
@@ -82,6 +218,168 @@ Lean more in the [documentation](https://theia-ide.org/docs/user_ai/#chat).
82
218
  </div>;
83
219
  }
84
220
 
221
+ protected renderModelConfigurationScreen(): React.ReactNode {
222
+ const config = this.modelConfig ?? { hasModels: false, errorMessages: [] };
223
+ const { hasModels, errorMessages } = config;
224
+
225
+ if (!hasModels) {
226
+ return <div className={'theia-WelcomeMessage'} key="setup-state">
227
+ <div className="theia-WelcomeMessage-ErrorIcon">⚠️</div>
228
+ <LocalizedMarkdown
229
+ localizationKey="theia/ai/ide/noLanguageModelProviders"
230
+ defaultMarkdown={`
231
+ ## No Language Model Providers Available
232
+
233
+ No language model provider packages are installed in this IDE.
234
+
235
+ This typically happens in custom IDE distributions where Theia AI language model packages have been omitted.
236
+
237
+ **To resolve this:**
238
+
239
+ - Install one or more language model provider packages (e.g., '@theia/ai-openai', '@theia/ai-anthropic', '@theia/ai-ollama')
240
+ - Or use agents that don't require Theia Language Models (e.g., Claude Code)
241
+ `}
242
+ markdownRenderer={this.markdownRenderer}
243
+ className="theia-WelcomeMessage-Content"
244
+ />
245
+ <div className="theia-WelcomeMessage-Actions">
246
+ <button
247
+ className="theia-button main"
248
+ onClick={() => this.setModelRequirementBypassed(true)}>
249
+ {nls.localize('theia/ai/ide/continueAnyway', 'Continue Anyway')}
250
+ </button>
251
+ </div>
252
+ <small className="theia-WelcomeMessage-Hint">
253
+ {nls.localize('theia/ai/ide/bypassHint', 'Some agents like Claude Code don\'t require Theia Language Models')}
254
+ </small>
255
+ </div>;
256
+ }
257
+
258
+ return <div className={'theia-WelcomeMessage'} key="setup-state">
259
+ <TheiaIdeAiLogo width={150} height={150} className="theia-WelcomeMessage-Logo" />
260
+ <LocalizedMarkdown
261
+ key="configure-provider-hasmodels"
262
+ localizationKey="theia/ai/ide/configureProvider"
263
+ defaultMarkdown={`
264
+ # Please configure at least one language model provider
265
+
266
+ If you want to use [OpenAI]({0}), [Anthropic]({1}) or [GoogleAI]({2}) hosted models, please enter an API key in the settings.
267
+
268
+ If you want to use another provider such as Ollama, please configure it in the settings and adapt agents or a model alias to use your custom model.
269
+
270
+ **Note:** Some agents, such as Claude Code do not need a provider to be configured, just continue in this case.
271
+
272
+ See the [documentation](https://theia-ide.org/docs/user_ai/) for more details.
273
+ `}
274
+ args={[
275
+ `command:${CommonCommands.OPEN_PREFERENCES.id}?ai-features.languageModels.openai`,
276
+ `command:${CommonCommands.OPEN_PREFERENCES.id}?ai-features.languageModels.anthropic`,
277
+ `command:${CommonCommands.OPEN_PREFERENCES.id}?ai-features.languageModels.googleai`
278
+ ]}
279
+ markdownRenderer={this.markdownRenderer}
280
+ className="theia-WelcomeMessage-Content"
281
+ markdownOptions={{
282
+ supportHtml: true,
283
+ isTrusted: { enabledCommands: [CommonCommands.OPEN_PREFERENCES.id] }
284
+ }}
285
+ />
286
+ {errorMessages.length > 0 && (
287
+ <>
288
+ <LocalizedMarkdown
289
+ key="configuration-state"
290
+ localizationKey="theia/ai/ide/configurationState"
291
+ defaultMarkdown="# Current Configuration State"
292
+ markdownRenderer={this.markdownRenderer}
293
+ className="theia-WelcomeMessage-Content"
294
+ />
295
+ <div className="theia-WelcomeMessage-Content">
296
+ <ul className="theia-WelcomeMessage-IssuesList">
297
+ {errorMessages.map((msg, idx) => <li key={idx}>{msg}</li>)}
298
+ </ul>
299
+ </div>
300
+ </>
301
+ )}
302
+ <div className="theia-WelcomeMessage-Actions">
303
+ <button
304
+ className="theia-button main"
305
+ onClick={() => this.commandRegistry.executeCommand(CommonCommands.OPEN_PREFERENCES.id, 'ai-features')}>
306
+ {nls.localize('theia/ai/ide/openSettings', 'Open AI Settings')}
307
+ </button>
308
+ <button
309
+ className="theia-button secondary"
310
+ onClick={() => this.setModelRequirementBypassed(true)}>
311
+ {nls.localize('theia/ai/ide/continueAnyway', 'Continue Anyway')}
312
+ </button>
313
+ </div>
314
+ <small className="theia-WelcomeMessage-Hint">
315
+ {nls.localize('theia/ai/ide/bypassHint', 'Some agents like Claude Code don\'t require Theia Language Models')}
316
+ </small>
317
+ </div>;
318
+ }
319
+
320
+ protected renderAgentSelectionScreen(): React.ReactNode {
321
+ const recommendedAgents = this.recommendationService.getRecommendedAgents()
322
+ .filter(agent => this.chatAgentService.getAgent(agent.id) !== undefined);
323
+
324
+ return <div className={'theia-WelcomeMessage theia-WelcomeMessage-AgentSelection'} key="agent-selection">
325
+ <TheiaIdeAiLogo width={200} height={200} className="theia-WelcomeMessage-Logo" />
326
+ <LocalizedMarkdown
327
+ localizationKey="theia/ai/ide/selectDefaultAgent"
328
+ defaultMarkdown={`
329
+ ## Select a Default Chat Agent
330
+
331
+ Choose the agent to use by default. You can always override this by mentioning @AgentName in your message.
332
+ `}
333
+ markdownRenderer={this.markdownRenderer}
334
+ className="theia-WelcomeMessage-Content"
335
+ />
336
+ {recommendedAgents.length > 0 && (
337
+ <p className="theia-WelcomeMessage-RecommendedNote">
338
+ {nls.localize('theia/ai/ide/recommendedAgents', 'Recommended agents:')}
339
+ </p>
340
+ )}
341
+ {recommendedAgents.length > 0 ? (
342
+ <>
343
+ <div className="theia-WelcomeMessage-AgentButtons">
344
+ {recommendedAgents.map(agent => (
345
+ <button
346
+ key={agent.id}
347
+ className="theia-WelcomeMessage-AgentButton"
348
+ onClick={() => this.setDefaultAgent(agent.id)}
349
+ title={agent.description}>
350
+ <span className="theia-WelcomeMessage-AgentButton-Icon">@</span>
351
+ <span className="theia-WelcomeMessage-AgentButton-Label">{agent.label}</span>
352
+ </button>
353
+ ))}
354
+ </div>
355
+ <div className="theia-WelcomeMessage-AlternativeOptions">
356
+ <p className="theia-WelcomeMessage-OrDivider">
357
+ {nls.localize('theia/ai/ide/or', 'or')}
358
+ </p>
359
+ </div>
360
+ </>
361
+ ) : (
362
+ <AlertMessage
363
+ type='WARNING'
364
+ header={nls.localize('theia/ai/ide/noRecommendedAgents', 'No recommended agents are available.')}
365
+ />
366
+ )}
367
+ <AlertMessage
368
+ type='INFO'
369
+ header={recommendedAgents.length > 0
370
+ ? nls.localize('theia/ai/ide/moreAgentsAvailable/header', 'More agents are available')
371
+ : nls.localize('theia/ai/ide/configureAgent/header', 'Configure a default agent')}>
372
+ <LocalizedMarkdown
373
+ localizationKey="theia/ai/ide/moreAgentsAvailable"
374
+ defaultMarkdown='Use @AgentName to try others or configure a different default in [preferences]({0}).'
375
+ args={[`command:${CommonCommands.OPEN_PREFERENCES.id}?ai-features.chat`]}
376
+ markdownRenderer={this.markdownRenderer}
377
+ markdownOptions={{ isTrusted: { enabledCommands: [CommonCommands.OPEN_PREFERENCES.id] } }}
378
+ />
379
+ </AlertMessage>
380
+ </div>;
381
+ }
382
+
85
383
  renderDisabledMessage(): React.ReactNode {
86
384
  const openAiHistory = 'aiHistory:open';
87
385
 
@@ -0,0 +1,160 @@
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 { FrontendApplicationContribution } from '@theia/core/lib/browser';
18
+ import { inject, injectable } from '@theia/core/shared/inversify';
19
+ import { PromptService } from '@theia/ai-core/lib/common';
20
+ import { nls } from '@theia/core';
21
+ import { AGENT_DELEGATION_FUNCTION_ID } from '@theia/ai-chat/lib/browser/agent-delegation-tool';
22
+ import { GitHubChatAgentId } from './github-chat-agent';
23
+
24
+ @injectable()
25
+ export class FixGitHubTicketCommandContribution implements FrontendApplicationContribution {
26
+
27
+ @inject(PromptService)
28
+ protected readonly promptService: PromptService;
29
+
30
+ onStart(): void {
31
+ this.registerFixGitHubTicketCommand();
32
+ }
33
+
34
+ protected registerFixGitHubTicketCommand(): void {
35
+ const commandTemplate = this.buildCommandTemplate();
36
+
37
+ this.promptService.addBuiltInPromptFragment({
38
+ id: 'fix-gh-ticket',
39
+ template: commandTemplate,
40
+ isCommand: true,
41
+ commandName: 'fix-gh-ticket',
42
+ commandDescription: nls.localize(
43
+ 'theia/ai-ide/fixGhTicketCommand/description',
44
+ 'Analyze a GitHub ticket and implement the solution'
45
+ ),
46
+ commandArgumentHint: nls.localize(
47
+ 'theia/ai-ide/fixGhTicketCommand/argumentHint',
48
+ '<ticket-number>'
49
+ ),
50
+ commandAgents: ['Coder']
51
+ });
52
+ }
53
+
54
+ protected buildCommandTemplate(): string {
55
+ return `You have been asked to analyze a GitHub ticket and implement the solution.
56
+
57
+ ## Ticket Number
58
+ $ARGUMENTS
59
+
60
+ ## Task Overview
61
+ You need to retrieve details about the specified GitHub ticket, analyze whether it can be implemented, and if so, implement the solution.
62
+
63
+ ## Step 1: Retrieve Ticket Information
64
+ Use the ~{${AGENT_DELEGATION_FUNCTION_ID}} tool to delegate to the GitHub agent and retrieve comprehensive information about the ticket.
65
+
66
+ **Agent ID:** '${GitHubChatAgentId}'
67
+ **Prompt:** Ask the GitHub agent to retrieve ALL details about issue/ticket #$ARGUMENTS, specifically requesting:
68
+ - The complete issue title and description/body
69
+ - All comments on the issue (this is critical for understanding the full context)
70
+ - Labels and assignees
71
+ - Issue state (open/closed)
72
+ - Any referenced issues or pull requests mentioned in the description or comments
73
+ - If other issues are referenced, retrieve their details as well
74
+
75
+ Example delegation prompt:
76
+ \`\`\`
77
+ Please retrieve comprehensive information about issue #$ARGUMENTS. I need:
78
+ 1. The complete issue title, body/description, labels, state, and assignees
79
+ 2. ALL comments on this issue - every single comment is important for understanding the context
80
+ 3. Any issues or PRs that are referenced or linked in the description or comments
81
+ 4. For any referenced issues, please also retrieve their titles and descriptions
82
+
83
+ This is for implementing the issue, so completeness is crucial.
84
+ \`\`\`
85
+
86
+ ## Step 2: Analyze AI Solvability
87
+ After receiving the ticket information, analyze whether this ticket can be implemented by you. Consider:
88
+
89
+ ### Criteria for Implementable Tickets:
90
+ - **Clear requirements**: The ticket clearly describes what needs to be done
91
+ - **Defined scope**: The scope of changes is well-defined and bounded
92
+ - **Technical feasibility**: The task involves code changes that can be reasoned about
93
+ - **Sufficient context**: Enough information is provided to understand the problem and solution
94
+ - **Reproducible**: For bugs, there's enough information to understand and reproduce the issue
95
+
96
+ ### Criteria for Non-Implementable Tickets:
97
+ - **Ambiguous requirements**: The ticket is vague or open to multiple interpretations
98
+ - **Missing context**: Critical information is missing (e.g., environment details, reproduction steps)
99
+ - **External dependencies**: Requires access to external systems, credentials, or human interaction
100
+ - **Design decisions needed**: Requires architectural decisions that need human judgment
101
+ - **Insufficient information**: Cannot determine what success looks like
102
+
103
+ ## Step 3: Respond Based on Analysis
104
+
105
+ ### If the ticket CANNOT be implemented:
106
+ Provide a clear explanation:
107
+ 1. **Reason**: Explain specifically why this ticket cannot be implemented by AI
108
+ 2. **Missing Information**: List what information is missing or unclear
109
+ 3. **Questions for Clarification**: Ask specific questions that, if answered, might make the ticket implementable
110
+
111
+ Example response format:
112
+ \`\`\`
113
+ ## Analysis Result: Cannot Be Implemented
114
+
115
+ ### Reason
116
+ [Explain why]
117
+
118
+ ### Missing Information
119
+ - [Item 1]
120
+ - [Item 2]
121
+
122
+ ### Questions for Clarification
123
+ 1. [Question 1]
124
+ 2. [Question 2]
125
+
126
+ Please provide the missing information and I will proceed with the implementation.
127
+ \`\`\`
128
+
129
+ ### If the ticket CAN be implemented:
130
+ Proceed with the implementation:
131
+
132
+ 1. **Briefly summarize** what the ticket requests and your implementation approach
133
+ 2. **Explore the codebase** to understand the existing code structure and find relevant files
134
+ 3. **Implement the solution** by making the necessary code changes using your file modification tools
135
+ 4. **Explain your changes** as you make them
136
+ 5. **Consider edge cases** and handle them appropriately
137
+ 6. **Suggest testing steps** the user should perform to verify the implementation
138
+
139
+ Example response format:
140
+ \`\`\`
141
+ ## Analysis Result: Can Be Implemented
142
+
143
+ ### Summary
144
+ [Brief summary of the ticket and your approach]
145
+
146
+ ### Implementation
147
+ [Proceed to explore the codebase and implement the changes, explaining as you go]
148
+ \`\`\`
149
+
150
+ ## Important Guidelines for Implementation
151
+ - Always explore the codebase first to understand the existing patterns and conventions
152
+ - Follow the existing code style and patterns in the project
153
+ - Make incremental changes and explain each step
154
+ - If you encounter unexpected issues during implementation, explain them and ask for guidance
155
+ - After implementation, summarize what was changed and suggest how to test the changes
156
+
157
+ Remember: If at any point during implementation you realize you need more information or the task is more complex than initially assessed, stop and ask for clarification rather
158
+ than making assumptions.`;
159
+ }
160
+ }
@@ -0,0 +1,90 @@
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
+ /* Base styles for all AI configuration widgets */
18
+
19
+ .ai-configuration-widget-content {
20
+ width: 100%;
21
+ height: 100%;
22
+ overflow: auto;
23
+ }
24
+
25
+ /* Empty state styling */
26
+ .ai-configuration-empty-state {
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ height: 100%;
31
+ padding: var(--theia-ui-padding);
32
+ }
33
+
34
+ .ai-empty-state-message {
35
+ color: var(--theia-descriptionForeground);
36
+ font-style: italic;
37
+ }
38
+
39
+ /* Configuration section styling */
40
+ .ai-configuration-section {
41
+ margin-bottom: calc(var(--theia-ui-padding) * 2);
42
+ }
43
+
44
+ .ai-configuration-section:last-child {
45
+ margin-bottom: 0;
46
+ }
47
+
48
+ .ai-configuration-section-content {
49
+ padding: var(--theia-ui-padding) 0;
50
+ }
51
+
52
+ .ai-configuration-section-content ul,
53
+ .ai-configuration-section-content ol {
54
+ padding-left: calc(var(--theia-ui-padding) * 2);
55
+ margin: 0 var(--theia-ui-padding) 0;
56
+ }
57
+
58
+ /* Expandable section styling */
59
+ .ai-expandable-section {
60
+ margin-bottom: var(--theia-ui-padding);
61
+ }
62
+
63
+ .ai-expandable-section-header {
64
+ display: flex;
65
+ align-items: center;
66
+ padding: calc(var(--theia-ui-padding) / 2) 0;
67
+ cursor: pointer;
68
+ user-select: none;
69
+ }
70
+
71
+ .ai-expandable-section-header:hover {
72
+ background-color: var(--theia-list-hoverBackground);
73
+ }
74
+
75
+ .ai-expandable-section-icon {
76
+ display: flex;
77
+ align-items: center;
78
+ margin-right: calc(var(--theia-ui-padding) / 2);
79
+ color: var(--theia-icon-foreground);
80
+ }
81
+
82
+ .ai-expandable-section-title {
83
+ flex: 1;
84
+ font-weight: 500;
85
+ }
86
+
87
+ .ai-expandable-section-content {
88
+ padding-left: calc(var(--theia-ui-padding) * 2);
89
+ padding-top: calc(var(--theia-ui-padding) / 2);
90
+ }