@theia/ai-ide 1.71.0-next.72 → 1.71.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 (41) hide show
  1. package/lib/browser/frontend-module.d.ts.map +1 -1
  2. package/lib/browser/frontend-module.js +8 -0
  3. package/lib/browser/frontend-module.js.map +1 -1
  4. package/lib/browser/review/pr-review-agent.d.ts +19 -0
  5. package/lib/browser/review/pr-review-agent.d.ts.map +1 -0
  6. package/lib/browser/review/pr-review-agent.js +47 -0
  7. package/lib/browser/review/pr-review-agent.js.map +1 -0
  8. package/lib/browser/review/pr-review-prompt-template.d.ts +4 -0
  9. package/lib/browser/review/pr-review-prompt-template.d.ts.map +1 -0
  10. package/lib/browser/review/pr-review-prompt-template.js +437 -0
  11. package/lib/browser/review/pr-review-prompt-template.js.map +1 -0
  12. package/lib/browser/user-interaction-tool-renderer.d.ts +18 -0
  13. package/lib/browser/user-interaction-tool-renderer.d.ts.map +1 -0
  14. package/lib/browser/user-interaction-tool-renderer.js +330 -0
  15. package/lib/browser/user-interaction-tool-renderer.js.map +1 -0
  16. package/lib/browser/user-interaction-tool.d.ts +47 -0
  17. package/lib/browser/user-interaction-tool.d.ts.map +1 -0
  18. package/lib/browser/user-interaction-tool.js +397 -0
  19. package/lib/browser/user-interaction-tool.js.map +1 -0
  20. package/lib/browser/user-interaction-tool.spec.d.ts +2 -0
  21. package/lib/browser/user-interaction-tool.spec.d.ts.map +1 -0
  22. package/lib/browser/user-interaction-tool.spec.js +336 -0
  23. package/lib/browser/user-interaction-tool.spec.js.map +1 -0
  24. package/lib/common/user-interaction-tool.d.ts +53 -0
  25. package/lib/common/user-interaction-tool.d.ts.map +1 -0
  26. package/lib/common/user-interaction-tool.js +176 -0
  27. package/lib/common/user-interaction-tool.js.map +1 -0
  28. package/lib/common/user-interaction-tool.spec.d.ts +2 -0
  29. package/lib/common/user-interaction-tool.spec.d.ts.map +1 -0
  30. package/lib/common/user-interaction-tool.spec.js +216 -0
  31. package/lib/common/user-interaction-tool.spec.js.map +1 -0
  32. package/package.json +22 -22
  33. package/src/browser/frontend-module.ts +9 -0
  34. package/src/browser/review/pr-review-agent.ts +42 -0
  35. package/src/browser/review/pr-review-prompt-template.ts +449 -0
  36. package/src/browser/style/index.css +299 -0
  37. package/src/browser/user-interaction-tool-renderer.tsx +531 -0
  38. package/src/browser/user-interaction-tool.spec.ts +396 -0
  39. package/src/browser/user-interaction-tool.ts +423 -0
  40. package/src/common/user-interaction-tool.spec.ts +241 -0
  41. package/src/common/user-interaction-tool.ts +237 -0
@@ -0,0 +1,18 @@
1
+ import { ChatResponsePartRenderer } from '@theia/ai-chat-ui/lib/browser/chat-response-part-renderer';
2
+ import { ResponseNode } from '@theia/ai-chat-ui/lib/browser/chat-tree-view';
3
+ import { ChatResponseContent, ToolCallChatResponseContent } from '@theia/ai-chat/lib/common';
4
+ import { ReactNode } from '@theia/core/shared/react';
5
+ import { ContextMenuRenderer, OpenerService } from '@theia/core/lib/browser';
6
+ import { ToolConfirmationManager } from '@theia/ai-chat/lib/browser/chat-tool-preference-bindings';
7
+ import { ToolInvocationRegistry } from '@theia/ai-core';
8
+ import { UserInteractionTool } from './user-interaction-tool';
9
+ export declare class UserInteractionToolRenderer implements ChatResponsePartRenderer<ToolCallChatResponseContent> {
10
+ protected toolConfirmationManager: ToolConfirmationManager;
11
+ protected contextMenuRenderer: ContextMenuRenderer;
12
+ protected toolInvocationRegistry: ToolInvocationRegistry;
13
+ protected userInteractionTool: UserInteractionTool;
14
+ protected openerService: OpenerService;
15
+ canHandle(response: ChatResponseContent): number;
16
+ render(response: ToolCallChatResponseContent, parentNode: ResponseNode): ReactNode;
17
+ }
18
+ //# sourceMappingURL=user-interaction-tool-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-interaction-tool-renderer.d.ts","sourceRoot":"","sources":["../../src/browser/user-interaction-tool-renderer.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2DAA2D,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAW,mBAAmB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAItF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0DAA0D,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAib9D,qBACa,2BAA4B,YAAW,wBAAwB,CAAC,2BAA2B,CAAC;IAGrG,SAAS,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;IAG3D,SAAS,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAGnD,SAAS,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAGzD,SAAS,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAGnD,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAEvC,SAAS,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM;IAOhD,MAAM,CAAC,QAAQ,EAAE,2BAA2B,EAAE,UAAU,EAAE,YAAY,GAAG,SAAS;CA4CrF"}
@@ -0,0 +1,330 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 EclipseSource GmbH.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.UserInteractionToolRenderer = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const common_1 = require("@theia/ai-chat/lib/common");
22
+ const React = require("@theia/core/shared/react");
23
+ const browser_1 = require("@theia/core/lib/browser");
24
+ const nls_1 = require("@theia/core/lib/common/nls");
25
+ const markdown_part_renderer_1 = require("@theia/ai-chat-ui/lib/browser/chat-response-renderer/markdown-part-renderer");
26
+ const tool_confirmation_1 = require("@theia/ai-chat-ui/lib/browser/chat-response-renderer/tool-confirmation");
27
+ const chat_tool_preference_bindings_1 = require("@theia/ai-chat/lib/browser/chat-tool-preference-bindings");
28
+ const ai_core_1 = require("@theia/ai-core");
29
+ const user_interaction_tool_1 = require("./user-interaction-tool");
30
+ const user_interaction_tool_2 = require("../common/user-interaction-tool");
31
+ const UserInteractionComponent = ({ args, toolCallId, tool, finished, canceled, responseComplete, result, openerService }) => {
32
+ const steps = args.interactions;
33
+ const stepCount = steps.length;
34
+ const [currentStep, setCurrentStep] = React.useState(0);
35
+ const [stepStates, setStepStates] = React.useState(() => steps.map(() => ({ comments: [] })));
36
+ const [pendingComment, setPendingComment] = React.useState('');
37
+ const activeStep = steps[currentStep];
38
+ const isLastStep = currentStep === stepCount - 1;
39
+ const messageRef = (0, markdown_part_renderer_1.useMarkdownRendering)(activeStep?.message ?? '', openerService);
40
+ // A parent response that completed without delivering a tool result means the
41
+ // interaction was restored from a serialized "waiting for input" state. The
42
+ // agent that was waiting is no longer running, so it must be treated as
43
+ // canceled and all inputs locked.
44
+ const restoredWithoutResult = responseComplete && !result;
45
+ const isFinal = finished || !!result || canceled || restoredWithoutResult;
46
+ // Auto-open the active step's links the first time the user reaches it.
47
+ // Going Back and then Forward must not re-open them.
48
+ const visitedStepsRef = React.useRef(new Set());
49
+ React.useEffect(() => {
50
+ if (isFinal || !activeStep || visitedStepsRef.current.has(currentStep)) {
51
+ return;
52
+ }
53
+ visitedStepsRef.current.add(currentStep);
54
+ const links = activeStep.links ?? [];
55
+ for (const link of links) {
56
+ if (link.autoOpen !== false) {
57
+ tool.openLink(link).catch(err => console.warn('Failed to auto-open user-interaction link:', err));
58
+ }
59
+ }
60
+ }, [currentStep, activeStep, isFinal, tool]);
61
+ const persistStepState = React.useCallback((stepIndex, state) => {
62
+ tool.setStepResult(toolCallId, stepIndex, {
63
+ value: state.value,
64
+ comments: state.comments.length > 0 ? state.comments : undefined
65
+ });
66
+ }, [tool, toolCallId]);
67
+ const updateStepState = React.useCallback((stepIndex, updater) => {
68
+ setStepStates(prev => {
69
+ const next = prev.slice();
70
+ const updated = updater(prev[stepIndex]);
71
+ next[stepIndex] = updated;
72
+ persistStepState(stepIndex, updated);
73
+ return next;
74
+ });
75
+ }, [persistStepState]);
76
+ const isSingleStep = stepCount === 1;
77
+ const hasOptions = !!activeStep?.options && activeStep.options.length > 0;
78
+ const handleOptionClick = React.useCallback((value) => {
79
+ if (isFinal) {
80
+ return;
81
+ }
82
+ if (isSingleStep) {
83
+ setStepStates(prev => {
84
+ const next = prev.slice();
85
+ next[0] = { ...prev[0], value };
86
+ return next;
87
+ });
88
+ tool.completeInteractionWith(toolCallId, 0, { value });
89
+ return;
90
+ }
91
+ updateStepState(currentStep, prev => ({
92
+ ...prev,
93
+ value: prev.value === value ? undefined : value
94
+ }));
95
+ }, [currentStep, isFinal, isSingleStep, tool, toolCallId, updateStepState]);
96
+ const handleAddComment = React.useCallback(() => {
97
+ const trimmed = pendingComment.trim();
98
+ if (isFinal || !trimmed) {
99
+ return;
100
+ }
101
+ updateStepState(currentStep, prev => ({
102
+ ...prev,
103
+ comments: [...prev.comments, trimmed]
104
+ }));
105
+ setPendingComment('');
106
+ }, [currentStep, isFinal, pendingComment, updateStepState]);
107
+ const handleRemoveComment = React.useCallback((commentIndex) => {
108
+ if (isFinal) {
109
+ return;
110
+ }
111
+ updateStepState(currentStep, prev => ({
112
+ ...prev,
113
+ comments: prev.comments.filter((_, i) => i !== commentIndex)
114
+ }));
115
+ }, [currentStep, isFinal, updateStepState]);
116
+ const handleCommentKeyDown = React.useCallback((e) => {
117
+ if (e.key === 'Enter') {
118
+ e.preventDefault();
119
+ handleAddComment();
120
+ }
121
+ }, [handleAddComment]);
122
+ const goToStep = React.useCallback((idx) => {
123
+ if (idx < 0 || idx >= stepCount) {
124
+ return;
125
+ }
126
+ setCurrentStep(idx);
127
+ setPendingComment('');
128
+ }, [stepCount]);
129
+ const handleAdvance = React.useCallback(() => {
130
+ if (isLastStep) {
131
+ if (!isFinal) {
132
+ tool.completeInteraction(toolCallId);
133
+ }
134
+ return;
135
+ }
136
+ setCurrentStep(idx => idx + 1);
137
+ setPendingComment('');
138
+ }, [isFinal, isLastStep, tool, toolCallId]);
139
+ const handleBack = React.useCallback(() => {
140
+ if (currentStep === 0) {
141
+ return;
142
+ }
143
+ setCurrentStep(idx => idx - 1);
144
+ setPendingComment('');
145
+ }, [currentStep]);
146
+ if (!activeStep) {
147
+ return undefined;
148
+ }
149
+ const activeState = stepStates[currentStep];
150
+ const stepLabel = nls_1.nls.localize('theia/ai-ide/userInteractionStepLabel', 'Step {0} of {1}', currentStep + 1, stepCount);
151
+ const advanceLabel = isLastStep
152
+ ? nls_1.nls.localize('theia/ai-ide/userInteractionFinishStep', 'Finish')
153
+ : nls_1.nls.localizeByDefault('Next');
154
+ const showAdvanceRow = !isSingleStep;
155
+ return (React.createElement("div", { className: 'tool-call container user-interaction-wizard' },
156
+ React.createElement("div", { className: 'tool-call header' },
157
+ React.createElement("span", { className: (0, browser_1.codicon)('comment-discussion') }),
158
+ React.createElement("span", { className: 'user-interaction-tool title' }, activeStep.title),
159
+ (() => {
160
+ // The tool's own result is authoritative: a completed
161
+ // interaction must stay "Completed" even if the chat
162
+ // session is canceled later. A response that completed
163
+ // without a result indicates the interaction was restored
164
+ // from a "waiting" state and is treated as canceled.
165
+ const status = result?.completed === true ? 'completed' :
166
+ result?.completed === false || canceled || restoredWithoutResult ? 'canceled' :
167
+ 'waiting';
168
+ if (status === 'completed') {
169
+ return (React.createElement("span", { className: 'user-interaction-tool status completed' },
170
+ React.createElement("i", { className: (0, browser_1.codicon)('check') }),
171
+ nls_1.nls.localizeByDefault('Completed')));
172
+ }
173
+ if (status === 'canceled') {
174
+ return (React.createElement("span", { className: 'user-interaction-tool status canceled' },
175
+ React.createElement("i", { className: (0, browser_1.codicon)('close') }),
176
+ nls_1.nls.localize('theia/ai-ide/userInteractionCanceled', 'Canceled')));
177
+ }
178
+ return (React.createElement("span", { className: 'user-interaction-tool status waiting', role: 'status', "aria-live": 'polite' }, nls_1.nls.localize('theia/ai/chat-ui/chat-view-tree-widget/waitingForInput', 'Waiting for input')));
179
+ })()),
180
+ !isSingleStep && React.createElement(StepProgress, { current: currentStep, total: stepCount, onSelect: goToStep, steps: steps }),
181
+ activeStep.links && activeStep.links.length > 0 && (React.createElement("div", { className: 'user-interaction-tool links' }, activeStep.links.map((link, i) => (React.createElement(LinkButton, { key: i, link: link, onClick: () => tool.openLink(link).catch(err => console.warn('Failed to open user-interaction link:', err)) }))))),
182
+ React.createElement("div", { className: 'user-interaction-tool message', ref: messageRef }),
183
+ hasOptions && (React.createElement("div", { className: 'user-interaction-tool options' }, activeStep.options.map((option, i) => {
184
+ const isSelected = activeState.value === option.value;
185
+ const className = 'user-interaction-tool option-button theia-button '
186
+ + (isSelected ? 'main selected' : 'secondary');
187
+ const label = option.buttonLabel || option.text;
188
+ return (React.createElement("button", { key: i, className: className, onClick: () => handleOptionClick(option.value), disabled: isFinal, title: option.description, "aria-pressed": isSelected },
189
+ React.createElement("span", { className: 'user-interaction-tool option-button-bold-spacer', "aria-hidden": 'true' }, label),
190
+ React.createElement("span", { className: 'user-interaction-tool option-button-label' }, label)));
191
+ }))),
192
+ !isSingleStep && (React.createElement("div", { className: 'user-interaction-tool comment-section' },
193
+ !isFinal && (React.createElement("div", { className: 'user-interaction-tool comment-input-row' },
194
+ React.createElement("input", { type: 'text', className: 'theia-input user-interaction-tool comment-input-field', placeholder: nls_1.nls.localize('theia/ai-ide/userInteractionCommentPlaceholder', 'Add a comment for this step...'), value: pendingComment, onChange: e => setPendingComment(e.target.value), onKeyDown: handleCommentKeyDown }),
195
+ React.createElement("button", { className: 'theia-button secondary user-interaction-tool comment-submit', onClick: handleAddComment, disabled: !pendingComment.trim() }, nls_1.nls.localizeByDefault('Comment')))),
196
+ activeState.comments.length > 0 && (React.createElement("ul", { className: 'user-interaction-tool comment-list' }, activeState.comments.map((comment, i) => (React.createElement("li", { key: i, className: 'user-interaction-tool comment-item' },
197
+ React.createElement("span", { className: 'user-interaction-tool comment-text' }, comment),
198
+ !isFinal && (React.createElement("button", { className: 'user-interaction-tool comment-remove', onClick: () => handleRemoveComment(i), title: nls_1.nls.localizeByDefault('Remove'), "aria-label": nls_1.nls.localizeByDefault('Remove') },
199
+ React.createElement("i", { className: (0, browser_1.codicon)('close') })))))))))),
200
+ showAdvanceRow && (React.createElement("div", { className: 'user-interaction-tool advance-row' },
201
+ !isSingleStep && (React.createElement(React.Fragment, null,
202
+ React.createElement("button", { className: 'theia-button secondary user-interaction-tool back-button', onClick: handleBack, disabled: currentStep === 0, title: nls_1.nls.localizeByDefault('Back') },
203
+ React.createElement("i", { className: (0, browser_1.codicon)('arrow-left') }),
204
+ nls_1.nls.localizeByDefault('Back')),
205
+ React.createElement("span", { className: 'user-interaction-tool page-counter', "aria-label": stepLabel },
206
+ currentStep + 1,
207
+ " / ",
208
+ stepCount))),
209
+ React.createElement("button", { className: 'theia-button main user-interaction-tool advance-button', onClick: handleAdvance, disabled: isFinal && isLastStep },
210
+ advanceLabel,
211
+ React.createElement("i", { className: (0, browser_1.codicon)(isLastStep ? 'check' : 'arrow-right') }))))));
212
+ };
213
+ const StepProgress = ({ current, total, onSelect, steps }) => (React.createElement("div", { className: 'user-interaction-tool progress' }, Array.from({ length: total }).map((_, i) => {
214
+ const label = nls_1.nls.localize('theia/ai-ide/userInteractionGoToStep', 'Go to step {0}: {1}', i + 1, steps[i]?.title ?? '');
215
+ return (React.createElement("button", { key: i, type: 'button', className: 'user-interaction-tool progress-dot'
216
+ + (i < current ? ' done' : '')
217
+ + (i === current ? ' active' : ''), onClick: () => onSelect(i), title: label, "aria-label": label, "aria-current": i === current ? 'step' : undefined }));
218
+ })));
219
+ const LinkButton = ({ link, onClick }) => {
220
+ const isDiff = link.rightRef !== undefined;
221
+ const icon = isDiff ? (0, browser_1.codicon)('diff') : (0, browser_1.codicon)('go-to-file');
222
+ const left = (0, user_interaction_tool_2.resolveContentRef)(link.ref);
223
+ let label;
224
+ if (link.label) {
225
+ label = link.label;
226
+ }
227
+ else if (isDiff) {
228
+ label = (0, user_interaction_tool_2.buildDiffLabel)(left, (0, user_interaction_tool_2.resolveContentRef)(link.rightRef));
229
+ }
230
+ else {
231
+ label = (0, user_interaction_tool_2.isEmptyContentRef)(left)
232
+ ? (left.label || nls_1.nls.localize('theia/ai-ide/userInteractionEmpty', 'Empty'))
233
+ : left.path;
234
+ }
235
+ return (React.createElement("button", { className: 'user-interaction-tool link-button', onClick: onClick },
236
+ React.createElement("i", { className: icon }),
237
+ React.createElement("span", null, label)));
238
+ };
239
+ const UserInteractionWithConfirmation = (0, tool_confirmation_1.withToolCallConfirmation)(UserInteractionComponent);
240
+ const StreamingProgress = ({ title, stepCount }) => {
241
+ let label;
242
+ if (title && stepCount > 0) {
243
+ label = nls_1.nls.localize('theia/ai-ide/userInteractionPreparingSteps', 'Preparing: {0} ({1} steps)', title, stepCount);
244
+ }
245
+ else if (title) {
246
+ label = nls_1.nls.localize('theia/ai-ide/userInteractionPreparingTitle', 'Preparing: {0}', title);
247
+ }
248
+ else {
249
+ label = nls_1.nls.localize('theia/ai-ide/userInteractionPreparing', 'Preparing user interaction...');
250
+ }
251
+ return (React.createElement("div", { className: 'tool-call container' },
252
+ React.createElement("div", { className: 'tool-call header pending' },
253
+ React.createElement("span", { className: (0, browser_1.codicon)('comment-discussion') }),
254
+ React.createElement("span", { className: `${(0, browser_1.codicon)('loading')} theia-animation-spin` }),
255
+ React.createElement("span", { className: 'user-interaction-tool pending-text' }, label))));
256
+ };
257
+ const MalformedInteraction = ({ message }) => (React.createElement("div", { className: 'tool-call container' },
258
+ React.createElement("div", { className: 'tool-call header error' },
259
+ React.createElement("span", { className: (0, browser_1.codicon)('comment-discussion') }),
260
+ React.createElement("span", { className: 'user-interaction-tool title' }, nls_1.nls.localize('theia/ai-ide/userInteractionMalformed', 'User interaction could not be displayed'))),
261
+ React.createElement("div", { className: 'tool-call error-message' }, message)));
262
+ function parseToolErrorResult(raw) {
263
+ let candidate = raw;
264
+ if (typeof raw === 'string') {
265
+ try {
266
+ candidate = JSON.parse(raw);
267
+ }
268
+ catch {
269
+ return undefined;
270
+ }
271
+ }
272
+ if (candidate && typeof candidate === 'object' && typeof candidate.error === 'string') {
273
+ return candidate;
274
+ }
275
+ return undefined;
276
+ }
277
+ let UserInteractionToolRenderer = class UserInteractionToolRenderer {
278
+ canHandle(response) {
279
+ if (common_1.ToolCallChatResponseContent.is(response) && response.name === user_interaction_tool_2.USER_INTERACTION_FUNCTION_ID) {
280
+ return 20;
281
+ }
282
+ return -1;
283
+ }
284
+ render(response, parentNode) {
285
+ const args = (0, user_interaction_tool_2.parseUserInteractionArgs)(response.arguments);
286
+ if (!args || !response.id) {
287
+ // The tool already returned a result but the args don't validate: this
288
+ // is a malformed invocation (e.g., the agent sent a step the tool
289
+ // rejected, or arguments that fail shared parsing). Show an error state
290
+ // instead of a perpetual loading spinner.
291
+ if (response.result !== undefined) {
292
+ const error = parseToolErrorResult(response.result);
293
+ const message = error?.error
294
+ ?? nls_1.nls.localize('theia/ai-ide/userInteractionMalformedFallback', 'The arguments could not be parsed.');
295
+ return React.createElement(MalformedInteraction, { message: message });
296
+ }
297
+ const input = (0, user_interaction_tool_2.parseUserInteractionInput)(response.arguments);
298
+ return React.createElement(StreamingProgress, { title: input.title, stepCount: input.stepCount });
299
+ }
300
+ const chatId = parentNode.sessionId;
301
+ const toolRequest = this.toolInvocationRegistry.getFunction(user_interaction_tool_2.USER_INTERACTION_FUNCTION_ID);
302
+ const confirmationMode = this.toolConfirmationManager.getConfirmationMode(user_interaction_tool_2.USER_INTERACTION_FUNCTION_ID, chatId, toolRequest);
303
+ return (React.createElement(UserInteractionWithConfirmation, { args: args, toolCallId: response.id, tool: this.userInteractionTool, finished: response.finished, canceled: parentNode.response.isCanceled, responseComplete: parentNode.response.isComplete, result: (0, user_interaction_tool_2.parseUserInteractionResult)(response.result), openerService: this.openerService, response: response, confirmationMode: confirmationMode, toolConfirmationManager: this.toolConfirmationManager, toolRequest: toolRequest, chatId: chatId, requestCanceled: parentNode.response.isCanceled, contextMenuRenderer: this.contextMenuRenderer }));
304
+ }
305
+ };
306
+ exports.UserInteractionToolRenderer = UserInteractionToolRenderer;
307
+ tslib_1.__decorate([
308
+ (0, inversify_1.inject)(chat_tool_preference_bindings_1.ToolConfirmationManager),
309
+ tslib_1.__metadata("design:type", chat_tool_preference_bindings_1.ToolConfirmationManager)
310
+ ], UserInteractionToolRenderer.prototype, "toolConfirmationManager", void 0);
311
+ tslib_1.__decorate([
312
+ (0, inversify_1.inject)(browser_1.ContextMenuRenderer),
313
+ tslib_1.__metadata("design:type", browser_1.ContextMenuRenderer)
314
+ ], UserInteractionToolRenderer.prototype, "contextMenuRenderer", void 0);
315
+ tslib_1.__decorate([
316
+ (0, inversify_1.inject)(ai_core_1.ToolInvocationRegistry),
317
+ tslib_1.__metadata("design:type", Object)
318
+ ], UserInteractionToolRenderer.prototype, "toolInvocationRegistry", void 0);
319
+ tslib_1.__decorate([
320
+ (0, inversify_1.inject)(user_interaction_tool_1.UserInteractionTool),
321
+ tslib_1.__metadata("design:type", user_interaction_tool_1.UserInteractionTool)
322
+ ], UserInteractionToolRenderer.prototype, "userInteractionTool", void 0);
323
+ tslib_1.__decorate([
324
+ (0, inversify_1.inject)(browser_1.OpenerService),
325
+ tslib_1.__metadata("design:type", Object)
326
+ ], UserInteractionToolRenderer.prototype, "openerService", void 0);
327
+ exports.UserInteractionToolRenderer = UserInteractionToolRenderer = tslib_1.__decorate([
328
+ (0, inversify_1.injectable)()
329
+ ], UserInteractionToolRenderer);
330
+ //# sourceMappingURL=user-interaction-tool-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-interaction-tool-renderer.js","sourceRoot":"","sources":["../../src/browser/user-interaction-tool-renderer.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;;;;AAEhF,4DAAkE;AAGlE,sDAA6F;AAE7F,kDAAkD;AAClD,qDAAsF;AACtF,oDAAiD;AACjD,wHAAmH;AACnH,8GAAkH;AAClH,4GAAmG;AACnG,4CAAwD;AACxD,mEAA8D;AAC9D,2EAYyC;AAuBzC,MAAM,wBAAwB,GAA4C,CAAC,EACvE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EACtF,EAAE,EAAE;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;IAChC,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;IAC/B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAc,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CA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AC,uBAAa,CAAC;;kEACiB;sCAf9B,2BAA2B;IADvC,IAAA,sBAAU,GAAE;GACA,2BAA2B,CAoEvC"}
@@ -0,0 +1,47 @@
1
+ import { ToolProvider, ToolRequest } from '@theia/ai-core';
2
+ import { ToolInvocationContext } from '@theia/ai-core/lib/common/language-model';
3
+ import { OpenerService } from '@theia/core/lib/browser';
4
+ import { Deferred } from '@theia/core/lib/common/promise-util';
5
+ import { ResourceProvider } from '@theia/core/lib/common/resource';
6
+ import URI from '@theia/core/lib/common/uri';
7
+ import { EditorManager } from '@theia/editor/lib/browser';
8
+ import { ScmService } from '@theia/scm/lib/browser/scm-service';
9
+ import { WorkspaceFunctionScope } from './workspace-functions';
10
+ import { ContentRef, PathContentRef, UserInteractionLink, UserInteractionStep, UserInteractionStepResult } from '../common/user-interaction-tool';
11
+ interface PendingInteraction {
12
+ deferred: Deferred<string>;
13
+ steps: UserInteractionStep[];
14
+ stepResults: UserInteractionStepResult[];
15
+ resolved: boolean;
16
+ }
17
+ export declare class UserInteractionTool implements ToolProvider {
18
+ static ID: string;
19
+ protected readonly openerService: OpenerService;
20
+ protected readonly editorManager: EditorManager;
21
+ protected readonly scmService: ScmService;
22
+ protected readonly workspaceScope: WorkspaceFunctionScope;
23
+ protected readonly resourceProvider: ResourceProvider;
24
+ protected readonly pendingInteractions: Map<string, PendingInteraction>;
25
+ getTool(): ToolRequest;
26
+ setStepResult(toolCallId: string, stepIndex: number, partial: Partial<UserInteractionStepResult>): void;
27
+ completeInteraction(toolCallId: string): void;
28
+ /**
29
+ * Set the result for a step and immediately complete the interaction.
30
+ * Use this to atomically pass the user's input value into the result, avoiding
31
+ * any reliance on synchronous state updates between `setStepResult` and `completeInteraction`.
32
+ */
33
+ completeInteractionWith(toolCallId: string, stepIndex: number, partial: Partial<UserInteractionStepResult>): void;
34
+ cancelInteraction(toolCallId: string): void;
35
+ protected normalizeStepResults(pending: PendingInteraction): UserInteractionStepResult[];
36
+ openLink(link: UserInteractionLink): Promise<void>;
37
+ protected resolveUri(ref: PathContentRef, workspaceRoot: URI): URI | undefined;
38
+ protected handleInteraction(argString: string, ctx: ToolInvocationContext | undefined): Promise<string>;
39
+ protected resolveDiffSideUri(ref: ContentRef, workspaceRoot: URI): Promise<URI>;
40
+ protected errorContentUri(path: string, gitRef: string): URI;
41
+ protected refNotFoundUri(path: string, gitRef: string): URI;
42
+ protected fileNotFoundUri(path: string): URI;
43
+ protected emptyContentUri(path: string): URI;
44
+ protected canResolveUri(uri: URI): Promise<boolean>;
45
+ }
46
+ export {};
47
+ //# sourceMappingURL=user-interaction-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-interaction-tool.d.ts","sourceRoot":"","sources":["../../src/browser/user-interaction-tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAuD,MAAM,gBAAgB,CAAC;AAChH,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAQ,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAqC,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACtG,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACH,UAAU,EAEV,cAAc,EACd,mBAAmB,EAEnB,mBAAmB,EACnB,yBAAyB,EAK5B,MAAM,iCAAiC,CAAC;AAEzC,UAAU,kBAAkB;IACxB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3B,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,WAAW,EAAE,yBAAyB,EAAE,CAAC;IACzC,QAAQ,EAAE,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