@theia/ai-chat-ui 1.63.0-next.0 → 1.63.0-next.52

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 (69) hide show
  1. package/lib/browser/ai-chat-ui-contribution.d.ts +29 -1
  2. package/lib/browser/ai-chat-ui-contribution.d.ts.map +1 -1
  3. package/lib/browser/ai-chat-ui-contribution.js +158 -2
  4. package/lib/browser/ai-chat-ui-contribution.js.map +1 -1
  5. package/lib/browser/ai-chat-ui-frontend-module.d.ts.map +1 -1
  6. package/lib/browser/ai-chat-ui-frontend-module.js +8 -0
  7. package/lib/browser/ai-chat-ui-frontend-module.js.map +1 -1
  8. package/lib/browser/chat-input-widget.d.ts +9 -6
  9. package/lib/browser/chat-input-widget.d.ts.map +1 -1
  10. package/lib/browser/chat-input-widget.js +181 -111
  11. package/lib/browser/chat-input-widget.js.map +1 -1
  12. package/lib/browser/chat-node-toolbar-action-contribution.d.ts +1 -0
  13. package/lib/browser/chat-node-toolbar-action-contribution.d.ts.map +1 -1
  14. package/lib/browser/chat-node-toolbar-action-contribution.js +13 -0
  15. package/lib/browser/chat-node-toolbar-action-contribution.js.map +1 -1
  16. package/lib/browser/chat-response-renderer/delegation-response-renderer.d.ts +14 -0
  17. package/lib/browser/chat-response-renderer/delegation-response-renderer.d.ts.map +1 -0
  18. package/lib/browser/chat-response-renderer/delegation-response-renderer.js +144 -0
  19. package/lib/browser/chat-response-renderer/delegation-response-renderer.js.map +1 -0
  20. package/lib/browser/chat-response-renderer/index.d.ts +2 -0
  21. package/lib/browser/chat-response-renderer/index.d.ts.map +1 -1
  22. package/lib/browser/chat-response-renderer/index.js +2 -0
  23. package/lib/browser/chat-response-renderer/index.js.map +1 -1
  24. package/lib/browser/chat-response-renderer/tool-confirmation.d.ts +17 -0
  25. package/lib/browser/chat-response-renderer/tool-confirmation.d.ts.map +1 -0
  26. package/lib/browser/chat-response-renderer/tool-confirmation.js +120 -0
  27. package/lib/browser/chat-response-renderer/tool-confirmation.js.map +1 -0
  28. package/lib/browser/chat-response-renderer/toolcall-part-renderer.d.ts +5 -1
  29. package/lib/browser/chat-response-renderer/toolcall-part-renderer.d.ts.map +1 -1
  30. package/lib/browser/chat-response-renderer/toolcall-part-renderer.js +83 -19
  31. package/lib/browser/chat-response-renderer/toolcall-part-renderer.js.map +1 -1
  32. package/lib/browser/chat-tree-view/chat-view-tree-input-widget.d.ts +6 -1
  33. package/lib/browser/chat-tree-view/chat-view-tree-input-widget.d.ts.map +1 -1
  34. package/lib/browser/chat-tree-view/chat-view-tree-input-widget.js +9 -0
  35. package/lib/browser/chat-tree-view/chat-view-tree-input-widget.js.map +1 -1
  36. package/lib/browser/chat-tree-view/chat-view-tree-widget.d.ts +8 -0
  37. package/lib/browser/chat-tree-view/chat-view-tree-widget.d.ts.map +1 -1
  38. package/lib/browser/chat-tree-view/chat-view-tree-widget.js +72 -3
  39. package/lib/browser/chat-tree-view/chat-view-tree-widget.js.map +1 -1
  40. package/lib/browser/chat-tree-view/sub-chat-widget.d.ts +22 -0
  41. package/lib/browser/chat-tree-view/sub-chat-widget.d.ts.map +1 -0
  42. package/lib/browser/chat-tree-view/sub-chat-widget.js +92 -0
  43. package/lib/browser/chat-tree-view/sub-chat-widget.js.map +1 -0
  44. package/lib/browser/chat-view-commands.d.ts +1 -0
  45. package/lib/browser/chat-view-commands.d.ts.map +1 -1
  46. package/lib/browser/chat-view-commands.js +5 -0
  47. package/lib/browser/chat-view-commands.js.map +1 -1
  48. package/lib/browser/chat-view-contribution.js +2 -1
  49. package/lib/browser/chat-view-contribution.js.map +1 -1
  50. package/lib/browser/chat-view-widget.d.ts +6 -3
  51. package/lib/browser/chat-view-widget.d.ts.map +1 -1
  52. package/lib/browser/chat-view-widget.js +20 -10
  53. package/lib/browser/chat-view-widget.js.map +1 -1
  54. package/package.json +10 -10
  55. package/src/browser/ai-chat-ui-contribution.ts +166 -5
  56. package/src/browser/ai-chat-ui-frontend-module.ts +11 -0
  57. package/src/browser/chat-input-widget.tsx +280 -170
  58. package/src/browser/chat-node-toolbar-action-contribution.ts +14 -0
  59. package/src/browser/chat-response-renderer/delegation-response-renderer.tsx +177 -0
  60. package/src/browser/chat-response-renderer/index.ts +2 -0
  61. package/src/browser/chat-response-renderer/tool-confirmation.tsx +173 -0
  62. package/src/browser/chat-response-renderer/toolcall-part-renderer.tsx +115 -19
  63. package/src/browser/chat-tree-view/chat-view-tree-input-widget.tsx +16 -1
  64. package/src/browser/chat-tree-view/chat-view-tree-widget.tsx +89 -5
  65. package/src/browser/chat-tree-view/sub-chat-widget.tsx +101 -0
  66. package/src/browser/chat-view-commands.ts +6 -0
  67. package/src/browser/chat-view-contribution.ts +1 -1
  68. package/src/browser/chat-view-widget.tsx +25 -12
  69. package/src/browser/style/index.css +350 -2
@@ -33,7 +33,7 @@ let ChatViewWidget = ChatViewWidget_1 = class ChatViewWidget extends browser_1.B
33
33
  super();
34
34
  this.treeWidget = treeWidget;
35
35
  this.inputWidget = inputWidget;
36
- this._state = { locked: false };
36
+ this._state = { locked: false, temporaryLocked: false };
37
37
  this.onStateChangedEmitter = new core_1.Emitter();
38
38
  this.id = ChatViewWidget_1.ID;
39
39
  this.title.label = ChatViewWidget_1.LABEL;
@@ -48,7 +48,8 @@ let ChatViewWidget = ChatViewWidget_1 = class ChatViewWidget extends browser_1.B
48
48
  this.treeWidget,
49
49
  this.inputWidget,
50
50
  this.onStateChanged(newState => {
51
- this.treeWidget.shouldScrollToEnd = !newState.locked;
51
+ const shouldScrollToEnd = !newState.locked && !newState.temporaryLocked;
52
+ this.treeWidget.shouldScrollToEnd = shouldScrollToEnd;
52
53
  this.update();
53
54
  })
54
55
  ]);
@@ -66,6 +67,7 @@ let ChatViewWidget = ChatViewWidget_1 = class ChatViewWidget extends browser_1.B
66
67
  this.inputWidget.onDeleteChangeSet = this.onDeleteChangeSet.bind(this);
67
68
  this.inputWidget.onDeleteChangeSetElement = this.onDeleteChangeSetElement.bind(this);
68
69
  this.treeWidget.trackChatModel(this.chatSession.model);
70
+ this.treeWidget.onScrollLockChange = this.onScrollLockChange.bind(this);
69
71
  this.initListeners();
70
72
  this.inputWidget.setEnabled(this.activationService.isActive);
71
73
  this.treeWidget.setEnabled(this.activationService.isActive);
@@ -88,9 +90,6 @@ let ChatViewWidget = ChatViewWidget_1 = class ChatViewWidget extends browser_1.B
88
90
  this.treeWidget.trackChatModel(this.chatSession.model);
89
91
  this.inputWidget.chatModel = this.chatSession.model;
90
92
  this.inputWidget.pinnedAgent = this.chatSession.pinnedAgent;
91
- if (event.focus) {
92
- this.show();
93
- }
94
93
  }
95
94
  else {
96
95
  console.warn(`Session with ${event.sessionId} not found.`);
@@ -114,6 +113,8 @@ let ChatViewWidget = ChatViewWidget_1 = class ChatViewWidget extends browser_1.B
114
113
  if (oldState.locked) {
115
114
  copy.locked = oldState.locked;
116
115
  }
116
+ // Don't restore temporary lock state as it should reset on restart
117
+ copy.temporaryLocked = false;
117
118
  this.state = copy;
118
119
  }
119
120
  get state() {
@@ -127,7 +128,7 @@ let ChatViewWidget = ChatViewWidget_1 = class ChatViewWidget extends browser_1.B
127
128
  return this.onStateChangedEmitter.event;
128
129
  }
129
130
  async onQuery(query) {
130
- const chatRequest = typeof query === 'string' ? { text: query } : { ...query };
131
+ const chatRequest = !query ? { text: '' } : typeof query === 'string' ? { text: query } : { ...query };
131
132
  if (chatRequest.text.length === 0) {
132
133
  return;
133
134
  }
@@ -156,14 +157,23 @@ let ChatViewWidget = ChatViewWidget_1 = class ChatViewWidget extends browser_1.B
156
157
  onDeleteChangeSet(sessionId) {
157
158
  this.chatService.deleteChangeSet(sessionId);
158
159
  }
159
- onDeleteChangeSetElement(sessionId, index) {
160
- this.chatService.deleteChangeSetElement(sessionId, index);
160
+ onDeleteChangeSetElement(sessionId, uri) {
161
+ this.chatService.deleteChangeSetElement(sessionId, uri);
162
+ }
163
+ onScrollLockChange(temporaryLocked) {
164
+ this.setTemporaryLock(temporaryLocked);
161
165
  }
162
166
  lock() {
163
- this.state = { ...(0, core_1.deepClone)(this.state), locked: true };
167
+ this.state = { ...(0, core_1.deepClone)(this.state), locked: true, temporaryLocked: false };
164
168
  }
165
169
  unlock() {
166
- this.state = { ...(0, core_1.deepClone)(this.state), locked: false };
170
+ this.state = { ...(0, core_1.deepClone)(this.state), locked: false, temporaryLocked: false };
171
+ }
172
+ setTemporaryLock(locked) {
173
+ // Only set temporary lock if not permanently locked
174
+ if (!this.state.locked) {
175
+ this.state = { ...(0, core_1.deepClone)(this.state), temporaryLocked: locked };
176
+ }
167
177
  }
168
178
  get isLocked() {
169
179
  return !!this.state.locked;
@@ -1 +1 @@
1
- {"version":3,"file":"chat-view-widget.js","sourceRoot":"","sources":["../../src/browser/chat-view-widget.tsx"],"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;AAChF,sCAAwF;AACxF,4CAAwI;AACxI,qDAA0I;AAC1I,oDAAiD;AACjD,4DAAiF;AACjF,2DAAwD;AACxD,kFAA4E;AAC5E,4FAAuF;AAEvF,uFAAkF;AAClF,wDAAqE;AAS9D,IAAM,cAAc,sBAApB,MAAM,cAAe,SAAQ,oBAAU;IAiC1C,YAEI,UAAuC,EAEvC,WAAuC;QAEvC,KAAK,EAAE,CAAC;QAJC,eAAU,GAAV,UAAU,CAAoB;QAE9B,gBAAW,GAAX,WAAW,CAAmB;QATjC,WAAM,GAAyB,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QACxC,0BAAqB,GAAG,IAAI,cAAO,EAAwB,CAAC;QAW3E,IAAI,CAAC,EAAE,GAAG,gBAAc,CAAC,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,gBAA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M,EAAC,qBAAW,CAAC;;mDACe;AAGzB;IADT,IAAA,kBAAM,EAAC,qBAAc,CAAC;sCACG,qBAAc;sDAAC;AAGtB;IADlB,IAAA,kBAAM,EAAC,2BAAiB,CAAC;;yDAC8B;AAGrC;IADlB,IAAA,kBAAM,EAAC,qBAAc,CAAC;;sDAC2B;AAG/B;IADlB,IAAA,kBAAM,EAAC,2CAAmB,CAAC;sCACU,2CAAmB;yDAAC;AAGvC;IADlB,IAAA,kBAAM,EAAC,iCAAuB,CAAC;;uDAC4B;AAGzC;IADlB,IAAA,kBAAM,EAAC,yCAAkB,CAAC;;0DAC+B;AA0BhD;IADT,IAAA,yBAAa,GAAE;;;;0CAwCf;yBAzFQ,cAAc;IAD1B,IAAA,sBAAU,GAAE;IAmCJ,mBAAA,IAAA,kBAAM,EAAC,0CAAkB,CAAC,CAAA;IAE1B,mBAAA,IAAA,kBAAM,EAAC,qCAAiB,CAAC,CAAA;6CADL,0CAAkB;QAEjB,qCAAiB;GArClC,cAAc,CAgO1B"}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@theia/ai-chat-ui",
3
- "version": "1.63.0-next.0+c02e6a4f5",
3
+ "version": "1.63.0-next.52+176018e53",
4
4
  "description": "Theia - AI Chat UI Extension",
5
5
  "dependencies": {
6
- "@theia/ai-chat": "1.63.0-next.0+c02e6a4f5",
7
- "@theia/ai-core": "1.63.0-next.0+c02e6a4f5",
8
- "@theia/core": "1.63.0-next.0+c02e6a4f5",
9
- "@theia/editor": "1.63.0-next.0+c02e6a4f5",
10
- "@theia/editor-preview": "1.63.0-next.0+c02e6a4f5",
11
- "@theia/filesystem": "1.63.0-next.0+c02e6a4f5",
12
- "@theia/monaco": "1.63.0-next.0+c02e6a4f5",
6
+ "@theia/ai-chat": "1.63.0-next.52+176018e53",
7
+ "@theia/ai-core": "1.63.0-next.52+176018e53",
8
+ "@theia/core": "1.63.0-next.52+176018e53",
9
+ "@theia/editor": "1.63.0-next.52+176018e53",
10
+ "@theia/editor-preview": "1.63.0-next.52+176018e53",
11
+ "@theia/filesystem": "1.63.0-next.52+176018e53",
12
+ "@theia/monaco": "1.63.0-next.52+176018e53",
13
13
  "@theia/monaco-editor-core": "1.96.302",
14
- "@theia/workspace": "1.63.0-next.0+c02e6a4f5",
14
+ "@theia/workspace": "1.63.0-next.52+176018e53",
15
15
  "date-fns": "^4.1.0",
16
16
  "minimatch": "^5.1.0",
17
17
  "tslib": "^2.6.2",
@@ -56,5 +56,5 @@
56
56
  "nyc": {
57
57
  "extends": "../../configs/nyc.json"
58
58
  },
59
- "gitHead": "c02e6a4f58728b4067cbd267d598550192abb249"
59
+ "gitHead": "176018e53e62cafec9b25b23ac9f0b4826b6d0f7"
60
60
  }
@@ -14,7 +14,7 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { inject, injectable } from '@theia/core/shared/inversify';
17
+ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
18
18
  import { CommandRegistry, Emitter, isOSX, MessageService, nls, QuickInputButton, QuickInputService, QuickPickItem } from '@theia/core';
19
19
  import { Widget } from '@theia/core/lib/browser';
20
20
  import {
@@ -22,7 +22,9 @@ import {
22
22
  AI_CHAT_SHOW_CHATS_COMMAND,
23
23
  ChatCommands
24
24
  } from './chat-view-commands';
25
- import { ChatAgentLocation, ChatService } from '@theia/ai-chat';
25
+ import { ChatAgent, ChatAgentLocation, ChatService, isActiveSessionChangedEvent } from '@theia/ai-chat';
26
+ import { ChatAgentService } from '@theia/ai-chat/lib/common/chat-agent-service';
27
+ import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
26
28
  import { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-contribution';
27
29
  import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
28
30
  import { ChatViewWidget } from './chat-view-widget';
@@ -32,7 +34,7 @@ import { formatDistance } from 'date-fns';
32
34
  import * as locales from 'date-fns/locale';
33
35
  import { AI_SHOW_SETTINGS_COMMAND } from '@theia/ai-core/lib/browser';
34
36
  import { ChatNodeToolbarCommands } from './chat-node-toolbar-action-contribution';
35
- import { isEditableRequestNode, type EditableRequestNode } from './chat-tree-view';
37
+ import { isEditableRequestNode, isResponseNode, type EditableRequestNode, type ResponseNode } from './chat-tree-view';
36
38
  import { TASK_CONTEXT_VARIABLE } from '@theia/ai-chat/lib/browser/task-context-variable';
37
39
  import { TaskContextService } from '@theia/ai-chat/lib/browser/task-context-service';
38
40
 
@@ -49,6 +51,10 @@ export class AIChatContribution extends AbstractViewContribution<ChatViewWidget>
49
51
  protected readonly taskContextService: TaskContextService;
50
52
  @inject(MessageService)
51
53
  protected readonly messageService: MessageService;
54
+ @inject(ChatAgentService)
55
+ protected readonly chatAgentService: ChatAgentService;
56
+ @inject(EditorManager)
57
+ protected readonly editorManager: EditorManager;
52
58
 
53
59
  protected static readonly RENAME_CHAT_BUTTON: QuickInputButton = {
54
60
  iconClass: 'codicon-edit',
@@ -75,6 +81,19 @@ export class AIChatContribution extends AbstractViewContribution<ChatViewWidget>
75
81
  });
76
82
  }
77
83
 
84
+ @postConstruct()
85
+ initialize(): void {
86
+ this.chatService.onSessionEvent(event => {
87
+ if (!isActiveSessionChangedEvent(event)) {
88
+ return;
89
+ }
90
+ if (event.focus) {
91
+ this.openView({ activate: true });
92
+ }
93
+ }
94
+ );
95
+ }
96
+
78
97
  override registerCommands(registry: CommandRegistry): void {
79
98
  super.registerCommands(registry);
80
99
  registry.registerCommand(ChatCommands.SCROLL_LOCK_WIDGET, {
@@ -136,9 +155,19 @@ export class AIChatContribution extends AbstractViewContribution<ChatViewWidget>
136
155
  return !!activeSession && this.taskContextService.hasSummary(activeSession);
137
156
  }
138
157
  });
158
+ registry.registerCommand(ChatCommands.AI_CHAT_INITIATE_SESSION_WITH_TASK_CONTEXT, {
159
+ execute: async () => {
160
+ const selectedContextId = await this.selectTaskContextWithMarking();
161
+ if (!selectedContextId) { return; }
162
+ const selectedAgent = await this.selectAgent('Coder');
163
+ if (!selectedAgent) { return; }
164
+ const newSession = this.chatService.createSession(ChatAgentLocation.Panel, { focus: true }, selectedAgent);
165
+ newSession.model.context.addVariables({ variable: TASK_CONTEXT_VARIABLE, arg: selectedContextId });
166
+ }
167
+ });
139
168
  registry.registerCommand(AI_CHAT_SHOW_CHATS_COMMAND, {
140
169
  execute: () => this.selectChat(),
141
- isEnabled: widget => this.withWidget(widget) && this.chatService.getSessions().length > 1,
170
+ isEnabled: widget => this.withWidget(widget) && this.chatService.getSessions().some(session => !!session.title),
142
171
  isVisible: widget => this.withWidget(widget)
143
172
  });
144
173
  registry.registerCommand(ChatNodeToolbarCommands.EDIT, {
@@ -155,6 +184,33 @@ export class AIChatContribution extends AbstractViewContribution<ChatViewWidget>
155
184
  node.request.cancelEdit();
156
185
  }
157
186
  });
187
+ registry.registerCommand(ChatNodeToolbarCommands.RETRY, {
188
+ isEnabled: node => isResponseNode(node) && (node.response.isError || node.response.isCanceled),
189
+ isVisible: node => isResponseNode(node) && (node.response.isError || node.response.isCanceled),
190
+ execute: async (node: ResponseNode) => {
191
+ try {
192
+ // Get the session for this response node
193
+ const session = this.chatService.getActiveSession();
194
+ if (!session) {
195
+ this.messageService.error('Session not found for retry');
196
+ return;
197
+ }
198
+
199
+ // Find the request associated with this response
200
+ const request = session.model.getRequests().find(req => req.response.id === node.response.id);
201
+ if (!request) {
202
+ this.messageService.error('Request not found for retry');
203
+ return;
204
+ }
205
+
206
+ // Send the same request again using the chat service
207
+ await this.chatService.sendRequest(node.sessionId, request.request);
208
+ } catch (error) {
209
+ console.error('Failed to retry chat message:', error);
210
+ this.messageService.error('Failed to retry message');
211
+ }
212
+ }
213
+ });
158
214
  }
159
215
 
160
216
  registerToolbarItems(registry: TabBarToolbarRegistry): void {
@@ -210,7 +266,7 @@ export class AIChatContribution extends AbstractViewContribution<ChatViewWidget>
210
266
  protected askForChatSession(): Promise<QuickPickItem | undefined> {
211
267
  const getItems = () =>
212
268
  this.chatService.getSessions()
213
- .filter(session => !session.isActive && session.title)
269
+ .filter(session => session.title)
214
270
  .sort((a, b) => {
215
271
  if (!a.lastInteraction) { return 1; }
216
272
  if (!b.lastInteraction) { return -1; }
@@ -289,6 +345,111 @@ export class AIChatContribution extends AbstractViewContribution<ChatViewWidget>
289
345
  return undefined;
290
346
  });
291
347
  }
348
+
349
+ /**
350
+ * Prompts the user to select a chat agent
351
+ * @returns The selected agent or undefined if cancelled
352
+ */
353
+ /**
354
+ * Prompts the user to select a chat agent with an optional default (pre-selected) agent.
355
+ * @param defaultAgentId The id of the agent to pre-select, if present
356
+ * @returns The selected agent or undefined if cancelled
357
+ */
358
+ protected async selectAgent(defaultAgentId?: string): Promise<ChatAgent | undefined> {
359
+ const agents = this.chatAgentService.getAgents();
360
+ if (agents.length === 0) {
361
+ this.messageService.warn('No chat agents available.');
362
+ return undefined;
363
+ }
364
+
365
+ const items: QuickPickItem[] = agents.map(agent => ({
366
+ label: agent.name || agent.id,
367
+ description: agent.description,
368
+ id: agent.id
369
+ }));
370
+
371
+ let preselected: QuickPickItem | undefined = undefined;
372
+ if (defaultAgentId) {
373
+ preselected = items.find(item => item.id === defaultAgentId);
374
+ }
375
+
376
+ const selected = await this.quickInputService.showQuickPick(items, {
377
+ placeholder: 'Select an agent for the new session',
378
+ activeItem: preselected
379
+ });
380
+
381
+ if (!selected) {
382
+ return undefined;
383
+ }
384
+
385
+ return this.chatAgentService.getAgent(selected.id!);
386
+ }
387
+
388
+ /**
389
+ * Prompts the user to select a task context with special marking for currently opened files
390
+ * @returns The selected task context ID or undefined if cancelled
391
+ */
392
+ protected async selectTaskContextWithMarking(): Promise<string | undefined> {
393
+ const contexts = this.taskContextService.getAll();
394
+ const openedFilesInfo = this.getOpenedTaskContextFiles();
395
+
396
+ // Create items with opened files marked and prioritized
397
+ const items: QuickPickItem[] = contexts.map(summary => {
398
+ const isOpened = openedFilesInfo.openedIds.includes(summary.id);
399
+ const isActive = openedFilesInfo.activeId === summary.id;
400
+ return {
401
+ label: isOpened ? `📄 ${summary.label} (currently open)` : summary.label,
402
+ description: summary.id,
403
+ id: summary.id,
404
+ // We'll sort active file first, then opened files, then others
405
+ sortText: isActive ? `0-${summary.label}` : isOpened ? `1-${summary.label}` : `2-${summary.label}`
406
+ };
407
+ }).sort((a, b) => a.sortText!.localeCompare(b.sortText!));
408
+
409
+ const selected = await this.quickInputService.showQuickPick(items, {
410
+ placeholder: 'Select a task context to attach'
411
+ });
412
+
413
+ return selected?.id;
414
+ }
415
+
416
+ /**
417
+ * Returns information about task context files that are currently opened
418
+ * @returns Object with arrays of opened context IDs and the active context ID
419
+ */
420
+ protected getOpenedTaskContextFiles(): { openedIds: string[], activeId?: string } {
421
+ // Get all contexts with their URIs
422
+ const allContexts = this.taskContextService.getAll();
423
+ const contextMap = new Map<string, string>(); // Map of URI -> ID
424
+ // Create a map of URI string -> context ID for lookup
425
+ for (const context of allContexts) {
426
+ if (context.uri) {
427
+ contextMap.set(context.uri.toString(), context.id);
428
+ }
429
+ }
430
+
431
+ // Get all open editor URIs
432
+ const openEditorUris = this.editorManager.all.map(widget => widget.editor.uri.toString());
433
+
434
+ // Get the currently active/focused editor URI if any
435
+ const activeEditorUri = this.editorManager.currentEditor?.editor.uri.toString();
436
+ let activeContextId: string | undefined;
437
+
438
+ if (activeEditorUri) {
439
+ activeContextId = contextMap.get(activeEditorUri);
440
+ }
441
+
442
+ // Filter to only task context files that are currently opened
443
+ const openedContextIds: string[] = [];
444
+ for (const uri of openEditorUris) {
445
+ const contextId = contextMap.get(uri);
446
+ if (contextId) {
447
+ openedContextIds.push(contextId);
448
+ }
449
+ }
450
+
451
+ return { openedIds: openedContextIds, activeId: activeContextId };
452
+ }
292
453
  }
293
454
 
294
455
  function getDateFnsLocale(): locales.Locale {
@@ -36,6 +36,7 @@ import {
36
36
  ToolCallPartRenderer,
37
37
  ThinkingPartRenderer,
38
38
  ProgressPartRenderer,
39
+ DelegationResponseRenderer,
39
40
  } from './chat-response-renderer';
40
41
  import {
41
42
  GitHubSelectionResolver,
@@ -53,6 +54,7 @@ import { ContextVariablePicker } from './context-variable-picker';
53
54
  import { ChangeSetActionRenderer, ChangeSetActionService } from './change-set-actions/change-set-action-service';
54
55
  import { ChangeSetAcceptAction } from './change-set-actions/change-set-accept-action';
55
56
  import { AIChatTreeInputArgs, AIChatTreeInputConfiguration, AIChatTreeInputFactory, AIChatTreeInputWidget } from './chat-tree-view/chat-view-tree-input-widget';
57
+ import { SubChatWidget, SubChatWidgetFactory } from './chat-tree-view/sub-chat-widget';
56
58
 
57
59
  export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
58
60
  bindViewContribution(bind, AIChatContribution);
@@ -118,6 +120,7 @@ export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
118
120
  bind(ChatResponsePartRenderer).to(ThinkingPartRenderer).inSingletonScope();
119
121
  bind(ChatResponsePartRenderer).to(QuestionPartRenderer).inSingletonScope();
120
122
  bind(ChatResponsePartRenderer).to(ProgressPartRenderer).inSingletonScope();
123
+ bind(ChatResponsePartRenderer).to(DelegationResponseRenderer).inSingletonScope();
121
124
  [CommandContribution, MenuContribution].forEach(serviceIdentifier =>
122
125
  bind(serviceIdentifier).to(ChatViewMenuContribution).inSingletonScope()
123
126
  );
@@ -144,6 +147,14 @@ export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
144
147
  bindContributionProvider(bind, ChatNodeToolbarActionContribution);
145
148
  bind(DefaultChatNodeToolbarActionContribution).toSelf().inSingletonScope();
146
149
  bind(ChatNodeToolbarActionContribution).toService(DefaultChatNodeToolbarActionContribution);
150
+
151
+ bind(SubChatWidgetFactory).toFactory(ctx => () => {
152
+ const container = ctx.container.createChild();
153
+ container.bind(SubChatWidget).toSelf().inSingletonScope();
154
+ const widget = container.get(SubChatWidget);
155
+ return widget;
156
+ });
157
+
147
158
  });
148
159
 
149
160
  function bindChatViewWidget(bind: interfaces.Bind): void {