@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
@@ -14,24 +14,29 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { ReactWidget, ConfirmDialog } from '@theia/core/lib/browser';
17
+ import { ConfirmDialog } from '@theia/core/lib/browser';
18
18
  import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
19
19
  import * as React from '@theia/core/shared/react';
20
20
  import { ToolInvocationRegistry } from '@theia/ai-core';
21
21
  import { nls, PreferenceService } from '@theia/core';
22
22
  import { ToolConfirmationManager } from '@theia/ai-chat/lib/browser/chat-tool-preference-bindings';
23
23
  import { ToolConfirmationMode } from '@theia/ai-chat/lib/common/chat-tool-preferences';
24
+ import { AITableConfigurationWidget, TableColumn } from './base/ai-table-configuration-widget';
24
25
 
25
26
  const TOOL_OPTIONS: { value: ToolConfirmationMode, label: string, icon: string }[] = [
26
27
  { value: ToolConfirmationMode.DISABLED, label: nls.localizeByDefault('Disabled'), icon: 'close' },
27
28
  { value: ToolConfirmationMode.CONFIRM, label: nls.localize('theia/ai/ide/toolsConfiguration/toolOptions/confirm/label', 'Confirm'), icon: 'question' },
28
- { value: ToolConfirmationMode.ALWAYS_ALLOW, label: nls.localize('theia/ai/ide/toolsConfiguration/toolOptions/alwaysAllow/label', 'Always Allow'), icon: 'thumbsup' },
29
+ { value: ToolConfirmationMode.ALWAYS_ALLOW, label: nls.localizeByDefault('Always Allow'), icon: 'thumbsup' },
29
30
  ];
30
31
 
32
+ interface ToolItem {
33
+ name: string;
34
+ }
35
+
31
36
  @injectable()
32
- export class AIToolsConfigurationWidget extends ReactWidget {
37
+ export class AIToolsConfigurationWidget extends AITableConfigurationWidget<ToolItem> {
33
38
  static readonly ID = 'ai-tools-configuration-widget';
34
- static readonly LABEL = nls.localize('theia/ai/ide/toolsConfiguration/label', 'Tools');
39
+ static readonly LABEL = nls.localizeByDefault('Tools');
35
40
 
36
41
  @inject(ToolConfirmationManager)
37
42
  protected readonly confirmationManager: ToolConfirmationManager;
@@ -42,19 +47,17 @@ export class AIToolsConfigurationWidget extends ReactWidget {
42
47
  @inject(ToolInvocationRegistry)
43
48
  protected readonly toolInvocationRegistry: ToolInvocationRegistry;
44
49
 
45
- // Mocked tool list and state
46
- protected tools: string[] = [];
47
50
  protected toolConfirmationModes: Record<string, ToolConfirmationMode> = {};
48
51
  protected defaultState: ToolConfirmationMode;
49
- protected loading = true;
50
52
 
51
53
  @postConstruct()
52
54
  protected init(): void {
53
55
  this.id = AIToolsConfigurationWidget.ID;
54
56
  this.title.label = AIToolsConfigurationWidget.LABEL;
55
57
  this.title.closable = false;
56
- this.loadData();
57
- this.update();
58
+ this.addClass('ai-configuration-widget');
59
+
60
+ this.loadData().then(() => this.update());
58
61
  this.toDispose.pushAll([
59
62
  this.preferenceService.onPreferenceChanged(async e => {
60
63
  if (e.preferenceName === 'ai-features.chat.toolConfirmation') {
@@ -64,23 +67,25 @@ export class AIToolsConfigurationWidget extends ReactWidget {
64
67
  }
65
68
  }),
66
69
  this.toolInvocationRegistry.onDidChange(async () => {
67
- this.tools = await this.loadTools();
70
+ await this.loadItems();
68
71
  this.update();
69
72
  })
70
73
  ]);
71
74
  }
72
75
 
73
76
  protected async loadData(): Promise<void> {
74
- // Replace with real service calls
75
- this.tools = await this.loadTools();
77
+ await this.loadItems();
76
78
  this.defaultState = await this.loadDefaultConfirmation();
77
79
  this.toolConfirmationModes = await this.loadToolConfigurationModes();
78
- this.loading = false;
79
- this.update();
80
80
  }
81
81
 
82
- protected async loadTools(): Promise<string[]> {
83
- return this.toolInvocationRegistry.getAllFunctions().map(func => func.name);
82
+ protected async loadItems(): Promise<void> {
83
+ const toolNames = this.toolInvocationRegistry.getAllFunctions().map(func => func.name);
84
+ this.items = toolNames.map(name => ({ name }));
85
+ }
86
+
87
+ protected getItemId(item: ToolItem): string {
88
+ return item.name;
84
89
  }
85
90
  protected async loadDefaultConfirmation(): Promise<ToolConfirmationMode> {
86
91
  return this.confirmationManager.getConfirmationMode('*', 'doesNotMatter');
@@ -95,9 +100,9 @@ export class AIToolsConfigurationWidget extends ReactWidget {
95
100
  await this.confirmationManager.setConfirmationMode('*', state);
96
101
  }
97
102
 
98
- protected handleToolConfirmationModeChange = async (tool: string, event: React.ChangeEvent<HTMLSelectElement>) => {
103
+ protected handleToolConfirmationModeChange = async (toolName: string, event: React.ChangeEvent<HTMLSelectElement>) => {
99
104
  const newState = event.target.value as ToolConfirmationMode;
100
- await this.updateToolConfirmationMode(tool, newState);
105
+ await this.updateToolConfirmationMode(toolName, newState);
101
106
  };
102
107
  protected handleDefaultStateChange = async (event: React.ChangeEvent<HTMLSelectElement>) => {
103
108
  const newState = event.target.value as ToolConfirmationMode;
@@ -118,25 +123,23 @@ export class AIToolsConfigurationWidget extends ReactWidget {
118
123
  }
119
124
  }
120
125
 
121
- protected render(): React.ReactNode {
122
- if (this.loading) {
123
- return <div>{nls.localize('theia/ai/ide/toolsConfiguration/loading', 'Loading tools...')}</div>;
124
- }
125
- return <div className='ai-tools-configuration-container'>
126
- <div className='ai-tools-configuration-default-section' style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
127
- <div className='ai-tools-configuration-default-label'>{nls.localize('theia/ai/ide/toolsConfiguration/default/label', 'Default Tool Confirmation Mode:')}</div>
126
+ protected override renderHeader(): React.ReactNode {
127
+ return (
128
+ <div className="ai-tools-configuration-header">
129
+ <div style={{ fontWeight: 500 }}>
130
+ {nls.localize('theia/ai/ide/toolsConfiguration/default/label', 'Default Tool Confirmation Mode:')}
131
+ </div>
128
132
  <select
129
- className="ai-tools-configuration-default-select"
133
+ className="theia-select"
130
134
  value={this.defaultState}
131
135
  onChange={this.handleDefaultStateChange}
132
- style={{ marginLeft: 8 }}
133
136
  >
134
137
  {TOOL_OPTIONS.map(opt => (
135
138
  <option key={opt.value} value={opt.value}>{opt.label}</option>
136
139
  ))}
137
140
  </select>
138
141
  <button
139
- className='ai-tools-configuration-reset-btn'
142
+ className='theia-button secondary ai-tools-reset-button'
140
143
  style={{ marginLeft: 'auto' }}
141
144
  title={nls.localize('theia/ai/ide/toolsConfiguration/resetAllTooltip', 'Reset all tools to default')}
142
145
  onClick={() => this.resetAllToolsToDefault()}
@@ -144,38 +147,44 @@ export class AIToolsConfigurationWidget extends ReactWidget {
144
147
  {nls.localize('theia/ai/ide/toolsConfiguration/resetAll', 'Reset All')}
145
148
  </button>
146
149
  </div>
147
- <div className='ai-tools-configuration-tools-section'>
148
- <div className='ai-tools-configuration-tools-label'>{nls.localize('theia/ai/ide/toolsConfiguration/tools/label', 'Tools')}</div>
149
- <ul className='ai-tools-configuration-tools-list'>
150
- {this.tools.map(tool => {
151
- const state = this.toolConfirmationModes[tool] || this.defaultState;
152
- const isDefault = state === this.defaultState;
153
- const selectClass = 'ai-tools-configuration-tool-select';
154
- return (
155
- <li
156
- key={tool}
157
- className={
158
- 'ai-tools-configuration-tool-item ' +
159
- (isDefault ? 'default' : 'custom')
160
- }
161
- >
162
- <span className='ai-tools-configuration-tool-name'>{tool}</span>
163
- <select
164
- className={selectClass}
165
- value={state}
166
- onChange={e => this.handleToolConfirmationModeChange(tool, e)}
167
- >
168
- {TOOL_OPTIONS.map(opt => (
169
- <option key={opt.value} value={opt.value}>
170
- {opt.label}
171
- </option>
172
- ))}
173
- </select>
174
- </li>
175
- );
176
- })}
177
- </ul>
178
- </div>
179
- </div>;
150
+ );
151
+ }
152
+
153
+ protected getColumns(): TableColumn<ToolItem>[] {
154
+ return [
155
+ {
156
+ id: 'tool-name',
157
+ label: nls.localizeByDefault('Tool'),
158
+ className: 'tool-name-column',
159
+ renderCell: (item: ToolItem) => <span>{item.name}</span>
160
+ },
161
+ {
162
+ id: 'confirmation-mode',
163
+ label: nls.localize('theia/ai/ide/toolsConfiguration/confirmationMode/label', 'Confirmation Mode'),
164
+ className: 'confirmation-mode-column',
165
+ renderCell: (item: ToolItem) => {
166
+ const state = this.toolConfirmationModes[item.name] || this.defaultState;
167
+ return (
168
+ <select
169
+ className="theia-select"
170
+ value={state}
171
+ onChange={e => this.handleToolConfirmationModeChange(item.name, e)}
172
+ >
173
+ {TOOL_OPTIONS.map(opt => (
174
+ <option key={opt.value} value={opt.value}>
175
+ {opt.label}
176
+ </option>
177
+ ))}
178
+ </select>
179
+ );
180
+ }
181
+ }
182
+ ];
183
+ }
184
+
185
+ protected override getRowClassName(item: ToolItem): string {
186
+ const state = this.toolConfirmationModes[item.name] || this.defaultState;
187
+ const isDefault = state === this.defaultState;
188
+ return isDefault ? 'default-mode' : 'custom-mode';
180
189
  }
181
190
  }
@@ -15,15 +15,16 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { Agent, AgentService, AIVariable, AIVariableService } from '@theia/ai-core/lib/common';
18
- import { codicon, ReactWidget } from '@theia/core/lib/browser';
18
+ import { codicon } from '@theia/core/lib/browser';
19
19
  import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
20
20
  import * as React from '@theia/core/shared/react';
21
21
  import { AIAgentConfigurationWidget } from './agent-configuration-widget';
22
22
  import { AIConfigurationSelectionService } from './ai-configuration-service';
23
23
  import { nls } from '@theia/core';
24
+ import { AIListDetailConfigurationWidget } from './base/ai-list-detail-configuration-widget';
24
25
 
25
26
  @injectable()
26
- export class AIVariableConfigurationWidget extends ReactWidget {
27
+ export class AIVariableConfigurationWidget extends AIListDetailConfigurationWidget<AIVariable> {
27
28
 
28
29
  static readonly ID = 'ai-variable-configuration-container-widget';
29
30
  static readonly LABEL = nls.localizeByDefault('Variables');
@@ -42,60 +43,109 @@ export class AIVariableConfigurationWidget extends ReactWidget {
42
43
  this.id = AIVariableConfigurationWidget.ID;
43
44
  this.title.label = AIVariableConfigurationWidget.LABEL;
44
45
  this.title.closable = false;
45
- this.update();
46
- this.toDispose.push(this.variableService.onDidChangeVariables(() => this.update()));
47
- }
46
+ this.addClass('ai-configuration-widget');
48
47
 
49
- protected render(): React.ReactNode {
50
- return <div className='configuration-variables-list'>
51
- <ul>
52
- {this.variableService.getVariables().map(variable =>
53
- <li key={variable.id} className='variable-item' >
54
- <div className='settings-section-title settings-section-category-title' style={{ paddingLeft: 0, paddingBottom: 10 }}>{variable.name}</div>
55
- <small>{variable.id}</small>
56
- <small>{variable.description}</small>
57
- {this.renderReferencedVariables(variable)}
58
- {this.renderArgs(variable)}
59
- </li>
60
- )}
61
- </ul>
62
- </div>;
48
+ this.loadItems().then(() => this.update());
49
+ this.toDispose.push(this.variableService.onDidChangeVariables(async () => {
50
+ await this.loadItems();
51
+ this.update();
52
+ }));
63
53
  }
64
54
 
65
- protected renderReferencedVariables(variable: AIVariable): React.ReactNode | undefined {
66
- const agents = this.getAgentsForVariable(variable);
67
- if (agents.length === 0) {
68
- return;
55
+ protected async loadItems(): Promise<void> {
56
+ this.items = this.variableService.getVariables();
57
+ if (this.items.length > 0 && !this.selectedItem) {
58
+ this.selectedItem = this.items[0];
69
59
  }
60
+ }
70
61
 
71
- return <div>
72
- <h3>{nls.localize('theia/ai/ide/variableConfiguration/agents', 'Agents')}</h3>
73
- <ul className='variable-references'>
74
- {agents.map(agent => <li key={agent.id} className='theia-TreeNode theia-CompositeTreeNode theia-ExpandableTreeNode theia-mod-selected'>
75
- <div onClick={() => { this.showAgentConfiguration(agent); }} className='variable-reference'>
76
- <span>{agent.name}</span>
77
- <i className={codicon('chevron-right')}></i>
78
- </div></li>)}
79
- </ul>
80
- </div>;
62
+ protected getItemId(variable: AIVariable): string {
63
+ return variable.id;
64
+ }
65
+
66
+ protected getItemLabel(variable: AIVariable): string {
67
+ return variable.name;
68
+ }
69
+
70
+ protected override getEmptySelectionMessage(): string {
71
+ return nls.localize('theia/ai/ide/variableConfiguration/selectVariable', 'Please select a Variable.');
72
+ }
73
+
74
+ protected renderItemDetail(variable: AIVariable): React.ReactNode {
75
+ return (
76
+ <div>
77
+ <div className="settings-section-title settings-section-category-title">
78
+ {variable.name}
79
+ <pre className='ai-id-label'>Id: {variable.id}</pre>
80
+ </div>
81
+
82
+ {variable.description && (
83
+ <div style={{
84
+ marginBottom: 'calc(var(--theia-ui-padding) * 2)',
85
+ color: 'var(--theia-descriptionForeground)',
86
+ lineHeight: '1.5'
87
+ }}>
88
+ {variable.description}
89
+ </div>
90
+ )}
91
+
92
+ {this.renderArgs(variable)}
93
+ {this.renderReferencedVariables(variable)}
94
+ </div>
95
+ );
81
96
  }
82
97
 
83
98
  protected renderArgs(variable: AIVariable): React.ReactNode | undefined {
84
99
  if (variable.args === undefined || variable.args.length === 0) {
85
- return;
100
+ return undefined;
86
101
  }
87
102
 
88
- return <div className='variable-args-container'>
89
- <h3>{nls.localize('theia/ai/ide/variableConfiguration/variableArgs', 'Variable Arguments')}</h3>
90
- <div className='variable-args'>
91
- {variable.args.map(arg =>
92
- <React.Fragment key={arg.name}>
93
- <span>{arg.name}</span>
94
- <small>{arg.description}</small>
95
- </React.Fragment>
96
- )}
97
- </div>
98
- </div>;
103
+ return (
104
+ <>
105
+ <div className="settings-section-subcategory-title">
106
+ {nls.localize('theia/ai/ide/variableConfiguration/variableArgs', 'Arguments')}
107
+ </div>
108
+ <div style={{
109
+ display: 'grid',
110
+ gridTemplateColumns: 'auto 1fr',
111
+ gap: 'calc(var(--theia-ui-padding) / 2) var(--theia-ui-padding)',
112
+ alignItems: 'start',
113
+ marginBottom: 'calc(var(--theia-ui-padding) * 2)'
114
+ }}>
115
+ {variable.args.map(arg => (
116
+ <React.Fragment key={arg.name}>
117
+ <span style={{ fontWeight: 500 }}>{arg.name}:</span>
118
+ <span style={{ color: 'var(--theia-descriptionForeground)' }}>
119
+ {arg.description}
120
+ </span>
121
+ </React.Fragment>
122
+ ))}
123
+ </div>
124
+ </>
125
+ );
126
+ }
127
+
128
+ protected renderReferencedVariables(variable: AIVariable): React.ReactNode | undefined {
129
+ const agents = this.getAgentsForVariable(variable);
130
+ if (agents.length === 0) {
131
+ return undefined;
132
+ }
133
+
134
+ return (
135
+ <>
136
+ <div className="settings-section-subcategory-title">
137
+ {nls.localize('theia/ai/ide/variableConfiguration/usedByAgents', 'Used by Agents')}
138
+ </div>
139
+ <ul className="variable-agent-list">
140
+ {agents.map(agent => (
141
+ <li key={agent.id} className="variable-agent-item" onClick={() => this.showAgentConfiguration(agent)}>
142
+ <span>{agent.name}</span>
143
+ <i className={codicon('chevron-right')}></i>
144
+ </li>
145
+ ))}
146
+ </ul>
147
+ </>
148
+ );
99
149
  }
100
150
 
101
151
  protected showAgentConfiguration(agent: Agent): void {
@@ -0,0 +1,176 @@
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 AnalyzesGhTicketCommandContribution implements FrontendApplicationContribution {
26
+
27
+ @inject(PromptService)
28
+ protected readonly promptService: PromptService;
29
+
30
+ onStart(): void {
31
+ this.registerGitHubTicketCommand();
32
+ }
33
+
34
+ protected registerGitHubTicketCommand(): void {
35
+ const commandTemplate = this.buildCommandTemplate();
36
+
37
+ this.promptService.addBuiltInPromptFragment({
38
+ id: 'analyze-gh-ticket',
39
+ template: commandTemplate,
40
+ isCommand: true,
41
+ commandName: 'analyze-gh-ticket',
42
+ commandDescription: nls.localize(
43
+ 'theia/ai-ide/ticketCommand/description',
44
+ 'Analyze a GitHub ticket and create an implementation plan'
45
+ ),
46
+ commandArgumentHint: nls.localize(
47
+ 'theia/ai-ide/ticketCommand/argumentHint',
48
+ '<ticket-number>'
49
+ ),
50
+ commandAgents: ['Architect']
51
+ });
52
+ }
53
+
54
+ protected buildCommandTemplate(): string {
55
+ return `You have been asked to analyze a GitHub ticket and create an implementation plan.
56
+
57
+ ## Ticket Number
58
+ $ARGUMENTS
59
+
60
+ ## Task Overview
61
+ You need to retrieve details about the specified GitHub ticket and analyze whether it can be implemented by an AI coding agent.
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 analyzing whether the issue can be implemented, so completeness is crucial.
84
+ \`\`\`
85
+
86
+ ## Step 2: Analyze AI Solvability
87
+ After receiving the ticket information, analyze whether this ticket can be solved by an AI coding agent. Consider:
88
+
89
+ ### Criteria for AI-Solvable 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-AI-Solvable 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 solved by AI:
106
+ Provide a clear explanation:
107
+ 1. **Reason**: Explain specifically why this ticket cannot be solved 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 solvable
110
+
111
+ Example response format:
112
+ \`\`\`
113
+ ## Analysis Result: Cannot Be Solved by AI
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
+
127
+ ### If the ticket CAN be solved by AI:
128
+ Create a detailed implementation plan:
129
+
130
+ 1. **Summary**: Brief summary of what the ticket requests
131
+ 2. **Analysis**: Your understanding of the problem and the proposed solution approach
132
+ 3. **Implementation Plan**: A step-by-step plan that a coding agent can follow, including:
133
+ - Files that likely need to be modified or created
134
+ - Specific changes to be made in each file
135
+ - Order of operations
136
+ - Testing considerations
137
+ 4. **Potential Challenges**: Any challenges or edge cases to be aware of
138
+ 5. **Success Criteria**: How to verify the implementation is correct
139
+
140
+ Example response format:
141
+ \`\`\`
142
+ ## Analysis Result: Can Be Solved by AI
143
+
144
+ ### Summary
145
+ [Brief summary of the ticket]
146
+
147
+ ### Analysis
148
+ [Your understanding of the problem and solution approach]
149
+
150
+ ### Implementation Plan
151
+
152
+ #### Step 1: [First step]
153
+ - File: \`path/to/file\`
154
+ - Changes: [Description of changes]
155
+
156
+ #### Step 2: [Second step]
157
+ - File: \`path/to/file\`
158
+ - Changes: [Description of changes]
159
+
160
+ [Continue with additional steps...]
161
+
162
+ ### Potential Challenges
163
+ - [Challenge 1]
164
+ - [Challenge 2]
165
+
166
+ ### Success Criteria
167
+ - [Criterion 1]
168
+ - [Criterion 2]
169
+
170
+ ### Next Steps
171
+ To implement this plan, you can ask @Coder to execute it.
172
+ \`\`\`
173
+
174
+ Remember: Be thorough in your analysis. It's better to ask for clarification than to create an incomplete or incorrect implementation plan.`;
175
+ }
176
+ }
@@ -0,0 +1,43 @@
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 } from '@theia/core/shared/inversify';
18
+ import { ChatAgentRecommendationService, RecommendedAgent } from '@theia/ai-chat/lib/common';
19
+ import { nls } from '@theia/core/lib/common/nls';
20
+
21
+ @injectable()
22
+ export class DefaultChatAgentRecommendationService implements ChatAgentRecommendationService {
23
+
24
+ getRecommendedAgents(): RecommendedAgent[] {
25
+ return [
26
+ {
27
+ id: 'Coder',
28
+ label: nls.localize('theia/ai/chat/agent/coder', 'Coder'),
29
+ description: nls.localize('theia/ai/chat/agent/coder/description', 'Code generation and modification')
30
+ },
31
+ {
32
+ id: 'Architect',
33
+ label: nls.localize('theia/ai/chat/agent/architect', 'Architect'),
34
+ description: nls.localize('theia/ai/chat/agent/architect/description', 'High-level design and architecture')
35
+ },
36
+ {
37
+ id: 'Universal',
38
+ label: nls.localize('theia/ai/chat/agent/universal', 'Universal'),
39
+ description: nls.localize('theia/ai/chat/agent/universal/description', 'General-purpose assistant')
40
+ }
41
+ ];
42
+ }
43
+ }