@gitlab/duo-ui 11.1.1 → 11.2.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 (27) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/chat/components/duo_chat_header/web_duo_chat_header.js +1 -1
  3. package/dist/components/chat/components/duo_chat_message/message_types/message_tool.js +8 -4
  4. package/dist/components/chat/components/duo_chat_message_tool_approval/components/base_tool_params.js +79 -0
  5. package/dist/components/chat/components/duo_chat_message_tool_approval/components/issuable_tool_params.js +116 -0
  6. package/dist/components/chat/components/duo_chat_message_tool_approval/components/run_command_tool_params.js +45 -5
  7. package/dist/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.js +67 -20
  8. package/dist/components/chat/constants.js +12 -1
  9. package/dist/components/chat/mock_data.js +77 -1
  10. package/dist/components.css +1 -1
  11. package/dist/components.css.map +1 -1
  12. package/dist/tailwind.css +1 -1
  13. package/dist/tailwind.css.map +1 -1
  14. package/package.json +2 -2
  15. package/src/components/chat/components/duo_chat_header/web_duo_chat_header.vue +1 -1
  16. package/src/components/chat/components/duo_chat_message/message_types/message_tool.vue +23 -11
  17. package/src/components/chat/components/duo_chat_message_tool_approval/components/base_tool_params.vue +55 -0
  18. package/src/components/chat/components/duo_chat_message_tool_approval/components/issuable_tool_params.vue +112 -0
  19. package/src/components/chat/components/duo_chat_message_tool_approval/components/run_command_tool_params.vue +51 -6
  20. package/src/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.vue +97 -22
  21. package/src/components/chat/constants.js +12 -0
  22. package/src/components/chat/mock_data.js +80 -0
  23. package/translations.js +24 -7
  24. package/dist/components/chat/components/duo_chat_message_tool_approval/components/create_issue_tool_params.js +0 -88
  25. package/dist/components/chat/components/duo_chat_message_tool_approval/components/create_merge_request_tool_params.js +0 -83
  26. package/src/components/chat/components/duo_chat_message_tool_approval/components/create_issue_tool_params.vue +0 -80
  27. package/src/components/chat/components/duo_chat_message_tool_approval/components/create_merge_request_tool_params.vue +0 -74
@@ -0,0 +1,112 @@
1
+ <script>
2
+ import { sprintf, translate } from '../../../../../utils/i18n';
3
+ import { APPROVAL_TOOL_NAMES } from '../../../constants';
4
+ import BaseToolParams from './base_tool_params.vue';
5
+
6
+ export default {
7
+ name: 'IssuableToolParams',
8
+ components: {
9
+ BaseToolParams,
10
+ },
11
+ props: {
12
+ toolName: {
13
+ type: String,
14
+ required: true,
15
+ validator: (toolName) =>
16
+ [
17
+ APPROVAL_TOOL_NAMES.createIssue,
18
+ APPROVAL_TOOL_NAMES.updateIssue,
19
+ APPROVAL_TOOL_NAMES.createEpic,
20
+ APPROVAL_TOOL_NAMES.updateEpic,
21
+ APPROVAL_TOOL_NAMES.createMergeRequest,
22
+ APPROVAL_TOOL_NAMES.updateMergeRequest,
23
+ ].includes(toolName),
24
+ },
25
+ toolParams: {
26
+ type: Object,
27
+ required: true,
28
+ },
29
+ },
30
+ computed: {
31
+ project() {
32
+ return this.toolParams?.projectPath || this.toolParams?.projectId;
33
+ },
34
+ title() {
35
+ return this.toolParams?.title;
36
+ },
37
+ labels() {
38
+ return this.toolParams?.labels;
39
+ },
40
+ description() {
41
+ return this.toolParams?.description;
42
+ },
43
+ sourceBranch() {
44
+ return this.toolParams?.sourceBranch;
45
+ },
46
+ targetBranch() {
47
+ return this.toolParams?.targetBranch;
48
+ },
49
+ message() {
50
+ let message = this.$options.i18n[this.toolName] || '';
51
+ const labelsMessage = this.$options.i18n.ASSIGN_LABELS_MESSAGE;
52
+ const branchMessage = this.$options.i18n.BRANCH_MESSAGE;
53
+
54
+ if (this.title) {
55
+ message = `${message} ${this.$options.i18n.TITLE_MESSAGE}`;
56
+ }
57
+
58
+ if (this.sourceBranch && this.targetBranch) {
59
+ message = `${message} ${branchMessage}`;
60
+ }
61
+
62
+ if (this.labels) {
63
+ message = `${message} ${labelsMessage}`;
64
+ }
65
+
66
+ return sprintf(message, { project: this.project, ...this.toolParams });
67
+ },
68
+ },
69
+ i18n: {
70
+ [APPROVAL_TOOL_NAMES.createIssue]: translate(
71
+ 'IssuableToolParams.CREATE_ISSUE',
72
+ 'Open an issue in project <code>%{project}</code>.'
73
+ ),
74
+ [APPROVAL_TOOL_NAMES.updateIssue]: translate(
75
+ 'IssuableToolParams.UPDATE_ISSUE',
76
+ 'Update issue <code>%{issueIid}</code> in project <code>%{project}</code>.'
77
+ ),
78
+ [APPROVAL_TOOL_NAMES.createEpic]: translate(
79
+ 'IssuableToolParams.CREATE_EPIC',
80
+ 'Create an epic in group <code>%{groupId}</code>.'
81
+ ),
82
+ [APPROVAL_TOOL_NAMES.updateEpic]: translate(
83
+ 'IssuableToolParams.UPDATE_EPIC',
84
+ 'Update epic <code>%{epicId}</code> in group <code>%{groupId}</code>.'
85
+ ),
86
+ [APPROVAL_TOOL_NAMES.createMergeRequest]: translate(
87
+ 'IssuableToolParams.CREATE_MERGE_REQUEST',
88
+ 'Open a merge request in project <code>%{project}</code>.'
89
+ ),
90
+ [APPROVAL_TOOL_NAMES.updateMergeRequest]: translate(
91
+ 'IssuableToolParams.UPDATE_MERGE_REQUEST',
92
+ 'Update merge request <code>%{mergeRequestIid}</code> in project <code>%{project}</code>.'
93
+ ),
94
+ TITLE_MESSAGE: translate(
95
+ 'IssuableToolParams.TITLE_MESSAGE',
96
+ 'Set the title "<em>%{title}</em>".'
97
+ ),
98
+ BRANCH_MESSAGE: translate(
99
+ 'IssuableToolParams.BRANCH_MESSAGE',
100
+ 'From branch <code>%{sourceBranch}</code> to branch <code>%{targetBranch}</code>.'
101
+ ),
102
+ ASSIGN_LABELS_MESSAGE: translate(
103
+ 'CreateIssueToolParams.ASSIGN_LABELS_MESSAGE',
104
+ 'Assign the labels <code>%{labels}</code>.'
105
+ ),
106
+ ACCORDION_TITLE: translate('CreateIssueToolParams.ACCORDION_TITLE', 'Read description'),
107
+ },
108
+ };
109
+ </script>
110
+ <template>
111
+ <base-tool-params :message="message" :description="description" />
112
+ </template>
@@ -1,30 +1,75 @@
1
1
  <script>
2
2
  import { GlIcon } from '@gitlab/ui';
3
+ import { translate } from '../../../../../utils/i18n';
4
+ import { APPROVAL_TOOL_NAMES } from '../../../constants';
5
+ import BaseToolParams from './base_tool_params.vue';
3
6
 
4
7
  export default {
5
8
  name: 'RunCommandToolParams',
6
9
  components: {
7
10
  GlIcon,
11
+ BaseToolParams,
8
12
  },
9
13
  props: {
10
- program: {
14
+ toolName: {
11
15
  type: String,
12
16
  required: true,
13
17
  },
18
+ program: {
19
+ type: String,
20
+ required: false,
21
+ default: '',
22
+ },
14
23
  args: {
15
24
  type: String,
16
- required: true,
25
+ required: false,
26
+ default: '',
27
+ },
28
+ command: {
29
+ type: String,
30
+ required: false,
31
+ default: '',
32
+ },
33
+ toolResponse: {
34
+ type: Object,
35
+ required: false,
36
+ default: null,
37
+ },
38
+ workingDirectory: {
39
+ type: String,
40
+ required: false,
41
+ default: '',
17
42
  },
18
43
  },
19
44
  computed: {
20
45
  formattedCommand() {
21
- return `${this.program} ${this.args}`;
46
+ if (this.toolName === APPROVAL_TOOL_NAMES.runCommand) {
47
+ return this.command?.length ? this.command : `${this.program} ${this.args}`;
48
+ }
49
+
50
+ return `git ${this.command} ${this.args}`;
22
51
  },
52
+ withWorkingDirectory() {
53
+ return this.workingDirectory?.length
54
+ ? `${this.workingDirectory}> ${this.formattedCommand}`
55
+ : this.formattedCommand;
56
+ },
57
+ commandOutput() {
58
+ return this.toolResponse?.content;
59
+ },
60
+ },
61
+ i18n: {
62
+ SEE_COMMAND_OUTPUT: translate('RunCommandToolParams.ACCORDION_TITLE', 'Expand command output'),
23
63
  },
24
64
  };
25
65
  </script>
26
66
  <template>
27
- <div class="gl-flex gl-items-center gl-gap-3">
28
- <gl-icon name="terminal" /> <code>{{ formattedCommand }}</code>
29
- </div>
67
+ <base-tool-params
68
+ :description="commandOutput"
69
+ :custom-accordion-title="$options.i18n.SEE_COMMAND_OUTPUT"
70
+ >
71
+ <div class="gl-flex gl-items-center gl-gap-3">
72
+ <gl-icon name="terminal" /> <code>{{ withWorkingDirectory }}</code>
73
+ </div>
74
+ </base-tool-params>
30
75
  </template>
@@ -10,25 +10,22 @@ import {
10
10
  } from '@gitlab/ui';
11
11
  import { translate } from '../../../../utils/i18n';
12
12
  import { convertKeysToCamelCase } from '../../../../utils/object';
13
- import { acceptedApproveToolPayloads } from '../../constants';
13
+ import { acceptedApproveToolPayloads, APPROVAL_TOOL_NAMES } from '../../constants';
14
14
  import CreateCommitToolParams from './components/create_commit_tool_params.vue';
15
- import CreateIssueToolParams from './components/create_issue_tool_params.vue';
16
- import CreateMergeRequestToolParams from './components/create_merge_request_tool_params.vue';
15
+ import IssuableToolParams from './components/issuable_tool_params.vue';
17
16
  import RunCommandToolParams from './components/run_command_tool_params.vue';
18
17
 
19
- export const APPROVAL_TOOL_NAMES = {
20
- createCommit: 'create_commit',
21
- createIssue: 'create_issue',
22
- createMergeRequest: 'create_merge_request',
23
- runCommand: 'run_command',
24
- };
25
-
26
18
  export const PROCESSING_STATE = {
27
19
  APPROVING: 'approving',
28
20
  DENYING: 'denying',
29
21
  NONE: null,
30
22
  };
31
23
 
24
+ export const TOOL_STATUS = {
25
+ Pending: 'pending',
26
+ Approved: 'approved',
27
+ };
28
+
32
29
  export const i18n = {
33
30
  TOOL_APPROVAL_DESCRIPTION: translate(
34
31
  'MessageToolApproval.toolApprovalDescription',
@@ -62,6 +59,18 @@ export const i18n = {
62
59
  'MessageToolApproval.createIssue',
63
60
  'Duo wants to open an issue.'
64
61
  ),
62
+ [APPROVAL_TOOL_NAMES.updateIssue]: translate(
63
+ 'MessageToolApproval.updateIssue',
64
+ 'Duo wants to update an issue.'
65
+ ),
66
+ [APPROVAL_TOOL_NAMES.createEpic]: translate(
67
+ 'MessageToolApproval.createEpic',
68
+ 'Duo wants to create an epic.'
69
+ ),
70
+ [APPROVAL_TOOL_NAMES.updateEpic]: translate(
71
+ 'MessageToolApproval.updateEpic',
72
+ 'Duo wants to update an epic.'
73
+ ),
65
74
  [APPROVAL_TOOL_NAMES.createMergeRequest]: translate(
66
75
  'MessageToolApproval.createMergeRequest',
67
76
  'Duo wants to create a merge request.'
@@ -70,15 +79,33 @@ export const i18n = {
70
79
  'MessageToolApproval.runCommand',
71
80
  'Duo wants to run a command.'
72
81
  ),
82
+ [APPROVAL_TOOL_NAMES.runGitCommand]: translate(
83
+ 'MessageToolApproval.runGitCommand',
84
+ 'Duo wants to run a git command.'
85
+ ),
73
86
  },
74
- TOOL_STATUS: translate('MessageToolApproval.toolStatus', 'Pending'),
87
+ [TOOL_STATUS.Pending]: translate('MessageToolApproval.toolStatusPending', 'Pending'),
88
+ [TOOL_STATUS.Approved]: translate('MessageToolApproval.toolStatusApproved', 'Approved'),
89
+ TOGGLE_PARAMS_BUTTON_EXPAND: translate(
90
+ 'MessageToolApproval.collapseButtonCollapsed',
91
+ 'Display tool details'
92
+ ),
93
+ TOGGLE_PARAMS_BUTTON_COLLAPSE: translate(
94
+ 'MessageToolApproval.collapseButtonExpanded',
95
+ 'Hide tool details'
96
+ ),
75
97
  };
76
98
 
77
99
  const TOOL_PARAMS_VIEW_COMPONENTS = {
78
100
  [APPROVAL_TOOL_NAMES.createCommit]: 'CreateCommitToolParams',
79
- [APPROVAL_TOOL_NAMES.createIssue]: 'CreateIssueToolParams',
80
- [APPROVAL_TOOL_NAMES.createMergeRequest]: 'CreateMergeRequestToolParams',
101
+ [APPROVAL_TOOL_NAMES.createIssue]: 'IssuableToolParams',
102
+ [APPROVAL_TOOL_NAMES.updateIssue]: 'IssuableToolParams',
103
+ [APPROVAL_TOOL_NAMES.createEpic]: 'IssuableToolParams',
104
+ [APPROVAL_TOOL_NAMES.updateEpic]: 'IssuableToolParams',
105
+ [APPROVAL_TOOL_NAMES.createMergeRequest]: 'IssuableToolParams',
106
+ [APPROVAL_TOOL_NAMES.updateMergeRequest]: 'IssuableToolParams',
81
107
  [APPROVAL_TOOL_NAMES.runCommand]: 'RunCommandToolParams',
108
+ [APPROVAL_TOOL_NAMES.runGitCommand]: 'RunCommandToolParams',
82
109
  };
83
110
 
84
111
  export default {
@@ -92,8 +119,7 @@ export default {
92
119
  GlDropdown,
93
120
  GlDropdownItem,
94
121
  CreateCommitToolParams,
95
- CreateIssueToolParams,
96
- CreateMergeRequestToolParams,
122
+ IssuableToolParams,
97
123
  RunCommandToolParams,
98
124
  },
99
125
  props: {
@@ -101,11 +127,21 @@ export default {
101
127
  required: true,
102
128
  type: Object,
103
129
  },
130
+ workingDirectory: {
131
+ type: String,
132
+ required: false,
133
+ default: '',
134
+ },
104
135
  isProcessing: {
105
136
  type: Boolean,
106
137
  required: false,
107
138
  default: false,
108
139
  },
140
+ approvalStatus: {
141
+ type: String,
142
+ required: false,
143
+ default: TOOL_STATUS.Pending,
144
+ },
109
145
  /**
110
146
  * Array of approval options for multi-approval functionality
111
147
  * @property {string} type - The approval type (approve-tool-once, approve-for-session, always-approve-tool)
@@ -137,6 +173,7 @@ export default {
137
173
  showDenialReason: false,
138
174
  denialReason: '',
139
175
  localProcessingState: PROCESSING_STATE.NONE,
176
+ collapsed: this.approvalStatus === TOOL_STATUS.Approved,
140
177
  };
141
178
  },
142
179
  computed: {
@@ -146,6 +183,9 @@ export default {
146
183
  toolParameters() {
147
184
  return this.message?.tool_info?.args || {};
148
185
  },
186
+ toolResponse() {
187
+ return this.message?.tool_info?.tool_response;
188
+ },
149
189
  camelCaseToolParameters() {
150
190
  return convertKeysToCamelCase(this.toolParameters);
151
191
  },
@@ -153,7 +193,27 @@ export default {
153
193
  return Object.keys(this.toolParameters).length > 0;
154
194
  },
155
195
  toolApprovalTitle() {
156
- return i18n.TOOL_APPROVAL_TITLES[this.toolName];
196
+ return i18n.TOOL_APPROVAL_TITLES[this.toolName] || this.toolName;
197
+ },
198
+ toolStatusLabel() {
199
+ return i18n[this.approvalStatus];
200
+ },
201
+ toolStatusVariant() {
202
+ return {
203
+ [TOOL_STATUS.Pending]: 'neutral',
204
+ [TOOL_STATUS.Approved]: 'info',
205
+ }[this.approvalStatus];
206
+ },
207
+ collapsible() {
208
+ return this.approvalStatus === TOOL_STATUS.Approved;
209
+ },
210
+ collapseButtonProps() {
211
+ return this.collapsed
212
+ ? { icon: 'chevron-right', title: i18n.TOGGLE_PARAMS_BUTTON_EXPAND }
213
+ : { icon: 'chevron-down', title: i18n.TOGGLE_PARAMS_BUTTON_COLLAPSE };
214
+ },
215
+ isApproved() {
216
+ return this.approvalStatus === TOOL_STATUS.Approved;
157
217
  },
158
218
  isApproving() {
159
219
  return this.isProcessing && this.localProcessingState === PROCESSING_STATE.APPROVING;
@@ -247,14 +307,25 @@ export default {
247
307
  </script>
248
308
 
249
309
  <template>
250
- <gl-card>
310
+ <gl-card class="gl-w-full" :body-class="{ 'gl-hidden': collapsed }">
251
311
  <template #header>
252
- <div class="gl-flex gl-items-center gl-justify-between">
312
+ <div class="gl-flex gl-items-center gl-justify-between gl-gap-3">
253
313
  <span>
254
- {{ toolApprovalTitle }}
314
+ <gl-button
315
+ v-if="collapsible"
316
+ variant="default"
317
+ category="tertiary"
318
+ size="small"
319
+ data-testid="toggle-details-button"
320
+ v-bind="collapseButtonProps"
321
+ @click="collapsed = !collapsed"
322
+ />
323
+ <span>
324
+ {{ toolApprovalTitle }}
325
+ </span>
255
326
  </span>
256
- <gl-badge>
257
- {{ $options.i18n.TOOL_STATUS }}
327
+ <gl-badge :variant="toolStatusVariant">
328
+ {{ toolStatusLabel }}
258
329
  </gl-badge>
259
330
  </div>
260
331
  </template>
@@ -262,6 +333,10 @@ export default {
262
333
  :is="toolParamsViewComponent"
263
334
  v-if="toolParamsViewComponent"
264
335
  class="gl-leading-20"
336
+ :tool-name="toolName"
337
+ :tool-params="camelCaseToolParameters"
338
+ :tool-response="toolResponse"
339
+ :working-directory="workingDirectory"
265
340
  v-bind="camelCaseToolParameters"
266
341
  />
267
342
  <div
@@ -283,7 +358,7 @@ export default {
283
358
  </span>
284
359
  </div>
285
360
  </div>
286
- <template #footer>
361
+ <template v-if="!isApproved" #footer>
287
362
  <div v-if="!showDenialReason" class="gl-flex gl-gap-2">
288
363
  <!-- Split button when multiple approval options available -->
289
364
  <gl-dropdown
@@ -49,3 +49,15 @@ export const acceptedApproveToolPayloads = {
49
49
  APPROVE_SESSION,
50
50
  APPROVE_ALL_TOOLS,
51
51
  };
52
+
53
+ export const APPROVAL_TOOL_NAMES = {
54
+ createCommit: 'create_commit',
55
+ createIssue: 'create_issue',
56
+ updateIssue: 'update_issue',
57
+ createEpic: 'create_epic',
58
+ updateEpic: 'update_epic',
59
+ createMergeRequest: 'create_merge_request',
60
+ updateMergeRequest: 'update_merge_request',
61
+ runCommand: 'run_command',
62
+ runGitCommand: 'run_git_command',
63
+ };
@@ -205,6 +205,51 @@ export const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND = {
205
205
  role: 'request',
206
206
  };
207
207
 
208
+ export const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_COMMAND_WITH_RESPONSE = {
209
+ id: '125',
210
+ content: 'Tool run_command requires approval. Please confirm if you want to proceed.',
211
+ message_type: MESSAGE_MODEL_ROLES.request,
212
+ tool_info: {
213
+ args: { command: 'cat Dockerfile | grep ENV' },
214
+ name: 'run_command',
215
+ tool_response: {
216
+ id: null,
217
+ name: 'run_command',
218
+ type: 'ToolMessage',
219
+ status: 'success',
220
+ content:
221
+ '\u001b]133;C;\u0007\u001b]633;E;cat Dockerfile | grep ENV;790e289b-7fc3-4fa8-accb-83538d075bfb\u0007\u001b]633;C\u0007ENV PYTHONDONTWRITEBYTECODE=1 \\\r\n',
222
+ artifact: null,
223
+ tool_call_id: 'toolu_01W1DWmLp26vLrohCV5ernd4',
224
+ additional_kwargs: {},
225
+ response_metadata: {},
226
+ },
227
+ },
228
+ timestamp: '2025-06-25T19:22:21.290791+00:00',
229
+ status: 'success',
230
+ role: 'request',
231
+ };
232
+
233
+ export const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_RUN_GIT_COMMAND = {
234
+ status: 'success',
235
+ content: 'Tool run_git_command requires approval. Please confirm if you want to proceed.',
236
+ timestamp: '2025-09-24T10:05:58.707330+00:00',
237
+ tool_info: {
238
+ args: {
239
+ args: '-r',
240
+ command: 'branch',
241
+ repository_url: 'https://gdk.test:3443/gitlab-duo/test',
242
+ },
243
+ name: 'run_git_command',
244
+ },
245
+ message_type: 'request',
246
+ correlation_id: null,
247
+ message_sub_type: null,
248
+ additional_context: null,
249
+ requestId: '41-1',
250
+ role: 'assistant',
251
+ };
252
+
208
253
  export const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_ISSUE = {
209
254
  id: '125',
210
255
  content: 'Tool run_command requires approval. Please confirm if you want to proceed.',
@@ -224,6 +269,41 @@ export const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_ISSUE = {
224
269
  role: 'request',
225
270
  };
226
271
 
272
+ export const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_UPDATE_ISSUE = {
273
+ id: '125',
274
+ content: 'Tool update_issue requires approval. Please confirm if you want to proceed.',
275
+ message_type: MESSAGE_MODEL_ROLES.request,
276
+ tool_info: {
277
+ name: 'update_issue',
278
+ args: {
279
+ project_id: 123,
280
+ issue_iid: 2,
281
+ title: 'CSP bug in VSCode Fork prevents loading external web views in Web IDE',
282
+ },
283
+ },
284
+ timestamp: '2025-06-25T19:22:21.290791+00:00',
285
+ status: 'success',
286
+ role: 'request',
287
+ };
288
+
289
+ export const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_EPIC = {
290
+ id: '125',
291
+ content: 'Tool create_epic requires approval. Please confirm if you want to proceed.',
292
+ message_type: MESSAGE_MODEL_ROLES.request,
293
+ tool_info: {
294
+ name: 'create_epic',
295
+ args: {
296
+ group_id: 'gitlab-duo',
297
+ title: 'CI Pipeline roadmap',
298
+ description:
299
+ 'This epic contains issues related to making the CI pipeline of various projects more efficient',
300
+ },
301
+ },
302
+ timestamp: '2025-06-25T19:22:21.290791+00:00',
303
+ status: 'success',
304
+ role: 'request',
305
+ };
306
+
227
307
  export const MOCK_REQUEST_MESSAGE_WITH_TOOL_APPROVAL_CREATE_COMMIT = {
228
308
  id: '125',
229
309
  content: 'Tool create_commit requires approval. Please confirm if you want to proceed.',
package/translations.js CHANGED
@@ -35,6 +35,7 @@ export default {
35
35
  'AgenticToolRejectionModal.placeholder': "Explain why you're rejecting this tool execution...",
36
36
  'AgenticToolRejectionModal.submitText': 'Submit Rejection',
37
37
  'AgenticToolRejectionModal.title': 'Provide Rejection Reason',
38
+ 'BaseToolParams.ACCORDION_TITLE': 'Read description',
38
39
  'CreateCommitToolParams.actionWithNoContent': 'This action does not have any content.',
39
40
  'CreateCommitToolParams.actionsCountMessage': null,
40
41
  'CreateCommitToolParams.chmodFileActionLabel': 'Change permissions for file %{filePath}',
@@ -48,12 +49,7 @@ export default {
48
49
  'CreateCommitToolParams.unknownFileActionLabel': 'Modify file %{filePath}',
49
50
  'CreateCommitToolParams.updateFileActionLabel': 'Update file %{filePath}',
50
51
  'CreateIssueToolParams.ACCORDION_TITLE': 'Read description',
51
- 'CreateIssueToolParams.ISSUE_SUMMARY_MESSAGE_BASE':
52
- 'Open an issue with title "%{title}" in project %{project}.',
53
- 'CreateIssueToolParams.ISSUE_SUMMARY_MESSAGE_WITH_LABELS': 'Assign the labels %{labels}.',
54
- 'CreateMergeRequestToolParams.ACCORDION_TITLE': 'Read description',
55
- 'CreateMergeRequestToolParams.MERGE_REQUEST_SUMMARY_MESSAGE':
56
- 'Open a merge request with title "%{title}" in project %{project} from branch %{sourceBranch} to branch %{targetBranch}.',
52
+ 'CreateIssueToolParams.ASSIGN_LABELS_MESSAGE': 'Assign the labels <code>%{labels}</code>.',
57
53
  'DuoChat.chatBackLabel': 'Back to history',
58
54
  'DuoChat.chatBackToChatToolTip': 'Back to chat',
59
55
  'DuoChat.chatCancelLabel': 'Cancel',
@@ -123,12 +119,28 @@ export default {
123
119
  'DuoRecentCollapsable.viewAllText': 'View All',
124
120
  'GlDuoChat.chatDisclamer': 'Responses may be inaccurate. Verify before use.',
125
121
  'GlDuoChat.chatHistoryTitle': 'Chat history',
122
+ 'IssuableToolParams.BRANCH_MESSAGE':
123
+ 'From branch <code>%{sourceBranch}</code> to branch <code>%{targetBranch}</code>.',
124
+ 'IssuableToolParams.CREATE_EPIC': 'Create an epic in group <code>%{groupId}</code>.',
125
+ 'IssuableToolParams.CREATE_ISSUE': 'Open an issue in project <code>%{project}</code>.',
126
+ 'IssuableToolParams.CREATE_MERGE_REQUEST':
127
+ 'Open a merge request in project <code>%{project}</code>.',
128
+ 'IssuableToolParams.TITLE_MESSAGE': 'Set the title "<em>%{title}</em>".',
129
+ 'IssuableToolParams.UPDATE_EPIC':
130
+ 'Update epic <code>%{epicId}</code> in group <code>%{groupId}</code>.',
131
+ 'IssuableToolParams.UPDATE_ISSUE':
132
+ 'Update issue <code>%{issueIid}</code> in project <code>%{project}</code>.',
133
+ 'IssuableToolParams.UPDATE_MERGE_REQUEST':
134
+ 'Update merge request <code>%{mergeRequestIid}</code> in project <code>%{project}</code>.',
126
135
  'MessageToolApproval.approveAllText': 'Always approve this tool',
127
136
  'MessageToolApproval.approveSessionText': 'Approve for session',
128
137
  'MessageToolApproval.approveText': 'Approve',
129
138
  'MessageToolApproval.approvingText': 'Approving...',
130
139
  'MessageToolApproval.cancelText': 'Cancel',
140
+ 'MessageToolApproval.collapseButtonCollapsed': 'Display tool details',
141
+ 'MessageToolApproval.collapseButtonExpanded': 'Hide tool details',
131
142
  'MessageToolApproval.createCommit': 'Duo wants to push a commit.',
143
+ 'MessageToolApproval.createEpic': 'Duo wants to create an epic.',
132
144
  'MessageToolApproval.createIssue': 'Duo wants to open an issue.',
133
145
  'MessageToolApproval.createMergeRequest': 'Duo wants to create a merge request.',
134
146
  'MessageToolApproval.denialReasonLabel': 'Rejection reason',
@@ -139,11 +151,16 @@ export default {
139
151
  'MessageToolApproval.noParametersText': 'No parameters will be sent with this request.',
140
152
  'MessageToolApproval.parametersText': 'Request',
141
153
  'MessageToolApproval.runCommand': 'Duo wants to run a command.',
154
+ 'MessageToolApproval.runGitCommand': 'Duo wants to run a git command.',
142
155
  'MessageToolApproval.toolApprovalDescription':
143
156
  'GitLab Duo Agentic Chat wants to execute a tool. Do you want to proceed?',
144
157
  'MessageToolApproval.toolLabel': 'Tool:',
145
- 'MessageToolApproval.toolStatus': 'Pending',
158
+ 'MessageToolApproval.toolStatusApproved': 'Approved',
159
+ 'MessageToolApproval.toolStatusPending': 'Pending',
146
160
  'MessageToolApproval.toolUnknown': 'Unknown',
161
+ 'MessageToolApproval.updateEpic': 'Duo wants to update an epic.',
162
+ 'MessageToolApproval.updateIssue': 'Duo wants to update an issue.',
163
+ 'RunCommandToolParams.ACCORDION_TITLE': 'Expand command output',
147
164
  'WebAgenticDuoChat.chatCancelLabel': 'Cancel',
148
165
  'WebAgenticDuoChat.chatDefaultPredefinedPromptsChangePassword':
149
166
  'How do I change my password in GitLab?',
@@ -1,88 +0,0 @@
1
- import { GlSprintf, GlAccordion, GlAccordionItem } from '@gitlab/ui';
2
- import { translate } from '../../../../../utils/i18n';
3
- import PreBlock from './pre_block';
4
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
-
6
- var script = {
7
- name: 'CreateIssueToolParams',
8
- components: {
9
- GlSprintf,
10
- GlAccordion,
11
- GlAccordionItem,
12
- PreBlock
13
- },
14
- props: {
15
- projectId: {
16
- type: [String, Number],
17
- required: true
18
- },
19
- projectPath: {
20
- type: String,
21
- required: false,
22
- default: ''
23
- },
24
- title: {
25
- type: String,
26
- required: true
27
- },
28
- description: {
29
- type: String,
30
- required: true
31
- },
32
- labels: {
33
- type: String,
34
- required: false,
35
- default: ''
36
- }
37
- },
38
- computed: {
39
- issueMessage() {
40
- const baseMessage = this.$options.i18n.ISSUE_SUMMARY_MESSAGE_BASE;
41
- const labelsMessage = this.$options.i18n.ISSUE_SUMMARY_MESSAGE_WITH_LABELS;
42
- return this.labels ? `${baseMessage} ${labelsMessage}` : baseMessage;
43
- }
44
- },
45
- i18n: {
46
- ISSUE_SUMMARY_MESSAGE_BASE: translate('CreateIssueToolParams.ISSUE_SUMMARY_MESSAGE_BASE', 'Open an issue with title "%{title}" in project %{project}.'),
47
- ISSUE_SUMMARY_MESSAGE_WITH_LABELS: translate('CreateIssueToolParams.ISSUE_SUMMARY_MESSAGE_WITH_LABELS', 'Assign the labels %{labels}.'),
48
- ACCORDION_TITLE: translate('CreateIssueToolParams.ACCORDION_TITLE', 'Read description')
49
- }
50
- };
51
-
52
- /* script */
53
- const __vue_script__ = script;
54
-
55
- /* template */
56
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-flex gl-flex-col"},[_c('div',[_c('gl-sprintf',{attrs:{"message":_vm.issueMessage},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('em',[_vm._v(_vm._s(_vm.title))])]},proxy:true},{key:"project",fn:function(){return [_c('code',[_vm._v(_vm._s(_vm.projectPath || _vm.projectId))])]},proxy:true},{key:"labels",fn:function(){return [_c('code',[_vm._v(_vm._s(_vm.labels))])]},proxy:true}])})],1),_vm._v(" "),_c('gl-accordion',{staticClass:"-gl-ml-2 gl-mt-3",attrs:{"header-level":3}},[_c('gl-accordion-item',{attrs:{"title":_vm.$options.i18n.ACCORDION_TITLE}},[_c('pre-block',[_vm._v(_vm._s(_vm.description))])],1)],1)],1)};
57
- var __vue_staticRenderFns__ = [];
58
-
59
- /* style */
60
- const __vue_inject_styles__ = undefined;
61
- /* scoped */
62
- const __vue_scope_id__ = undefined;
63
- /* module identifier */
64
- const __vue_module_identifier__ = undefined;
65
- /* functional template */
66
- const __vue_is_functional_template__ = false;
67
- /* style inject */
68
-
69
- /* style inject SSR */
70
-
71
- /* style inject shadow dom */
72
-
73
-
74
-
75
- const __vue_component__ = __vue_normalize__(
76
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
77
- __vue_inject_styles__,
78
- __vue_script__,
79
- __vue_scope_id__,
80
- __vue_is_functional_template__,
81
- __vue_module_identifier__,
82
- false,
83
- undefined,
84
- undefined,
85
- undefined
86
- );
87
-
88
- export default __vue_component__;